Product summary tab is working. Added total sums to bottom. Started working on coloring the total due in Summary tab
This commit is contained in:
49
main.py
49
main.py
@@ -47,6 +47,7 @@ def Run_Report(ticket, URL, HOST, REPORT_FIELDS, wb, ws, ws2, DETAIL_REPORT_FIEL
|
||||
ExternalID = []
|
||||
id = []
|
||||
shippingcost = []
|
||||
products = set()
|
||||
|
||||
|
||||
############# Order Summary tab #############
|
||||
@@ -153,9 +154,9 @@ def Run_Report(ticket, URL, HOST, REPORT_FIELDS, wb, ws, ws2, DETAIL_REPORT_FIEL
|
||||
ws['G1'] = "Adjustments"
|
||||
|
||||
# Load Shipping Charges into the sheet
|
||||
count = 2
|
||||
count = 1
|
||||
for x in shippingcost:
|
||||
ws.cell(column=6, row=count, value=x)
|
||||
ws.cell(column=6, row=count+1, value=x)
|
||||
count = count + 1
|
||||
|
||||
# Compute Production Charges and write to spreadsheet
|
||||
@@ -164,7 +165,8 @@ def Run_Report(ticket, URL, HOST, REPORT_FIELDS, wb, ws, ws2, DETAIL_REPORT_FIEL
|
||||
if count != 1:
|
||||
value = "=H" + str(count) + "-G" + str(count) + "-F" + str(count)
|
||||
ws.cell(column=5, row=count, value=value)
|
||||
count += 1
|
||||
if count < ws.max_row:
|
||||
count += 1
|
||||
|
||||
############# Order Details tab #############
|
||||
|
||||
@@ -196,13 +198,48 @@ def Run_Report(ticket, URL, HOST, REPORT_FIELDS, wb, ws, ws2, DETAIL_REPORT_FIEL
|
||||
y = bs(report, "lxml")
|
||||
|
||||
# Opens report file and writes each row
|
||||
sheet = ws2
|
||||
Write_Report(y, detail_columnFormat, detail_SSheader, sheet)
|
||||
Write_Report(y, detail_columnFormat, detail_SSheader, ws2)
|
||||
|
||||
|
||||
# Product Summary Tab
|
||||
ws3 = wb.create_sheet("Product Summary")
|
||||
|
||||
# Load in all proudct names and dedupe
|
||||
count = 1
|
||||
for x in ws2.rows:
|
||||
if count != 1:
|
||||
value = ws2.cell(column = 6, row = count).value
|
||||
products.add(value)
|
||||
count += 1
|
||||
|
||||
count = 2
|
||||
for x in products:
|
||||
ws3.cell(column = 1, row = count, value = x)
|
||||
count += 1
|
||||
|
||||
# Add Quantity and Item Price columns. Populate both based using SUMIF off of the Item Detail Tab
|
||||
ws3['A1'] = "Product Name"
|
||||
ws3['B1'] = "Quantity"
|
||||
ws3['C1'] = "Item Price"
|
||||
count = 1
|
||||
for x in ws3:
|
||||
value = "=SUMIF('Item Detail'!F:F,A"+str(count)+",'Item Detail'!G:G)"
|
||||
if count != 1:
|
||||
ws3.cell(column = 2, row = count, value = value)
|
||||
count += 1
|
||||
|
||||
count = 1
|
||||
for x in ws3:
|
||||
value = "=SUMIF('Item Detail'!F:F,A"+str(count)+",'Item Detail'!H:H)"
|
||||
if count != 1:
|
||||
ws3.cell(column = 3, row = count, value = value)
|
||||
count += 1
|
||||
|
||||
|
||||
# Finalize Spreadsheet and save
|
||||
Format_Report(ws, summary_SSheader, summary_columnFormat)
|
||||
Format_Report(ws2, detail_SSheader, detail_columnFormat)
|
||||
Save_Report(wb, ws, ws2, summary_SSheader, summary_columnFormat)
|
||||
Save_Report(wb, ws, ws2, ws3, summary_SSheader, summary_columnFormat)
|
||||
|
||||
def loadMenu():
|
||||
|
||||
|
||||
Reference in New Issue
Block a user