From a287e7386fa2f8ba16c2f8d1428521f0b92d8ae5 Mon Sep 17 00:00:00 2001 From: Dan Dembinski Date: Fri, 28 Jun 2019 11:21:49 -0400 Subject: [PATCH] Total Sums are now colored on Summary Sheet. Made changes to Production cost and Adjustment columns in Summary Tab. Now pulls in Item cost from Item Detail tab and sums all production charges in the order. Adjustment is balance due - production - shipping. This matches the original SFU. Minus column widths not being autoset(I'm still researching this) it seems to be on par with the original version. --- WriteReport.py | 12 ++++++------ main.py | 9 +++++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/WriteReport.py b/WriteReport.py index a173641..d9542b7 100644 --- a/WriteReport.py +++ b/WriteReport.py @@ -1,6 +1,6 @@ from openpyxl.styles import Font from openpyxl.styles import PatternFill -from openpyxl.styles import numbers +# from openpyxl.styles import numbers bold = Font(bold=True) @@ -72,16 +72,15 @@ def Save_Report(wb, sheet, sheet2, sheet3, SSheader, columnFormat): itemlength = sheet2.max_row productlength = sheet3.max_row - lightGreen = Font(color='006400') - darkGreen = PatternFill(bgColor="228B22", fill_type="solid") + lightGreen = 'ADFF2F' + darkGreen = '006400' sheet.cell(column = 5, row=summarylength+1, value="=SUM(E2:E"+str(summarylength)+")") sheet.cell(column = 6, row=summarylength+1, value="=SUM(F2:F"+str(summarylength)+")") sheet.cell(column = 7, row=summarylength+1, value="=SUM(G2:G"+str(summarylength)+")") sheet.cell(column = 8, row=summarylength+1, value="=SUM(H2:H"+str(summarylength)+")") - # thisCell = str(summarylength+1) - # sheet[thisCell].Font = lightGreen - # sheet[thisCell].PatternFill = darkGreen + sheet.cell(column = 8, row = summarylength+1).fill = PatternFill(start_color=lightGreen, end_color=darkGreen, fill_type='solid') + sheet.cell(column = 8, row= summarylength+1).font = Font(color=darkGreen) sheet2.cell(column=7, row=itemlength + 1, value="=SUM(G2:G" + str(itemlength)+")") sheet2.cell(column=8, row=itemlength + 1, value="=SUM(H2:H" + str(itemlength)+")") @@ -130,6 +129,7 @@ def Save_Report(wb, sheet, sheet2, sheet3, SSheader, columnFormat): for cell in sheet3["1:1"]: cell.font = bold + # print("Enter a filename for the report: ") # filename = input() wb.save('report.xlsx') diff --git a/main.py b/main.py index 5b5559f..dc28e58 100644 --- a/main.py +++ b/main.py @@ -159,15 +159,20 @@ def Run_Report(ticket, URL, HOST, REPORT_FIELDS, wb, ws, ws2, DETAIL_REPORT_FIEL ws.cell(column=6, row=count+1, value=x) count = count + 1 - # Compute Production Charges and write to spreadsheet + # Production and Adjustment Charges count = 1 for row in ws: if count != 1: - value = "=H" + str(count) + "-G" + str(count) + "-F" + str(count) + + # value = "=SUMIF(A:A,'Item Detail'!A:A,'Item Detail'!H:H)" + value = "=SUMIF('item Detail'!A:A,A" + str(count) + ",'Item Detail'!H:H)" ws.cell(column=5, row=count, value=value) + value = "=H" + str(count) + "-E" + str(count) + "-F" + str(count) + ws.cell(column=7, row=count, value = value) if count < ws.max_row: count += 1 + ############# Order Details tab ############# print("Getting Item Detail")