Ultronprime commited on
Commit
4ea623c
·
verified ·
1 Parent(s): 08cb293

Update purchaseOrderService.js

Browse files
Files changed (1) hide show
  1. purchaseOrderService.js +15 -19
purchaseOrderService.js CHANGED
@@ -48,19 +48,18 @@ export function generatePurchaseOrder(itemsToOrder, supplierName) {
48
  doc.text("________________________ (Supplier Address)", 20, 82);
49
 
50
 
51
- // --- REDESIGNED ITEMS TABLE ---
52
- const tableColumn = ["#", "Item Description", "Quantity", "Unit", "Unit Price", "Line Total"];
53
  const tableRows = [];
54
 
55
  itemsToOrder.forEach((item, index) => {
56
  const { material, quantity } = item;
 
57
  const materialRow = [
58
- index + 1, // Line number
59
- material.name, // Item Description
60
- quantity, // Order Quantity
61
- material.unit, // Unit
62
- '', // Placeholder for Unit Price
63
- '' // Placeholder for Line Total
64
  ];
65
  tableRows.push(materialRow);
66
  });
@@ -70,22 +69,19 @@ export function generatePurchaseOrder(itemsToOrder, supplierName) {
70
  body: tableRows,
71
  startY: 95,
72
  theme: 'grid',
73
- headStyles: { fillColor: [45, 55, 72] },
74
- didDrawPage: function (data) {
75
- // --- ADD GRAND TOTAL SECTION ---
76
- const finalY = data.cursor.y;
77
- doc.setFontSize(12);
78
- doc.setFont("helvetica", "bold");
79
- doc.text("Grand Total:", 140, finalY + 15);
80
- doc.setLineWidth(0.5);
81
- doc.line(165, finalY + 16, 200, finalY + 16); // Line for total amount
82
- }
83
  });
84
 
85
  // Footer
 
86
  doc.setFontSize(10);
87
  doc.setTextColor(150);
88
- doc.text("Please deliver items to the address above. Contact us with any questions regarding this order.", 105, 280, { align: 'center'});
 
 
 
 
89
 
90
 
91
  // Save the PDF
 
48
  doc.text("________________________ (Supplier Address)", 20, 82);
49
 
50
 
51
+ // --- MODIFIED: Standardized table columns for the supplier (No Prices) ---
52
+ const tableColumn = ["#", "Item Description", "Order Quantity", "Unit"];
53
  const tableRows = [];
54
 
55
  itemsToOrder.forEach((item, index) => {
56
  const { material, quantity } = item;
57
+ // --- MODIFIED: Row data now matches the new standardized columns ---
58
  const materialRow = [
59
+ index + 1,
60
+ material.name,
61
+ quantity,
62
+ material.unit
 
 
63
  ];
64
  tableRows.push(materialRow);
65
  });
 
69
  body: tableRows,
70
  startY: 95,
71
  theme: 'grid',
72
+ headStyles: { fillColor: [45, 55, 72] }
73
+ // --- MODIFIED: Removed the didDrawPage callback to eliminate the Grand Total section ---
 
 
 
 
 
 
 
 
74
  });
75
 
76
  // Footer
77
+ const finalY = doc.lastAutoTable.finalY || 150;
78
  doc.setFontSize(10);
79
  doc.setTextColor(150);
80
+ doc.text("Please deliver items to the address above. Contact us with any questions regarding this order.", 105, Math.max(finalY + 20, 270), { align: 'center'});
81
+
82
+ // Professional signature line
83
+ doc.setFont("helvetica", "normal");
84
+ doc.text("Authorized By: ________________________", 20, Math.max(finalY + 40, 285));
85
 
86
 
87
  // Save the PDF