From 6bab0a4a123d7ea88b5fe202658f254991348dc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=BD=C3=A1=C4=8Dek?= Date: Wed, 8 Jun 2022 20:28:29 +0200 Subject: [PATCH] cleanup --- ucetnictvi_vfcz.py | 51 +++------------------------------------------- 1 file changed, 3 insertions(+), 48 deletions(-) diff --git a/ucetnictvi_vfcz.py b/ucetnictvi_vfcz.py index 2718516..bf3bf60 100644 --- a/ucetnictvi_vfcz.py +++ b/ucetnictvi_vfcz.py @@ -20,8 +20,7 @@ FILE = FILE[0] ext_date_from_filaname = FILE.split('_')[-1] print(ext_date_from_filaname) -#usrmonth = input("Month to be processed: ") -#usrmonth = int(usrmonth) + usrmonth = int(5) dictionary = {} @@ -56,44 +55,15 @@ with open(FILE, newline='', encoding="utf-8") as csvfile: reader = csv.DictReader(csvfile, delimiter=';',fieldnames=['faktura_c','phonenumber','direction','productgroup','productser','item','service','datetime','dialnum','time_taken','time_charged','dataamount','realcost','creditcost','discount' 'servicescost','chargedwovat','chargedwvat','privatecall']) for row in reader: print("Product serie: ",row['productser']) - print("Time taken ",row['time_taken']) - # sys.exit(1) - - #print(row) if row['phonenumber'] == '': continue #skip empty phonenumber - # if row['Začátek fakturačního období'] == '': - # continue - # - # my_string = row['Začátek fakturačního období'] - # #my_string = '2021-09-06' - # print("start date: ",my_string) - # - # try: - # my_date = datetime.strptime(my_string, "%d.%m.%Y") - # except: - # print("An exception occurred, current my_string is: ", my_string) - # sys.exit(1) - - - #print(row['BILLED_PERIOD_START']) - #print(my_date.month) - - - # if usrmonth != my_date.month: - # print("skipping bad date") - # continue #skip bad dates - - MSISDN = int(row['phonenumber']) - #ICCID = int(row['ICCID']) - price = row['chargedwovat'].replace(',','.') - #price = round(price, 5) + price = row['chargedwovat'].replace(',','.') typ = None @@ -106,8 +76,6 @@ with open(FILE, newline='', encoding="utf-8") as csvfile: typ = 'other' - - if row['direction'] != "I" and row['productser'] == "SMS ": pricesms = int(row['time_taken']) @@ -136,18 +104,6 @@ with open(FILE, newline='', encoding="utf-8") as csvfile: print("direction: ", row['direction'], " and productser: ", row['productser']) - #try: - #print(dictionary[436761890319959]) #one with both types - #except: - #print("Required unit is not in our set") - #sys.exit(1) - -#print(len(dictionary.keys())) - -#for key, value in dictionary.items(): - #print(key, ' : ', value) - - print("Count of units: ", len(dictionary.keys())) @@ -173,5 +129,4 @@ with open('output_VFCZ_'+ext_date_from_filaname, 'w') as f: with open('output_VFCZ_'+ext_date_from_filaname, "rb") as f: webhook.add_file(file=f.read(), filename='output_VFCZ_'+ext_date_from_filaname) -response = webhook.execute() - +response = webhook.execute() \ No newline at end of file