final
This commit is contained in:
@@ -3,7 +3,7 @@ from datetime import datetime
|
||||
import sys
|
||||
import pandas as pd
|
||||
|
||||
FILE = 'TMGDSP202105.CSV'
|
||||
FILE = 'TMGDSP202110.CSV'
|
||||
|
||||
#usrmonth = input("Month to be processed: ")
|
||||
|
||||
@@ -70,10 +70,12 @@ with open(FILE, newline='', encoding='utf-8') as csvfile:
|
||||
|
||||
MSISDN = int(row['MSISDN'])
|
||||
ICCID = int(row['ICCID'])
|
||||
price1 = float(row['CHARGE_NET'].replace(',','.'))
|
||||
|
||||
price = round(price1, 5)
|
||||
print("before conditions price: ",price)
|
||||
|
||||
print("charge_net: ",row['CHARGE_NET'])
|
||||
price = float(row['CHARGE_NET'].replace(',','.'))
|
||||
price = round(price, 5)
|
||||
|
||||
print("before conditions price: ",price, "for: ",ICCID)
|
||||
|
||||
typ = None
|
||||
if row['CHARGE_TYPE'] == "Pravidelné měsíční poplatky":
|
||||
@@ -102,12 +104,12 @@ with open(FILE, newline='', encoding='utf-8') as csvfile:
|
||||
dictionary[MSISDN] = {'ICCID':ICCID,'data':0.00000, 'sms':0.00000, 'other':0.00000, 'smscount':pricesms}
|
||||
print("Creating new dictionary: ", dictionary[MSISDN])
|
||||
|
||||
else:
|
||||
print("Adding: ", price, " for: ", dictionary[MSISDN], "TYP: ",typ)
|
||||
add_dict(MSISDN, typ, price)
|
||||
if row['INCREMENT'] == "SMS":
|
||||
print("pricesms: ",pricesms," for unit: ",dictionary[MSISDN])
|
||||
add_dictsms(MSISDN, pricesms)
|
||||
|
||||
print("Adding: ", price, " for: ", dictionary[MSISDN], "TYP: ",typ)
|
||||
add_dict(MSISDN, typ, price)
|
||||
if row['INCREMENT'] == "SMS":
|
||||
print("pricesms: ",pricesms," for unit: ",dictionary[MSISDN])
|
||||
add_dictsms(MSISDN, pricesms)
|
||||
|
||||
|
||||
|
||||
@@ -141,7 +143,7 @@ print("Count of units: ", len(dictionary.keys()))
|
||||
|
||||
csv_columns = ['takhleuztoneudelam', 'ICCID', 'data', 'sms', 'other', 'smscount']
|
||||
try:
|
||||
with open('fakturace_tmgdsp_export_20211110v3.csv', 'w') as csvfile:
|
||||
with open('fakturace_tmgdsp_export_202110v1.csv', 'w') as csvfile:
|
||||
w = csv.DictWriter(sys.stdout, csv_columns)
|
||||
for key, val in sorted(dictionary.items()):
|
||||
row = {'takhleuztoneudelam': key}
|
||||
@@ -151,4 +153,4 @@ try:
|
||||
writer.writerow(row)
|
||||
|
||||
except IOError:
|
||||
print(f"I/O error: {IOError}")
|
||||
print(f"I/O error: {IOError}")
|
||||
Reference in New Issue
Block a user