asv-hlps-market 1.0.0 → 1.0.1

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.
Files changed (89) hide show
  1. package/package.json +1 -1
  2. package/lib/cjs/bills/bill.d.ts +0 -19
  3. package/lib/cjs/bills/bill.js +0 -79
  4. package/lib/cjs/bills/models/Bill.d.ts +0 -21
  5. package/lib/cjs/bills/models/Bill.js +0 -2
  6. package/lib/cjs/models/Gender.d.ts +0 -6
  7. package/lib/cjs/models/Gender.js +0 -2
  8. package/lib/cjs/models/Sale.d.ts +0 -34
  9. package/lib/cjs/models/Sale.js +0 -2
  10. package/lib/cjs/models/SaleProduct.d.ts +0 -18
  11. package/lib/cjs/models/SaleProduct.js +0 -6
  12. package/lib/cjs/models/Ste.d.ts +0 -8
  13. package/lib/cjs/models/Ste.js +0 -2
  14. package/lib/cjs/models/SteGrp.d.ts +0 -7
  15. package/lib/cjs/models/SteGrp.js +0 -2
  16. package/lib/cjs/models/Titr.d.ts +0 -5
  17. package/lib/cjs/models/Titr.js +0 -2
  18. package/lib/cjs/models/User.d.ts +0 -38
  19. package/lib/cjs/models/User.js +0 -2
  20. package/lib/cjs/models/UserGrp.d.ts +0 -4
  21. package/lib/cjs/models/UserGrp.js +0 -2
  22. package/lib/cjs/models/UserRole.d.ts +0 -5
  23. package/lib/cjs/models/UserRole.js +0 -2
  24. package/lib/cjs/models/shared/NaAc.d.ts +0 -6
  25. package/lib/cjs/models/shared/NaAc.js +0 -2
  26. package/lib/cjs/models/shared/NaCoAc.d.ts +0 -4
  27. package/lib/cjs/models/shared/NaCoAc.js +0 -2
  28. package/lib/cjs/models/shared/NaCoShortAc.d.ts +0 -4
  29. package/lib/cjs/models/shared/NaCoShortAc.js +0 -2
  30. package/lib/cjs/pdfs/invoices/amountInvoice.d.ts +0 -66
  31. package/lib/cjs/pdfs/invoices/amountInvoice.js +0 -144
  32. package/lib/cjs/pdfs/invoices/infoInvoice.d.ts +0 -32
  33. package/lib/cjs/pdfs/invoices/infoInvoice.js +0 -80
  34. package/lib/cjs/pdfs/tools/tools.d.ts +0 -34
  35. package/lib/cjs/pdfs/tools/tools.js +0 -53
  36. package/lib/cjs/products/interfaces/Product.d.ts +0 -53
  37. package/lib/cjs/products/interfaces/Product.js +0 -2
  38. package/lib/cjs/products/interfaces/ProductCat.d.ts +0 -6
  39. package/lib/cjs/products/interfaces/ProductCat.js +0 -2
  40. package/lib/cjs/products/interfaces/ProductStore.d.ts +0 -24
  41. package/lib/cjs/products/interfaces/ProductStore.js +0 -2
  42. package/lib/cjs/products/product.d.ts +0 -3
  43. package/lib/cjs/products/product.js +0 -22
  44. package/lib/cjs/sales/sale.d.ts +0 -18
  45. package/lib/cjs/sales/sale.js +0 -129
  46. package/lib/esm/bills/bill.d.ts +0 -19
  47. package/lib/esm/bills/bill.js +0 -58
  48. package/lib/esm/bills/models/Bill.d.ts +0 -21
  49. package/lib/esm/bills/models/Bill.js +0 -1
  50. package/lib/esm/models/Gender.d.ts +0 -6
  51. package/lib/esm/models/Gender.js +0 -1
  52. package/lib/esm/models/Sale.d.ts +0 -34
  53. package/lib/esm/models/Sale.js +0 -1
  54. package/lib/esm/models/SaleProduct.d.ts +0 -18
  55. package/lib/esm/models/SaleProduct.js +0 -2
  56. package/lib/esm/models/Ste.d.ts +0 -8
  57. package/lib/esm/models/Ste.js +0 -1
  58. package/lib/esm/models/SteGrp.d.ts +0 -7
  59. package/lib/esm/models/SteGrp.js +0 -1
  60. package/lib/esm/models/Titr.d.ts +0 -5
  61. package/lib/esm/models/Titr.js +0 -1
  62. package/lib/esm/models/User.d.ts +0 -38
  63. package/lib/esm/models/User.js +0 -1
  64. package/lib/esm/models/UserGrp.d.ts +0 -4
  65. package/lib/esm/models/UserGrp.js +0 -1
  66. package/lib/esm/models/UserRole.d.ts +0 -5
  67. package/lib/esm/models/UserRole.js +0 -1
  68. package/lib/esm/models/shared/NaAc.d.ts +0 -6
  69. package/lib/esm/models/shared/NaAc.js +0 -1
  70. package/lib/esm/models/shared/NaCoAc.d.ts +0 -4
  71. package/lib/esm/models/shared/NaCoAc.js +0 -1
  72. package/lib/esm/models/shared/NaCoShortAc.d.ts +0 -4
  73. package/lib/esm/models/shared/NaCoShortAc.js +0 -1
  74. package/lib/esm/pdfs/invoices/amountInvoice.d.ts +0 -66
  75. package/lib/esm/pdfs/invoices/amountInvoice.js +0 -137
  76. package/lib/esm/pdfs/invoices/infoInvoice.d.ts +0 -26
  77. package/lib/esm/pdfs/invoices/infoInvoice.js +0 -75
  78. package/lib/esm/pdfs/tools/tools.d.ts +0 -34
  79. package/lib/esm/pdfs/tools/tools.js +0 -47
  80. package/lib/esm/products/interfaces/Product.d.ts +0 -53
  81. package/lib/esm/products/interfaces/Product.js +0 -1
  82. package/lib/esm/products/interfaces/ProductCat.d.ts +0 -6
  83. package/lib/esm/products/interfaces/ProductCat.js +0 -1
  84. package/lib/esm/products/interfaces/ProductStore.d.ts +0 -24
  85. package/lib/esm/products/interfaces/ProductStore.js +0 -1
  86. package/lib/esm/products/product.d.ts +0 -3
  87. package/lib/esm/products/product.js +0 -17
  88. package/lib/esm/sales/sale.d.ts +0 -19
  89. package/lib/esm/sales/sale.js +0 -112
