pangea-server 3.3.11 → 3.3.12

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.
@@ -55,8 +55,14 @@ class Arca {
55
55
  if (concept !== 'products' && (serviceFrom === null || serviceTo === null || paymentDueDate === null))
56
56
  throw new Error('Service dates are required');
57
57
  const lastVoucher = await this.__afip.ElectronicBilling.getLastVoucher(pointOfSale, afipVoucherType);
58
+ let voucherDate = Number(new Date(Date.now() - new Date().getTimezoneOffset() * 60000).toISOString().split('T')[0].replace(/-/g, ''));
59
+ if (lastVoucher !== 0) {
60
+ const lastVoucherInfo = await this.__afip.ElectronicBilling.getVoucherInfo(lastVoucher, pointOfSale, afipVoucherType);
61
+ if (lastVoucherInfo && Number(lastVoucherInfo.CbteFch) > voucherDate) {
62
+ voucherDate = Number(lastVoucherInfo.CbteFch);
63
+ }
64
+ }
58
65
  const voucherNumber = lastVoucher + 1;
59
- const voucherDate = Number(new Date(Date.now() - new Date().getTimezoneOffset() * 60000).toISOString().split('T')[0].replace(/-/g, ''));
60
66
  const data = {
61
67
  CantReg: 1,
62
68
  PtoVta: pointOfSale,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pangea-server",
3
3
  "description": "",
4
- "version": "3.3.11",
4
+ "version": "3.3.12",
5
5
  "files": [
6
6
  "dist"
7
7
  ],