from openpyxl import load_workbook from shutil import copyfile sys.path.append('C:\\pycode\\libs') import igtools as ig import dbquery as dbq #------ program starting point -------- if __name__=="__main__": ## dd/mm/yyyy format print("Process date is " + str(time.strftime("%m/%d/%Y"))) print("The following will get cycle data from SMA database and export to Excel") getcycledate = datetime.datetime.strptime(input('Please enter the cycle end date (mm/dd/yyyy) you want to get:'), '%m/%d/%Y') endday = getcycledate startday = ig.getCStartDate(getcycledate) print('Cycle start date is ' + str(startday)) print('Cycle end date is ' + str(endday)) #----------- get SMA daily transactions and AL information ------------ driver = r"{Microsoft Access Driver (*.mdb, *.accdb)};" db_file = r"F:\\3-Compensation Programs\\IIROC Compensation\\SMA, FBA Compensation\\SMA.accdb;" #user = "******" #password = "" #odbc_conn_str = r"DRIVER={};DBQ={};".format(driver, db_file) #conn = pyodbc.connect(odbc_conn_str) sql = ''' SELECT DISTINCT qry_SMATranswALAll.[SMAKey]
import dbquery as dbq #------ program starting point -------- if __name__ == "__main__": ## dd/mm/yyyy format print("This is the process for IIROC Income Reporting") print("Process date is " + str(time.strftime("%m/%d/%Y"))) #print("Please enter the cycle end date (mm/dd/yyyy) you want to process:") #----------------------------------------------------- #------- get cycle date ---------------------- #enddate = datetime.datetime.strptime(raw_input(), "%m/%d/%Y") enddate = datetime.datetime.strptime( input( "Please enter the cycle end date (mm/dd/yyyy) you want to process:" ), "%m/%d/%Y") startdate = ig.getCStartDate(enddate) print("Cycle start date is " + str(startdate)) print("Cycle end date is " + str(enddate)) #--------- Handle Garnishee ------------- garnisheefile = "C:\\pycode\\IIROCIncome\\Garnishee " + enddate.strftime( "%m%d%Y") + ".csv" #print(garnisheefile) if os.path.isfile(garnisheefile): total = float(0) file = csv.reader(open(garnisheefile, newline=""), delimiter=",") #get the total amount "Report Totals" from file, used to check the total of all data rows for line in file: