brainloper-ui 14.1.13 → 14.1.14
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.
- package/esm2020/public_api.mjs +2 -1
- package/esm2020/src/app/modules/brainloper-ui/components/report/template-fuel/template-fuel.component.mjs +4 -35
- package/esm2020/src/app/modules/brainloper-ui/components/report/template-ot/template-ot.component.mjs +4 -68
- package/esm2020/src/app/modules/interfaces/report/template-pdf-base.mjs +1 -1
- package/esm2020/src/app/modules/interfaces/report/template-pdf-purchase-order.mjs +2 -0
- package/esm2020/src/app/modules/services/fuel-order-pdf.service.mjs +31 -213
- package/esm2020/src/app/modules/services/functions.service.mjs +22 -1
- package/esm2020/src/app/modules/services/generate-pdf.service.mjs +25 -45
- package/esm2020/src/app/modules/services/purchase-order-pdf.service.mjs +173 -0
- package/esm2020/src/app/modules/services/work-order-pdf.service.mjs +56 -77
- package/fesm2015/brainloper-ui.mjs +298 -433
- package/fesm2015/brainloper-ui.mjs.map +1 -1
- package/fesm2020/brainloper-ui.mjs +303 -433
- package/fesm2020/brainloper-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +1 -0
- package/src/app/modules/brainloper-ui/components/report/template-fuel/template-fuel.component.d.ts +0 -2
- package/src/app/modules/brainloper-ui/components/report/template-ot/template-ot.component.d.ts +0 -2
- package/src/app/modules/interfaces/report/template-pdf-base.d.ts +1 -0
- package/src/app/modules/interfaces/report/template-pdf-purchase-order.d.ts +18 -0
- package/src/app/modules/services/fuel-order-pdf.service.d.ts +5 -39
- package/src/app/modules/services/functions.service.d.ts +2 -0
- package/src/app/modules/services/generate-pdf.service.d.ts +7 -6
- package/src/app/modules/services/purchase-order-pdf.service.d.ts +21 -0
- package/src/app/modules/services/work-order-pdf.service.d.ts +14 -41
|
@@ -810,12 +810,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
810
810
|
type: Output
|
|
811
811
|
}] } });
|
|
812
812
|
|
|
813
|
+
// export interface TemplatePdfOt {
|
|
814
|
+
// name?: string;
|
|
815
|
+
// nit?: string;
|
|
816
|
+
// address?: string;
|
|
817
|
+
// telephone?: string;
|
|
818
|
+
// mail?: string;
|
|
819
|
+
// image?: string;
|
|
820
|
+
// code?: string;
|
|
821
|
+
// date?: string;
|
|
822
|
+
// responsible?: string;
|
|
823
|
+
// third?: string;
|
|
824
|
+
// approved_by?: string;
|
|
825
|
+
// description?: string;
|
|
826
|
+
// consecutive?: string;
|
|
827
|
+
// nameProvider?: string;
|
|
828
|
+
// addressProvider?: string;
|
|
829
|
+
// area?: string;
|
|
830
|
+
// odometer?: string;
|
|
831
|
+
// invoiceReference?: string;
|
|
832
|
+
// }
|
|
813
833
|
class WorkOrderPdfService {
|
|
814
834
|
constructor() { }
|
|
815
|
-
/**
|
|
816
|
-
* Genera PDF de orden de trabajo con diseño profesional
|
|
817
|
-
* Dimensiones fijas, independiente del DOM
|
|
818
|
-
*/
|
|
819
835
|
generateWorkOrderPDF(data, options) {
|
|
820
836
|
return new Promise((resolve, reject) => {
|
|
821
837
|
try {
|
|
@@ -860,6 +876,41 @@ class WorkOrderPdfService {
|
|
|
860
876
|
}
|
|
861
877
|
});
|
|
862
878
|
}
|
|
879
|
+
/**
|
|
880
|
+
* Genera PDF optimizado para impresión
|
|
881
|
+
*/
|
|
882
|
+
generateForPrint(data) {
|
|
883
|
+
return this.generateWorkOrderPDF(data, {
|
|
884
|
+
format: 'letter',
|
|
885
|
+
download: false
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Genera PDF y lo devuelve como Blob para envío por email
|
|
890
|
+
*/
|
|
891
|
+
generateAsBlob(data) {
|
|
892
|
+
return new Promise((resolve, reject) => {
|
|
893
|
+
this.generateWorkOrderPDF(data, { download: false })
|
|
894
|
+
.then(doc => {
|
|
895
|
+
const pdfBlob = doc.output('blob');
|
|
896
|
+
resolve(pdfBlob);
|
|
897
|
+
})
|
|
898
|
+
.catch(reject);
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
* Genera PDF y lo devuelve como base64
|
|
903
|
+
*/
|
|
904
|
+
generateAsBase64(data) {
|
|
905
|
+
return new Promise((resolve, reject) => {
|
|
906
|
+
this.generateWorkOrderPDF(data, { download: false })
|
|
907
|
+
.then(doc => {
|
|
908
|
+
const base64 = doc.output('datauristring');
|
|
909
|
+
resolve(base64);
|
|
910
|
+
})
|
|
911
|
+
.catch(reject);
|
|
912
|
+
});
|
|
913
|
+
}
|
|
863
914
|
addHeader(doc, data, margin, y, pageWidth, color) {
|
|
864
915
|
// Fondo del encabezado
|
|
865
916
|
doc.setFillColor(color[0], color[1], color[2]);
|
|
@@ -1062,43 +1113,6 @@ class WorkOrderPdfService {
|
|
|
1062
1113
|
}
|
|
1063
1114
|
return finalBoxY + boxHeight;
|
|
1064
1115
|
}
|
|
1065
|
-
/**
|
|
1066
|
-
* Método auxiliar para manejar texto largo que puede necesitar múltiples páginas
|
|
1067
|
-
*/
|
|
1068
|
-
addLongText(doc, text, x, y, maxWidth, fontSize = 11) {
|
|
1069
|
-
if (!text || !text.trim())
|
|
1070
|
-
return y;
|
|
1071
|
-
doc.setFontSize(fontSize);
|
|
1072
|
-
const lines = doc.splitTextToSize(text.trim(), maxWidth);
|
|
1073
|
-
const lineHeight = fontSize + 3;
|
|
1074
|
-
const pageHeight = doc.internal.pageSize.getHeight();
|
|
1075
|
-
const margin = 40;
|
|
1076
|
-
let currentY = y;
|
|
1077
|
-
let lineIndex = 0;
|
|
1078
|
-
while (lineIndex < lines.length) {
|
|
1079
|
-
// Verificar si necesitamos una nueva página
|
|
1080
|
-
if (currentY + lineHeight > pageHeight - margin) {
|
|
1081
|
-
doc.addPage();
|
|
1082
|
-
currentY = margin;
|
|
1083
|
-
}
|
|
1084
|
-
// Calcular cuántas líneas caben en la página actual
|
|
1085
|
-
const remainingSpace = pageHeight - currentY - margin;
|
|
1086
|
-
const maxLinesInPage = Math.floor(remainingSpace / lineHeight);
|
|
1087
|
-
if (maxLinesInPage > 0) {
|
|
1088
|
-
const linesToShow = Math.min(maxLinesInPage, lines.length - lineIndex);
|
|
1089
|
-
const pageLines = lines.slice(lineIndex, lineIndex + linesToShow);
|
|
1090
|
-
doc.text(pageLines, x, currentY);
|
|
1091
|
-
currentY += pageLines.length * lineHeight;
|
|
1092
|
-
lineIndex += linesToShow;
|
|
1093
|
-
}
|
|
1094
|
-
else {
|
|
1095
|
-
// Si no cabe ni una línea, ir a nueva página
|
|
1096
|
-
doc.addPage();
|
|
1097
|
-
currentY = margin;
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
return currentY;
|
|
1101
|
-
}
|
|
1102
1116
|
addAuthorization(doc, data, y, margin, pageWidth) {
|
|
1103
1117
|
const tableData = [
|
|
1104
1118
|
[
|
|
@@ -1140,41 +1154,6 @@ class WorkOrderPdfService {
|
|
|
1140
1154
|
// Resetear color
|
|
1141
1155
|
doc.setTextColor(0, 0, 0);
|
|
1142
1156
|
}
|
|
1143
|
-
/**
|
|
1144
|
-
* Genera PDF optimizado para impresión
|
|
1145
|
-
*/
|
|
1146
|
-
generateForPrint(data) {
|
|
1147
|
-
return this.generateWorkOrderPDF(data, {
|
|
1148
|
-
format: 'letter',
|
|
1149
|
-
download: false
|
|
1150
|
-
});
|
|
1151
|
-
}
|
|
1152
|
-
/**
|
|
1153
|
-
* Genera PDF y lo devuelve como Blob para envío por email
|
|
1154
|
-
*/
|
|
1155
|
-
generateAsBlob(data) {
|
|
1156
|
-
return new Promise((resolve, reject) => {
|
|
1157
|
-
this.generateWorkOrderPDF(data, { download: false })
|
|
1158
|
-
.then(doc => {
|
|
1159
|
-
const pdfBlob = doc.output('blob');
|
|
1160
|
-
resolve(pdfBlob);
|
|
1161
|
-
})
|
|
1162
|
-
.catch(reject);
|
|
1163
|
-
});
|
|
1164
|
-
}
|
|
1165
|
-
/**
|
|
1166
|
-
* Genera PDF y lo devuelve como base64
|
|
1167
|
-
*/
|
|
1168
|
-
generateAsBase64(data) {
|
|
1169
|
-
return new Promise((resolve, reject) => {
|
|
1170
|
-
this.generateWorkOrderPDF(data, { download: false })
|
|
1171
|
-
.then(doc => {
|
|
1172
|
-
const base64 = doc.output('datauristring');
|
|
1173
|
-
resolve(base64);
|
|
1174
|
-
})
|
|
1175
|
-
.catch(reject);
|
|
1176
|
-
});
|
|
1177
|
-
}
|
|
1178
1157
|
}
|
|
1179
1158
|
WorkOrderPdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: WorkOrderPdfService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1180
1159
|
WorkOrderPdfService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: WorkOrderPdfService, providedIn: 'root' });
|
|
@@ -1218,12 +1197,7 @@ class TemplateOtComponent {
|
|
|
1218
1197
|
}
|
|
1219
1198
|
ngAfterViewInit() {
|
|
1220
1199
|
if (this.dataModal.autoGenerate) {
|
|
1221
|
-
|
|
1222
|
-
this.generatePdfWithJsPDFVersion2();
|
|
1223
|
-
}
|
|
1224
|
-
else {
|
|
1225
|
-
this.generatePdfWithHtml2Canvas();
|
|
1226
|
-
}
|
|
1200
|
+
this.generatePdfWithHtml2Canvas();
|
|
1227
1201
|
}
|
|
1228
1202
|
}
|
|
1229
1203
|
generatePdfWithHtml2Canvas() {
|
|
@@ -1251,71 +1225,12 @@ class TemplateOtComponent {
|
|
|
1251
1225
|
this.message.closeLoading();
|
|
1252
1226
|
});
|
|
1253
1227
|
}
|
|
1254
|
-
generatePdfWithJsPDFVersion2() {
|
|
1255
|
-
this.message.openLoading("Cargando", "Generando PDF con nuevo método");
|
|
1256
|
-
try {
|
|
1257
|
-
const doc = new jsPDF('p', 'pt', 'letter');
|
|
1258
|
-
const pageWidth = doc.internal.pageSize.getWidth();
|
|
1259
|
-
const margin = 40;
|
|
1260
|
-
let currentY = margin;
|
|
1261
|
-
// Encabezado simple
|
|
1262
|
-
doc.setFont('helvetica', 'bold');
|
|
1263
|
-
doc.setFontSize(18);
|
|
1264
|
-
const title = 'ORDEN DE TRABAJO';
|
|
1265
|
-
const titleWidth = doc.getTextWidth(title);
|
|
1266
|
-
doc.text(title, (pageWidth - titleWidth) / 2, currentY);
|
|
1267
|
-
currentY += 30;
|
|
1268
|
-
doc.setFontSize(14);
|
|
1269
|
-
const numberText = `N° ${this.data.consecutive}`;
|
|
1270
|
-
const numberWidth = doc.getTextWidth(numberText);
|
|
1271
|
-
doc.text(numberText, (pageWidth - numberWidth) / 2, currentY);
|
|
1272
|
-
currentY += 40;
|
|
1273
|
-
// Información básica
|
|
1274
|
-
doc.setFont('helvetica', 'normal');
|
|
1275
|
-
doc.setFontSize(12);
|
|
1276
|
-
const info = [
|
|
1277
|
-
`Empresa: ${this.data.name}`,
|
|
1278
|
-
`NIT: ${this.data.nit}`,
|
|
1279
|
-
`Área: ${this.data.area}`,
|
|
1280
|
-
`Código: ${this.data.code}`,
|
|
1281
|
-
`Fecha: ${this.data.date}`,
|
|
1282
|
-
`Operario: ${this.data.responsible}`,
|
|
1283
|
-
`Proveedor: ${this.data.nameProvider}`,
|
|
1284
|
-
`Descripción: ${this.data.description}`
|
|
1285
|
-
];
|
|
1286
|
-
info.forEach(line => {
|
|
1287
|
-
doc.text(line, margin, currentY);
|
|
1288
|
-
currentY += 20;
|
|
1289
|
-
});
|
|
1290
|
-
doc.output('dataurlnewwindow', { filename: 'orden_trabajo.pdf' });
|
|
1291
|
-
this.dialog.closeAll();
|
|
1292
|
-
this.message.closeLoading();
|
|
1293
|
-
}
|
|
1294
|
-
catch (error) {
|
|
1295
|
-
console.error('Error generando PDF nuevo:', error);
|
|
1296
|
-
this.message.closeLoading();
|
|
1297
|
-
this.generatePdfWithHtml2Canvas();
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
generatePdfWithJsPDFVersion3() {
|
|
1301
|
-
this.message.openLoading("Cargando", "Generando PDF profesional");
|
|
1302
|
-
this.workOrderPdfService.generateWorkOrderPDF(this.data)
|
|
1303
|
-
.then(() => {
|
|
1304
|
-
this.dialog.closeAll();
|
|
1305
|
-
this.message.closeLoading();
|
|
1306
|
-
})
|
|
1307
|
-
.catch((error) => {
|
|
1308
|
-
console.error('Error generando PDF profesional:', error);
|
|
1309
|
-
this.message.closeLoading();
|
|
1310
|
-
this.generatePdfWithHtml2Canvas();
|
|
1311
|
-
});
|
|
1312
|
-
}
|
|
1313
1228
|
}
|
|
1314
1229
|
TemplateOtComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TemplateOtComponent, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i1.MatDialog }, { token: MessageService }, { token: WorkOrderPdfService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1315
|
-
TemplateOtComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TemplateOtComponent, selector: "app-template-ot", ngImport: i0, template: "<div id=\"templateOT\" #templateOT>\n <div class=\"d-flex flex-column w-100 white-background\">\n\n <!-- Encabezado -->\n <div class=\"borde w-100 d-flex flex-row align-items-center header-section\">\n <div class=\"d-flex flex-column align-items-center text-content\" style=\"width:80%\">\n <h2 class=\"text-header text-uppercase wrap-text\">{{data.name}}</h2>\n <h2 class=\"text-header wrap-text\">NIT: {{data.nit}}</h2>\n <div class=\"w-100 d-flex flex-row justify-content-evenly\">\n <h3 class=\"text-header wrap-text\">{{data.address}}</h3>\n <h3 class=\"text-header wrap-text\">TEL: {{data.telephone}}</h3>\n </div>\n </div>\n <div style=\"width:20%\">\n <div class=\"img w-100\" [style.background-image]=\"'url(' + data.image + ')'\">\n </div>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Orden de trabajo</h2>\n <h2 class=\"wrap-text\">N\u00B0: {{data.consecutive}}</h2>\n </div>\n\n <!-- Cuerpo -->\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">\u00C1rea:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.area}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">C\u00F3digo:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.code}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Fecha:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.date}}</h2>\n </div>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Operario:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.responsible}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Od\u00F3metro:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.odometer}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Referencia Factura:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.invoiceReference}}</h2>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Datos del proveedor</h2>\n </div>\n\n <div class=\"borde flexible-row\">\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Nombre:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.nameProvider}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Direcci\u00F3n:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.addressProvider}}</h2>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Detalles del servicio</h2>\n </div>\n\n <div class=\"borde w-100 description-section\">\n <h2 class=\"wrap-text text-start\">{{data.description}}</h2>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:35%\">\n <h2 class=\"fw-bold\">AUTORIZADA POR:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:65%\">\n <h2 class=\"wrap-text\">{{data.approved_by}}</h2>\n </div>\n </div>\n\n <!-- piso -->\n <div class=\"borde d-flex flex-column align-items-center justify-content-center w-100 footer-section\">\n <h2>Favor adjuntar la orden a la factura o cuenta de cobro</h2>\n <h2 class=\"wrap-text\">{{data.mail}}</h2>\n </div>\n\n </div>\n</div>\n\n<div class=\"download-container\">\n <button (click)=\"generatePdfWithHtml2Canvas()\" color='primary' mat-raised-button style=\"margin-right: 10px;\">\n Generar PDF\n </button>\n
|
|
1230
|
+
TemplateOtComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TemplateOtComponent, selector: "app-template-ot", ngImport: i0, template: "<div id=\"templateOT\" #templateOT>\n <div class=\"d-flex flex-column w-100 white-background\">\n\n <!-- Encabezado -->\n <div class=\"borde w-100 d-flex flex-row align-items-center header-section\">\n <div class=\"d-flex flex-column align-items-center text-content\" style=\"width:80%\">\n <h2 class=\"text-header text-uppercase wrap-text\">{{data.name}}</h2>\n <h2 class=\"text-header wrap-text\">NIT: {{data.nit}}</h2>\n <div class=\"w-100 d-flex flex-row justify-content-evenly\">\n <h3 class=\"text-header wrap-text\">{{data.address}}</h3>\n <h3 class=\"text-header wrap-text\">TEL: {{data.telephone}}</h3>\n </div>\n </div>\n <div style=\"width:20%\">\n <div class=\"img w-100\" [style.background-image]=\"'url(' + data.image + ')'\">\n </div>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Orden de trabajo</h2>\n <h2 class=\"wrap-text\">N\u00B0: {{data.consecutive}}</h2>\n </div>\n\n <!-- Cuerpo -->\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">\u00C1rea:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.area}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">C\u00F3digo:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.code}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Fecha:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.date}}</h2>\n </div>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Operario:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.responsible}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Od\u00F3metro:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.odometer}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Referencia Factura:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.invoiceReference}}</h2>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Datos del proveedor</h2>\n </div>\n\n <div class=\"borde flexible-row\">\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Nombre:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.nameProvider}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Direcci\u00F3n:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.addressProvider}}</h2>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Detalles del servicio</h2>\n </div>\n\n <div class=\"borde w-100 description-section\">\n <h2 class=\"wrap-text text-start\">{{data.description}}</h2>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:35%\">\n <h2 class=\"fw-bold\">AUTORIZADA POR:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:65%\">\n <h2 class=\"wrap-text\">{{data.approved_by}}</h2>\n </div>\n </div>\n\n <!-- piso -->\n <div class=\"borde d-flex flex-column align-items-center justify-content-center w-100 footer-section\">\n <h2>Favor adjuntar la orden a la factura o cuenta de cobro</h2>\n <h2 class=\"wrap-text\">{{data.mail}}</h2>\n </div>\n\n </div>\n</div>\n\n<div class=\"download-container\">\n <button (click)=\"generatePdfWithHtml2Canvas()\" color='primary' mat-raised-button style=\"margin-right: 10px;\">\n Generar PDF\n </button>\n</div>", styles: [".img{background-size:100%!important;background-repeat:no-repeat!important;background-position:center!important;background-size:contain!important;height:22mm!important;margin:0!important;padding:0!important}h2{font-size:1rem!important;line-height:1.2!important;margin:0!important;padding:0!important;text-align:center!important}h3{line-height:1.2!important;margin:0!important;padding:0!important;text-align:center!important}.text-header{line-height:1.5!important;font-weight:700!important}.text-uppercase{text-transform:uppercase!important}.wrap-text{white-space:pre-wrap!important}.text-content{padding:5px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.borde{border:1px solid blue!important}.border-r{border-right:1px solid blue!important;min-height:100%!important;align-self:stretch!important}.container-text{display:flex!important;justify-content:center!important;align-items:center!important;min-height:inherit!important}.container-headers{display:flex!important;align-items:center!important;justify-content:space-evenly!important;width:100%!important;min-height:8mm!important;background:rgba(240,244,255,.6117647059)!important;padding:5px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.container-headers h2{font-weight:700!important}.flexible-row{display:flex!important;flex-direction:row!important;align-items:stretch!important;min-height:11mm!important}.header-section{min-height:25mm!important}.footer-section{min-height:14mm!important;background:rgba(240,244,255,.35)!important;padding:5px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.description-section{min-height:20mm!important;padding:10px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.w-100{width:100%!important}.text-start{text-align:start!important}.white-background{background-color:#fff!important}.download-container{display:flex!important;justify-content:center!important;margin-top:15px!important}\n"], dependencies: [{ kind: "component", type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] });
|
|
1316
1231
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TemplateOtComponent, decorators: [{
|
|
1317
1232
|
type: Component,
|
|
1318
|
-
args: [{ selector: 'app-template-ot', template: "<div id=\"templateOT\" #templateOT>\n <div class=\"d-flex flex-column w-100 white-background\">\n\n <!-- Encabezado -->\n <div class=\"borde w-100 d-flex flex-row align-items-center header-section\">\n <div class=\"d-flex flex-column align-items-center text-content\" style=\"width:80%\">\n <h2 class=\"text-header text-uppercase wrap-text\">{{data.name}}</h2>\n <h2 class=\"text-header wrap-text\">NIT: {{data.nit}}</h2>\n <div class=\"w-100 d-flex flex-row justify-content-evenly\">\n <h3 class=\"text-header wrap-text\">{{data.address}}</h3>\n <h3 class=\"text-header wrap-text\">TEL: {{data.telephone}}</h3>\n </div>\n </div>\n <div style=\"width:20%\">\n <div class=\"img w-100\" [style.background-image]=\"'url(' + data.image + ')'\">\n </div>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Orden de trabajo</h2>\n <h2 class=\"wrap-text\">N\u00B0: {{data.consecutive}}</h2>\n </div>\n\n <!-- Cuerpo -->\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">\u00C1rea:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.area}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">C\u00F3digo:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.code}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Fecha:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.date}}</h2>\n </div>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Operario:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.responsible}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Od\u00F3metro:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.odometer}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Referencia Factura:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.invoiceReference}}</h2>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Datos del proveedor</h2>\n </div>\n\n <div class=\"borde flexible-row\">\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Nombre:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.nameProvider}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Direcci\u00F3n:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.addressProvider}}</h2>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Detalles del servicio</h2>\n </div>\n\n <div class=\"borde w-100 description-section\">\n <h2 class=\"wrap-text text-start\">{{data.description}}</h2>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:35%\">\n <h2 class=\"fw-bold\">AUTORIZADA POR:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:65%\">\n <h2 class=\"wrap-text\">{{data.approved_by}}</h2>\n </div>\n </div>\n\n <!-- piso -->\n <div class=\"borde d-flex flex-column align-items-center justify-content-center w-100 footer-section\">\n <h2>Favor adjuntar la orden a la factura o cuenta de cobro</h2>\n <h2 class=\"wrap-text\">{{data.mail}}</h2>\n </div>\n\n </div>\n</div>\n\n<div class=\"download-container\">\n <button (click)=\"generatePdfWithHtml2Canvas()\" color='primary' mat-raised-button style=\"margin-right: 10px;\">\n Generar PDF\n </button>\n
|
|
1233
|
+
args: [{ selector: 'app-template-ot', template: "<div id=\"templateOT\" #templateOT>\n <div class=\"d-flex flex-column w-100 white-background\">\n\n <!-- Encabezado -->\n <div class=\"borde w-100 d-flex flex-row align-items-center header-section\">\n <div class=\"d-flex flex-column align-items-center text-content\" style=\"width:80%\">\n <h2 class=\"text-header text-uppercase wrap-text\">{{data.name}}</h2>\n <h2 class=\"text-header wrap-text\">NIT: {{data.nit}}</h2>\n <div class=\"w-100 d-flex flex-row justify-content-evenly\">\n <h3 class=\"text-header wrap-text\">{{data.address}}</h3>\n <h3 class=\"text-header wrap-text\">TEL: {{data.telephone}}</h3>\n </div>\n </div>\n <div style=\"width:20%\">\n <div class=\"img w-100\" [style.background-image]=\"'url(' + data.image + ')'\">\n </div>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Orden de trabajo</h2>\n <h2 class=\"wrap-text\">N\u00B0: {{data.consecutive}}</h2>\n </div>\n\n <!-- Cuerpo -->\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">\u00C1rea:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.area}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">C\u00F3digo:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.code}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Fecha:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.date}}</h2>\n </div>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Operario:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.responsible}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Od\u00F3metro:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.odometer}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Referencia Factura:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.invoiceReference}}</h2>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Datos del proveedor</h2>\n </div>\n\n <div class=\"borde flexible-row\">\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Nombre:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.nameProvider}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Direcci\u00F3n:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.addressProvider}}</h2>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Detalles del servicio</h2>\n </div>\n\n <div class=\"borde w-100 description-section\">\n <h2 class=\"wrap-text text-start\">{{data.description}}</h2>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:35%\">\n <h2 class=\"fw-bold\">AUTORIZADA POR:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:65%\">\n <h2 class=\"wrap-text\">{{data.approved_by}}</h2>\n </div>\n </div>\n\n <!-- piso -->\n <div class=\"borde d-flex flex-column align-items-center justify-content-center w-100 footer-section\">\n <h2>Favor adjuntar la orden a la factura o cuenta de cobro</h2>\n <h2 class=\"wrap-text\">{{data.mail}}</h2>\n </div>\n\n </div>\n</div>\n\n<div class=\"download-container\">\n <button (click)=\"generatePdfWithHtml2Canvas()\" color='primary' mat-raised-button style=\"margin-right: 10px;\">\n Generar PDF\n </button>\n</div>", styles: [".img{background-size:100%!important;background-repeat:no-repeat!important;background-position:center!important;background-size:contain!important;height:22mm!important;margin:0!important;padding:0!important}h2{font-size:1rem!important;line-height:1.2!important;margin:0!important;padding:0!important;text-align:center!important}h3{line-height:1.2!important;margin:0!important;padding:0!important;text-align:center!important}.text-header{line-height:1.5!important;font-weight:700!important}.text-uppercase{text-transform:uppercase!important}.wrap-text{white-space:pre-wrap!important}.text-content{padding:5px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.borde{border:1px solid blue!important}.border-r{border-right:1px solid blue!important;min-height:100%!important;align-self:stretch!important}.container-text{display:flex!important;justify-content:center!important;align-items:center!important;min-height:inherit!important}.container-headers{display:flex!important;align-items:center!important;justify-content:space-evenly!important;width:100%!important;min-height:8mm!important;background:rgba(240,244,255,.6117647059)!important;padding:5px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.container-headers h2{font-weight:700!important}.flexible-row{display:flex!important;flex-direction:row!important;align-items:stretch!important;min-height:11mm!important}.header-section{min-height:25mm!important}.footer-section{min-height:14mm!important;background:rgba(240,244,255,.35)!important;padding:5px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.description-section{min-height:20mm!important;padding:10px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.w-100{width:100%!important}.text-start{text-align:start!important}.white-background{background-color:#fff!important}.download-container{display:flex!important;justify-content:center!important;margin-top:15px!important}\n"] }]
|
|
1319
1234
|
}], ctorParameters: function () {
|
|
1320
1235
|
return [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
|
|
1321
1236
|
type: Inject,
|
|
@@ -1323,148 +1238,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
1323
1238
|
}] }, { type: i1.MatDialog }, { type: MessageService }, { type: WorkOrderPdfService }];
|
|
1324
1239
|
} });
|
|
1325
1240
|
|
|
1241
|
+
// export interface TemplatePdfFo {
|
|
1242
|
+
// name: string;
|
|
1243
|
+
// nit: string;
|
|
1244
|
+
// address: string;
|
|
1245
|
+
// telephone: string;
|
|
1246
|
+
// mail: string;
|
|
1247
|
+
// image?: string;
|
|
1248
|
+
// code: string;
|
|
1249
|
+
// date: string;
|
|
1250
|
+
// responsible: string;
|
|
1251
|
+
// id_place: string;
|
|
1252
|
+
// approved_by: string;
|
|
1253
|
+
// detalle: string;
|
|
1254
|
+
// description: string;
|
|
1255
|
+
// consecutive: string;
|
|
1256
|
+
// namePlace: string;
|
|
1257
|
+
// addressPlace: string;
|
|
1258
|
+
// area: string;
|
|
1259
|
+
// odometer: string;
|
|
1260
|
+
// invoiceReference?: string;
|
|
1261
|
+
// }
|
|
1326
1262
|
class FuelOrderPdfService {
|
|
1327
1263
|
constructor() { }
|
|
1328
|
-
generateFuelOrderPDF(data) {
|
|
1329
|
-
//return this.FuelOrderPdfService.generateFuelOrderPDF(data);
|
|
1330
|
-
return new Promise((resolve, reject) => {
|
|
1331
|
-
try {
|
|
1332
|
-
const doc = new jsPDF('p', 'pt', 'letter'); // Tamaño carta fijo
|
|
1333
|
-
const pageWidth = doc.internal.pageSize.getWidth();
|
|
1334
|
-
const pageHeight = doc.internal.pageSize.getHeight();
|
|
1335
|
-
const margin = 40;
|
|
1336
|
-
let currentY = margin;
|
|
1337
|
-
// Configurar fuentes
|
|
1338
|
-
doc.setFont('helvetica', 'bold');
|
|
1339
|
-
doc.setFontSize(16);
|
|
1340
|
-
// Función auxiliar para añadir texto centrado
|
|
1341
|
-
const addCenteredText = (text, y, fontSize = 12, style = 'normal') => {
|
|
1342
|
-
doc.setFont('helvetica', style);
|
|
1343
|
-
doc.setFontSize(fontSize);
|
|
1344
|
-
const textWidth = doc.getTextWidth(text);
|
|
1345
|
-
doc.text(text, (pageWidth - textWidth) / 2, y);
|
|
1346
|
-
return y + fontSize + 5;
|
|
1347
|
-
};
|
|
1348
|
-
// Función auxiliar para añadir texto con ajuste de línea
|
|
1349
|
-
const addWrappedText = (text, x, y, maxWidth, fontSize = 10, style = 'normal') => {
|
|
1350
|
-
doc.setFont('helvetica', style);
|
|
1351
|
-
doc.setFontSize(fontSize);
|
|
1352
|
-
const lines = doc.splitTextToSize(text, maxWidth);
|
|
1353
|
-
doc.text(lines, x, y);
|
|
1354
|
-
return y + (lines.length * fontSize) + 5;
|
|
1355
|
-
};
|
|
1356
|
-
// Función para dibujar rectángulo con borde
|
|
1357
|
-
const drawRect = (x, y, width, height) => {
|
|
1358
|
-
doc.rect(x, y, width, height);
|
|
1359
|
-
};
|
|
1360
|
-
// ENCABEZADO
|
|
1361
|
-
currentY = addCenteredText(data.name.toUpperCase(), currentY, 16, 'bold');
|
|
1362
|
-
currentY = addCenteredText(`NIT: ${data.nit}`, currentY, 12, 'bold');
|
|
1363
|
-
currentY = addCenteredText(data.address, currentY, 10);
|
|
1364
|
-
currentY = addCenteredText(`TEL: ${data.telephone}`, currentY, 10);
|
|
1365
|
-
currentY += 20;
|
|
1366
|
-
// Título del documento
|
|
1367
|
-
currentY = addCenteredText('ORDEN DE COMBUSTIBLE', currentY, 18, 'bold');
|
|
1368
|
-
currentY = addCenteredText(`N°: ${data.consecutive}`, currentY, 14, 'bold');
|
|
1369
|
-
currentY += 20;
|
|
1370
|
-
// Información principal en tabla
|
|
1371
|
-
const tableData = [
|
|
1372
|
-
['Área:', data.area, 'Código:', data.code, 'Fecha:', data.date],
|
|
1373
|
-
['Operario:', data.responsible, 'Odómetro:', data.odometer, '', '']
|
|
1374
|
-
];
|
|
1375
|
-
doc.autoTable({
|
|
1376
|
-
startY: currentY,
|
|
1377
|
-
head: [],
|
|
1378
|
-
body: tableData,
|
|
1379
|
-
theme: 'grid',
|
|
1380
|
-
styles: {
|
|
1381
|
-
fontSize: 10,
|
|
1382
|
-
cellPadding: 8,
|
|
1383
|
-
lineColor: [0, 0, 0],
|
|
1384
|
-
lineWidth: 0.5
|
|
1385
|
-
},
|
|
1386
|
-
columnStyles: {
|
|
1387
|
-
0: { fontStyle: 'bold', cellWidth: 60 },
|
|
1388
|
-
1: { cellWidth: 120 },
|
|
1389
|
-
2: { fontStyle: 'bold', cellWidth: 60 },
|
|
1390
|
-
3: { cellWidth: 80 },
|
|
1391
|
-
4: { fontStyle: 'bold', cellWidth: 60 },
|
|
1392
|
-
5: { cellWidth: 80 }
|
|
1393
|
-
},
|
|
1394
|
-
margin: { left: margin, right: margin }
|
|
1395
|
-
});
|
|
1396
|
-
currentY = doc.lastAutoTable.finalY + 20;
|
|
1397
|
-
// Datos del proveedor
|
|
1398
|
-
currentY = addCenteredText('DATOS DEL PROVEEDOR', currentY, 14, 'bold');
|
|
1399
|
-
currentY += 10;
|
|
1400
|
-
const providerData = [
|
|
1401
|
-
['Lugar:', data.namePlace, 'Dirección:', data.addressPlace]
|
|
1402
|
-
];
|
|
1403
|
-
doc.autoTable({
|
|
1404
|
-
startY: currentY,
|
|
1405
|
-
head: [],
|
|
1406
|
-
body: providerData,
|
|
1407
|
-
theme: 'grid',
|
|
1408
|
-
styles: {
|
|
1409
|
-
fontSize: 10,
|
|
1410
|
-
cellPadding: 8,
|
|
1411
|
-
lineColor: [0, 0, 0],
|
|
1412
|
-
lineWidth: 0.5
|
|
1413
|
-
},
|
|
1414
|
-
columnStyles: {
|
|
1415
|
-
0: { fontStyle: 'bold', cellWidth: 80 },
|
|
1416
|
-
1: { cellWidth: 150 },
|
|
1417
|
-
2: { fontStyle: 'bold', cellWidth: 80 },
|
|
1418
|
-
3: { cellWidth: 150 }
|
|
1419
|
-
},
|
|
1420
|
-
margin: { left: margin, right: margin }
|
|
1421
|
-
});
|
|
1422
|
-
currentY = doc.lastAutoTable.finalY + 20;
|
|
1423
|
-
// Detalles del servicio
|
|
1424
|
-
currentY = addCenteredText('DETALLES DEL SERVICIO', currentY, 14, 'bold');
|
|
1425
|
-
currentY += 15;
|
|
1426
|
-
// Contenedor para detalles
|
|
1427
|
-
const detailsY = currentY;
|
|
1428
|
-
const detailsHeight = 80;
|
|
1429
|
-
drawRect(margin, detailsY, pageWidth - (margin * 2), detailsHeight);
|
|
1430
|
-
currentY += 15;
|
|
1431
|
-
currentY = addWrappedText(data.detalle, margin + 10, currentY, pageWidth - (margin * 2) - 20, 10);
|
|
1432
|
-
currentY = addWrappedText(`Descripción: ${data.description}`, margin + 10, currentY, pageWidth - (margin * 2) - 20, 10);
|
|
1433
|
-
currentY = detailsY + detailsHeight + 20;
|
|
1434
|
-
// Autorización
|
|
1435
|
-
const authData = [
|
|
1436
|
-
['AUTORIZADA POR:', data.approved_by]
|
|
1437
|
-
];
|
|
1438
|
-
doc.autoTable({
|
|
1439
|
-
startY: currentY,
|
|
1440
|
-
head: [],
|
|
1441
|
-
body: authData,
|
|
1442
|
-
theme: 'grid',
|
|
1443
|
-
styles: {
|
|
1444
|
-
fontSize: 12,
|
|
1445
|
-
cellPadding: 10,
|
|
1446
|
-
lineColor: [0, 0, 0],
|
|
1447
|
-
lineWidth: 0.5
|
|
1448
|
-
},
|
|
1449
|
-
columnStyles: {
|
|
1450
|
-
0: { fontStyle: 'bold', cellWidth: 150 },
|
|
1451
|
-
1: { cellWidth: 310 }
|
|
1452
|
-
},
|
|
1453
|
-
margin: { left: margin, right: margin }
|
|
1454
|
-
});
|
|
1455
|
-
currentY = doc.lastAutoTable.finalY + 30;
|
|
1456
|
-
// Pie de página
|
|
1457
|
-
currentY = addCenteredText('Favor adjuntar la orden de venta o factura', currentY, 12, 'bold');
|
|
1458
|
-
currentY = addCenteredText(data.mail, currentY, 10);
|
|
1459
|
-
// Generar el PDF
|
|
1460
|
-
doc.output('dataurlnewwindow', { filename: 'orden_combustible.pdf' });
|
|
1461
|
-
resolve();
|
|
1462
|
-
}
|
|
1463
|
-
catch (error) {
|
|
1464
|
-
reject(error);
|
|
1465
|
-
}
|
|
1466
|
-
});
|
|
1467
|
-
}
|
|
1468
1264
|
generateFuelOrderProfesionalPDF(data, options) {
|
|
1469
1265
|
return new Promise((resolve, reject) => {
|
|
1470
1266
|
try {
|
|
@@ -1509,6 +1305,15 @@ class FuelOrderPdfService {
|
|
|
1509
1305
|
}
|
|
1510
1306
|
});
|
|
1511
1307
|
}
|
|
1308
|
+
/**
|
|
1309
|
+
* Genera PDF optimizado para impresión
|
|
1310
|
+
*/
|
|
1311
|
+
generateForPrint(data) {
|
|
1312
|
+
return this.generateFuelOrderProfesionalPDF(data, {
|
|
1313
|
+
format: 'letter',
|
|
1314
|
+
download: false
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1512
1317
|
addHeader(doc, data, margin, y, pageWidth, color) {
|
|
1513
1318
|
// Fondo del encabezado
|
|
1514
1319
|
doc.setFillColor(color[0], color[1], color[2]);
|
|
@@ -1719,43 +1524,6 @@ class FuelOrderPdfService {
|
|
|
1719
1524
|
}
|
|
1720
1525
|
return finalBoxY + boxHeight;
|
|
1721
1526
|
}
|
|
1722
|
-
/**
|
|
1723
|
-
* Método auxiliar para manejar texto largo que puede necesitar múltiples páginas
|
|
1724
|
-
*/
|
|
1725
|
-
addLongText(doc, text, x, y, maxWidth, fontSize = 11) {
|
|
1726
|
-
if (!text || !text.trim())
|
|
1727
|
-
return y;
|
|
1728
|
-
doc.setFontSize(fontSize);
|
|
1729
|
-
const lines = doc.splitTextToSize(text.trim(), maxWidth);
|
|
1730
|
-
const lineHeight = fontSize + 3;
|
|
1731
|
-
const pageHeight = doc.internal.pageSize.getHeight();
|
|
1732
|
-
const margin = 40;
|
|
1733
|
-
let currentY = y;
|
|
1734
|
-
let lineIndex = 0;
|
|
1735
|
-
while (lineIndex < lines.length) {
|
|
1736
|
-
// Verificar si necesitamos una nueva página
|
|
1737
|
-
if (currentY + lineHeight > pageHeight - margin) {
|
|
1738
|
-
doc.addPage();
|
|
1739
|
-
currentY = margin;
|
|
1740
|
-
}
|
|
1741
|
-
// Calcular cuántas líneas caben en la página actual
|
|
1742
|
-
const remainingSpace = pageHeight - currentY - margin;
|
|
1743
|
-
const maxLinesInPage = Math.floor(remainingSpace / lineHeight);
|
|
1744
|
-
if (maxLinesInPage > 0) {
|
|
1745
|
-
const linesToShow = Math.min(maxLinesInPage, lines.length - lineIndex);
|
|
1746
|
-
const pageLines = lines.slice(lineIndex, lineIndex + linesToShow);
|
|
1747
|
-
doc.text(pageLines, x, currentY);
|
|
1748
|
-
currentY += pageLines.length * lineHeight;
|
|
1749
|
-
lineIndex += linesToShow;
|
|
1750
|
-
}
|
|
1751
|
-
else {
|
|
1752
|
-
// Si no cabe ni una línea, ir a nueva página
|
|
1753
|
-
doc.addPage();
|
|
1754
|
-
currentY = margin;
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
return currentY;
|
|
1758
|
-
}
|
|
1759
1527
|
addAuthorization(doc, data, y, margin, pageWidth) {
|
|
1760
1528
|
const tableData = [
|
|
1761
1529
|
[
|
|
@@ -1797,41 +1565,6 @@ class FuelOrderPdfService {
|
|
|
1797
1565
|
// Resetear color
|
|
1798
1566
|
doc.setTextColor(0, 0, 0);
|
|
1799
1567
|
}
|
|
1800
|
-
/**
|
|
1801
|
-
* Genera PDF optimizado para impresión
|
|
1802
|
-
*/
|
|
1803
|
-
generateForPrint(data) {
|
|
1804
|
-
return this.generateFuelOrderProfesionalPDF(data, {
|
|
1805
|
-
format: 'letter',
|
|
1806
|
-
download: false
|
|
1807
|
-
});
|
|
1808
|
-
}
|
|
1809
|
-
/**
|
|
1810
|
-
* Genera PDF y lo devuelve como Blob para envío por email
|
|
1811
|
-
*/
|
|
1812
|
-
generateAsBlob(data) {
|
|
1813
|
-
return new Promise((resolve, reject) => {
|
|
1814
|
-
this.generateFuelOrderProfesionalPDF(data, { download: false })
|
|
1815
|
-
.then(doc => {
|
|
1816
|
-
const pdfBlob = doc.output('blob');
|
|
1817
|
-
resolve(pdfBlob);
|
|
1818
|
-
})
|
|
1819
|
-
.catch(reject);
|
|
1820
|
-
});
|
|
1821
|
-
}
|
|
1822
|
-
/**
|
|
1823
|
-
* Genera PDF y lo devuelve como base64
|
|
1824
|
-
*/
|
|
1825
|
-
generateAsBase64(data) {
|
|
1826
|
-
return new Promise((resolve, reject) => {
|
|
1827
|
-
this.generateFuelOrderProfesionalPDF(data, { download: false })
|
|
1828
|
-
.then(doc => {
|
|
1829
|
-
const base64 = doc.output('datauristring');
|
|
1830
|
-
resolve(base64);
|
|
1831
|
-
})
|
|
1832
|
-
.catch(reject);
|
|
1833
|
-
});
|
|
1834
|
-
}
|
|
1835
1568
|
}
|
|
1836
1569
|
FuelOrderPdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FuelOrderPdfService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1837
1570
|
FuelOrderPdfService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FuelOrderPdfService, providedIn: 'root' });
|
|
@@ -1876,12 +1609,7 @@ class TemplateFuelComponent {
|
|
|
1876
1609
|
}
|
|
1877
1610
|
ngAfterViewInit() {
|
|
1878
1611
|
if (this.dataModal.autoGenerate) {
|
|
1879
|
-
|
|
1880
|
-
this.generatePdfWithHtml2Canvas();
|
|
1881
|
-
}
|
|
1882
|
-
else {
|
|
1883
|
-
this.generatePdfWithHtml2Canvas();
|
|
1884
|
-
}
|
|
1612
|
+
this.generatePdfWithHtml2Canvas();
|
|
1885
1613
|
}
|
|
1886
1614
|
}
|
|
1887
1615
|
generatePdfWithHtml2Canvas() {
|
|
@@ -1911,38 +1639,12 @@ class TemplateFuelComponent {
|
|
|
1911
1639
|
this.message.closeLoading();
|
|
1912
1640
|
});
|
|
1913
1641
|
}
|
|
1914
|
-
generatePdfWithJsPDFVersion2() {
|
|
1915
|
-
this.message.openLoading("Cargando", "Generando PDF con nuevo método");
|
|
1916
|
-
this.FuelOrderPdfService.generateFuelOrderPDF(this.data)
|
|
1917
|
-
.then(() => {
|
|
1918
|
-
this.dialog.closeAll();
|
|
1919
|
-
this.message.closeLoading();
|
|
1920
|
-
})
|
|
1921
|
-
.catch((error) => {
|
|
1922
|
-
console.error('Error generando PDF:', error);
|
|
1923
|
-
this.message.closeLoading();
|
|
1924
|
-
this.generatePdfWithHtml2Canvas();
|
|
1925
|
-
});
|
|
1926
|
-
}
|
|
1927
|
-
generatePdfWithJsPDFVersion3() {
|
|
1928
|
-
this.message.openLoading("Cargando", "Generando PDF profesional");
|
|
1929
|
-
this.FuelOrderPdfService.generateFuelOrderProfesionalPDF(this.data)
|
|
1930
|
-
.then(() => {
|
|
1931
|
-
this.dialog.closeAll();
|
|
1932
|
-
this.message.closeLoading();
|
|
1933
|
-
})
|
|
1934
|
-
.catch((error) => {
|
|
1935
|
-
console.error('Error generando PDF profesional:', error);
|
|
1936
|
-
this.message.closeLoading();
|
|
1937
|
-
this.generatePdfWithHtml2Canvas();
|
|
1938
|
-
});
|
|
1939
|
-
}
|
|
1940
1642
|
}
|
|
1941
1643
|
TemplateFuelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TemplateFuelComponent, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i1.MatDialog }, { token: MessageService }, { token: FuelOrderPdfService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1942
|
-
TemplateFuelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TemplateFuelComponent, selector: "app-template-fuel", ngImport: i0, template: "<div id=\"templateFO\" #templateFO>\n <div class=\"d-flex flex-column w-100 white-background\">\n\n <!-- Encabezado -->\n <div class=\"borde w-100 d-flex flex-row align-items-center header-section\">\n <div class=\"d-flex flex-column align-items-center text-content\" style=\"width:80%\">\n <h2 class=\"text-header text-uppercase wrap-text\">{{data.name}}</h2>\n <h2 class=\"text-header wrap-text\">NIT: {{data.nit}}</h2>\n <div class=\"w-100 d-flex flex-row justify-content-evenly\">\n <h3 class=\"text-header wrap-text\">{{data.address}}</h3>\n <h3 class=\"text-header wrap-text\">TEL: {{data.telephone}}</h3>\n </div>\n </div>\n <div style=\"width:20%\">\n <div class=\"img w-100\" [style.background-image]=\"'url(' + data.image + ')'\">\n </div>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Orden de combustible</h2>\n <h2 class=\"wrap-text\">N\u00B0: {{data.consecutive}}</h2>\n </div>\n\n <!-- Cuerpo -->\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">\u00C1rea:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.area}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">C\u00F3digo:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.code}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Fecha:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.date}}</h2>\n </div>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Operario:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.responsible}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Od\u00F3metro:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:44%\">\n <h2 class=\"wrap-text\">{{data.odometer}}</h2>\n </div>\n <!-- <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Referencia Factura:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.invoiceReference}}</h2>\n </div> -->\n </div>\n\n <div class=\"borde container-headers\">\n <h3>Datos del proveedor</h3>\n </div>\n\n <div class=\"borde flexible-row\">\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Lugar:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.namePlace}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Direcci\u00F3n:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.addressPlace}}</h2>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h3>Detalles del servicio</h3>\n </div>\n\n <div class=\"borde w-100 description-section\">\n <h3 class=\"wrap-text text-start\">{{data.detalle}}</h3>\n <h3 class=\"wrap-text text-start\">Descripci\u00F3n: {{data.description}}</h3>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:35%\">\n <h2 class=\"fw-bold\">AUTORIZADA POR:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:65%\">\n <h2 class=\"wrap-text\">{{data.approved_by}}</h2>\n </div>\n </div>\n\n <!-- piso -->\n <div class=\"borde d-flex flex-column align-items-center justify-content-center w-100 footer-section\">\n <h2>Favor adjuntar la orden de venta o factura</h2>\n <h2 class=\"wrap-text\">{{data.mail}}</h2>\n </div>\n\n </div>\n</div>\n\n<div class=\"download-container\">\n <button (click)=\"generatePdfWithHtml2Canvas()\" color='primary' mat-raised-button style=\"margin-right: 10px;\">\n Generar PDF\n </button>\n
|
|
1644
|
+
TemplateFuelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TemplateFuelComponent, selector: "app-template-fuel", ngImport: i0, template: "<div id=\"templateFO\" #templateFO>\n <div class=\"d-flex flex-column w-100 white-background\">\n\n <!-- Encabezado -->\n <div class=\"borde w-100 d-flex flex-row align-items-center header-section\">\n <div class=\"d-flex flex-column align-items-center text-content\" style=\"width:80%\">\n <h2 class=\"text-header text-uppercase wrap-text\">{{data.name}}</h2>\n <h2 class=\"text-header wrap-text\">NIT: {{data.nit}}</h2>\n <div class=\"w-100 d-flex flex-row justify-content-evenly\">\n <h3 class=\"text-header wrap-text\">{{data.address}}</h3>\n <h3 class=\"text-header wrap-text\">TEL: {{data.telephone}}</h3>\n </div>\n </div>\n <div style=\"width:20%\">\n <div class=\"img w-100\" [style.background-image]=\"'url(' + data.image + ')'\">\n </div>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Orden de combustible</h2>\n <h2 class=\"wrap-text\">N\u00B0: {{data.consecutive}}</h2>\n </div>\n\n <!-- Cuerpo -->\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">\u00C1rea:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.area}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">C\u00F3digo:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.code}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Fecha:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.date}}</h2>\n </div>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Operario:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.responsible}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Od\u00F3metro:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:44%\">\n <h2 class=\"wrap-text\">{{data.odometer}}</h2>\n </div>\n <!-- <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Referencia Factura:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.invoiceReference}}</h2>\n </div> -->\n </div>\n\n <div class=\"borde container-headers\">\n <h3>Datos del proveedor</h3>\n </div>\n\n <div class=\"borde flexible-row\">\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Lugar:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.namePlace}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Direcci\u00F3n:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.addressPlace}}</h2>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h3>Detalles del servicio</h3>\n </div>\n\n <div class=\"borde w-100 description-section\">\n <h3 class=\"wrap-text text-start\">{{data.detalle}}</h3>\n <h3 class=\"wrap-text text-start\">Descripci\u00F3n: {{data.description}}</h3>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:35%\">\n <h2 class=\"fw-bold\">AUTORIZADA POR:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:65%\">\n <h2 class=\"wrap-text\">{{data.approved_by}}</h2>\n </div>\n </div>\n\n <!-- piso -->\n <div class=\"borde d-flex flex-column align-items-center justify-content-center w-100 footer-section\">\n <h2>Favor adjuntar la orden de venta o factura</h2>\n <h2 class=\"wrap-text\">{{data.mail}}</h2>\n </div>\n\n </div>\n</div>\n\n<div class=\"download-container\">\n <button (click)=\"generatePdfWithHtml2Canvas()\" color='primary' mat-raised-button style=\"margin-right: 10px;\">\n Generar PDF\n </button>\n</div>", styles: [".img{background-size:100%!important;background-repeat:no-repeat!important;background-position:center!important;background-size:contain!important;height:22mm!important;margin:0!important;padding:0!important}h2{font-size:1rem!important;line-height:1.2!important;margin:0!important;padding:0!important;text-align:center!important}h3{line-height:1.2!important;margin:0!important;padding:0!important;text-align:center!important}.text-header{line-height:1.5!important;font-weight:700!important}.text-uppercase{text-transform:uppercase!important}.wrap-text{white-space:pre-wrap!important}.text-content{padding:5px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.borde{border:1px solid blue!important}.border-r{border-right:1px solid blue!important;min-height:100%!important;align-self:stretch!important}.container-text{display:flex!important;justify-content:center!important;align-items:center!important;min-height:inherit!important}.container-headers{display:flex!important;align-items:center!important;justify-content:space-evenly!important;width:100%!important;min-height:8mm!important;background:rgba(240,244,255,.6117647059)!important;padding:5px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.container-headers h2,.container-headers h3{font-weight:700!important}.flexible-row{display:flex!important;flex-direction:row!important;align-items:stretch!important;min-height:11mm!important}.header-section{min-height:25mm!important}.footer-section{min-height:14mm!important;background:rgba(240,244,255,.35)!important;padding:5px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.description-section{min-height:20mm!important;padding:10px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.w-100{width:100%!important}.text-start{text-align:start!important}.white-background{background-color:#fff!important}.download-container{display:flex!important;justify-content:center!important;margin-top:15px!important}\n"], dependencies: [{ kind: "component", type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] });
|
|
1943
1645
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TemplateFuelComponent, decorators: [{
|
|
1944
1646
|
type: Component,
|
|
1945
|
-
args: [{ selector: 'app-template-fuel', template: "<div id=\"templateFO\" #templateFO>\n <div class=\"d-flex flex-column w-100 white-background\">\n\n <!-- Encabezado -->\n <div class=\"borde w-100 d-flex flex-row align-items-center header-section\">\n <div class=\"d-flex flex-column align-items-center text-content\" style=\"width:80%\">\n <h2 class=\"text-header text-uppercase wrap-text\">{{data.name}}</h2>\n <h2 class=\"text-header wrap-text\">NIT: {{data.nit}}</h2>\n <div class=\"w-100 d-flex flex-row justify-content-evenly\">\n <h3 class=\"text-header wrap-text\">{{data.address}}</h3>\n <h3 class=\"text-header wrap-text\">TEL: {{data.telephone}}</h3>\n </div>\n </div>\n <div style=\"width:20%\">\n <div class=\"img w-100\" [style.background-image]=\"'url(' + data.image + ')'\">\n </div>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Orden de combustible</h2>\n <h2 class=\"wrap-text\">N\u00B0: {{data.consecutive}}</h2>\n </div>\n\n <!-- Cuerpo -->\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">\u00C1rea:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.area}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">C\u00F3digo:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.code}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Fecha:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.date}}</h2>\n </div>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Operario:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.responsible}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Od\u00F3metro:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:44%\">\n <h2 class=\"wrap-text\">{{data.odometer}}</h2>\n </div>\n <!-- <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Referencia Factura:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.invoiceReference}}</h2>\n </div> -->\n </div>\n\n <div class=\"borde container-headers\">\n <h3>Datos del proveedor</h3>\n </div>\n\n <div class=\"borde flexible-row\">\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Lugar:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.namePlace}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Direcci\u00F3n:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.addressPlace}}</h2>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h3>Detalles del servicio</h3>\n </div>\n\n <div class=\"borde w-100 description-section\">\n <h3 class=\"wrap-text text-start\">{{data.detalle}}</h3>\n <h3 class=\"wrap-text text-start\">Descripci\u00F3n: {{data.description}}</h3>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:35%\">\n <h2 class=\"fw-bold\">AUTORIZADA POR:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:65%\">\n <h2 class=\"wrap-text\">{{data.approved_by}}</h2>\n </div>\n </div>\n\n <!-- piso -->\n <div class=\"borde d-flex flex-column align-items-center justify-content-center w-100 footer-section\">\n <h2>Favor adjuntar la orden de venta o factura</h2>\n <h2 class=\"wrap-text\">{{data.mail}}</h2>\n </div>\n\n </div>\n</div>\n\n<div class=\"download-container\">\n <button (click)=\"generatePdfWithHtml2Canvas()\" color='primary' mat-raised-button style=\"margin-right: 10px;\">\n Generar PDF\n </button>\n
|
|
1647
|
+
args: [{ selector: 'app-template-fuel', template: "<div id=\"templateFO\" #templateFO>\n <div class=\"d-flex flex-column w-100 white-background\">\n\n <!-- Encabezado -->\n <div class=\"borde w-100 d-flex flex-row align-items-center header-section\">\n <div class=\"d-flex flex-column align-items-center text-content\" style=\"width:80%\">\n <h2 class=\"text-header text-uppercase wrap-text\">{{data.name}}</h2>\n <h2 class=\"text-header wrap-text\">NIT: {{data.nit}}</h2>\n <div class=\"w-100 d-flex flex-row justify-content-evenly\">\n <h3 class=\"text-header wrap-text\">{{data.address}}</h3>\n <h3 class=\"text-header wrap-text\">TEL: {{data.telephone}}</h3>\n </div>\n </div>\n <div style=\"width:20%\">\n <div class=\"img w-100\" [style.background-image]=\"'url(' + data.image + ')'\">\n </div>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h2>Orden de combustible</h2>\n <h2 class=\"wrap-text\">N\u00B0: {{data.consecutive}}</h2>\n </div>\n\n <!-- Cuerpo -->\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">\u00C1rea:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.area}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">C\u00F3digo:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.code}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Fecha:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.date}}</h2>\n </div>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Operario:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:32%\">\n <h2 class=\"wrap-text\">{{data.responsible}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Od\u00F3metro:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:44%\">\n <h2 class=\"wrap-text\">{{data.odometer}}</h2>\n </div>\n <!-- <div class=\"border-r container-text\" style=\"width:12%\">\n <h2 class=\"fw-bold\">Referencia Factura:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:16%\">\n <h2 class=\"wrap-text\">{{data.invoiceReference}}</h2>\n </div> -->\n </div>\n\n <div class=\"borde container-headers\">\n <h3>Datos del proveedor</h3>\n </div>\n\n <div class=\"borde flexible-row\">\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Lugar:</h2>\n </div>\n <div class=\"border-r container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.namePlace}}</h2>\n </div>\n <div class=\"border-r container-text\" style=\"width:15%\">\n <h2 class=\"fw-bold\">Direcci\u00F3n:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:35%\">\n <h2 class=\"wrap-text\">{{data.addressPlace}}</h2>\n </div>\n </div>\n\n <div class=\"borde container-headers\">\n <h3>Detalles del servicio</h3>\n </div>\n\n <div class=\"borde w-100 description-section\">\n <h3 class=\"wrap-text text-start\">{{data.detalle}}</h3>\n <h3 class=\"wrap-text text-start\">Descripci\u00F3n: {{data.description}}</h3>\n </div>\n\n <div class=\"borde w-100 flexible-row\">\n <div class=\"border-r container-text\" style=\"width:35%\">\n <h2 class=\"fw-bold\">AUTORIZADA POR:</h2>\n </div>\n <div class=\"container-text text-content\" style=\"width:65%\">\n <h2 class=\"wrap-text\">{{data.approved_by}}</h2>\n </div>\n </div>\n\n <!-- piso -->\n <div class=\"borde d-flex flex-column align-items-center justify-content-center w-100 footer-section\">\n <h2>Favor adjuntar la orden de venta o factura</h2>\n <h2 class=\"wrap-text\">{{data.mail}}</h2>\n </div>\n\n </div>\n</div>\n\n<div class=\"download-container\">\n <button (click)=\"generatePdfWithHtml2Canvas()\" color='primary' mat-raised-button style=\"margin-right: 10px;\">\n Generar PDF\n </button>\n</div>", styles: [".img{background-size:100%!important;background-repeat:no-repeat!important;background-position:center!important;background-size:contain!important;height:22mm!important;margin:0!important;padding:0!important}h2{font-size:1rem!important;line-height:1.2!important;margin:0!important;padding:0!important;text-align:center!important}h3{line-height:1.2!important;margin:0!important;padding:0!important;text-align:center!important}.text-header{line-height:1.5!important;font-weight:700!important}.text-uppercase{text-transform:uppercase!important}.wrap-text{white-space:pre-wrap!important}.text-content{padding:5px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.borde{border:1px solid blue!important}.border-r{border-right:1px solid blue!important;min-height:100%!important;align-self:stretch!important}.container-text{display:flex!important;justify-content:center!important;align-items:center!important;min-height:inherit!important}.container-headers{display:flex!important;align-items:center!important;justify-content:space-evenly!important;width:100%!important;min-height:8mm!important;background:rgba(240,244,255,.6117647059)!important;padding:5px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.container-headers h2,.container-headers h3{font-weight:700!important}.flexible-row{display:flex!important;flex-direction:row!important;align-items:stretch!important;min-height:11mm!important}.header-section{min-height:25mm!important}.footer-section{min-height:14mm!important;background:rgba(240,244,255,.35)!important;padding:5px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.description-section{min-height:20mm!important;padding:10px!important;word-wrap:break-word!important;overflow-wrap:break-word!important}.w-100{width:100%!important}.text-start{text-align:start!important}.white-background{background-color:#fff!important}.download-container{display:flex!important;justify-content:center!important;margin-top:15px!important}\n"] }]
|
|
1946
1648
|
}], ctorParameters: function () {
|
|
1947
1649
|
return [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
|
|
1948
1650
|
type: Inject,
|
|
@@ -2087,6 +1789,27 @@ class FunctionsService {
|
|
|
2087
1789
|
});
|
|
2088
1790
|
return uniqueArray;
|
|
2089
1791
|
}
|
|
1792
|
+
transformDate(date) {
|
|
1793
|
+
if (!date) {
|
|
1794
|
+
return '';
|
|
1795
|
+
}
|
|
1796
|
+
const dateObj = new Date(date);
|
|
1797
|
+
const day = this.validateTwoDigitFormat(dateObj.getDate().toString());
|
|
1798
|
+
const month = this.validateTwoDigitFormat((dateObj.getMonth() + 1).toString());
|
|
1799
|
+
const year = dateObj.getFullYear();
|
|
1800
|
+
return `${day}/${month}/${year}`;
|
|
1801
|
+
}
|
|
1802
|
+
formatNumber(value) {
|
|
1803
|
+
if (value === null || value === undefined) {
|
|
1804
|
+
return '$ 0';
|
|
1805
|
+
}
|
|
1806
|
+
return new Intl.NumberFormat('es-CO', {
|
|
1807
|
+
style: 'currency',
|
|
1808
|
+
currency: 'COP',
|
|
1809
|
+
minimumFractionDigits: 0,
|
|
1810
|
+
maximumFractionDigits: 0,
|
|
1811
|
+
}).format(value);
|
|
1812
|
+
}
|
|
2090
1813
|
validateTwoDigitFormat(number) {
|
|
2091
1814
|
if (number.length == 1)
|
|
2092
1815
|
number = "0" + number;
|
|
@@ -3797,11 +3520,175 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
3797
3520
|
}]
|
|
3798
3521
|
}], ctorParameters: function () { return [{ type: CryptoService }]; } });
|
|
3799
3522
|
|
|
3523
|
+
class PurchaseOrderPdfService {
|
|
3524
|
+
constructor(functions) {
|
|
3525
|
+
this.functions = functions;
|
|
3526
|
+
}
|
|
3527
|
+
generatePurchaseOrderPDF(order, options) {
|
|
3528
|
+
return new Promise((resolve, reject) => {
|
|
3529
|
+
try {
|
|
3530
|
+
const opts = Object.assign({ format: 'letter', download: true, filename: `orden_compra_${order.consecutive}.pdf` }, options);
|
|
3531
|
+
const doc = new jsPDF('p', 'pt', opts.format);
|
|
3532
|
+
const pageWidth = doc.internal.pageSize.getWidth();
|
|
3533
|
+
const margin = 40;
|
|
3534
|
+
let currentY = margin;
|
|
3535
|
+
// === ENCABEZADO ===
|
|
3536
|
+
currentY = this.addHeader(doc, order, currentY, pageWidth, margin);
|
|
3537
|
+
currentY += 18;
|
|
3538
|
+
// === DETALLES DE LA ORDEN ===
|
|
3539
|
+
currentY = this.addOrderDetails(doc, order, currentY, margin, pageWidth);
|
|
3540
|
+
currentY += 20;
|
|
3541
|
+
// === ITEMS DE LA ORDEN ===
|
|
3542
|
+
currentY = this.addOrderItems(doc, order, currentY, margin, pageWidth);
|
|
3543
|
+
currentY += 20;
|
|
3544
|
+
// === COMENTARIOS ===
|
|
3545
|
+
if (order.comment) {
|
|
3546
|
+
currentY = this.addComments(doc, order, currentY, margin, pageWidth);
|
|
3547
|
+
currentY += 20;
|
|
3548
|
+
}
|
|
3549
|
+
// === PIE DE PÁGINA ===
|
|
3550
|
+
this.addFooter(doc, pageWidth, doc.internal.pageSize.getHeight());
|
|
3551
|
+
if (opts.download) {
|
|
3552
|
+
doc.save(opts.filename);
|
|
3553
|
+
}
|
|
3554
|
+
resolve(doc);
|
|
3555
|
+
}
|
|
3556
|
+
catch (error) {
|
|
3557
|
+
reject(error);
|
|
3558
|
+
}
|
|
3559
|
+
});
|
|
3560
|
+
}
|
|
3561
|
+
addHeader(doc, order, y, pageWidth, margin) {
|
|
3562
|
+
// Título centrado y número derecha
|
|
3563
|
+
doc.setFont('helvetica', 'bold');
|
|
3564
|
+
doc.setFontSize(14);
|
|
3565
|
+
doc.setTextColor(0, 0, 0);
|
|
3566
|
+
doc.text('ORDEN DE COMPRA', pageWidth / 2, y + 8, { align: 'center' });
|
|
3567
|
+
doc.setFontSize(10);
|
|
3568
|
+
doc.text(`N° ${order.consecutive}`, pageWidth - margin, y + 8, { align: 'right' });
|
|
3569
|
+
y += 26;
|
|
3570
|
+
// Línea bajo título
|
|
3571
|
+
doc.setDrawColor(180);
|
|
3572
|
+
doc.setLineWidth(0.5);
|
|
3573
|
+
doc.line(margin, y, pageWidth - margin, y);
|
|
3574
|
+
y += 8;
|
|
3575
|
+
// Logo a la izquierda
|
|
3576
|
+
const logoW = 80;
|
|
3577
|
+
const logoH = 60;
|
|
3578
|
+
if (order.image) {
|
|
3579
|
+
doc.addImage(order.image, 'PNG', margin, y, logoW, logoH);
|
|
3580
|
+
}
|
|
3581
|
+
// Datos empresa a la derecha (alineados a la derecha)
|
|
3582
|
+
const rightX = pageWidth - margin;
|
|
3583
|
+
let infoY = y + 2;
|
|
3584
|
+
doc.setFont('helvetica', 'bold');
|
|
3585
|
+
doc.setFontSize(10);
|
|
3586
|
+
if (order.name) {
|
|
3587
|
+
doc.text(order.name, rightX, infoY, { align: 'right' });
|
|
3588
|
+
infoY += 14;
|
|
3589
|
+
}
|
|
3590
|
+
doc.setFont('helvetica', 'normal');
|
|
3591
|
+
doc.setFontSize(8);
|
|
3592
|
+
const add = (value) => {
|
|
3593
|
+
if (!value)
|
|
3594
|
+
return;
|
|
3595
|
+
doc.text(value, rightX, infoY, { align: 'right' });
|
|
3596
|
+
infoY += 12;
|
|
3597
|
+
};
|
|
3598
|
+
add(order.nit ? `Nit: ${order.nit}` : '');
|
|
3599
|
+
add(order.address);
|
|
3600
|
+
add(order.telephone ? `Tel: ${order.telephone}` : '');
|
|
3601
|
+
add(order.mail ? `Email: ${order.mail}` : '');
|
|
3602
|
+
// Altura total ocupada
|
|
3603
|
+
const blockBottom = Math.max(y + logoH, infoY);
|
|
3604
|
+
const separatorY = blockBottom + 6;
|
|
3605
|
+
// Separador
|
|
3606
|
+
doc.setDrawColor(180);
|
|
3607
|
+
doc.line(margin, separatorY, pageWidth - margin, separatorY);
|
|
3608
|
+
return separatorY + 10;
|
|
3609
|
+
}
|
|
3610
|
+
addOrderDetails(doc, order, y, margin, pageWidth) {
|
|
3611
|
+
doc.setFontSize(10);
|
|
3612
|
+
const rows = [
|
|
3613
|
+
[
|
|
3614
|
+
{ content: `Proveedor: ${order.providerName}`, styles: { fontStyle: 'bold' } },
|
|
3615
|
+
{ content: `Fecha de creación: ${this.functions.transformDate(order.created)}`, styles: { halign: 'right' } }
|
|
3616
|
+
],
|
|
3617
|
+
[
|
|
3618
|
+
{ content: `Almacén: ${order.warehouse}` },
|
|
3619
|
+
{ content: `Solicita: ${order.requestsName}`, styles: { halign: 'right' } }
|
|
3620
|
+
]
|
|
3621
|
+
];
|
|
3622
|
+
if (order.authorizeName && order.authorizeName !== order.requestsName) {
|
|
3623
|
+
rows.push([
|
|
3624
|
+
{ content: '' },
|
|
3625
|
+
{ content: `Autoriza: ${order.authorizeName}`, styles: { halign: 'right' } }
|
|
3626
|
+
]);
|
|
3627
|
+
}
|
|
3628
|
+
doc.autoTable({
|
|
3629
|
+
startY: y,
|
|
3630
|
+
body: rows,
|
|
3631
|
+
theme: 'plain',
|
|
3632
|
+
styles: { fontSize: 10, cellPadding: 2 }
|
|
3633
|
+
});
|
|
3634
|
+
return doc.lastAutoTable.finalY;
|
|
3635
|
+
}
|
|
3636
|
+
addOrderItems(doc, order, y, margin, pageWidth) {
|
|
3637
|
+
const head = [['Código', 'Nombre', 'U.M.', 'Cant.', 'Descripción']];
|
|
3638
|
+
const body = order.items.map(item => [
|
|
3639
|
+
item.code,
|
|
3640
|
+
item.itemName,
|
|
3641
|
+
item.unitMeasurement,
|
|
3642
|
+
item.amount,
|
|
3643
|
+
item.description || ''
|
|
3644
|
+
]);
|
|
3645
|
+
doc.autoTable({
|
|
3646
|
+
startY: y,
|
|
3647
|
+
head: head,
|
|
3648
|
+
body: body,
|
|
3649
|
+
theme: 'grid',
|
|
3650
|
+
headStyles: { fillColor: [220, 220, 220], textColor: 0, fontStyle: 'bold' },
|
|
3651
|
+
columnStyles: {
|
|
3652
|
+
3: { halign: 'right' },
|
|
3653
|
+
4: { halign: 'right' },
|
|
3654
|
+
5: { halign: 'right' }
|
|
3655
|
+
}
|
|
3656
|
+
});
|
|
3657
|
+
let finalY = doc.lastAutoTable.finalY;
|
|
3658
|
+
return finalY;
|
|
3659
|
+
}
|
|
3660
|
+
addComments(doc, order, y, margin, pageWidth) {
|
|
3661
|
+
doc.setFontSize(10);
|
|
3662
|
+
doc.setFont('helvetica', 'bold');
|
|
3663
|
+
doc.text('Comentarios:', margin, y);
|
|
3664
|
+
y += 15;
|
|
3665
|
+
doc.setFont('helvetica', 'normal');
|
|
3666
|
+
const splitText = doc.splitTextToSize(order.comment, pageWidth - margin * 2);
|
|
3667
|
+
doc.text(splitText, margin, y);
|
|
3668
|
+
return y + splitText.length * 12;
|
|
3669
|
+
}
|
|
3670
|
+
addFooter(doc, pageWidth, pageHeight) {
|
|
3671
|
+
const footerText = 'Documento generado por Brainloper';
|
|
3672
|
+
doc.setFontSize(8);
|
|
3673
|
+
const footerWidth = doc.getStringUnitWidth(footerText) * 8 / doc.internal.scaleFactor;
|
|
3674
|
+
doc.text(footerText, (pageWidth - footerWidth) / 2, pageHeight - 20);
|
|
3675
|
+
}
|
|
3676
|
+
}
|
|
3677
|
+
PurchaseOrderPdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PurchaseOrderPdfService, deps: [{ token: FunctionsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3678
|
+
PurchaseOrderPdfService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PurchaseOrderPdfService, providedIn: 'root' });
|
|
3679
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PurchaseOrderPdfService, decorators: [{
|
|
3680
|
+
type: Injectable,
|
|
3681
|
+
args: [{
|
|
3682
|
+
providedIn: 'root'
|
|
3683
|
+
}]
|
|
3684
|
+
}], ctorParameters: function () { return [{ type: FunctionsService }]; } });
|
|
3685
|
+
|
|
3800
3686
|
class GeneratePdfService {
|
|
3801
|
-
constructor(dialog, workOrderPdfService, FuelOrderPdfService) {
|
|
3687
|
+
constructor(dialog, workOrderPdfService, FuelOrderPdfService, purchaseOrderPdfService) {
|
|
3802
3688
|
this.dialog = dialog;
|
|
3803
3689
|
this.workOrderPdfService = workOrderPdfService;
|
|
3804
3690
|
this.FuelOrderPdfService = FuelOrderPdfService;
|
|
3691
|
+
this.purchaseOrderPdfService = purchaseOrderPdfService;
|
|
3805
3692
|
}
|
|
3806
3693
|
getPdfOt(data, autoGenerateData) {
|
|
3807
3694
|
let autoGenerate = false;
|
|
@@ -3842,62 +3729,40 @@ class GeneratePdfService {
|
|
|
3842
3729
|
});
|
|
3843
3730
|
});
|
|
3844
3731
|
}
|
|
3845
|
-
|
|
3846
|
-
* Método mejorado para generar PDF de orden de combustible
|
|
3847
|
-
*/
|
|
3848
|
-
getPdfFoNew(data, autoGenerateData) {
|
|
3732
|
+
getPdfFoV2(data) {
|
|
3849
3733
|
return new Promise((resolve, reject) => {
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
.catch(error => reject(error));
|
|
3854
|
-
}
|
|
3855
|
-
else {
|
|
3856
|
-
let screen = "850px";
|
|
3857
|
-
this.dialog.open(TemplateFuelComponent, {
|
|
3858
|
-
data: {
|
|
3859
|
-
data,
|
|
3860
|
-
autoGenerate: false,
|
|
3861
|
-
useNewMethod: true
|
|
3862
|
-
},
|
|
3863
|
-
width: screen
|
|
3864
|
-
}).afterClosed().subscribe((res) => {
|
|
3865
|
-
resolve(true);
|
|
3866
|
-
});
|
|
3867
|
-
}
|
|
3734
|
+
this.FuelOrderPdfService.generateFuelOrderProfesionalPDF(data)
|
|
3735
|
+
.then(() => resolve(true))
|
|
3736
|
+
.catch(error => reject(error));
|
|
3868
3737
|
});
|
|
3869
3738
|
}
|
|
3870
|
-
|
|
3739
|
+
getPdfOtV2(data) {
|
|
3871
3740
|
return new Promise((resolve, reject) => {
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
}).afterClosed().subscribe((res) => {
|
|
3887
|
-
resolve(true);
|
|
3888
|
-
});
|
|
3889
|
-
}
|
|
3741
|
+
this.workOrderPdfService.generateWorkOrderPDF(data)
|
|
3742
|
+
.then(() => resolve(true))
|
|
3743
|
+
.catch(error => reject(error));
|
|
3744
|
+
});
|
|
3745
|
+
}
|
|
3746
|
+
generatePurchaseOrderPDF(order) {
|
|
3747
|
+
return new Promise((resolve, reject) => {
|
|
3748
|
+
this.purchaseOrderPdfService.generatePurchaseOrderPDF(order, { download: false })
|
|
3749
|
+
.then((doc) => {
|
|
3750
|
+
const blobUrl = doc.output('bloburl');
|
|
3751
|
+
window.open(blobUrl, '_blank');
|
|
3752
|
+
resolve(true);
|
|
3753
|
+
})
|
|
3754
|
+
.catch(error => reject(error));
|
|
3890
3755
|
});
|
|
3891
3756
|
}
|
|
3892
3757
|
}
|
|
3893
|
-
GeneratePdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GeneratePdfService, deps: [{ token: i1.MatDialog }, { token: WorkOrderPdfService }, { token: FuelOrderPdfService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3758
|
+
GeneratePdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GeneratePdfService, deps: [{ token: i1.MatDialog }, { token: WorkOrderPdfService }, { token: FuelOrderPdfService }, { token: PurchaseOrderPdfService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3894
3759
|
GeneratePdfService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GeneratePdfService, providedIn: 'root' });
|
|
3895
3760
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GeneratePdfService, decorators: [{
|
|
3896
3761
|
type: Injectable,
|
|
3897
3762
|
args: [{
|
|
3898
3763
|
providedIn: 'root'
|
|
3899
3764
|
}]
|
|
3900
|
-
}], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: WorkOrderPdfService }, { type: FuelOrderPdfService }]; } });
|
|
3765
|
+
}], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: WorkOrderPdfService }, { type: FuelOrderPdfService }, { type: PurchaseOrderPdfService }]; } });
|
|
3901
3766
|
|
|
3902
3767
|
class LocalStorageService {
|
|
3903
3768
|
constructor() {
|