main.py 1.1 KB

123456789101112131415161718192021222324
  1. from fast_excel_to_bill.read_table import Read_unordered_Table, Read_Table
  2. from fast_excel_to_bill.table_config import TABLE_PATH, LIST_OF_KEYS
  3. def main():
  4. table_object = Read_unordered_Table(path=TABLE_PATH, type= 'xlsx').get_values_after_key_as_dict(list_of_keys=LIST_OF_KEYS)
  5. # Get Specific Values only useable for this specific format:
  6. table_object['ZWISCHENSUMME']=table_object['BETRAG'][-4]
  7. table_object['STEUERSATZ']=table_object['BETRAG'][-3]
  8. table_object['STEUER']=table_object['BETRAG'][-2]
  9. table_object['SUMME']=table_object['BETRAG'][-1]
  10. for c,value in enumerate(table_object['MENGE']):
  11. if value == 'ZWISCHENSUMME':
  12. table_object['BESCHREIBUNG'] = table_object['BESCHREIBUNG'][1:c]
  13. table_object['MENGE'] = table_object['MENGE'][1:c]
  14. table_object['EINZELPREIS'] = table_object['EINZELPREIS'][1:c]
  15. table_object['BETRAG'] = table_object['BETRAG'][1:c]
  16. assert(len(table_object['BESCHREIBUNG'])==len(table_object['MENGE']),'FORMAT von CHRIS IST FEHLERHAFT, BESCHREIBUNGS Länge =! MENGE Länge')
  17. return table_object
  18. if __name__ == '__main__':
  19. table_object = main()