brainloper-ui 20.1.2 → 20.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3787,6 +3787,9 @@ class PurchaseOrderPdfService {
3787
3787
  currentY += 20;
3788
3788
  // === ITEMS DE LA ORDEN ===
3789
3789
  currentY = this.addOrderItems(doc, order, currentY, margin, pageWidth);
3790
+ currentY += 10;
3791
+ // === TOTAL ===
3792
+ currentY = this.addTotal(doc, order, currentY, margin, pageWidth);
3790
3793
  currentY += 20;
3791
3794
  // === COMENTARIOS ===
3792
3795
  if (order.comment) {
@@ -3886,13 +3889,15 @@ class PurchaseOrderPdfService {
3886
3889
  return doc.lastAutoTable.finalY;
3887
3890
  }
3888
3891
  addOrderItems(doc, order, y, margin, pageWidth) {
3889
- const head = [['Código', 'Nombre', 'U.M.', 'Cant.', 'Descripción']];
3890
- const body = order.items.map(item => [
3892
+ const head = [['#', 'Código', 'Nombre', 'U.M.', 'Cant.', 'V. Unitario', 'V. Total']];
3893
+ const body = order.items.map((item, index) => [
3894
+ index + 1,
3891
3895
  item.code,
3892
3896
  item.itemName,
3893
3897
  item.unitMeasurement,
3894
3898
  item.amount,
3895
- item.description || ''
3899
+ this.functions.formatNumber(item.costItem),
3900
+ this.functions.formatNumber(item.totalCostItems)
3896
3901
  ]);
3897
3902
  autoTable(doc, {
3898
3903
  startY: y,
@@ -3901,14 +3906,31 @@ class PurchaseOrderPdfService {
3901
3906
  theme: 'grid',
3902
3907
  headStyles: { fillColor: [220, 220, 220], textColor: 0, fontStyle: 'bold' },
3903
3908
  columnStyles: {
3904
- 3: { halign: 'right' },
3905
- 4: { halign: 'right' },
3906
- 5: { halign: 'right' }
3909
+ 0: { halign: 'center', cellWidth: 30 }, // #
3910
+ 4: { halign: 'right' }, // Cant.
3911
+ 5: { halign: 'right' }, // V. Unitario
3912
+ 6: { halign: 'right' }, // V. Total
3907
3913
  }
3908
3914
  });
3909
3915
  let finalY = doc.lastAutoTable.finalY;
3910
3916
  return finalY;
3911
3917
  }
3918
+ addTotal(doc, order, y, margin, pageWidth) {
3919
+ const totalLabel = 'TOTAL ORDEN:';
3920
+ const totalValue = this.functions.formatNumber(order.totalCost);
3921
+ doc.setFontSize(10);
3922
+ doc.setFont('helvetica', 'bold');
3923
+ // Alineado a la derecha, cerca de la columna de V. Total
3924
+ const labelX = pageWidth - margin - 150;
3925
+ const valueX = pageWidth - margin;
3926
+ doc.text(totalLabel, labelX, y);
3927
+ doc.text(totalValue, valueX, y, { align: 'right' });
3928
+ // Línea decorativa bajo el total
3929
+ doc.setDrawColor(0);
3930
+ doc.setLineWidth(1);
3931
+ doc.line(labelX - 5, y + 4, pageWidth - margin, y + 4);
3932
+ return y + 15;
3933
+ }
3912
3934
  addComments(doc, order, y, margin, pageWidth) {
3913
3935
  doc.setFontSize(10);
3914
3936
  doc.setFont('helvetica', 'bold');