@@ -1,112 +0,0 @@
1
- import { convertEnDateToFr, formatToStringCfa, labelSteName, removeBackSlashOccurences } from "asv-hlps";
2
- import { unitPriceByClientCat } from "../products/product";
3
- export const getNbProductsOnSale = (sale) => {
4
- return sale.saleProducts.length || 0;
5
- };
6
- export const getTotalTvaOnSale = (sale, dlvr = false) => {
7
- return sale.saleProducts.reduce((prev, curr) => {
8
- const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : unitPriceByClientCat(curr.product, sale.client, curr.speUnitPrice);
9
- return !dlvr
10
- ? Math.ceil(prev + unitPrice * (+curr.product.tva / 100) * +curr.qtityOdr)
11
- : Math.ceil(prev + unitPrice * (+curr.product.tva / 100) * +curr.qtityDlvr);
12
- }, 0);
13
- };
14
- export const getSubTotalAmountOnSale = (sale, dlvr = false) => {
15
- return sale.saleProducts.reduce((prev, curr) => {
16
- const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : unitPriceByClientCat(curr.product, sale.client, curr.speUnitPrice);
17
- return !dlvr ? Math.ceil(prev + unitPrice * +curr.qtityOdr) : Math.ceil(prev + unitPrice * +curr.qtityDlvr);
18
- }, 0);
19
- };
20
- export const getSubTotalAmountBackOnSale = (sale) => {
21
- return sale.saleProducts.reduce((prev, curr) => {
22
- const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : unitPriceByClientCat(curr.product, sale.client, curr.speUnitPrice);
23
- return Math.ceil(prev + unitPrice * +curr.qtityBack);
24
- }, 0);
25
- };
26
- export const getTotalAmountWithoutTvaOnSale = (sale, dlvr = false) => {
27
- return sale.saleProducts.reduce((prev, curr) => {
28
- const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : unitPriceByClientCat(curr.product, sale.client, curr.speUnitPrice);
29
- return !dlvr ? Math.ceil(prev + unitPrice * +curr.qtityOdr) : Math.ceil(prev + unitPrice * +curr.qtityDlvr);
30
- }, 0);
31
- };
32
- export const getTotalAmountWithoutTvaBackOnSale = (sale) => {
33
- return sale.saleProducts.reduce((prev, curr) => {
34
- const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : unitPriceByClientCat(curr.product, sale.client, curr.speUnitPrice);
35
- return Math.ceil(prev + unitPrice * +curr.qtityBack);
36
- }, 0);
37
- };
38
- export const getTotalTvaOnSaleOnSale = (sale, dlvr = false) => {
39
- return sale.saleProducts.reduce((prev, curr) => {
40
- const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : unitPriceByClientCat(curr.product, sale.client, curr.speUnitPrice);
41
- return !dlvr
42
- ? Math.ceil(prev + unitPrice * (+curr.product.tva / 100) * +curr.qtityOdr)
43
- : Math.ceil(prev + unitPrice * (+curr.product.tva / 100) * +curr.qtityDlvr);
44
- }, 0);
45
- };
46
- export const getTotalTvaBackOnSale = (sale) => {
47
- return sale.saleProducts.reduce((prev, curr) => {
48
- const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : unitPriceByClientCat(curr.product, sale.client, curr.speUnitPrice);
49
- return Math.ceil(prev + unitPrice * (+curr.product.tva / 100) * +curr.qtityBack);
50
- }, 0);
51
- };
52
- export const getTotalAmountOnSale = (sale, dlvr = false) => {
53
- return getTotalAmountWithoutTvaOnSale(sale, dlvr) + getTotalTvaOnSale(sale, dlvr);
54
- };
55
- export const getTotalAmountBackOnSale = (sale) => {
56
- return getTotalAmountWithoutTvaBackOnSale(sale) + getTotalTvaBackOnSale(sale);
57
- };
58
- export const getTotalAmountAllIncludedOnSale = (sale, dlvr = false) => {
59
- return getTotalAmountOnSale(sale, dlvr) + getTotalShippingOnSale(sale) - getTotalAmountDiscountOnSale(sale, dlvr) || 0;
60
- };
61
- // export const getTotalShippingOnSale = (shippingFee: number , otherFee: number = 0) => {
62
- export const getTotalShippingOnSale = (sale) => {
63
- return (+sale.shippingFee || 0) + (+sale.otherFee || 0);
64
- };
65
- export const getTotalAmountDiscountOnSale = (sale, dlvr = false) => {
66
- return getTotalAmountOnSale(sale, dlvr) * (+sale.discountRate / 100 || 0);
67
- };
68
- export const getTotalQtityOnSale = (sale, dlvr = false) => {
69
- return sale.saleProducts.reduce((prev, curr) => {
70
- return !dlvr
71
- ? Math.ceil(prev + (+curr.qtityOdr + (+curr.qtityFree || 0)))
72
- : Math.ceil(prev + (+curr.qtityDlvr + (+curr.qtityFree || 0)));
73
- }, 0);
74
- };
75
- export const getTotalQtityFreeOnSale = (sale) => {
76
- return sale.saleProducts.reduce((prev, curr) => {
77
- return Math.ceil(prev + (+curr.qtityFree || 0));
78
- }, 0);
79
- };
80
- export const getTotalQtityOdrOrDlvrOnSale = (sale, dlvr = false) => {
81
- return sale.saleProducts.reduce((prev, curr) => {
82
- return !dlvr ? Math.ceil(prev + (+curr.qtityOdr || 0)) : Math.ceil(prev + (+curr.qtityDlvr || 0));
83
- }, 0);
84
- };
85
- export const tabLabel = (sale) => {
86
- const labels = [];
87
- for (const sp of sale.saleProducts) {
88
- for (let j = 0; j < (+sp.qtityDlvr + +sp.qtityFree); j++) {
89
- const name = labelSteName(sale.client.ste);
90
- const product = sp.product.designation;
91
- const pp = formatToStringCfa(Math.ceil(sp.publicPrice));
92
- const saleDate = convertEnDateToFr(sale.saleDate, '/');
93
- // const saleDate = formatDateYmd(sale.saleDate, '/');
94
- // const saleDate = moment(sale.saleDate ).format('DD/MM/YYYY');
95
- labels.push({ name, product, pp, saleDate });
96
- }
97
- }
98
- const tabLen = labels.length;
99
- const modulo = tabLen % 5;
100
- if (modulo !== 0) {
101
- for (let i = 0; i < (5 - +modulo); i++) {
102
- labels.push({ name: 'L\' OEIL DE DIEU', product: 'est votre meilleur ami', pp: ' ', saleDate: ' ' });
103
- }
104
- }
105
- return labels;
106
- };
107
- export const refSaleGenerator = () => {
108
- let date = new Date();
109
- const nDate = 'C' + date.toLocaleDateString().split('-').join('') + date.toLocaleTimeString().split(':').join('');
110
- return removeBackSlashOccurences(nDate, '').toLocaleUpperCase();
111
- // return randomatic('A', 4) + date.toLocaleDateString().split('-').join('') + date.toLocaleTimeString().split(':').join('')
112
- };