brainloper-ui 14.1.13 → 14.1.15
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-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-purchase-order.d.ts +17 -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
|
@@ -805,12 +805,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
805
805
|
type: Output
|
|
806
806
|
}] } });
|
|
807
807
|
|
|
808
|
+
// export interface TemplatePdfOt {
|
|
809
|
+
// name?: string;
|
|
810
|
+
// nit?: string;
|
|
811
|
+
// address?: string;
|
|
812
|
+
// telephone?: string;
|
|
813
|
+
// mail?: string;
|
|
814
|
+
// image?: string;
|
|
815
|
+
// code?: string;
|
|
816
|
+
// date?: string;
|
|
817
|
+
// responsible?: string;
|
|
818
|
+
// third?: string;
|
|
819
|
+
// approved_by?: string;
|
|
820
|
+
// description?: string;
|
|
821
|
+
// consecutive?: string;
|
|
822
|
+
// nameProvider?: string;
|
|
823
|
+
// addressProvider?: string;
|
|
824
|
+
// area?: string;
|
|
825
|
+
// odometer?: string;
|
|
826
|
+
// invoiceReference?: string;
|
|
827
|
+
// }
|
|
808
828
|
class WorkOrderPdfService {
|
|
809
829
|
constructor() { }
|
|
810
|
-
/**
|
|
811
|
-
* Genera PDF de orden de trabajo con diseño profesional
|
|
812
|
-
* Dimensiones fijas, independiente del DOM
|
|
813
|
-
*/
|
|
814
830
|
generateWorkOrderPDF(data, options) {
|
|
815
831
|
return new Promise((resolve, reject) => {
|
|
816
832
|
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,218 +1225,40 @@ 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 () { return [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
|
|
1320
1235
|
type: Inject,
|
|
1321
1236
|
args: [MAT_DIALOG_DATA]
|
|
1322
1237
|
}] }, { type: i1.MatDialog }, { type: MessageService }, { type: WorkOrderPdfService }]; } });
|
|
1323
1238
|
|
|
1239
|
+
// export interface TemplatePdfFo {
|
|
1240
|
+
// name: string;
|
|
1241
|
+
// nit: string;
|
|
1242
|
+
// address: string;
|
|
1243
|
+
// telephone: string;
|
|
1244
|
+
// mail: string;
|
|
1245
|
+
// image?: string;
|
|
1246
|
+
// code: string;
|
|
1247
|
+
// date: string;
|
|
1248
|
+
// responsible: string;
|
|
1249
|
+
// id_place: string;
|
|
1250
|
+
// approved_by: string;
|
|
1251
|
+
// detalle: string;
|
|
1252
|
+
// description: string;
|
|
1253
|
+
// consecutive: string;
|
|
1254
|
+
// namePlace: string;
|
|
1255
|
+
// addressPlace: string;
|
|
1256
|
+
// area: string;
|
|
1257
|
+
// odometer: string;
|
|
1258
|
+
// invoiceReference?: string;
|
|
1259
|
+
// }
|
|
1324
1260
|
class FuelOrderPdfService {
|
|
1325
1261
|
constructor() { }
|
|
1326
|
-
generateFuelOrderPDF(data) {
|
|
1327
|
-
//return this.FuelOrderPdfService.generateFuelOrderPDF(data);
|
|
1328
|
-
return new Promise((resolve, reject) => {
|
|
1329
|
-
try {
|
|
1330
|
-
const doc = new jsPDF('p', 'pt', 'letter'); // Tamaño carta fijo
|
|
1331
|
-
const pageWidth = doc.internal.pageSize.getWidth();
|
|
1332
|
-
const pageHeight = doc.internal.pageSize.getHeight();
|
|
1333
|
-
const margin = 40;
|
|
1334
|
-
let currentY = margin;
|
|
1335
|
-
// Configurar fuentes
|
|
1336
|
-
doc.setFont('helvetica', 'bold');
|
|
1337
|
-
doc.setFontSize(16);
|
|
1338
|
-
// Función auxiliar para añadir texto centrado
|
|
1339
|
-
const addCenteredText = (text, y, fontSize = 12, style = 'normal') => {
|
|
1340
|
-
doc.setFont('helvetica', style);
|
|
1341
|
-
doc.setFontSize(fontSize);
|
|
1342
|
-
const textWidth = doc.getTextWidth(text);
|
|
1343
|
-
doc.text(text, (pageWidth - textWidth) / 2, y);
|
|
1344
|
-
return y + fontSize + 5;
|
|
1345
|
-
};
|
|
1346
|
-
// Función auxiliar para añadir texto con ajuste de línea
|
|
1347
|
-
const addWrappedText = (text, x, y, maxWidth, fontSize = 10, style = 'normal') => {
|
|
1348
|
-
doc.setFont('helvetica', style);
|
|
1349
|
-
doc.setFontSize(fontSize);
|
|
1350
|
-
const lines = doc.splitTextToSize(text, maxWidth);
|
|
1351
|
-
doc.text(lines, x, y);
|
|
1352
|
-
return y + (lines.length * fontSize) + 5;
|
|
1353
|
-
};
|
|
1354
|
-
// Función para dibujar rectángulo con borde
|
|
1355
|
-
const drawRect = (x, y, width, height) => {
|
|
1356
|
-
doc.rect(x, y, width, height);
|
|
1357
|
-
};
|
|
1358
|
-
// ENCABEZADO
|
|
1359
|
-
currentY = addCenteredText(data.name.toUpperCase(), currentY, 16, 'bold');
|
|
1360
|
-
currentY = addCenteredText(`NIT: ${data.nit}`, currentY, 12, 'bold');
|
|
1361
|
-
currentY = addCenteredText(data.address, currentY, 10);
|
|
1362
|
-
currentY = addCenteredText(`TEL: ${data.telephone}`, currentY, 10);
|
|
1363
|
-
currentY += 20;
|
|
1364
|
-
// Título del documento
|
|
1365
|
-
currentY = addCenteredText('ORDEN DE COMBUSTIBLE', currentY, 18, 'bold');
|
|
1366
|
-
currentY = addCenteredText(`N°: ${data.consecutive}`, currentY, 14, 'bold');
|
|
1367
|
-
currentY += 20;
|
|
1368
|
-
// Información principal en tabla
|
|
1369
|
-
const tableData = [
|
|
1370
|
-
['Área:', data.area, 'Código:', data.code, 'Fecha:', data.date],
|
|
1371
|
-
['Operario:', data.responsible, 'Odómetro:', data.odometer, '', '']
|
|
1372
|
-
];
|
|
1373
|
-
doc.autoTable({
|
|
1374
|
-
startY: currentY,
|
|
1375
|
-
head: [],
|
|
1376
|
-
body: tableData,
|
|
1377
|
-
theme: 'grid',
|
|
1378
|
-
styles: {
|
|
1379
|
-
fontSize: 10,
|
|
1380
|
-
cellPadding: 8,
|
|
1381
|
-
lineColor: [0, 0, 0],
|
|
1382
|
-
lineWidth: 0.5
|
|
1383
|
-
},
|
|
1384
|
-
columnStyles: {
|
|
1385
|
-
0: { fontStyle: 'bold', cellWidth: 60 },
|
|
1386
|
-
1: { cellWidth: 120 },
|
|
1387
|
-
2: { fontStyle: 'bold', cellWidth: 60 },
|
|
1388
|
-
3: { cellWidth: 80 },
|
|
1389
|
-
4: { fontStyle: 'bold', cellWidth: 60 },
|
|
1390
|
-
5: { cellWidth: 80 }
|
|
1391
|
-
},
|
|
1392
|
-
margin: { left: margin, right: margin }
|
|
1393
|
-
});
|
|
1394
|
-
currentY = doc.lastAutoTable.finalY + 20;
|
|
1395
|
-
// Datos del proveedor
|
|
1396
|
-
currentY = addCenteredText('DATOS DEL PROVEEDOR', currentY, 14, 'bold');
|
|
1397
|
-
currentY += 10;
|
|
1398
|
-
const providerData = [
|
|
1399
|
-
['Lugar:', data.namePlace, 'Dirección:', data.addressPlace]
|
|
1400
|
-
];
|
|
1401
|
-
doc.autoTable({
|
|
1402
|
-
startY: currentY,
|
|
1403
|
-
head: [],
|
|
1404
|
-
body: providerData,
|
|
1405
|
-
theme: 'grid',
|
|
1406
|
-
styles: {
|
|
1407
|
-
fontSize: 10,
|
|
1408
|
-
cellPadding: 8,
|
|
1409
|
-
lineColor: [0, 0, 0],
|
|
1410
|
-
lineWidth: 0.5
|
|
1411
|
-
},
|
|
1412
|
-
columnStyles: {
|
|
1413
|
-
0: { fontStyle: 'bold', cellWidth: 80 },
|
|
1414
|
-
1: { cellWidth: 150 },
|
|
1415
|
-
2: { fontStyle: 'bold', cellWidth: 80 },
|
|
1416
|
-
3: { cellWidth: 150 }
|
|
1417
|
-
},
|
|
1418
|
-
margin: { left: margin, right: margin }
|
|
1419
|
-
});
|
|
1420
|
-
currentY = doc.lastAutoTable.finalY + 20;
|
|
1421
|
-
// Detalles del servicio
|
|
1422
|
-
currentY = addCenteredText('DETALLES DEL SERVICIO', currentY, 14, 'bold');
|
|
1423
|
-
currentY += 15;
|
|
1424
|
-
// Contenedor para detalles
|
|
1425
|
-
const detailsY = currentY;
|
|
1426
|
-
const detailsHeight = 80;
|
|
1427
|
-
drawRect(margin, detailsY, pageWidth - (margin * 2), detailsHeight);
|
|
1428
|
-
currentY += 15;
|
|
1429
|
-
currentY = addWrappedText(data.detalle, margin + 10, currentY, pageWidth - (margin * 2) - 20, 10);
|
|
1430
|
-
currentY = addWrappedText(`Descripción: ${data.description}`, margin + 10, currentY, pageWidth - (margin * 2) - 20, 10);
|
|
1431
|
-
currentY = detailsY + detailsHeight + 20;
|
|
1432
|
-
// Autorización
|
|
1433
|
-
const authData = [
|
|
1434
|
-
['AUTORIZADA POR:', data.approved_by]
|
|
1435
|
-
];
|
|
1436
|
-
doc.autoTable({
|
|
1437
|
-
startY: currentY,
|
|
1438
|
-
head: [],
|
|
1439
|
-
body: authData,
|
|
1440
|
-
theme: 'grid',
|
|
1441
|
-
styles: {
|
|
1442
|
-
fontSize: 12,
|
|
1443
|
-
cellPadding: 10,
|
|
1444
|
-
lineColor: [0, 0, 0],
|
|
1445
|
-
lineWidth: 0.5
|
|
1446
|
-
},
|
|
1447
|
-
columnStyles: {
|
|
1448
|
-
0: { fontStyle: 'bold', cellWidth: 150 },
|
|
1449
|
-
1: { cellWidth: 310 }
|
|
1450
|
-
},
|
|
1451
|
-
margin: { left: margin, right: margin }
|
|
1452
|
-
});
|
|
1453
|
-
currentY = doc.lastAutoTable.finalY + 30;
|
|
1454
|
-
// Pie de página
|
|
1455
|
-
currentY = addCenteredText('Favor adjuntar la orden de venta o factura', currentY, 12, 'bold');
|
|
1456
|
-
currentY = addCenteredText(data.mail, currentY, 10);
|
|
1457
|
-
// Generar el PDF
|
|
1458
|
-
doc.output('dataurlnewwindow', { filename: 'orden_combustible.pdf' });
|
|
1459
|
-
resolve();
|
|
1460
|
-
}
|
|
1461
|
-
catch (error) {
|
|
1462
|
-
reject(error);
|
|
1463
|
-
}
|
|
1464
|
-
});
|
|
1465
|
-
}
|
|
1466
1262
|
generateFuelOrderProfesionalPDF(data, options) {
|
|
1467
1263
|
return new Promise((resolve, reject) => {
|
|
1468
1264
|
try {
|
|
@@ -1512,6 +1308,15 @@ class FuelOrderPdfService {
|
|
|
1512
1308
|
}
|
|
1513
1309
|
});
|
|
1514
1310
|
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Genera PDF optimizado para impresión
|
|
1313
|
+
*/
|
|
1314
|
+
generateForPrint(data) {
|
|
1315
|
+
return this.generateFuelOrderProfesionalPDF(data, {
|
|
1316
|
+
format: 'letter',
|
|
1317
|
+
download: false
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1515
1320
|
addHeader(doc, data, margin, y, pageWidth, color) {
|
|
1516
1321
|
// Fondo del encabezado
|
|
1517
1322
|
doc.setFillColor(color[0], color[1], color[2]);
|
|
@@ -1722,43 +1527,6 @@ class FuelOrderPdfService {
|
|
|
1722
1527
|
}
|
|
1723
1528
|
return finalBoxY + boxHeight;
|
|
1724
1529
|
}
|
|
1725
|
-
/**
|
|
1726
|
-
* Método auxiliar para manejar texto largo que puede necesitar múltiples páginas
|
|
1727
|
-
*/
|
|
1728
|
-
addLongText(doc, text, x, y, maxWidth, fontSize = 11) {
|
|
1729
|
-
if (!text || !text.trim())
|
|
1730
|
-
return y;
|
|
1731
|
-
doc.setFontSize(fontSize);
|
|
1732
|
-
const lines = doc.splitTextToSize(text.trim(), maxWidth);
|
|
1733
|
-
const lineHeight = fontSize + 3;
|
|
1734
|
-
const pageHeight = doc.internal.pageSize.getHeight();
|
|
1735
|
-
const margin = 40;
|
|
1736
|
-
let currentY = y;
|
|
1737
|
-
let lineIndex = 0;
|
|
1738
|
-
while (lineIndex < lines.length) {
|
|
1739
|
-
// Verificar si necesitamos una nueva página
|
|
1740
|
-
if (currentY + lineHeight > pageHeight - margin) {
|
|
1741
|
-
doc.addPage();
|
|
1742
|
-
currentY = margin;
|
|
1743
|
-
}
|
|
1744
|
-
// Calcular cuántas líneas caben en la página actual
|
|
1745
|
-
const remainingSpace = pageHeight - currentY - margin;
|
|
1746
|
-
const maxLinesInPage = Math.floor(remainingSpace / lineHeight);
|
|
1747
|
-
if (maxLinesInPage > 0) {
|
|
1748
|
-
const linesToShow = Math.min(maxLinesInPage, lines.length - lineIndex);
|
|
1749
|
-
const pageLines = lines.slice(lineIndex, lineIndex + linesToShow);
|
|
1750
|
-
doc.text(pageLines, x, currentY);
|
|
1751
|
-
currentY += pageLines.length * lineHeight;
|
|
1752
|
-
lineIndex += linesToShow;
|
|
1753
|
-
}
|
|
1754
|
-
else {
|
|
1755
|
-
// Si no cabe ni una línea, ir a nueva página
|
|
1756
|
-
doc.addPage();
|
|
1757
|
-
currentY = margin;
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
|
-
return currentY;
|
|
1761
|
-
}
|
|
1762
1530
|
addAuthorization(doc, data, y, margin, pageWidth) {
|
|
1763
1531
|
const tableData = [
|
|
1764
1532
|
[
|
|
@@ -1800,41 +1568,6 @@ class FuelOrderPdfService {
|
|
|
1800
1568
|
// Resetear color
|
|
1801
1569
|
doc.setTextColor(0, 0, 0);
|
|
1802
1570
|
}
|
|
1803
|
-
/**
|
|
1804
|
-
* Genera PDF optimizado para impresión
|
|
1805
|
-
*/
|
|
1806
|
-
generateForPrint(data) {
|
|
1807
|
-
return this.generateFuelOrderProfesionalPDF(data, {
|
|
1808
|
-
format: 'letter',
|
|
1809
|
-
download: false
|
|
1810
|
-
});
|
|
1811
|
-
}
|
|
1812
|
-
/**
|
|
1813
|
-
* Genera PDF y lo devuelve como Blob para envío por email
|
|
1814
|
-
*/
|
|
1815
|
-
generateAsBlob(data) {
|
|
1816
|
-
return new Promise((resolve, reject) => {
|
|
1817
|
-
this.generateFuelOrderProfesionalPDF(data, { download: false })
|
|
1818
|
-
.then(doc => {
|
|
1819
|
-
const pdfBlob = doc.output('blob');
|
|
1820
|
-
resolve(pdfBlob);
|
|
1821
|
-
})
|
|
1822
|
-
.catch(reject);
|
|
1823
|
-
});
|
|
1824
|
-
}
|
|
1825
|
-
/**
|
|
1826
|
-
* Genera PDF y lo devuelve como base64
|
|
1827
|
-
*/
|
|
1828
|
-
generateAsBase64(data) {
|
|
1829
|
-
return new Promise((resolve, reject) => {
|
|
1830
|
-
this.generateFuelOrderProfesionalPDF(data, { download: false })
|
|
1831
|
-
.then(doc => {
|
|
1832
|
-
const base64 = doc.output('datauristring');
|
|
1833
|
-
resolve(base64);
|
|
1834
|
-
})
|
|
1835
|
-
.catch(reject);
|
|
1836
|
-
});
|
|
1837
|
-
}
|
|
1838
1571
|
}
|
|
1839
1572
|
FuelOrderPdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FuelOrderPdfService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1840
1573
|
FuelOrderPdfService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FuelOrderPdfService, providedIn: 'root' });
|
|
@@ -1879,12 +1612,7 @@ class TemplateFuelComponent {
|
|
|
1879
1612
|
}
|
|
1880
1613
|
ngAfterViewInit() {
|
|
1881
1614
|
if (this.dataModal.autoGenerate) {
|
|
1882
|
-
|
|
1883
|
-
this.generatePdfWithHtml2Canvas();
|
|
1884
|
-
}
|
|
1885
|
-
else {
|
|
1886
|
-
this.generatePdfWithHtml2Canvas();
|
|
1887
|
-
}
|
|
1615
|
+
this.generatePdfWithHtml2Canvas();
|
|
1888
1616
|
}
|
|
1889
1617
|
}
|
|
1890
1618
|
generatePdfWithHtml2Canvas() {
|
|
@@ -1914,38 +1642,12 @@ class TemplateFuelComponent {
|
|
|
1914
1642
|
this.message.closeLoading();
|
|
1915
1643
|
});
|
|
1916
1644
|
}
|
|
1917
|
-
generatePdfWithJsPDFVersion2() {
|
|
1918
|
-
this.message.openLoading("Cargando", "Generando PDF con nuevo método");
|
|
1919
|
-
this.FuelOrderPdfService.generateFuelOrderPDF(this.data)
|
|
1920
|
-
.then(() => {
|
|
1921
|
-
this.dialog.closeAll();
|
|
1922
|
-
this.message.closeLoading();
|
|
1923
|
-
})
|
|
1924
|
-
.catch((error) => {
|
|
1925
|
-
console.error('Error generando PDF:', error);
|
|
1926
|
-
this.message.closeLoading();
|
|
1927
|
-
this.generatePdfWithHtml2Canvas();
|
|
1928
|
-
});
|
|
1929
|
-
}
|
|
1930
|
-
generatePdfWithJsPDFVersion3() {
|
|
1931
|
-
this.message.openLoading("Cargando", "Generando PDF profesional");
|
|
1932
|
-
this.FuelOrderPdfService.generateFuelOrderProfesionalPDF(this.data)
|
|
1933
|
-
.then(() => {
|
|
1934
|
-
this.dialog.closeAll();
|
|
1935
|
-
this.message.closeLoading();
|
|
1936
|
-
})
|
|
1937
|
-
.catch((error) => {
|
|
1938
|
-
console.error('Error generando PDF profesional:', error);
|
|
1939
|
-
this.message.closeLoading();
|
|
1940
|
-
this.generatePdfWithHtml2Canvas();
|
|
1941
|
-
});
|
|
1942
|
-
}
|
|
1943
1645
|
}
|
|
1944
1646
|
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 });
|
|
1945
|
-
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
|
|
1647
|
+
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"] }] });
|
|
1946
1648
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TemplateFuelComponent, decorators: [{
|
|
1947
1649
|
type: Component,
|
|
1948
|
-
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
|
|
1650
|
+
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"] }]
|
|
1949
1651
|
}], ctorParameters: function () { return [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
|
|
1950
1652
|
type: Inject,
|
|
1951
1653
|
args: [MAT_DIALOG_DATA]
|
|
@@ -2088,6 +1790,27 @@ class FunctionsService {
|
|
|
2088
1790
|
});
|
|
2089
1791
|
return uniqueArray;
|
|
2090
1792
|
}
|
|
1793
|
+
transformDate(date) {
|
|
1794
|
+
if (!date) {
|
|
1795
|
+
return '';
|
|
1796
|
+
}
|
|
1797
|
+
const dateObj = new Date(date);
|
|
1798
|
+
const day = this.validateTwoDigitFormat(dateObj.getDate().toString());
|
|
1799
|
+
const month = this.validateTwoDigitFormat((dateObj.getMonth() + 1).toString());
|
|
1800
|
+
const year = dateObj.getFullYear();
|
|
1801
|
+
return `${day}/${month}/${year}`;
|
|
1802
|
+
}
|
|
1803
|
+
formatNumber(value) {
|
|
1804
|
+
if (value === null || value === undefined) {
|
|
1805
|
+
return '$ 0';
|
|
1806
|
+
}
|
|
1807
|
+
return new Intl.NumberFormat('es-CO', {
|
|
1808
|
+
style: 'currency',
|
|
1809
|
+
currency: 'COP',
|
|
1810
|
+
minimumFractionDigits: 0,
|
|
1811
|
+
maximumFractionDigits: 0,
|
|
1812
|
+
}).format(value);
|
|
1813
|
+
}
|
|
2091
1814
|
validateTwoDigitFormat(number) {
|
|
2092
1815
|
if (number.length == 1)
|
|
2093
1816
|
number = "0" + number;
|
|
@@ -3766,11 +3489,180 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
3766
3489
|
}]
|
|
3767
3490
|
}], ctorParameters: function () { return [{ type: CryptoService }]; } });
|
|
3768
3491
|
|
|
3492
|
+
class PurchaseOrderPdfService {
|
|
3493
|
+
constructor(functions) {
|
|
3494
|
+
this.functions = functions;
|
|
3495
|
+
}
|
|
3496
|
+
generatePurchaseOrderPDF(order, options) {
|
|
3497
|
+
return new Promise((resolve, reject) => {
|
|
3498
|
+
try {
|
|
3499
|
+
const opts = {
|
|
3500
|
+
format: 'letter',
|
|
3501
|
+
download: true,
|
|
3502
|
+
filename: `orden_compra_${order.consecutive}.pdf`,
|
|
3503
|
+
...options
|
|
3504
|
+
};
|
|
3505
|
+
const doc = new jsPDF('p', 'pt', opts.format);
|
|
3506
|
+
const pageWidth = doc.internal.pageSize.getWidth();
|
|
3507
|
+
const margin = 40;
|
|
3508
|
+
let currentY = margin;
|
|
3509
|
+
// === ENCABEZADO ===
|
|
3510
|
+
currentY = this.addHeader(doc, order, currentY, pageWidth, margin);
|
|
3511
|
+
currentY += 18;
|
|
3512
|
+
// === DETALLES DE LA ORDEN ===
|
|
3513
|
+
currentY = this.addOrderDetails(doc, order, currentY, margin, pageWidth);
|
|
3514
|
+
currentY += 20;
|
|
3515
|
+
// === ITEMS DE LA ORDEN ===
|
|
3516
|
+
currentY = this.addOrderItems(doc, order, currentY, margin, pageWidth);
|
|
3517
|
+
currentY += 20;
|
|
3518
|
+
// === COMENTARIOS ===
|
|
3519
|
+
if (order.comment) {
|
|
3520
|
+
currentY = this.addComments(doc, order, currentY, margin, pageWidth);
|
|
3521
|
+
currentY += 20;
|
|
3522
|
+
}
|
|
3523
|
+
// === PIE DE PÁGINA ===
|
|
3524
|
+
this.addFooter(doc, pageWidth, doc.internal.pageSize.getHeight());
|
|
3525
|
+
if (opts.download) {
|
|
3526
|
+
doc.save(opts.filename);
|
|
3527
|
+
}
|
|
3528
|
+
resolve(doc);
|
|
3529
|
+
}
|
|
3530
|
+
catch (error) {
|
|
3531
|
+
reject(error);
|
|
3532
|
+
}
|
|
3533
|
+
});
|
|
3534
|
+
}
|
|
3535
|
+
addHeader(doc, order, y, pageWidth, margin) {
|
|
3536
|
+
// Título centrado y número derecha
|
|
3537
|
+
doc.setFont('helvetica', 'bold');
|
|
3538
|
+
doc.setFontSize(14);
|
|
3539
|
+
doc.setTextColor(0, 0, 0);
|
|
3540
|
+
doc.text('ORDEN DE COMPRA', pageWidth / 2, y + 8, { align: 'center' });
|
|
3541
|
+
doc.setFontSize(10);
|
|
3542
|
+
doc.text(`N° ${order.consecutive}`, pageWidth - margin, y + 8, { align: 'right' });
|
|
3543
|
+
y += 26;
|
|
3544
|
+
// Línea bajo título
|
|
3545
|
+
doc.setDrawColor(180);
|
|
3546
|
+
doc.setLineWidth(0.5);
|
|
3547
|
+
doc.line(margin, y, pageWidth - margin, y);
|
|
3548
|
+
y += 8;
|
|
3549
|
+
// Logo a la izquierda
|
|
3550
|
+
const logoW = 80;
|
|
3551
|
+
const logoH = 60;
|
|
3552
|
+
if (order.image) {
|
|
3553
|
+
doc.addImage(order.image, 'PNG', margin, y, logoW, logoH);
|
|
3554
|
+
}
|
|
3555
|
+
// Datos empresa a la derecha (alineados a la derecha)
|
|
3556
|
+
const rightX = pageWidth - margin;
|
|
3557
|
+
let infoY = y + 2;
|
|
3558
|
+
doc.setFont('helvetica', 'bold');
|
|
3559
|
+
doc.setFontSize(10);
|
|
3560
|
+
if (order.name) {
|
|
3561
|
+
doc.text(order.name, rightX, infoY, { align: 'right' });
|
|
3562
|
+
infoY += 14;
|
|
3563
|
+
}
|
|
3564
|
+
doc.setFont('helvetica', 'normal');
|
|
3565
|
+
doc.setFontSize(8);
|
|
3566
|
+
const add = (value) => {
|
|
3567
|
+
if (!value)
|
|
3568
|
+
return;
|
|
3569
|
+
doc.text(value, rightX, infoY, { align: 'right' });
|
|
3570
|
+
infoY += 12;
|
|
3571
|
+
};
|
|
3572
|
+
add(order.nit ? `Nit: ${order.nit}` : '');
|
|
3573
|
+
add(order.address);
|
|
3574
|
+
add(order.telephone ? `Tel: ${order.telephone}` : '');
|
|
3575
|
+
add(order.mail ? `Email: ${order.mail}` : '');
|
|
3576
|
+
// Altura total ocupada
|
|
3577
|
+
const blockBottom = Math.max(y + logoH, infoY);
|
|
3578
|
+
const separatorY = blockBottom + 6;
|
|
3579
|
+
// Separador
|
|
3580
|
+
doc.setDrawColor(180);
|
|
3581
|
+
doc.line(margin, separatorY, pageWidth - margin, separatorY);
|
|
3582
|
+
return separatorY + 10;
|
|
3583
|
+
}
|
|
3584
|
+
addOrderDetails(doc, order, y, margin, pageWidth) {
|
|
3585
|
+
doc.setFontSize(10);
|
|
3586
|
+
const rows = [
|
|
3587
|
+
[
|
|
3588
|
+
{ content: `Proveedor: ${order.providerName}`, styles: { fontStyle: 'bold' } },
|
|
3589
|
+
{ content: `Fecha de creación: ${this.functions.transformDate(order.created)}`, styles: { halign: 'right' } }
|
|
3590
|
+
],
|
|
3591
|
+
[
|
|
3592
|
+
{ content: `Almacén: ${order.warehouse}` },
|
|
3593
|
+
{ content: `Solicita: ${order.requestsName}`, styles: { halign: 'right' } }
|
|
3594
|
+
]
|
|
3595
|
+
];
|
|
3596
|
+
if (order.authorizeName && order.authorizeName !== order.requestsName) {
|
|
3597
|
+
rows.push([
|
|
3598
|
+
{ content: '' },
|
|
3599
|
+
{ content: `Autoriza: ${order.authorizeName}`, styles: { halign: 'right' } }
|
|
3600
|
+
]);
|
|
3601
|
+
}
|
|
3602
|
+
doc.autoTable({
|
|
3603
|
+
startY: y,
|
|
3604
|
+
body: rows,
|
|
3605
|
+
theme: 'plain',
|
|
3606
|
+
styles: { fontSize: 10, cellPadding: 2 }
|
|
3607
|
+
});
|
|
3608
|
+
return doc.lastAutoTable.finalY;
|
|
3609
|
+
}
|
|
3610
|
+
addOrderItems(doc, order, y, margin, pageWidth) {
|
|
3611
|
+
const head = [['Código', 'Nombre', 'U.M.', 'Cant.', 'Descripción']];
|
|
3612
|
+
const body = order.items.map(item => [
|
|
3613
|
+
item.code,
|
|
3614
|
+
item.itemName,
|
|
3615
|
+
item.unitMeasurement,
|
|
3616
|
+
item.amount,
|
|
3617
|
+
item.description || ''
|
|
3618
|
+
]);
|
|
3619
|
+
doc.autoTable({
|
|
3620
|
+
startY: y,
|
|
3621
|
+
head: head,
|
|
3622
|
+
body: body,
|
|
3623
|
+
theme: 'grid',
|
|
3624
|
+
headStyles: { fillColor: [220, 220, 220], textColor: 0, fontStyle: 'bold' },
|
|
3625
|
+
columnStyles: {
|
|
3626
|
+
3: { halign: 'right' },
|
|
3627
|
+
4: { halign: 'right' },
|
|
3628
|
+
5: { halign: 'right' }
|
|
3629
|
+
}
|
|
3630
|
+
});
|
|
3631
|
+
let finalY = doc.lastAutoTable.finalY;
|
|
3632
|
+
return finalY;
|
|
3633
|
+
}
|
|
3634
|
+
addComments(doc, order, y, margin, pageWidth) {
|
|
3635
|
+
doc.setFontSize(10);
|
|
3636
|
+
doc.setFont('helvetica', 'bold');
|
|
3637
|
+
doc.text('Comentarios:', margin, y);
|
|
3638
|
+
y += 15;
|
|
3639
|
+
doc.setFont('helvetica', 'normal');
|
|
3640
|
+
const splitText = doc.splitTextToSize(order.comment, pageWidth - margin * 2);
|
|
3641
|
+
doc.text(splitText, margin, y);
|
|
3642
|
+
return y + splitText.length * 12;
|
|
3643
|
+
}
|
|
3644
|
+
addFooter(doc, pageWidth, pageHeight) {
|
|
3645
|
+
const footerText = 'Documento generado por Brainloper';
|
|
3646
|
+
doc.setFontSize(8);
|
|
3647
|
+
const footerWidth = doc.getStringUnitWidth(footerText) * 8 / doc.internal.scaleFactor;
|
|
3648
|
+
doc.text(footerText, (pageWidth - footerWidth) / 2, pageHeight - 20);
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
PurchaseOrderPdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PurchaseOrderPdfService, deps: [{ token: FunctionsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3652
|
+
PurchaseOrderPdfService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PurchaseOrderPdfService, providedIn: 'root' });
|
|
3653
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PurchaseOrderPdfService, decorators: [{
|
|
3654
|
+
type: Injectable,
|
|
3655
|
+
args: [{
|
|
3656
|
+
providedIn: 'root'
|
|
3657
|
+
}]
|
|
3658
|
+
}], ctorParameters: function () { return [{ type: FunctionsService }]; } });
|
|
3659
|
+
|
|
3769
3660
|
class GeneratePdfService {
|
|
3770
|
-
constructor(dialog, workOrderPdfService, FuelOrderPdfService) {
|
|
3661
|
+
constructor(dialog, workOrderPdfService, FuelOrderPdfService, purchaseOrderPdfService) {
|
|
3771
3662
|
this.dialog = dialog;
|
|
3772
3663
|
this.workOrderPdfService = workOrderPdfService;
|
|
3773
3664
|
this.FuelOrderPdfService = FuelOrderPdfService;
|
|
3665
|
+
this.purchaseOrderPdfService = purchaseOrderPdfService;
|
|
3774
3666
|
}
|
|
3775
3667
|
getPdfOt(data, autoGenerateData) {
|
|
3776
3668
|
let autoGenerate = false;
|
|
@@ -3811,62 +3703,40 @@ class GeneratePdfService {
|
|
|
3811
3703
|
});
|
|
3812
3704
|
});
|
|
3813
3705
|
}
|
|
3814
|
-
|
|
3815
|
-
* Método mejorado para generar PDF de orden de combustible
|
|
3816
|
-
*/
|
|
3817
|
-
getPdfFoNew(data, autoGenerateData) {
|
|
3706
|
+
getPdfFoV2(data) {
|
|
3818
3707
|
return new Promise((resolve, reject) => {
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
.catch(error => reject(error));
|
|
3823
|
-
}
|
|
3824
|
-
else {
|
|
3825
|
-
let screen = "850px";
|
|
3826
|
-
this.dialog.open(TemplateFuelComponent, {
|
|
3827
|
-
data: {
|
|
3828
|
-
data,
|
|
3829
|
-
autoGenerate: false,
|
|
3830
|
-
useNewMethod: true
|
|
3831
|
-
},
|
|
3832
|
-
width: screen
|
|
3833
|
-
}).afterClosed().subscribe((res) => {
|
|
3834
|
-
resolve(true);
|
|
3835
|
-
});
|
|
3836
|
-
}
|
|
3708
|
+
this.FuelOrderPdfService.generateFuelOrderProfesionalPDF(data)
|
|
3709
|
+
.then(() => resolve(true))
|
|
3710
|
+
.catch(error => reject(error));
|
|
3837
3711
|
});
|
|
3838
3712
|
}
|
|
3839
|
-
|
|
3713
|
+
getPdfOtV2(data) {
|
|
3840
3714
|
return new Promise((resolve, reject) => {
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
}).afterClosed().subscribe((res) => {
|
|
3856
|
-
resolve(true);
|
|
3857
|
-
});
|
|
3858
|
-
}
|
|
3715
|
+
this.workOrderPdfService.generateWorkOrderPDF(data)
|
|
3716
|
+
.then(() => resolve(true))
|
|
3717
|
+
.catch(error => reject(error));
|
|
3718
|
+
});
|
|
3719
|
+
}
|
|
3720
|
+
generatePurchaseOrderPDF(order) {
|
|
3721
|
+
return new Promise((resolve, reject) => {
|
|
3722
|
+
this.purchaseOrderPdfService.generatePurchaseOrderPDF(order, { download: false })
|
|
3723
|
+
.then((doc) => {
|
|
3724
|
+
const blobUrl = doc.output('bloburl');
|
|
3725
|
+
window.open(blobUrl, '_blank');
|
|
3726
|
+
resolve(true);
|
|
3727
|
+
})
|
|
3728
|
+
.catch(error => reject(error));
|
|
3859
3729
|
});
|
|
3860
3730
|
}
|
|
3861
3731
|
}
|
|
3862
|
-
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 });
|
|
3732
|
+
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 });
|
|
3863
3733
|
GeneratePdfService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GeneratePdfService, providedIn: 'root' });
|
|
3864
3734
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GeneratePdfService, decorators: [{
|
|
3865
3735
|
type: Injectable,
|
|
3866
3736
|
args: [{
|
|
3867
3737
|
providedIn: 'root'
|
|
3868
3738
|
}]
|
|
3869
|
-
}], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: WorkOrderPdfService }, { type: FuelOrderPdfService }]; } });
|
|
3739
|
+
}], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: WorkOrderPdfService }, { type: FuelOrderPdfService }, { type: PurchaseOrderPdfService }]; } });
|
|
3870
3740
|
|
|
3871
3741
|
class LocalStorageService {
|
|
3872
3742
|
constructor() {
|