@acontplus/ng-common 1.0.6 → 1.0.8
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.
|
@@ -27,17 +27,37 @@ import { MatSelectModule } from '@angular/material/select';
|
|
|
27
27
|
var SALE_CODE_REPORT;
|
|
28
28
|
(function (SALE_CODE_REPORT) {
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* REPORTE FACTURA
|
|
31
31
|
*/
|
|
32
|
-
SALE_CODE_REPORT["
|
|
32
|
+
SALE_CODE_REPORT["RF"] = "RF";
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* FACTURA GENERAL
|
|
35
35
|
*/
|
|
36
|
-
SALE_CODE_REPORT["
|
|
36
|
+
SALE_CODE_REPORT["FG"] = "FG";
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* REPORTE NOTA ENTREGA
|
|
39
39
|
*/
|
|
40
|
-
SALE_CODE_REPORT["
|
|
40
|
+
SALE_CODE_REPORT["RNE"] = "RNE";
|
|
41
|
+
/**
|
|
42
|
+
* REPORTE NOTA CREDITO
|
|
43
|
+
*/
|
|
44
|
+
SALE_CODE_REPORT["RNC"] = "RNCC";
|
|
45
|
+
/**
|
|
46
|
+
* NOTA CREDITO GENERAL
|
|
47
|
+
*/
|
|
48
|
+
SALE_CODE_REPORT["NCRG"] = "NCRG";
|
|
49
|
+
/**
|
|
50
|
+
* REPORTE PROFORMA
|
|
51
|
+
*/
|
|
52
|
+
SALE_CODE_REPORT["PR"] = "PR";
|
|
53
|
+
/**
|
|
54
|
+
* REPORTE RENTABILIDAD
|
|
55
|
+
*/
|
|
56
|
+
SALE_CODE_REPORT["SRR"] = "SRR";
|
|
57
|
+
/**
|
|
58
|
+
* REPORTE RENTABILIDAD CUSTOM
|
|
59
|
+
*/
|
|
60
|
+
SALE_CODE_REPORT["SRRC"] = "SRRC";
|
|
41
61
|
})(SALE_CODE_REPORT || (SALE_CODE_REPORT = {}));
|
|
42
62
|
/**
|
|
43
63
|
* Códigos de reportes de compras
|
|
@@ -45,13 +65,45 @@ var SALE_CODE_REPORT;
|
|
|
45
65
|
var PURCHASE_CODE_REPORT;
|
|
46
66
|
(function (PURCHASE_CODE_REPORT) {
|
|
47
67
|
/**
|
|
48
|
-
* REPORTE
|
|
68
|
+
* REPORTE LIQUIDACION COMPRA
|
|
69
|
+
*/
|
|
70
|
+
PURCHASE_CODE_REPORT["RLC"] = "RLC";
|
|
71
|
+
/**
|
|
72
|
+
* REPORTE COMPRA DETALLE
|
|
73
|
+
*/
|
|
74
|
+
PURCHASE_CODE_REPORT["RCD"] = "RCD";
|
|
75
|
+
/**
|
|
76
|
+
* REPORTE FACTURA COMPRA
|
|
77
|
+
*/
|
|
78
|
+
PURCHASE_CODE_REPORT["RFC"] = "RFC";
|
|
79
|
+
/**
|
|
80
|
+
* REPORTE COMPRAS NOTA HIDDEN (No Habitual)
|
|
49
81
|
*/
|
|
50
82
|
PURCHASE_CODE_REPORT["RCNH"] = "RCNH";
|
|
51
83
|
/**
|
|
52
|
-
*
|
|
84
|
+
* ORDEN COMPRA
|
|
53
85
|
*/
|
|
54
|
-
PURCHASE_CODE_REPORT["
|
|
86
|
+
PURCHASE_CODE_REPORT["ROC"] = "ROC";
|
|
87
|
+
/**
|
|
88
|
+
* REPORTE COMPRAS
|
|
89
|
+
*/
|
|
90
|
+
PURCHASE_CODE_REPORT["RCP"] = "RCP";
|
|
91
|
+
/**
|
|
92
|
+
* REPORTE RECEPCION FACTURA
|
|
93
|
+
*/
|
|
94
|
+
PURCHASE_CODE_REPORT["RRF"] = "RRF";
|
|
95
|
+
/**
|
|
96
|
+
* RECEPCION NOTA CREDITO
|
|
97
|
+
*/
|
|
98
|
+
PURCHASE_CODE_REPORT["RRNC"] = "RRNC";
|
|
99
|
+
/**
|
|
100
|
+
* RECEPCION RETENCION GENERAL
|
|
101
|
+
*/
|
|
102
|
+
PURCHASE_CODE_REPORT["RRG"] = "RRG";
|
|
103
|
+
/**
|
|
104
|
+
* REPORTE RECEPCION NOTA DEBITO
|
|
105
|
+
*/
|
|
106
|
+
PURCHASE_CODE_REPORT["RRND"] = "RRND";
|
|
55
107
|
})(PURCHASE_CODE_REPORT || (PURCHASE_CODE_REPORT = {}));
|
|
56
108
|
/**
|
|
57
109
|
* Códigos de reportes de contabilidad
|
|
@@ -70,9 +122,21 @@ var ACCOUNTING_CODE_REPORT;
|
|
|
70
122
|
* ASIENTO CONTABLE ESTADO LIBRO CAJA
|
|
71
123
|
*/
|
|
72
124
|
ACCOUNTING_CODE_REPORT["ACELC"] = "ACELC";
|
|
125
|
+
/**
|
|
126
|
+
* REPORTE CONTROL CAJA
|
|
127
|
+
*/
|
|
128
|
+
ACCOUNTING_CODE_REPORT["RCC"] = "RCC";
|
|
129
|
+
/**
|
|
130
|
+
* REPORTE MOVIMIENTO CAJA
|
|
131
|
+
*/
|
|
132
|
+
ACCOUNTING_CODE_REPORT["RMIE"] = "RMIE";
|
|
133
|
+
/**
|
|
134
|
+
* CONTABILIDAD DETALLE CONTROL CAJA
|
|
135
|
+
*/
|
|
136
|
+
ACCOUNTING_CODE_REPORT["CDCC"] = "CDCC";
|
|
73
137
|
})(ACCOUNTING_CODE_REPORT || (ACCOUNTING_CODE_REPORT = {}));
|
|
74
138
|
/**
|
|
75
|
-
* Códigos de reportes de clientes
|
|
139
|
+
* Códigos de reportes de clientes y cartera
|
|
76
140
|
*/
|
|
77
141
|
var CUSTOMER_CODE_REPORT;
|
|
78
142
|
(function (CUSTOMER_CODE_REPORT) {
|
|
@@ -80,6 +144,34 @@ var CUSTOMER_CODE_REPORT;
|
|
|
80
144
|
* REPORTE CLIENTE LISTADO
|
|
81
145
|
*/
|
|
82
146
|
CUSTOMER_CODE_REPORT["RCL"] = "RCL";
|
|
147
|
+
/**
|
|
148
|
+
* CUENTA POR COBRAR
|
|
149
|
+
*/
|
|
150
|
+
CUSTOMER_CODE_REPORT["CCR"] = "CCR";
|
|
151
|
+
/**
|
|
152
|
+
* CONTABILIDAD CARTERA PROVEEDOR
|
|
153
|
+
*/
|
|
154
|
+
CUSTOMER_CODE_REPORT["CCP"] = "CCP";
|
|
155
|
+
/**
|
|
156
|
+
* CONTABILIDAD CARTERA PROVEEDOR CUOTA
|
|
157
|
+
*/
|
|
158
|
+
CUSTOMER_CODE_REPORT["CCPC"] = "CCPC";
|
|
159
|
+
/**
|
|
160
|
+
* CONTABILIDAD COBROS POR CUOTAS
|
|
161
|
+
*/
|
|
162
|
+
CUSTOMER_CODE_REPORT["RCXC"] = "RCXC";
|
|
163
|
+
/**
|
|
164
|
+
* CONTABILIDAD COBROS POR DOCUMENTOS
|
|
165
|
+
*/
|
|
166
|
+
CUSTOMER_CODE_REPORT["RCXD"] = "RCXD";
|
|
167
|
+
/**
|
|
168
|
+
* CONTABILIDAD COBROS POR PAGOS
|
|
169
|
+
*/
|
|
170
|
+
CUSTOMER_CODE_REPORT["RCXP"] = "RCXP";
|
|
171
|
+
/**
|
|
172
|
+
* REPORTE ANTICIPO
|
|
173
|
+
*/
|
|
174
|
+
CUSTOMER_CODE_REPORT["RA"] = "RA";
|
|
83
175
|
})(CUSTOMER_CODE_REPORT || (CUSTOMER_CODE_REPORT = {}));
|
|
84
176
|
/**
|
|
85
177
|
* Códigos de reportes de inventario
|
|
@@ -157,6 +249,34 @@ var ELECTRONIC_DOCUMENT_CODE;
|
|
|
157
249
|
*/
|
|
158
250
|
ELECTRONIC_DOCUMENT_CODE["NORMAL"] = "NORMAL";
|
|
159
251
|
})(ELECTRONIC_DOCUMENT_CODE || (ELECTRONIC_DOCUMENT_CODE = {}));
|
|
252
|
+
/**
|
|
253
|
+
* Códigos de reporte de Facturación Electrónico
|
|
254
|
+
*/
|
|
255
|
+
var BILLING_CODE_REPORT;
|
|
256
|
+
(function (BILLING_CODE_REPORT) {
|
|
257
|
+
/**
|
|
258
|
+
* FACTURACION ELECTRONICA GENERAL
|
|
259
|
+
*/
|
|
260
|
+
BILLING_CODE_REPORT["FEG"] = "FEG";
|
|
261
|
+
/**
|
|
262
|
+
* REPORTE RETENCION
|
|
263
|
+
*/
|
|
264
|
+
BILLING_CODE_REPORT["RRC"] = "RRC";
|
|
265
|
+
})(BILLING_CODE_REPORT || (BILLING_CODE_REPORT = {}));
|
|
266
|
+
/**
|
|
267
|
+
* Códigos de aprobación de documentos
|
|
268
|
+
*/
|
|
269
|
+
var APPROVAL_CODE_REPORT;
|
|
270
|
+
(function (APPROVAL_CODE_REPORT) {
|
|
271
|
+
/**
|
|
272
|
+
* APROBACION FACTURA
|
|
273
|
+
*/
|
|
274
|
+
APPROVAL_CODE_REPORT["PRE_F"] = "RAC";
|
|
275
|
+
/**
|
|
276
|
+
* APROBACION NOTA ENTREGA
|
|
277
|
+
*/
|
|
278
|
+
APPROVAL_CODE_REPORT["P_NE"] = "P-NE";
|
|
279
|
+
})(APPROVAL_CODE_REPORT || (APPROVAL_CODE_REPORT = {}));
|
|
160
280
|
/**
|
|
161
281
|
* Formatos de reporte disponibles
|
|
162
282
|
*/
|
|
@@ -166,6 +286,16 @@ var REPORT_FORMAT;
|
|
|
166
286
|
REPORT_FORMAT["EXCEL"] = "excel";
|
|
167
287
|
REPORT_FORMAT["WORD"] = "word";
|
|
168
288
|
})(REPORT_FORMAT || (REPORT_FORMAT = {}));
|
|
289
|
+
/**
|
|
290
|
+
* Códigos de soporte técnico
|
|
291
|
+
*/
|
|
292
|
+
var TECHNICAL_SUPPORT_CODE_REPORT;
|
|
293
|
+
(function (TECHNICAL_SUPPORT_CODE_REPORT) {
|
|
294
|
+
/**
|
|
295
|
+
* REPORTE SOPORTE TECNICO
|
|
296
|
+
*/
|
|
297
|
+
TECHNICAL_SUPPORT_CODE_REPORT["RTS"] = "RTS";
|
|
298
|
+
})(TECHNICAL_SUPPORT_CODE_REPORT || (TECHNICAL_SUPPORT_CODE_REPORT = {}));
|
|
169
299
|
|
|
170
300
|
const API_PATHS = {
|
|
171
301
|
WHATSAPP: 'common/whatsapp-cloud',
|
|
@@ -1059,6 +1189,13 @@ class ReportParamsBuilder {
|
|
|
1059
1189
|
idField: 'id',
|
|
1060
1190
|
hasParams: true,
|
|
1061
1191
|
},
|
|
1192
|
+
[BILLING_CODE_REPORT.RRC]: {
|
|
1193
|
+
codigo: BILLING_CODE_REPORT.RRC,
|
|
1194
|
+
hasService: true,
|
|
1195
|
+
useV1Api: true, // isOldVersion: true
|
|
1196
|
+
idField: 'idDocumentoElectronico',
|
|
1197
|
+
hasParams: false,
|
|
1198
|
+
},
|
|
1062
1199
|
// Reportes de ventas
|
|
1063
1200
|
[SALE_CODE_REPORT.SRR]: {
|
|
1064
1201
|
codigo: SALE_CODE_REPORT.SRR,
|
|
@@ -1096,6 +1233,41 @@ class ReportParamsBuilder {
|
|
|
1096
1233
|
idField: 'id',
|
|
1097
1234
|
hasParams: false,
|
|
1098
1235
|
},
|
|
1236
|
+
[PURCHASE_CODE_REPORT.RRNC]: {
|
|
1237
|
+
codigo: PURCHASE_CODE_REPORT.RRNC,
|
|
1238
|
+
hasService: true,
|
|
1239
|
+
useV1Api: false,
|
|
1240
|
+
idField: 'id',
|
|
1241
|
+
hasParams: false,
|
|
1242
|
+
},
|
|
1243
|
+
[PURCHASE_CODE_REPORT.RRG]: {
|
|
1244
|
+
codigo: PURCHASE_CODE_REPORT.RRG,
|
|
1245
|
+
hasService: true,
|
|
1246
|
+
useV1Api: false,
|
|
1247
|
+
idField: 'id',
|
|
1248
|
+
hasParams: false,
|
|
1249
|
+
},
|
|
1250
|
+
[PURCHASE_CODE_REPORT.RRND]: {
|
|
1251
|
+
codigo: PURCHASE_CODE_REPORT.RRND,
|
|
1252
|
+
hasService: true,
|
|
1253
|
+
useV1Api: false,
|
|
1254
|
+
idField: 'id',
|
|
1255
|
+
hasParams: false,
|
|
1256
|
+
},
|
|
1257
|
+
[PURCHASE_CODE_REPORT.RRF]: {
|
|
1258
|
+
codigo: PURCHASE_CODE_REPORT.RRF,
|
|
1259
|
+
hasService: true,
|
|
1260
|
+
useV1Api: false,
|
|
1261
|
+
idField: 'id',
|
|
1262
|
+
hasParams: false,
|
|
1263
|
+
},
|
|
1264
|
+
[PURCHASE_CODE_REPORT.RCP]: {
|
|
1265
|
+
codigo: PURCHASE_CODE_REPORT.RCP,
|
|
1266
|
+
hasService: true,
|
|
1267
|
+
useV1Api: false,
|
|
1268
|
+
idField: 'id',
|
|
1269
|
+
hasParams: false,
|
|
1270
|
+
},
|
|
1099
1271
|
// Reportes de contabilidad
|
|
1100
1272
|
[ACCOUNTING_CODE_REPORT.RCEGR]: {
|
|
1101
1273
|
codigo: ACCOUNTING_CODE_REPORT.RCEGR,
|
|
@@ -1201,26 +1373,28 @@ class ReportParamsBuilder {
|
|
|
1201
1373
|
/**
|
|
1202
1374
|
* Construye los parámetros de reporte según el tipo de documento
|
|
1203
1375
|
*
|
|
1204
|
-
* @param
|
|
1376
|
+
* @param codeReport - Código del reporte (FG, SRR, FV, RCNH, etc.)
|
|
1377
|
+
* @param docData - Datos del documento con parámetros adicionales
|
|
1205
1378
|
* @param format - Formato del reporte: 'pdf' | 'excel' | 'word'
|
|
1206
1379
|
* @returns Objeto con hasService, reportParams (string JSON) y dataParams (string JSON)
|
|
1207
1380
|
*
|
|
1208
1381
|
* @example
|
|
1209
1382
|
* ```typescript
|
|
1210
1383
|
* const params = ReportParamsBuilder.buildParams(
|
|
1211
|
-
*
|
|
1384
|
+
* SALE_CODE_REPORT.FG,
|
|
1385
|
+
* { codDoc: '01', tipo: 2, codEstab: '001' },
|
|
1212
1386
|
* 'pdf'
|
|
1213
1387
|
* );
|
|
1214
1388
|
* // Resultado:
|
|
1215
1389
|
* // {
|
|
1216
1390
|
* // hasService: true,
|
|
1217
|
-
* // reportParams: "{\"codigo\":\"
|
|
1218
|
-
* // dataParams: "{\"
|
|
1391
|
+
* // reportParams: "{\"codigo\":\"FG\",\"format\":\"pdf\",\"hasParams\":false}",
|
|
1392
|
+
* // dataParams: "{\"codDoc\":\"01\",\"tipo\":2,\"codEstab\":\"001\"}"
|
|
1219
1393
|
* // }
|
|
1220
1394
|
* ```
|
|
1221
1395
|
*/
|
|
1222
|
-
static buildParams(docData, format = 'pdf') {
|
|
1223
|
-
const config = this.getReportConfig(
|
|
1396
|
+
static buildParams(codeReport, docData, format = 'pdf') {
|
|
1397
|
+
const config = this.getReportConfig(codeReport);
|
|
1224
1398
|
return {
|
|
1225
1399
|
hasService: config.hasService,
|
|
1226
1400
|
reportParams: this.buildReportParams(docData, config, format),
|
|
@@ -1228,36 +1402,44 @@ class ReportParamsBuilder {
|
|
|
1228
1402
|
};
|
|
1229
1403
|
}
|
|
1230
1404
|
/**
|
|
1231
|
-
* Determina si debe usar la API v1 según el
|
|
1405
|
+
* Determina si debe usar la API v1 o v2 según el código de reporte
|
|
1232
1406
|
*
|
|
1233
|
-
*
|
|
1234
|
-
*
|
|
1407
|
+
* Algunos reportes (como documentos electrónicos) usan API v1,
|
|
1408
|
+
* mientras que otros (reportes de ventas, inventario) usan API v2.
|
|
1409
|
+
*
|
|
1410
|
+
* @param codeReport - Código del reporte
|
|
1411
|
+
* @returns true para API v1, false para API v2
|
|
1235
1412
|
*
|
|
1236
1413
|
* @example
|
|
1237
1414
|
* ```typescript
|
|
1415
|
+
* // Documentos electrónicos usan v1
|
|
1238
1416
|
* const useV1 = ReportParamsBuilder.shouldUseV1Api(ELECTRONIC_DOCUMENT_CODE.FV);
|
|
1239
|
-
*
|
|
1417
|
+
* console.log(useV1); // true
|
|
1240
1418
|
*
|
|
1419
|
+
* // Reportes de ventas usan v2
|
|
1241
1420
|
* const useV1Sales = ReportParamsBuilder.shouldUseV1Api(SALE_CODE_REPORT.FG);
|
|
1242
|
-
*
|
|
1421
|
+
* console.log(useV1Sales); // false
|
|
1422
|
+
*
|
|
1423
|
+
* // Uso manual (normalmente no necesario, build() lo hace automáticamente)
|
|
1424
|
+
* const apiVersion = useV1 ? '/reporte/download' : '/v2/reporte/download';
|
|
1243
1425
|
* ```
|
|
1244
1426
|
*/
|
|
1245
|
-
static shouldUseV1Api(
|
|
1246
|
-
const config = this.getReportConfig(
|
|
1427
|
+
static shouldUseV1Api(codeReport) {
|
|
1428
|
+
const config = this.getReportConfig(codeReport);
|
|
1247
1429
|
return config.useV1Api;
|
|
1248
1430
|
}
|
|
1249
1431
|
/**
|
|
1250
1432
|
* Obtiene la configuración para un tipo de documento
|
|
1251
1433
|
*
|
|
1252
|
-
* @param
|
|
1434
|
+
* @param codeReport - Código del reporte (FG, SRR, FV, etc.)
|
|
1253
1435
|
* @returns Configuración del reporte
|
|
1254
1436
|
* @throws Error si el tipo de documento no está soportado
|
|
1255
1437
|
* @private
|
|
1256
1438
|
*/
|
|
1257
|
-
static getReportConfig(
|
|
1258
|
-
const config = this.reportConfigs[
|
|
1439
|
+
static getReportConfig(codeReport) {
|
|
1440
|
+
const config = this.reportConfigs[codeReport];
|
|
1259
1441
|
if (!config) {
|
|
1260
|
-
throw new Error(`Tipo de
|
|
1442
|
+
throw new Error(`Tipo de reporte no soportado: ${codeReport}. Tipos disponibles: ${Object.keys(this.reportConfigs).join(', ')}`);
|
|
1261
1443
|
}
|
|
1262
1444
|
return config;
|
|
1263
1445
|
}
|
|
@@ -1307,7 +1489,7 @@ class ReportParamsBuilder {
|
|
|
1307
1489
|
* - codEstab: Código de establecimiento (según configuración)
|
|
1308
1490
|
* - codigo: Código del reporte (según configuración)
|
|
1309
1491
|
* - Parámetros extra específicos del tipo (extraDataParams)
|
|
1310
|
-
* - Todos los parámetros adicionales del docData (excepto
|
|
1492
|
+
* - Todos los parámetros adicionales del docData (excepto codEstab, id, serie)
|
|
1311
1493
|
*
|
|
1312
1494
|
* @param docData - Datos del documento con parámetros adicionales
|
|
1313
1495
|
* @param config - Configuración del tipo de reporte
|
|
@@ -1317,11 +1499,11 @@ class ReportParamsBuilder {
|
|
|
1317
1499
|
* @example
|
|
1318
1500
|
* ```typescript
|
|
1319
1501
|
* // Input:
|
|
1320
|
-
* docData = { codDoc: '
|
|
1502
|
+
* docData = { codDoc: '01', tipo: 2, codEstab: '001', fechaInicio: '2024-01-01' }
|
|
1321
1503
|
* config = { idField: 'id', includeEstabInData: false, ... }
|
|
1322
1504
|
*
|
|
1323
1505
|
* // Output:
|
|
1324
|
-
* "{\"tipo\":2,\"fechaInicio\":\"2024-01-01\"}"
|
|
1506
|
+
* "{\"codDoc\":\"01\",\"tipo\":2,\"fechaInicio\":\"2024-01-01\"}"
|
|
1325
1507
|
* ```
|
|
1326
1508
|
*/
|
|
1327
1509
|
static buildDataParams(docData, config) {
|
|
@@ -1341,9 +1523,9 @@ class ReportParamsBuilder {
|
|
|
1341
1523
|
if (config.extraDataParams) {
|
|
1342
1524
|
Object.assign(params, config.extraDataParams);
|
|
1343
1525
|
}
|
|
1344
|
-
// Agregar cualquier parámetro adicional del docData
|
|
1526
|
+
// Agregar cualquier parámetro adicional del docData (incluyendo codDoc si existe)
|
|
1345
1527
|
Object.keys(docData).forEach((key) => {
|
|
1346
|
-
if (!['
|
|
1528
|
+
if (!['codEstab', 'id', 'serie'].includes(key) && docData[key] !== undefined) {
|
|
1347
1529
|
params[key] = docData[key];
|
|
1348
1530
|
}
|
|
1349
1531
|
});
|
|
@@ -1352,96 +1534,168 @@ class ReportParamsBuilder {
|
|
|
1352
1534
|
/**
|
|
1353
1535
|
* Construye las opciones completas para generar un reporte
|
|
1354
1536
|
*
|
|
1355
|
-
* @param
|
|
1537
|
+
* @param codeReport - Código del reporte (FG, SRR, FV, RCNH, etc.) - REQUERIDO
|
|
1538
|
+
* @param docData - Datos del documento con parámetros adicionales (sin codeReport)
|
|
1356
1539
|
* @param format - Formato del reporte: 'pdf' | 'excel' | 'word'
|
|
1357
|
-
|
|
1540
|
+
/**
|
|
1541
|
+
* Construye las opciones completas para generar un reporte
|
|
1542
|
+
*
|
|
1543
|
+
* Método principal que acepta un objeto con opciones tipadas.
|
|
1544
|
+
* Proporciona IntelliSense y validación de tipos en tiempo de desarrollo.
|
|
1545
|
+
*
|
|
1546
|
+
* @param options - Opciones del reporte
|
|
1547
|
+
* @param options.codeReport - Código del reporte (tipado: SALE_CODE_REPORT, PURCHASE_CODE_REPORT, etc.)
|
|
1548
|
+
* @param options.data - Datos del documento (codDoc, tipo, fechas, etc.)
|
|
1549
|
+
* @param options.format - Formato de salida: 'pdf' | 'excel' | 'word' (opcional, por defecto 'pdf')
|
|
1550
|
+
* @returns Objeto con data, format y useV1Api para enviar a la facade
|
|
1358
1551
|
*
|
|
1359
1552
|
* @example
|
|
1360
1553
|
* ```typescript
|
|
1361
|
-
*
|
|
1362
|
-
*
|
|
1363
|
-
*
|
|
1364
|
-
*
|
|
1365
|
-
*
|
|
1366
|
-
*
|
|
1367
|
-
*
|
|
1368
|
-
*
|
|
1369
|
-
*
|
|
1370
|
-
*
|
|
1554
|
+
* // Ejemplo 1: Reporte de ventas
|
|
1555
|
+
* const options = ReportParamsBuilder.build({
|
|
1556
|
+
* codeReport: SALE_CODE_REPORT.FG,
|
|
1557
|
+
* data: {
|
|
1558
|
+
* tipo: 2,
|
|
1559
|
+
* ckFecha: true,
|
|
1560
|
+
* codEstab: 'ESTAB-000000216',
|
|
1561
|
+
* fechaInicio: '2024-01-01',
|
|
1562
|
+
* fechaFin: '2024-12-31',
|
|
1563
|
+
* userRoleId: '307'
|
|
1564
|
+
* },
|
|
1565
|
+
* format: 'pdf'
|
|
1566
|
+
* });
|
|
1567
|
+
*
|
|
1568
|
+
* // Ejemplo 2: Documento electrónico con codDoc variable
|
|
1569
|
+
* const options2 = ReportParamsBuilder.build({
|
|
1570
|
+
* codeReport: ELECTRONIC_DOCUMENT_CODE.FV,
|
|
1571
|
+
* data: {
|
|
1572
|
+
* id: 123,
|
|
1573
|
+
* codDoc: '01', // ← Variable, va a dataParams
|
|
1574
|
+
* codEstab: '001'
|
|
1575
|
+
* }
|
|
1576
|
+
* // format es opcional, por defecto 'pdf'
|
|
1577
|
+
* });
|
|
1578
|
+
*
|
|
1579
|
+
* // Ejemplo 3: Reporte de inventario
|
|
1580
|
+
* const options3 = ReportParamsBuilder.build({
|
|
1581
|
+
* codeReport: INVENTORY_CODE_REPORT.ARTICULO_PVP,
|
|
1582
|
+
* data: {
|
|
1583
|
+
* tipo: 2,
|
|
1584
|
+
* stockStatusCode: 1,
|
|
1585
|
+
* idTarifa: 3
|
|
1586
|
+
* },
|
|
1587
|
+
* format: 'excel'
|
|
1588
|
+
* });
|
|
1371
1589
|
*
|
|
1372
1590
|
* // Usar con facade
|
|
1373
|
-
* this.reportFacade.
|
|
1591
|
+
* this.reportFacade.open(options).subscribe();
|
|
1592
|
+
* this.reportFacade.download(options2).subscribe();
|
|
1374
1593
|
* ```
|
|
1375
1594
|
*/
|
|
1376
|
-
static build(
|
|
1595
|
+
static build(options) {
|
|
1596
|
+
const { codeReport, data, format = 'pdf' } = options;
|
|
1377
1597
|
return {
|
|
1378
|
-
data: this.buildParams(
|
|
1598
|
+
data: this.buildParams(codeReport, data, format),
|
|
1379
1599
|
format,
|
|
1380
|
-
useV1Api: this.shouldUseV1Api(
|
|
1600
|
+
useV1Api: this.shouldUseV1Api(codeReport),
|
|
1381
1601
|
};
|
|
1382
1602
|
}
|
|
1383
1603
|
/**
|
|
1384
|
-
* Obtiene la lista de
|
|
1604
|
+
* Obtiene la lista de códigos de reporte soportados
|
|
1605
|
+
*
|
|
1606
|
+
* Devuelve un array con todos los códigos de reporte configurados
|
|
1607
|
+
* en el builder (FV, NE, FG, SRR, RCNH, etc.)
|
|
1385
1608
|
*
|
|
1386
|
-
* @returns Array con todos los códigos de
|
|
1609
|
+
* @returns Array con todos los códigos de reporte disponibles
|
|
1387
1610
|
*
|
|
1388
1611
|
* @example
|
|
1389
1612
|
* ```typescript
|
|
1390
1613
|
* const types = ReportParamsBuilder.getSupportedDocumentTypes();
|
|
1391
|
-
*
|
|
1614
|
+
* console.log(types);
|
|
1615
|
+
* // ['FV', 'NE', 'NC', 'ND', 'GR', 'NORMAL', 'SRR', 'SRRC', 'FG',
|
|
1616
|
+
* // 'RCNH', 'RLC', 'RCEGR', 'ACEDFP', 'ACELC', 'RCL', 'RK', ...]
|
|
1617
|
+
*
|
|
1618
|
+
* // Usar para validación
|
|
1619
|
+
* if (types.includes(myCode)) {
|
|
1620
|
+
* // Código válido
|
|
1621
|
+
* }
|
|
1392
1622
|
* ```
|
|
1393
1623
|
*/
|
|
1394
1624
|
static getSupportedDocumentTypes() {
|
|
1395
1625
|
return Object.keys(this.reportConfigs);
|
|
1396
1626
|
}
|
|
1397
1627
|
/**
|
|
1398
|
-
* Verifica si un
|
|
1628
|
+
* Verifica si un código de reporte está soportado
|
|
1399
1629
|
*
|
|
1400
|
-
*
|
|
1401
|
-
*
|
|
1630
|
+
* Útil para validar códigos antes de generar reportes,
|
|
1631
|
+
* especialmente cuando el código viene dinámicamente.
|
|
1632
|
+
*
|
|
1633
|
+
* @param codeReport - Código del reporte a verificar
|
|
1634
|
+
* @returns true si el código está soportado, false en caso contrario
|
|
1402
1635
|
*
|
|
1403
1636
|
* @example
|
|
1404
1637
|
* ```typescript
|
|
1405
|
-
*
|
|
1406
|
-
*
|
|
1638
|
+
* // Validación con enum
|
|
1639
|
+
* if (ReportParamsBuilder.isDocumentTypeSupported(SALE_CODE_REPORT.FG)) {
|
|
1640
|
+
* console.log('Código FG soportado');
|
|
1641
|
+
* }
|
|
1642
|
+
*
|
|
1643
|
+
* // Validación con string dinámico
|
|
1644
|
+
* const dynamicCode = getUserSelectedCode();
|
|
1645
|
+
* if (ReportParamsBuilder.isDocumentTypeSupported(dynamicCode)) {
|
|
1646
|
+
* const options = ReportParamsBuilder.build({
|
|
1647
|
+
* codeReport: dynamicCode,
|
|
1648
|
+
* data: {...}
|
|
1649
|
+
* });
|
|
1407
1650
|
* } else {
|
|
1408
|
-
* console.error('
|
|
1651
|
+
* console.error('Código no soportado:', dynamicCode);
|
|
1409
1652
|
* }
|
|
1410
1653
|
* ```
|
|
1411
1654
|
*/
|
|
1412
|
-
static isDocumentTypeSupported(
|
|
1413
|
-
return
|
|
1655
|
+
static isDocumentTypeSupported(codeReport) {
|
|
1656
|
+
return codeReport in this.reportConfigs;
|
|
1414
1657
|
}
|
|
1415
1658
|
/**
|
|
1416
1659
|
* Registra un nuevo tipo de reporte dinámicamente
|
|
1417
1660
|
*
|
|
1418
|
-
* Permite agregar soporte para
|
|
1661
|
+
* Permite agregar soporte para códigos de reporte personalizados
|
|
1419
1662
|
* sin modificar el código fuente de la librería.
|
|
1663
|
+
* Útil para reportes específicos de cada aplicación.
|
|
1420
1664
|
*
|
|
1421
|
-
* @param
|
|
1665
|
+
* @param codeReport - Código único del reporte personalizado
|
|
1422
1666
|
* @param config - Configuración completa del reporte
|
|
1423
1667
|
*
|
|
1424
1668
|
* @example
|
|
1425
1669
|
* ```typescript
|
|
1426
|
-
* //
|
|
1427
|
-
* ReportParamsBuilder.registerReportType('
|
|
1428
|
-
* codigo: '
|
|
1670
|
+
* // Registrar un reporte personalizado
|
|
1671
|
+
* ReportParamsBuilder.registerReportType('MI_REPORTE_CUSTOM', {
|
|
1672
|
+
* codigo: 'MI_REPORTE_CUSTOM',
|
|
1429
1673
|
* hasService: true,
|
|
1430
1674
|
* useV1Api: false,
|
|
1431
1675
|
* idField: 'id',
|
|
1432
1676
|
* hasParams: true,
|
|
1433
|
-
*
|
|
1677
|
+
* includeEstabInData: true,
|
|
1678
|
+
* extraDataParams: {
|
|
1679
|
+
* tipoCustom: 'especial',
|
|
1680
|
+
* version: 2
|
|
1681
|
+
* }
|
|
1434
1682
|
* });
|
|
1435
1683
|
*
|
|
1436
|
-
* // Ahora se puede usar
|
|
1437
|
-
* const options = ReportParamsBuilder.build(
|
|
1438
|
-
*
|
|
1439
|
-
* '
|
|
1440
|
-
*
|
|
1684
|
+
* // Ahora se puede usar como cualquier otro reporte
|
|
1685
|
+
* const options = ReportParamsBuilder.build({
|
|
1686
|
+
* codeReport: 'MI_REPORTE_CUSTOM',
|
|
1687
|
+
* data: { id: 123, codEstab: '001' },
|
|
1688
|
+
* format: 'pdf'
|
|
1689
|
+
* });
|
|
1690
|
+
*
|
|
1691
|
+
* // Verificar si fue registrado
|
|
1692
|
+
* console.log(
|
|
1693
|
+
* ReportParamsBuilder.isDocumentTypeSupported('MI_REPORTE_CUSTOM')
|
|
1694
|
+
* ); // true
|
|
1441
1695
|
* ```
|
|
1442
1696
|
*/
|
|
1443
|
-
static registerReportType(
|
|
1444
|
-
this.reportConfigs[
|
|
1697
|
+
static registerReportType(codeReport, config) {
|
|
1698
|
+
this.reportConfigs[codeReport] = config;
|
|
1445
1699
|
}
|
|
1446
1700
|
}
|
|
1447
1701
|
|
|
@@ -1567,7 +1821,11 @@ class WhatsAppSender {
|
|
|
1567
1821
|
generateReport() {
|
|
1568
1822
|
const docData = this.config.documentData;
|
|
1569
1823
|
// Construir opciones de reporte
|
|
1570
|
-
const reportOptions = ReportParamsBuilder.build(
|
|
1824
|
+
const reportOptions = ReportParamsBuilder.build({
|
|
1825
|
+
codeReport: docData.codDoc,
|
|
1826
|
+
data: docData,
|
|
1827
|
+
format: 'pdf',
|
|
1828
|
+
});
|
|
1571
1829
|
return this.reportFacade.generate(reportOptions);
|
|
1572
1830
|
}
|
|
1573
1831
|
processReportFile(response) {
|
|
@@ -1675,5 +1933,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
1675
1933
|
* Generated bundle index. Do not edit.
|
|
1676
1934
|
*/
|
|
1677
1935
|
|
|
1678
|
-
export { ACCOUNTING_CODE_REPORT, API_PATHS, CUSTOMER_CODE_REPORT, DOCUMENT_TYPES, ELECTRONIC_DOCUMENT_CODE, FileMapperUtil, GreenWhatsAppAdapter, INVENTORY_CODE_REPORT, MetaWhatsAppAdapter, PRINTER_PORT, PURCHASE_CODE_REPORT, PhoneFormatterUtil, PrinterAdapter, PrinterFacade, REPORT_FORMAT, REPORT_PORT, ReportAdapter, ReportFacade, ReportParamsBuilder, SALE_CODE_REPORT, WHATSAPP_MESSAGING_PORT, WhatsAppMessageBuilder, WhatsAppMessagingFacade, WhatsAppSender };
|
|
1936
|
+
export { ACCOUNTING_CODE_REPORT, API_PATHS, APPROVAL_CODE_REPORT, BILLING_CODE_REPORT, CUSTOMER_CODE_REPORT, DOCUMENT_TYPES, ELECTRONIC_DOCUMENT_CODE, FileMapperUtil, GreenWhatsAppAdapter, INVENTORY_CODE_REPORT, MetaWhatsAppAdapter, PRINTER_PORT, PURCHASE_CODE_REPORT, PhoneFormatterUtil, PrinterAdapter, PrinterFacade, REPORT_FORMAT, REPORT_PORT, ReportAdapter, ReportFacade, ReportParamsBuilder, SALE_CODE_REPORT, TECHNICAL_SUPPORT_CODE_REPORT, WHATSAPP_MESSAGING_PORT, WhatsAppMessageBuilder, WhatsAppMessagingFacade, WhatsAppSender };
|
|
1679
1937
|
//# sourceMappingURL=acontplus-ng-common.mjs.map
|