spec_symbol = item.findtext("S86_SPECSYMOUR", "") price = item.findtext("S61_CASTKA").replace("+", "").replace(",", ".") name = item.findtext("PART_ACC_ID") date = datetime.strptime(item.findtext("DPROCD"), "%d.%m.%Y").date().isoformat() code = item.findtext("S61_CD_INDIK") memo = item.findtext("PART_ID1_1")[:64] crtime = '' # code can be D - debet, C - credit, DR - storno deposit and CR - storno credit # (we already know difference between C and D by sign of price - so to <code> tag # we save only whether it is normal (1) or storno(2) transaction): if code in ("D", "C"): code = "1" elif code in ("DR", "CR"): code = "2" type = "" # only for output for backend, transproc leaves this blank # all payments in CSOB XML are realized: status = "1" print unicode( render_template_item([ ident, account_number, account_bank_code, const_symbol, var_symbol, spec_symbol, price, type, code, status, memo, date, crtime, name ])).encode('utf8') print unicode(render_template_tail()).encode('utf8')
# we set price to zero here in order to import the payment # and be sure that it will not be processed by backend # till correct price in CZK is known price = 0 type = "" # only for output for backend, transproc leaves this blank # status # * 1-Realized (only this should be further processed) # * 2-Partially realized # * 3-Not realized # * 4-Suspended # * 5-Ended # * 6-Waiting for clearing status = status_mapping[int(row[13].strip())] # import only realized payments if status != 1: continue # all transfers in CSV file are deposit from registrars code = "1" memo = row[12].strip()[:64] date = datetime.strptime(row[5].strip(), "%d.%m.%Y %H:%M:%S").date().isoformat() crtime = "" name = row[14].strip() print render_template_item([ident, account_number, bank_code, const_symbol, var_symbol, spec_symbol, price, type, code, status, memo, date, crtime, name]) if first_time == False: # there was at least one row in input csv print render_template_tail()
# and be sure that it will not be processed by backend # till correct price in CZK is known price = 0 type = "1" # not decided (not processed) # status # * 1-Realized (only this should be further processed) # * 2-Partially realized # * 3-Not realized # * 4-Suspended # * 5-Ended # * 6-Waiting for clearing status = status_mapping[int(row[13].strip())] # import only realized payments if status != 1: continue # all transfers in CSV file are deposit from registrars code = "1" memo = row[12].strip()[:64] date = datetime.strptime(row[5].strip(), "%d.%m.%Y %H:%M:%S").date().isoformat() crtime = "" name = row[14].strip() print render_template_item([ ident, account_number, bank_code, const_symbol, var_symbol, spec_symbol, price, type, code, status, memo, date, crtime, name ]) if first_time == False: # there was at least one row in input csv print render_template_tail()
const_symbol = item.findtext("S86_KONSTSYM", "") var_symbol = item.findtext("S86_VARSYMOUR", "") spec_symbol = item.findtext("S86_SPECSYMOUR", "") price = item.findtext("S61_CASTKA").replace("+", "").replace(",", ".") name = item.findtext("PART_ACC_ID") date = datetime.strptime(item.findtext("DPROCD"), "%d.%m.%Y").date().isoformat() code = item.findtext("S61_CD_INDIK") memo = item.findtext("PART_ID1_1")[:64] crtime = '' # code can be D - debet, C - credit, DR - storno deposit and CR - storno credit # (we already know difference between C and D by sign of price - so to <code> tag # we save only whether it is normal (1) or storno(2) transaction): if code in ("D", "C"): code = "1" elif code in ("DR", "CR"): code = "2" type = "" # only for output for backend, transproc leaves this blank # all payments in CSOB XML are realized: status = "1" print unicode(render_template_item([ident, account_number, account_bank_code, const_symbol, var_symbol, spec_symbol, price, type, code, status, memo, date, crtime, name])).encode('utf8') print unicode(render_template_tail()).encode('utf8')