|
@@ -4,7 +4,7 @@ Created on 21 Jan 2023 @author: vnc-console
|
|
|
import gspread
|
|
|
from gspread.client import BackoffClient
|
|
|
from winmentor import WinMentor
|
|
|
-from beautiful_date import * # @UnusedWildImport
|
|
|
+from beautiful_date import * # @UnusedWildImport
|
|
|
|
|
|
# g_sheet = '17ZympS8FjiCqsGbkKz1CPN_7NKdV_idXmYs61Mdxnsc'
|
|
|
g_sheet = '1G4l7Klb34Nu1h7lBNvA-q4FB5WlQmtoxS3xLFM5XEVw' # HUN
|
|
@@ -46,43 +46,49 @@ date = (D.today() - 1 * months).strftime('%m_%Y')
|
|
|
mentor_date = (D.today() - 1 * months).strftime('%Y_%m')
|
|
|
print(f'period should be "{date}"', end='\n' * 2)
|
|
|
col_NAME = sh1.col_values(2)[2:]
|
|
|
-col_TAX = sh1.col_values(18)[2:]
|
|
|
+col_TAX = sh1.col_values(19)[2:]
|
|
|
col_PER = sh1.col_values(3)[2:]
|
|
|
-col_CHKM = sh1.col_values(22)[2:]
|
|
|
+col_CHKM = sh1.col_values(23)[2:]
|
|
|
cond_range = zip(col_NAME, col_TAX, col_PER, col_CHKM)
|
|
|
|
|
|
-def main():
|
|
|
+def main(month_=None):
|
|
|
for name, tax, period, mail in cond_range:
|
|
|
for company in office:
|
|
|
condition = name == company[0] and tax == '.00' and period == date and mail == '1'
|
|
|
if condition:
|
|
|
- current_month = mentor.get_last_month(company[6])
|
|
|
+ if month_:
|
|
|
+ if month_ >= mentor.get_last_month(company[6]):
|
|
|
+ current_month = mentor.get_last_month(company[6])
|
|
|
+ else:
|
|
|
+ current_month = month_
|
|
|
+ else:
|
|
|
+ current_month = mentor.get_last_month(company[6])
|
|
|
if current_month == mentor_date:
|
|
|
account = mentor.verif_cont(company[6] + '/' + current_month + './NCONT.DB')
|
|
|
print(f'...processing-->>{name}')
|
|
|
cell = sh1.find(f'{name}_{date}', in_column=1)
|
|
|
# Update cells
|
|
|
- sh1.update_cell(cell.row, 6, mentor.vat_payable(account))
|
|
|
+ sh1.update_cell(cell.row, 7, mentor.vat_payable(account))
|
|
|
print('writing VAT')
|
|
|
- sh1.update_cell(cell.row, 8, mentor.vat_final(account))
|
|
|
+ sh1.update_cell(cell.row, 9, mentor.vat_final(account))
|
|
|
print('writing VAT total')
|
|
|
contrs = [mentor.CAS_payable(account),
|
|
|
mentor.CASS_payable(account),
|
|
|
mentor.sal_tax_payable(account)]
|
|
|
contr = sum(contrs)
|
|
|
- sh1.update_cell(cell.row, 10, contr)
|
|
|
+ sh1.update_cell(cell.row, 11, contr)
|
|
|
print('writing contributions')
|
|
|
- sh1.update_cell(cell.row, 11, mentor.cam_payable(account))
|
|
|
+ sh1.update_cell(cell.row, 12, mentor.cam_payable(account))
|
|
|
print('writing CAM')
|
|
|
- sh1.update_cell(cell.row, 14, mentor.tax_payable(account))
|
|
|
+ sh1.update_cell(cell.row, 15, mentor.tax_payable(account))
|
|
|
print('writing income tax')
|
|
|
- sh1.update_cell(cell.row, 17, mentor.div_tax_payable(account))
|
|
|
+ sh1.update_cell(cell.row, 18, mentor.div_tax_payable(account))
|
|
|
print('writing dividend tax')
|
|
|
- sh1.update_cell(cell.row, 19, mentor.an_inc(account, 0, 6, 8))
|
|
|
+ sh1.update_cell(cell.row, 20, mentor.an_inc(account, 0, 6, 8))
|
|
|
print('writing turnover')
|
|
|
- sh1.update_cell(cell.row, 20, mentor.result(account, 0, 6, 8))
|
|
|
+ sh1.update_cell(cell.row, 21, mentor.result(account, 0, 6, 8))
|
|
|
print('writing result', end='\n' * 2)
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- main()
|
|
|
+ main(month_='2023_01')
|