示例#1
0
def get_description(invoice_number):
    last_invoice_row = str(get_final_row())
    invoice_titles = get_range('A71:A' + last_invoice_row)['values']

    invoice_id = get_file_id('Trio_JM_Facture_1004')
    last_description = get_range('C15',
                                 spreadsheet_id=invoice_id,
                                 sheet_title='Sheet1')['values'][0][0]
    return (last_description)
示例#2
0
def print_description(row):
    invoice_name = get_range('A' + row)['values'][0][0]
    print(invoice_name)
    invoice_id = get_file_id(invoice_name)
    if invoice_id is None:
        print("No description available - CHECK MANUALLY! POSSIBLE BUG!")
    last_description = get_range('C15',
                                 spreadsheet_id=invoice_id,
                                 sheet_title='Sheet1')['values'][0][0]
    print(last_description)
示例#3
0
 def get_last_description(self):
     invoice_name = self.get_last_invoice_name()
     invoice_id = get_file_id(invoice_name)
     if invoice_id is None:
         return ("No description available")
     last_description = get_range('C15',
                                  spreadsheet_id=invoice_id,
                                  sheet_title='Sheet1')['values'][0][0]
     return (last_description)
示例#4
0
def check_invoice_number(to_print=False):
    #general accounting ID - NOTE: Test version - Change for production
    general_accounting = '1GhovgewjuCoqJRdN-PrJvXv9Tq9INeKqgBH_s__xi2M'

    #current invoice number from json dict
    invoice_number = int(json_load('json/invoice_number.json'))

    last_invoice_row = str(get_final_row())

    #last invoice number from general accounting
    worksheet_invoice_number = int(
        get_range('A' + last_invoice_row)['values'][0][0][-4:])

    if to_print:
        print('google docs last invoice: ' + str(worksheet_invoice_number) +
              '\n')
        print('json dict last invoice: ' + str(invoice_number) + '\n')

    return invoice_number == worksheet_invoice_number + 1
示例#5
0
def pay_invoice(row):
    set_range('G' + row, [['=TRUE']])
    print('Paid invoice: ' + get_range('A' + row)['values'][0][0] + '\n')
    print('Value: ' + get_range('F' + row)['values'][0][0] + '\n')
示例#6
0
        for row in last_change_list:
            set_range('G' + row, [['=FALSE']])
        sys.exit(0)
except IndexError:
    pass

company_dict = json_load('json/company_dict.json')
for company in company_dict:
    print(company_dict[company]['invoice_name'])

#general accounting ID - NOTE: Test version - Change for production
general_accounting = '1GhovgewjuCoqJRdN-PrJvXv9Tq9INeKqgBH_s__xi2M'

last_invoice_row = str(get_final_row())

paid_bools = get_range('G4:G' + last_invoice_row)['values']

bool_dict = {'TRUE': True, 'FALSE': False, 'VRAI': True, 'FAUX': False}

value_dict = {}


#Prints description of invoice in specific row.
def print_description(row):
    invoice_name = get_range('A' + row)['values'][0][0]
    print(invoice_name)
    invoice_id = get_file_id(invoice_name)
    if invoice_id is None:
        print("No description available - CHECK MANUALLY! POSSIBLE BUG!")
    last_description = get_range('C15',
                                 spreadsheet_id=invoice_id,
示例#7
0
                json_dump(work_in_progress, 'json/work_in_progress.json')
            except IndexError:
                print('Incorrect input. Rerun program to try again.')
        json_dump(work_in_progress, 'json/work_in_progress.json')
        sys.exit(0)
except IndexError:
    pass

print(type(work_in_progress))

#general accounting ID - NOTE: Test version - Change for production
general_accounting = '1GhovgewjuCoqJRdN-PrJvXv9Tq9INeKqgBH_s__xi2M'

last_invoice_row = str(get_final_row())

paid_bools = get_range('G4:G' + last_invoice_row)[
    'values']  #List of true or false strings

bool_dict = {
    'TRUE': True,
    'FALSE': False,
    'VRAI': True,
    'FAUX': False
}  #Convert strings to booleans

value_dict = {}

#value_dict = json_load('json/test_check.json') #Uncomment to use test dictionary.

for index, bool in enumerate(
        paid_bools):  #Get unpaid invoice info from Google Sheets
    if not bool_dict[bool[0]]:
示例#8
0
def get_final_row():
    range_object = get_range('A1:A')
    return range_object['values'].index(['Total:'
                                         ]) - 1  #for zero-index purposes
示例#9
0
    'col': (3),
    'value_list': ('stringValue', active_rate.rate_sentence(unit_quan))
})

value_changes(new_id, change_dict_list)

#Update general accounting spreadsheet with new invoice info

new_row = get_final_row()

insert_row(general_accounting, new_row)

new_range = 'A' + str(new_row + 1) + ':I' + str(new_row + 1)

dollar_amounts = get_range('E41:E44',
                           spreadsheet_id=new_id,
                           sheet_title='sheet1')

base_salary = dollar_to_float(dollar_amounts['values'][0][0])

tax_federal = dollar_to_float(dollar_amounts['values'][1][0])

tax_provincial = dollar_to_float(dollar_amounts['values'][2][0])

total_salary = dollar_to_float(dollar_amounts['values'][3][0])

new_values = [[
    title, date_string, base_salary, tax_federal, tax_provincial, total_salary,
    '=FAUX', prof_type, invo_code
]]