bis merge fixed
This commit is contained in:
334
main.py
334
main.py
@@ -1,4 +1,5 @@
|
|||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
|
||||||
from tkinter import ttk
|
from tkinter import ttk
|
||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
import sys
|
import sys
|
||||||
@@ -12,6 +13,9 @@ from datetime import datetime
|
|||||||
import time
|
import time
|
||||||
import configparser
|
import configparser
|
||||||
from pandastable import Table
|
from pandastable import Table
|
||||||
|
import pathlib
|
||||||
|
|
||||||
|
ver = "0.4.5"
|
||||||
|
|
||||||
outvar = {}
|
outvar = {}
|
||||||
|
|
||||||
@@ -21,40 +25,79 @@ def merge():
|
|||||||
df = pd.concat((pd.read_csv(f, header = 0) for f in interesting_files))
|
df = pd.concat((pd.read_csv(f, header = 0) for f in interesting_files))
|
||||||
df.to_csv("./output/global_output.csv",index=False,index_label=None,columns=None)
|
df.to_csv("./output/global_output.csv",index=False,index_label=None,columns=None)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def updateapp():
|
||||||
|
print("Updating app")
|
||||||
|
ret = sp.call(["python", "update.py"])
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def convertChars(val):
|
def convertChars(val):
|
||||||
converted = val.replace(',', '')
|
converted = val.replace(',', '')
|
||||||
converted = converted.replace('.', ',')
|
converted = converted.replace('.', ',')
|
||||||
return converted
|
return converted
|
||||||
|
def doNothing():
|
||||||
def openConfig():
|
print("")
|
||||||
configwindow = tk.Toplevel(root)
|
def test():
|
||||||
configwindow.title("Config")
|
|
||||||
configwindow.geometry("320x150")
|
|
||||||
#frame = tk.Frame(config)
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read('config.conf')
|
config.read('config.conf')
|
||||||
tmgdspen = config.get('modules', 'tmgdsp')
|
|
||||||
vfgdspen = config.get('modules', 'vfgdsp')
|
|
||||||
tmczen = config.get('modules', 'tmcz')
|
|
||||||
vfczen = config.get('modules', 'vfcz')
|
|
||||||
print(tmgdspen)
|
|
||||||
print(vfgdspen)
|
|
||||||
print(tmczen)
|
|
||||||
print(vfczen)
|
|
||||||
tmgdspen = tmgdspen.get()
|
|
||||||
|
|
||||||
|
|
||||||
checktmgdsp = ttk.Checkbutton(configwindow, text="TMGDSP", variable=tmgdspen, onvalue = 1, offvalue = 0)
|
tmgdspen = tk.IntVar()
|
||||||
|
vfgdspen = tk.IntVar()
|
||||||
|
tmczen = tk.IntVar()
|
||||||
|
vfczen = tk.IntVar()
|
||||||
|
|
||||||
|
tmgdspen.set(int(1))
|
||||||
|
vfgdspen.set(int(0))
|
||||||
|
tmczen.set(int(0))
|
||||||
|
vfczen.set(int(1))
|
||||||
|
print(tmczen.get())
|
||||||
|
print("test")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def openConfig():
|
||||||
|
|
||||||
|
#configwindow = tk.Toplevel(root)
|
||||||
|
configwindow = tk.Tk()
|
||||||
|
configwindow.title("Config")
|
||||||
|
configwindow.geometry("320x150")
|
||||||
|
|
||||||
|
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read('config.conf')
|
||||||
|
|
||||||
|
|
||||||
|
tmgdspen = tk.IntVar()
|
||||||
|
vfgdspen = tk.IntVar()
|
||||||
|
tmczen = tk.IntVar()
|
||||||
|
vfczen = tk.IntVar()
|
||||||
|
|
||||||
|
jedna.set(int(config.get('modules', 'tmgdsp')))
|
||||||
|
dva.set(int(config.get('modules', 'vfgdsp')))
|
||||||
|
tri.set(int(config.get('modules', 'tmcz')))
|
||||||
|
ctyri.set(int(config.get('modules', 'vfcz')))
|
||||||
|
|
||||||
|
|
||||||
|
checktmgdsp = tk.Checkbutton(configwindow, text="TMGDSP", variable=tmgdspen, onvalue=1, offvalue=0)
|
||||||
|
checkvfgdsp = tk.Checkbutton(configwindow, text="VFGDSP", variable=vfgdspen, onvalue=1, offvalue=0)
|
||||||
|
checktmcz = tk.Checkbutton(configwindow, text="TMCZ", variable=tmczen, onvalue=1, offvalue=0)
|
||||||
|
checkvfcz = tk.Checkbutton(configwindow, text="VFCZ", variable=vfczen, onvalue=1, offvalue=0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
checktmgdsp.place(x=10, y=10)
|
checktmgdsp.place(x=10, y=10)
|
||||||
|
|
||||||
checkvfgdsp = ttk.Checkbutton(configwindow, text="VFGDSP", variable=vfgdspen, onvalue = 1, offvalue = 0)
|
|
||||||
checkvfgdsp.place(x=10, y=30)
|
checkvfgdsp.place(x=10, y=30)
|
||||||
|
checkvfcz.place(x=10, y=50)
|
||||||
|
checktmcz.place(x=10, y=70)
|
||||||
|
btn = tk.Button(configwindow, text='Save',command=lambda: test(), width=20)
|
||||||
|
|
||||||
checktmcz = ttk.Checkbutton(configwindow, text="TMCZ", variable=tmczen, onvalue = 1, offvalue = 0)
|
|
||||||
checktmcz.place(x=10, y=50)
|
|
||||||
|
|
||||||
checkvfcz = ttk.Checkbutton(configwindow, text="VFCZ", variable=vfczen, onvalue = 1, offvalue = 0)
|
btn.place(x=50, y=90)
|
||||||
checkvfcz.place(x=10, y=70)
|
configwindow.after(0,configwindow.update())
|
||||||
|
|
||||||
|
|
||||||
def buttonnewwindow():
|
def buttonnewwindow():
|
||||||
@@ -69,12 +112,12 @@ def buttonnewwindow():
|
|||||||
|
|
||||||
|
|
||||||
table.show()
|
table.show()
|
||||||
|
dirpath = "output/"
|
||||||
|
mergedfile = [filename for filename in os.listdir(dirpath) if filename.startswith("merged_output_")]
|
||||||
|
print('mergedfile: ',mergedfile[0])
|
||||||
table.importCSV('output/global_output.csv')
|
table.importCSV('output/'+mergedfile[0])
|
||||||
table.setColumnColors(cols=[1, 2], clr='green')
|
#table.setColumnColors(cols=[1, 2], clr='green')
|
||||||
table.colheader.cellwidth = 100
|
#table.colheader.cellwidth = 100
|
||||||
|
|
||||||
|
|
||||||
def realsndatestrip(realsndate):
|
def realsndatestrip(realsndate):
|
||||||
@@ -83,6 +126,154 @@ def realsndatestrip(realsndate):
|
|||||||
return realsndate
|
return realsndate
|
||||||
|
|
||||||
|
|
||||||
|
def pairBis():
|
||||||
|
bisbyphoneno = {}
|
||||||
|
bisbyiccid = {}
|
||||||
|
completepairing = {}
|
||||||
|
# create two help dicts for pairing
|
||||||
|
# first one is for pairing by Phone No., second one is for pairing by ICCID
|
||||||
|
dirpath = "./help_files/"
|
||||||
|
bispairingfile = [filename for filename in os.listdir(dirpath) if filename.startswith("bis")]
|
||||||
|
with open('./help_files/' + bispairingfile[0], 'r',encoding='utf-8') as file:
|
||||||
|
reader =csv.DictReader(file, delimiter=';')
|
||||||
|
for row in reader:
|
||||||
|
|
||||||
|
# do we have valid Phone number for this record?
|
||||||
|
if row['Phone No.'] != '' and row['Phone No.'] != 'True' and row['Phone No.'] != 'False':
|
||||||
|
phoneno = int(row['Phone No.'])
|
||||||
|
|
||||||
|
amount = row['Amount']
|
||||||
|
currency = row['Currency']
|
||||||
|
code = row['Code']
|
||||||
|
textid = row['Text ID']
|
||||||
|
iccid = row['ICCID']
|
||||||
|
print("iccid: ",iccid)
|
||||||
|
print("phoneno: ", phoneno)
|
||||||
|
|
||||||
|
|
||||||
|
bisbyphoneno[phoneno] = {'amount': amount, 'currency': currency, 'code': code, 'textid': textid}
|
||||||
|
|
||||||
|
# We don't have valid Phone number, so we use ICCID if possible
|
||||||
|
elif row['ICCID'] != '' and row['ICCID'] != 'True' and row['ICCID'] != 'False':
|
||||||
|
|
||||||
|
print("We have no Phone number, trying to pair by iccid")
|
||||||
|
iccid = row['ICCID']
|
||||||
|
phoneno = 0
|
||||||
|
amount = row['Amount']
|
||||||
|
currency = row['Currency']
|
||||||
|
code = row['Code']
|
||||||
|
textid = row['Text ID']
|
||||||
|
print("iccid: ", iccid)
|
||||||
|
print("phoneno: ", phoneno)
|
||||||
|
bisbyiccid[iccid] = {'amount': amount, 'currency': currency, 'code': code, 'textid': textid}
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("skipping record, no valid Phone No. or ICCID")
|
||||||
|
|
||||||
|
continue
|
||||||
|
|
||||||
|
# this still works...
|
||||||
|
# create a dict for pairing by Phone No.
|
||||||
|
testcounter = 0
|
||||||
|
dirpath = "./output/"
|
||||||
|
mergedfile = [filename for filename in os.listdir(dirpath) if filename.startswith("merged_output_")]
|
||||||
|
with open(dirpath + mergedfile[0], 'r') as mergedfileread:
|
||||||
|
print("working with file: ",mergedfile[0])
|
||||||
|
readermerged =csv.DictReader(mergedfileread, delimiter=',')
|
||||||
|
for row in readermerged:
|
||||||
|
|
||||||
|
MSISDN = int(row['MSISDN'])
|
||||||
|
ICCID = row['ICCID']
|
||||||
|
IMSI = row['IMSI']
|
||||||
|
DATAPRICE = row['DATA-PRICE']
|
||||||
|
DATAAMOUNT = row['DATA-AMOUNT']
|
||||||
|
SMSPRICE= row['SMS-PRICE']
|
||||||
|
SMSCOUNT = row['SMS-COUNT']
|
||||||
|
OTHERPRICE = row['OTHER-PRICE']
|
||||||
|
SIMSTATUS = row['SIM-STATUS']
|
||||||
|
SN = row['SN']
|
||||||
|
SNDEC = row['SN-DEC']
|
||||||
|
LASTDATA = row['LAST-DATA']
|
||||||
|
OPERATOR = row['OPERATOR']
|
||||||
|
UNIT = row['UNIT']
|
||||||
|
print("UNIT: ", UNIT)
|
||||||
|
|
||||||
|
# Crawl through the pairing bis file
|
||||||
|
|
||||||
|
if MSISDN in bisbyphoneno:
|
||||||
|
amount = bisbyphoneno[MSISDN]['amount']
|
||||||
|
currency = bisbyphoneno[MSISDN]['currency']
|
||||||
|
code = bisbyphoneno[MSISDN]['code']
|
||||||
|
textid = bisbyphoneno[MSISDN]['textid']
|
||||||
|
|
||||||
|
|
||||||
|
elif ICCID in bisbyiccid:
|
||||||
|
amount = bisbyiccid[ICCID]['amount']
|
||||||
|
currency = bisbyiccid[ICCID]['currency']
|
||||||
|
code = bisbyiccid[ICCID]['code']
|
||||||
|
textid = bisbyiccid[ICCID]['textid']
|
||||||
|
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("what is the issue here?: ",MSISDN, ICCID, IMSI)
|
||||||
|
print("just ignore this record")
|
||||||
|
amount = "N/A"
|
||||||
|
currency = "N/A"
|
||||||
|
code = "N/A"
|
||||||
|
textid = "N/A"
|
||||||
|
testcounter += 1
|
||||||
|
print("testcounter: ", testcounter)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
completepairing[MSISDN] = {'ICCID': ICCID, 'IMSI': IMSI, 'DATA-PRICE': DATAPRICE,
|
||||||
|
'DATA-AMOUNT': DATAAMOUNT, 'SMS-PRICE': SMSPRICE, 'SMS-COUNT': SMSCOUNT,
|
||||||
|
'OTHER-PRICE': OTHERPRICE, 'SIM-STATUS': SIMSTATUS, 'SN': SN,
|
||||||
|
'SN-DEC': SNDEC, 'UNIT': UNIT, 'LAST-DATA': LASTDATA, 'OPERATOR': OPERATOR,
|
||||||
|
'amount': amount, 'currency': currency, 'code': code, 'textid': textid}
|
||||||
|
# this still works...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
filetoremove =pathlib.Path("./output/bis_merged_output.csv")
|
||||||
|
if filetoremove.exists():
|
||||||
|
os.remove("./output/bis_merged_output.csv")
|
||||||
|
|
||||||
|
with open(dirpath + 'bis_merged_output.csv', 'a', newline='', encoding="utf-8") as f:
|
||||||
|
writer = csv.writer(f)
|
||||||
|
writer.writerow(
|
||||||
|
["MSISDN", "ICCID", "IMSI", "DATA-PRICE", "DATA-AMOUNT", "SMS-PRICE", "SMS-COUNT", "OTHER-PRICE",
|
||||||
|
"SIM-STATUS", "SN", "SN-DEC", "UNIT", "LAST-DATA", "OPERATOR", "AMOUNT", "CURRENCY", "CODE", "TEXTID"])
|
||||||
|
|
||||||
|
print("how many: ", len(completepairing.keys()))
|
||||||
|
|
||||||
|
for MSISDN in completepairing:
|
||||||
|
|
||||||
|
print("MSISDN: ", MSISDN)
|
||||||
|
|
||||||
|
IMSI = completepairing[MSISDN]['IMSI']
|
||||||
|
DATAPRICE = completepairing[MSISDN]['DATA-PRICE']
|
||||||
|
DATAAMOUNT = completepairing[MSISDN]['DATA-AMOUNT']
|
||||||
|
SMSPRICE = completepairing[MSISDN]['SMS-PRICE']
|
||||||
|
SMSCOUNT = completepairing[MSISDN]['SMS-COUNT']
|
||||||
|
OTHERPRICE = completepairing[MSISDN]['OTHER-PRICE']
|
||||||
|
SIMSTATUS = completepairing[MSISDN]['SIM-STATUS']
|
||||||
|
SN = completepairing[MSISDN]['SN']
|
||||||
|
SNDEC = completepairing[MSISDN]['SN-DEC']
|
||||||
|
LASTDATA = completepairing[MSISDN]['LAST-DATA']
|
||||||
|
OPERATOR = completepairing[MSISDN]['OPERATOR']
|
||||||
|
amount = completepairing[MSISDN]['amount']
|
||||||
|
currency = completepairing[MSISDN]['currency']
|
||||||
|
code = completepairing[MSISDN]['code']
|
||||||
|
textid = completepairing[MSISDN]['textid']
|
||||||
|
UNIT = completepairing[MSISDN]['UNIT']
|
||||||
|
print(amount)
|
||||||
|
writer.writerow([MSISDN, ICCID, IMSI, DATAPRICE, DATAAMOUNT, SMSPRICE, SMSCOUNT, OTHERPRICE, SIMSTATUS, SN, SNDEC, UNIT, LASTDATA, OPERATOR, amount, currency, code, textid])
|
||||||
|
print("Pairing BIS file with merged output file done")
|
||||||
|
|
||||||
def merge():
|
def merge():
|
||||||
dirpath = "./output/"
|
dirpath = "./output/"
|
||||||
tmgdspfile = [filename for filename in os.listdir(dirpath) if filename.startswith("output_TMGDSP_")]
|
tmgdspfile = [filename for filename in os.listdir(dirpath) if filename.startswith("output_TMGDSP_")]
|
||||||
@@ -111,10 +302,14 @@ def merge():
|
|||||||
with open('./help_files/TMCZ_IMSI.csv', 'r') as file:
|
with open('./help_files/TMCZ_IMSI.csv', 'r') as file:
|
||||||
reader =csv.DictReader(file, delimiter=';')
|
reader =csv.DictReader(file, delimiter=';')
|
||||||
for row in reader:
|
for row in reader:
|
||||||
|
print(row)
|
||||||
MSISDN = int(row['MSISDN'])
|
MSISDN = int(row['MSISDN'])
|
||||||
|
MSISDN = int(str(420)+str(MSISDN))
|
||||||
print(row['ICCID'])
|
print(row['ICCID'])
|
||||||
print(row['IMSI'])
|
print(row['IMSI'])
|
||||||
convert_tmcz[MSISDN] = {'iccid': row['ICCID'],'imsi': row['IMSI']}
|
convert_tmcz[MSISDN] = {'iccid': row['ICCID'],'imsi': row['IMSI']}
|
||||||
|
print(MSISDN)
|
||||||
|
|
||||||
|
|
||||||
# vfcz_convertids
|
# vfcz_convertids
|
||||||
convert_vfcz = {}
|
convert_vfcz = {}
|
||||||
@@ -167,16 +362,19 @@ def merge():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print("created dict to translate sns")
|
print("created dict to translate sns")
|
||||||
|
|
||||||
with open(dirpath+tmczfile, newline='', encoding="utf-8") as csvfile:
|
with open(dirpath+tmczfile, newline='', encoding="utf-8") as csvfile:
|
||||||
reader = csv.DictReader(csvfile, delimiter=',')
|
reader = csv.DictReader(csvfile, delimiter=',')
|
||||||
#next(reader)
|
#next(reader)
|
||||||
print("got into reader func")
|
print("got into reader func")
|
||||||
with open('./output/output_'+ext_date_from_filaname, 'w', newline='', encoding="utf-8") as f:
|
with open('./output/merged_output_'+ext_date_from_filaname, 'w', newline='', encoding="utf-8") as f:
|
||||||
writer = csv.writer(f)
|
writer = csv.writer(f)
|
||||||
|
|
||||||
writer.writerow(
|
writer.writerow(
|
||||||
["MSISDN", "ICCID", "IMSI", "DATA-PRICE", "DATA-AMOUNT", "SMS-PRICE", "SMS-COUNT", "OTHER-PRICE", "SIM-STATUS", "SN", "SN-DEC", "LAST-DATA","OPERATOR"])
|
["MSISDN", "ICCID", "IMSI", "DATA-PRICE", "DATA-AMOUNT", "SMS-PRICE", "SMS-COUNT", "OTHER-PRICE", "SIM-STATUS", "SN", "SN-DEC","UNIT", "LAST-DATA","OPERATOR"])
|
||||||
|
|
||||||
for row in reader:
|
for row in reader:
|
||||||
#if istmczenabled == 0:
|
#if istmczenabled == 0:
|
||||||
@@ -237,15 +435,20 @@ def merge():
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
realsndecadic = realsn
|
realsndecadic = realsn
|
||||||
|
if realsn != "unknown":
|
||||||
|
|
||||||
writer.writerow([msisdn, iccid, imsi, convertChars(dataprice), convertChars(dataamount), convertChars(smsprice), convertChars(smscount), convertChars(otherprice), simstatus, realsn, realsndecadic, realsndate,operator])
|
unit = realsn[ 0 : 4 ]
|
||||||
|
else:
|
||||||
|
unit = "unknown"
|
||||||
|
|
||||||
|
writer.writerow([msisdn, iccid, imsi, convertChars(dataprice), convertChars(dataamount), convertChars(smsprice), convertChars(smscount), convertChars(otherprice), simstatus, realsn, realsndecadic, unit, realsndate,operator])
|
||||||
print("Merged")
|
print("Merged")
|
||||||
|
|
||||||
with open(dirpath+vfczfile, newline='', encoding="utf-8") as csvfile:
|
with open(dirpath+vfczfile, newline='', encoding="utf-8") as csvfile:
|
||||||
reader = csv.DictReader(csvfile, delimiter=',')
|
reader = csv.DictReader(csvfile, delimiter=',')
|
||||||
#next(reader)
|
#next(reader)
|
||||||
print("got into reader func")
|
print("got into reader func")
|
||||||
with open(dirpath+'output_'+ext_date_from_filaname, 'a', newline='', encoding="utf-8") as f:
|
with open(dirpath+'merged_output_'+ext_date_from_filaname, 'a', newline='', encoding="utf-8") as f:
|
||||||
writer = csv.writer(f)
|
writer = csv.writer(f)
|
||||||
for row in reader:
|
for row in reader:
|
||||||
|
|
||||||
@@ -286,6 +489,12 @@ def merge():
|
|||||||
else:
|
else:
|
||||||
realsndecadic = realsn
|
realsndecadic = realsn
|
||||||
|
|
||||||
|
if realsn != "unknown":
|
||||||
|
|
||||||
|
unit = realsn[ 0 : 4 ]
|
||||||
|
else:
|
||||||
|
unit = "unknown"
|
||||||
|
|
||||||
dataprice = row['DATA-PRICE']
|
dataprice = row['DATA-PRICE']
|
||||||
dataamount = row['DATA-AMOUNT']
|
dataamount = row['DATA-AMOUNT']
|
||||||
smsprice = row['SMS-PRICE']
|
smsprice = row['SMS-PRICE']
|
||||||
@@ -293,14 +502,14 @@ def merge():
|
|||||||
otherprice = row['OTHER-PRICE']
|
otherprice = row['OTHER-PRICE']
|
||||||
simstatus = row['SIM-STATUS']
|
simstatus = row['SIM-STATUS']
|
||||||
operator = row['OPERATOR']
|
operator = row['OPERATOR']
|
||||||
writer.writerow([msisdn, iccid, imsi, convertChars(dataprice), convertChars(dataamount), convertChars(smsprice), convertChars(smscount), convertChars(otherprice), simstatus, realsn, realsndecadic, realsndate, operator])
|
writer.writerow([msisdn, iccid, imsi, convertChars(dataprice), convertChars(dataamount), convertChars(smsprice), convertChars(smscount), convertChars(otherprice), simstatus, realsn, realsndecadic, unit, realsndate, operator])
|
||||||
|
|
||||||
|
|
||||||
with open(dirpath+vfgdspfile, newline='', encoding="utf-8") as csvfile:
|
with open(dirpath+vfgdspfile, newline='', encoding="utf-8") as csvfile:
|
||||||
reader = csv.DictReader(csvfile, delimiter=',')
|
reader = csv.DictReader(csvfile, delimiter=',')
|
||||||
#next(reader)
|
#next(reader)
|
||||||
print("got into reader func")
|
print("got into reader func")
|
||||||
with open(dirpath+'output_'+ext_date_from_filaname, 'a', newline='', encoding="utf-8") as f:
|
with open(dirpath+'merged_output_'+ext_date_from_filaname, 'a', newline='', encoding="utf-8") as f:
|
||||||
writer = csv.writer(f)
|
writer = csv.writer(f)
|
||||||
for row in reader:
|
for row in reader:
|
||||||
print(row)
|
print(row)
|
||||||
@@ -335,6 +544,13 @@ def merge():
|
|||||||
else:
|
else:
|
||||||
realsndecadic = realsn
|
realsndecadic = realsn
|
||||||
|
|
||||||
|
if realsn != "unknown":
|
||||||
|
|
||||||
|
unit = realsn[ 0 : 4 ]
|
||||||
|
else:
|
||||||
|
unit = "unknown"
|
||||||
|
|
||||||
|
|
||||||
dataprice = row['DATA-PRICE']
|
dataprice = row['DATA-PRICE']
|
||||||
dataamount = row['DATA-AMOUNT']
|
dataamount = row['DATA-AMOUNT']
|
||||||
smsprice = row['SMS-PRICE']
|
smsprice = row['SMS-PRICE']
|
||||||
@@ -342,13 +558,13 @@ def merge():
|
|||||||
otherprice = row['OTHER-PRICE']
|
otherprice = row['OTHER-PRICE']
|
||||||
simstatus = row['SIM-STATUS']
|
simstatus = row['SIM-STATUS']
|
||||||
operator = row['OPERATOR']
|
operator = row['OPERATOR']
|
||||||
writer.writerow([msisdn, iccid, imsi, convertChars(dataprice), convertChars(dataamount), convertChars(smsprice), convertChars(smscount), convertChars(otherprice), simstatus, realsn, realsndecadic, realsndate, operator])
|
writer.writerow([msisdn, iccid, imsi, convertChars(dataprice), convertChars(dataamount), convertChars(smsprice), convertChars(smscount), convertChars(otherprice), simstatus, realsn, realsndecadic, unit, realsndate, operator])
|
||||||
|
|
||||||
with open(dirpath+tmgdspfile, newline='', encoding="utf-8") as csvfile:
|
with open(dirpath+tmgdspfile, newline='', encoding="utf-8") as csvfile:
|
||||||
reader = csv.DictReader(csvfile, delimiter=',')
|
reader = csv.DictReader(csvfile, delimiter=',')
|
||||||
#next(reader)
|
#next(reader)
|
||||||
print("got into reader func")
|
print("got into reader func")
|
||||||
with open(dirpath+'output_'+ext_date_from_filaname, 'a', newline='', encoding="utf-8") as f:
|
with open(dirpath+'merged_output_'+ext_date_from_filaname, 'a', newline='', encoding="utf-8") as f:
|
||||||
writer = csv.writer(f)
|
writer = csv.writer(f)
|
||||||
for row in reader:
|
for row in reader:
|
||||||
print(row)
|
print(row)
|
||||||
@@ -381,6 +597,13 @@ def merge():
|
|||||||
else:
|
else:
|
||||||
realsndecadic = realsn
|
realsndecadic = realsn
|
||||||
|
|
||||||
|
if realsn != "unknown":
|
||||||
|
|
||||||
|
unit = realsn[ 0 : 4 ]
|
||||||
|
else:
|
||||||
|
unit = "unknown"
|
||||||
|
|
||||||
|
|
||||||
dataprice = row['DATA-PRICE']
|
dataprice = row['DATA-PRICE']
|
||||||
dataamount = row['DATA-AMOUNT']
|
dataamount = row['DATA-AMOUNT']
|
||||||
smsprice = row['SMS-PRICE']
|
smsprice = row['SMS-PRICE']
|
||||||
@@ -389,7 +612,7 @@ def merge():
|
|||||||
simstatus = row['SIM-STATUS']
|
simstatus = row['SIM-STATUS']
|
||||||
operator = row['OPERATOR']
|
operator = row['OPERATOR']
|
||||||
print("before write: ",realsndate)
|
print("before write: ",realsndate)
|
||||||
writer.writerow([msisdn, iccid, imsi, convertChars(dataprice), convertChars(dataamount), convertChars(smsprice), convertChars(smscount), convertChars(otherprice), simstatus,realsn ,realsndecadic, realsndate, operator])
|
writer.writerow([msisdn, iccid, imsi, convertChars(dataprice), convertChars(dataamount), convertChars(smsprice), convertChars(smscount), convertChars(otherprice), simstatus,realsn ,realsndecadic, unit, realsndate, operator])
|
||||||
|
|
||||||
print("succesfuly merged")
|
print("succesfuly merged")
|
||||||
|
|
||||||
@@ -408,6 +631,7 @@ def checkFiles():
|
|||||||
FILE7 = [filename for filename in os.listdir("./help_files") if filename.startswith("VFCZ_IMSI")]
|
FILE7 = [filename for filename in os.listdir("./help_files") if filename.startswith("VFCZ_IMSI")]
|
||||||
FILE8 = [filename for filename in os.listdir("./help_files") if filename.startswith("TMCZ_IMSI")]
|
FILE8 = [filename for filename in os.listdir("./help_files") if filename.startswith("TMCZ_IMSI")]
|
||||||
FILE9 = [filename for filename in os.listdir("./help_files") if filename.startswith("config_parser")]
|
FILE9 = [filename for filename in os.listdir("./help_files") if filename.startswith("config_parser")]
|
||||||
|
FILE10 = [filename for filename in os.listdir("./help_files") if filename.startswith("bis")]
|
||||||
|
|
||||||
|
|
||||||
b2['state'] = "active"
|
b2['state'] = "active"
|
||||||
@@ -516,7 +740,7 @@ def checkFiles():
|
|||||||
if FILE9:
|
if FILE9:
|
||||||
FILE9 = FILE9[0]
|
FILE9 = FILE9[0]
|
||||||
|
|
||||||
modTimesinceEpoc = os.path.getmtime(FILE9)
|
modTimesinceEpoc = os.path.getmtime("./help_files/" + FILE9)
|
||||||
modificationTime = time.strftime('%Y-%m-%d', time.localtime(modTimesinceEpoc))
|
modificationTime = time.strftime('%Y-%m-%d', time.localtime(modTimesinceEpoc))
|
||||||
print("Last Modified Time : ", modificationTime)
|
print("Last Modified Time : ", modificationTime)
|
||||||
|
|
||||||
@@ -529,13 +753,28 @@ def checkFiles():
|
|||||||
file9area['bg'] = "#FF0000"
|
file9area['bg'] = "#FF0000"
|
||||||
b2['state'] = "disable"
|
b2['state'] = "disable"
|
||||||
|
|
||||||
|
if FILE10:
|
||||||
|
FILE10 = FILE10[0]
|
||||||
|
|
||||||
|
modTimesinceEpoc = os.path.getmtime("./help_files/" + FILE10)
|
||||||
|
modificationTime = time.strftime('%Y-%m-%d', time.localtime(modTimesinceEpoc))
|
||||||
|
print("Last Modified Time : ", modificationTime)
|
||||||
|
|
||||||
|
file10area['text'] = FILE10 + " - " + modificationTime
|
||||||
|
file10area['bg'] = "#32CD32"
|
||||||
|
print("succ")
|
||||||
|
else:
|
||||||
|
print("no file found")
|
||||||
|
file10area['text'] = "BIS file not found"
|
||||||
|
file10area['bg'] = "#FF0000"
|
||||||
|
b2['state'] = "disable"
|
||||||
|
|
||||||
def help():
|
def help():
|
||||||
#filewin = Toplevel(root)
|
#filewin = Toplevel(root)
|
||||||
#button = Button(filewin, text="Do nothing button")
|
#button = Button(filewin, text="Do nothing button")
|
||||||
#button.pack()
|
#button.pack()
|
||||||
print("")
|
print("")
|
||||||
messagebox.showinfo("showinfo", "Ferengi v 0.2.4 by Jakub and Manik")
|
messagebox.showinfo("showinfo", "Ferengi v "+ver+" by Jakub and Manik")
|
||||||
|
|
||||||
def addSerialNumbers():
|
def addSerialNumbers():
|
||||||
|
|
||||||
@@ -566,7 +805,7 @@ def runBilling():
|
|||||||
if ret != 0:
|
if ret != 0:
|
||||||
raw_input()
|
raw_input()
|
||||||
|
|
||||||
|
print("Billing done")
|
||||||
|
|
||||||
|
|
||||||
root = tk.Tk()
|
root = tk.Tk()
|
||||||
@@ -601,6 +840,8 @@ help2text = "TMCZ_IMSI.csv file not found"
|
|||||||
|
|
||||||
help3text = "config_parser.csv file not found"
|
help3text = "config_parser.csv file not found"
|
||||||
|
|
||||||
|
help4text = "bis file not found"
|
||||||
|
|
||||||
# TMGDSP
|
# TMGDSP
|
||||||
tmgdpssection = tk.Label( root, text="TMGDSP",borderwidth=0, relief="groove",width=60, anchor='w')
|
tmgdpssection = tk.Label( root, text="TMGDSP",borderwidth=0, relief="groove",width=60, anchor='w')
|
||||||
file1area = tk.Label( root, text=tmgdsptext,borderwidth=2, relief="groove",width=60)
|
file1area = tk.Label( root, text=tmgdsptext,borderwidth=2, relief="groove",width=60)
|
||||||
@@ -627,6 +868,8 @@ file8area = tk.Label( root, text=help2text,borderwidth=2, relief="groove",width=
|
|||||||
|
|
||||||
file9area = tk.Label( root, text=help3text,borderwidth=2, relief="groove",width=60)
|
file9area = tk.Label( root, text=help3text,borderwidth=2, relief="groove",width=60)
|
||||||
|
|
||||||
|
file10area = tk.Label( root, text=help4text,borderwidth=2, relief="groove",width=60)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
T = tk.Text(root, height=20, width=200)
|
T = tk.Text(root, height=20, width=200)
|
||||||
@@ -643,6 +886,9 @@ b3 = tk.Button(root, text="Merge",
|
|||||||
b4 = tk.Button(root, text="Download pairing file",
|
b4 = tk.Button(root, text="Download pairing file",
|
||||||
command=lambda: obtainIdFile(), width=20)
|
command=lambda: obtainIdFile(), width=20)
|
||||||
|
|
||||||
|
pairbis = tk.Button(root, text="Pair BIS data",
|
||||||
|
command=lambda: pairBis(), width=20)
|
||||||
|
|
||||||
buttonnewwindow = tk.Button(root,
|
buttonnewwindow = tk.Button(root,
|
||||||
text ="Show results",
|
text ="Show results",
|
||||||
command = buttonnewwindow, width=20)
|
command = buttonnewwindow, width=20)
|
||||||
@@ -663,6 +909,7 @@ helpsection.place(x=10, y=230)
|
|||||||
file7area.place(x=10, y=250)
|
file7area.place(x=10, y=250)
|
||||||
file8area.place(x=10, y=270)
|
file8area.place(x=10, y=270)
|
||||||
file9area.place(x=10, y=290)
|
file9area.place(x=10, y=290)
|
||||||
|
file10area.place(x=10, y=310)
|
||||||
|
|
||||||
menubar = tk.Menu(root)
|
menubar = tk.Menu(root)
|
||||||
filemenu = tk.Menu(menubar, tearoff=0)
|
filemenu = tk.Menu(menubar, tearoff=0)
|
||||||
@@ -678,8 +925,10 @@ editmenu = tk.Menu(menubar, tearoff=0)
|
|||||||
helpmenu = tk.Menu(menubar, tearoff=0)
|
helpmenu = tk.Menu(menubar, tearoff=0)
|
||||||
|
|
||||||
helpmenu.add_command(label="About", command=help)
|
helpmenu.add_command(label="About", command=help)
|
||||||
|
helpmenu.add_command(label="Update", command=updateapp)
|
||||||
menubar.add_cascade(label="Help", menu=helpmenu)
|
menubar.add_cascade(label="Help", menu=helpmenu)
|
||||||
|
|
||||||
|
|
||||||
root.config(menu=menubar)
|
root.config(menu=menubar)
|
||||||
|
|
||||||
|
|
||||||
@@ -689,6 +938,11 @@ b2.place(x=450, y=90)
|
|||||||
b3.place(x=450, y=120)
|
b3.place(x=450, y=120)
|
||||||
b4.place(x=450, y=150)
|
b4.place(x=450, y=150)
|
||||||
buttonnewwindow.place(x=450, y=180)
|
buttonnewwindow.place(x=450, y=180)
|
||||||
|
pairbis.place(x=450, y=210)
|
||||||
|
|
||||||
|
versionlabel = tk.Label(root,text=ver)
|
||||||
|
|
||||||
|
versionlabel.place(relx=1.0, rely=1.0,anchor ='se')
|
||||||
|
|
||||||
"""
|
"""
|
||||||
height = 5
|
height = 5
|
||||||
|
|||||||
Reference in New Issue
Block a user