VaneshDev commited on
Commit
0b081d3
·
verified ·
1 Parent(s): 1491063

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -20
app.py CHANGED
@@ -246,23 +246,20 @@ def generate_batch_pdf(records, batch_uid):
246
  pdf_path.parent.mkdir(parents=True, exist_ok=True)
247
 
248
  c = canvas.Canvas(str(pdf_path), pagesize=letter)
249
- c.setFont("Helvetica-Bold", 16)
250
- y = 770
251
- title_str = "Equipment Utilization Batch Report"
 
 
 
252
 
253
  for idx, record in enumerate(records, 1):
254
- # New page and title if near bottom
255
- if y < 120:
256
  c.showPage()
257
- c.setFont("Helvetica-Bold", 16)
258
- c.drawString(100, 770, title_str)
259
- c.setFont("Helvetica", 12)
260
  y = 740
261
-
262
- # Draw title on first page or new page
263
- if y == 770:
264
- c.drawString(100, y, title_str)
265
- y -= 30
266
  c.setFont("Helvetica", 12)
267
 
268
  c.drawString(100, y, f"Record {idx}: {record['Summary']['Equipment Name']}")
@@ -272,16 +269,16 @@ def generate_batch_pdf(records, batch_uid):
272
 
273
  for key, value in record["Summary"].items():
274
  c.drawString(100, y, f"{key}: {value}")
275
- y -= 18
276
- if y < 120:
277
  c.showPage()
278
- c.setFont("Helvetica-Bold", 16)
279
- c.drawString(100, 770, title_str)
280
- c.setFont("Helvetica", 12)
281
  y = 740
 
282
 
283
- y -= 15
284
- c.drawString(100, y, "-" * 60)
285
  y -= 20
286
 
287
  c.save()
 
246
  pdf_path.parent.mkdir(parents=True, exist_ok=True)
247
 
248
  c = canvas.Canvas(str(pdf_path), pagesize=letter)
249
+ c.setFont("Helvetica-Bold", 14)
250
+ y = 760
251
+
252
+ c.drawString(100, y, "Equipment Utilization Batch Report")
253
+ y -= 30
254
+ c.setFont("Helvetica", 12)
255
 
256
  for idx, record in enumerate(records, 1):
257
+ # Start new page if near bottom
258
+ if y < 100:
259
  c.showPage()
260
+ c.setFont("Helvetica-Bold", 14)
261
+ c.drawString(100, 770, "Equipment Utilization Batch Report")
 
262
  y = 740
 
 
 
 
 
263
  c.setFont("Helvetica", 12)
264
 
265
  c.drawString(100, y, f"Record {idx}: {record['Summary']['Equipment Name']}")
 
269
 
270
  for key, value in record["Summary"].items():
271
  c.drawString(100, y, f"{key}: {value}")
272
+ y -= 20
273
+ if y < 100:
274
  c.showPage()
275
+ c.setFont("Helvetica-Bold", 14)
276
+ c.drawString(100, 770, "Equipment Utilization Batch Report")
 
277
  y = 740
278
+ c.setFont("Helvetica", 12)
279
 
280
+ y -= 10
281
+ c.drawString(100, y, "-" * 50)
282
  y -= 20
283
 
284
  c.save()