asv-hlps-market 1.0.6 → 1.0.9

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 (166) hide show
  1. package/lib/cjs/bills/bill.d.ts +19 -0
  2. package/lib/cjs/bills/bill.js +79 -0
  3. package/lib/cjs/bills/models/Bill.d.ts +21 -0
  4. package/lib/cjs/buys/models/Buy.d.ts +3 -2
  5. package/lib/cjs/buys/models/BuyProduct.d.ts +3 -0
  6. package/lib/cjs/index.d.ts +12 -2
  7. package/lib/cjs/index.js +14 -2
  8. package/lib/cjs/markets/index.d.ts +1 -0
  9. package/lib/cjs/{shops → markets}/index.js +1 -1
  10. package/lib/cjs/{models → markets/models}/Market.d.ts +2 -1
  11. package/lib/{esm → cjs/markets}/models/UMarket.d.ts +2 -2
  12. package/lib/cjs/models/Gender.d.ts +6 -0
  13. package/lib/cjs/models/Gender.js +2 -0
  14. package/lib/cjs/models/Sale.d.ts +34 -0
  15. package/lib/cjs/models/Sale.js +2 -0
  16. package/lib/cjs/models/SaleProduct.d.ts +18 -0
  17. package/lib/cjs/models/SaleProduct.js +6 -0
  18. package/lib/cjs/models/Ste.d.ts +8 -0
  19. package/lib/cjs/models/Ste.js +2 -0
  20. package/lib/cjs/models/SteGrp.d.ts +7 -0
  21. package/lib/cjs/models/SteGrp.js +2 -0
  22. package/lib/cjs/models/Titr.d.ts +5 -0
  23. package/lib/cjs/models/Titr.js +2 -0
  24. package/lib/cjs/models/User.d.ts +38 -0
  25. package/lib/cjs/models/User.js +2 -0
  26. package/lib/cjs/models/UserGrp.d.ts +4 -0
  27. package/lib/cjs/models/UserGrp.js +2 -0
  28. package/lib/cjs/models/UserRole.d.ts +5 -0
  29. package/lib/cjs/models/UserRole.js +2 -0
  30. package/lib/cjs/models/shared/NaAc.d.ts +6 -0
  31. package/lib/cjs/models/shared/NaAc.js +2 -0
  32. package/lib/cjs/models/shared/NaCoAc.d.ts +4 -0
  33. package/lib/cjs/models/shared/NaCoAc.js +2 -0
  34. package/lib/cjs/models/shared/NaCoShortAc.d.ts +4 -0
  35. package/lib/cjs/models/shared/NaCoShortAc.js +2 -0
  36. package/lib/cjs/pdfs/invoices/amountInvoice.d.ts +66 -0
  37. package/lib/cjs/pdfs/invoices/amountInvoice.js +144 -0
  38. package/lib/cjs/pdfs/invoices/infoInvoice.d.ts +32 -0
  39. package/lib/cjs/pdfs/invoices/infoInvoice.js +80 -0
  40. package/lib/cjs/pdfs/tools/tools.d.ts +34 -0
  41. package/lib/cjs/pdfs/tools/tools.js +53 -0
  42. package/lib/cjs/products/hlpProduct.d.ts +1 -2
  43. package/lib/cjs/products/hlpProduct.js +7 -16
  44. package/lib/cjs/products/interfaces/Product.d.ts +53 -0
  45. package/lib/cjs/products/interfaces/Product.js +2 -0
  46. package/lib/cjs/products/interfaces/ProductCat.d.ts +6 -0
  47. package/lib/cjs/products/interfaces/ProductCat.js +2 -0
  48. package/lib/cjs/products/interfaces/ProductStore.d.ts +24 -0
  49. package/lib/cjs/products/interfaces/ProductStore.js +2 -0
  50. package/lib/cjs/products/models/Product.d.ts +5 -5
  51. package/lib/cjs/products/product.d.ts +3 -0
  52. package/lib/cjs/products/product.js +22 -0
  53. package/lib/cjs/sales/models/SaleItems.d.ts +2 -2
  54. package/lib/cjs/sales/models/SalePayment.d.ts +2 -1
  55. package/lib/cjs/sales/sale.d.ts +18 -0
  56. package/lib/cjs/sales/sale.js +129 -0
  57. package/lib/cjs/shared/CartItem.js +0 -1
  58. package/lib/cjs/shopping/models/CartItem.d.ts +6 -0
  59. package/lib/cjs/shopping/models/CartItem.js +2 -0
  60. package/lib/cjs/shopping/models/index.d.ts +1 -0
  61. package/lib/cjs/shopping/models/index.js +17 -0
  62. package/lib/cjs/shops/models/CartItem.d.ts +6 -0
  63. package/lib/cjs/shops/models/CartItem.js +2 -0
  64. package/lib/cjs/shops/models/Shop.d.ts +1 -1
  65. package/lib/cjs/shops/models/index.d.ts +1 -0
  66. package/lib/cjs/shops/models/index.js +17 -0
  67. package/lib/cjs/users/index.d.ts +1 -0
  68. package/lib/cjs/users/index.js +17 -0
  69. package/lib/cjs/users/models/User.d.ts +1 -1
  70. package/lib/cjs/users/models/index.d.ts +1 -0
  71. package/lib/cjs/users/models/index.js +17 -0
  72. package/lib/esm/bills/bill.d.ts +19 -0
  73. package/lib/esm/bills/bill.js +58 -0
  74. package/lib/esm/bills/models/Bill.d.ts +21 -0
  75. package/lib/esm/buys/models/Buy.d.ts +3 -2
  76. package/lib/esm/buys/models/BuyProduct.d.ts +3 -0
  77. package/lib/esm/index.d.ts +12 -2
  78. package/lib/esm/index.js +14 -2
  79. package/lib/esm/markets/index.d.ts +1 -0
  80. package/lib/esm/markets/index.js +1 -0
  81. package/lib/esm/{models → markets/models}/Market.d.ts +2 -1
  82. package/lib/{cjs → esm/markets}/models/UMarket.d.ts +2 -2
  83. package/lib/esm/models/Gender.d.ts +6 -0
  84. package/lib/esm/models/Gender.js +1 -0
  85. package/lib/esm/models/Sale.d.ts +34 -0
  86. package/lib/esm/models/Sale.js +1 -0
  87. package/lib/esm/models/SaleProduct.d.ts +18 -0
  88. package/lib/esm/models/SaleProduct.js +2 -0
  89. package/lib/esm/models/Ste.d.ts +8 -0
  90. package/lib/esm/models/Ste.js +1 -0
  91. package/lib/esm/models/SteGrp.d.ts +7 -0
  92. package/lib/esm/models/SteGrp.js +1 -0
  93. package/lib/esm/models/Titr.d.ts +5 -0
  94. package/lib/esm/models/Titr.js +1 -0
  95. package/lib/esm/models/User.d.ts +38 -0
  96. package/lib/esm/models/User.js +1 -0
  97. package/lib/esm/models/UserGrp.d.ts +4 -0
  98. package/lib/esm/models/UserGrp.js +1 -0
  99. package/lib/esm/models/UserRole.d.ts +5 -0
  100. package/lib/esm/models/UserRole.js +1 -0
  101. package/lib/esm/models/shared/NaAc.d.ts +6 -0
  102. package/lib/esm/models/shared/NaAc.js +1 -0
  103. package/lib/esm/models/shared/NaCoAc.d.ts +4 -0
  104. package/lib/esm/models/shared/NaCoAc.js +1 -0
  105. package/lib/esm/models/shared/NaCoShortAc.d.ts +4 -0
  106. package/lib/esm/models/shared/NaCoShortAc.js +1 -0
  107. package/lib/esm/pdfs/invoices/amountInvoice.d.ts +66 -0
  108. package/lib/esm/pdfs/invoices/amountInvoice.js +137 -0
  109. package/lib/esm/pdfs/invoices/infoInvoice.d.ts +26 -0
  110. package/lib/esm/pdfs/invoices/infoInvoice.js +75 -0
  111. package/lib/esm/pdfs/tools/tools.d.ts +34 -0
  112. package/lib/esm/pdfs/tools/tools.js +47 -0
  113. package/lib/esm/products/hlpProduct.d.ts +1 -2
  114. package/lib/esm/products/hlpProduct.js +7 -16
  115. package/lib/esm/products/interfaces/Product.d.ts +53 -0
  116. package/lib/esm/products/interfaces/Product.js +1 -0
  117. package/lib/esm/products/interfaces/ProductCat.d.ts +6 -0
  118. package/lib/esm/products/interfaces/ProductCat.js +1 -0
  119. package/lib/esm/products/interfaces/ProductStore.d.ts +24 -0
  120. package/lib/esm/products/interfaces/ProductStore.js +1 -0
  121. package/lib/esm/products/models/Product.d.ts +5 -5
  122. package/lib/esm/products/product.d.ts +3 -0
  123. package/lib/esm/products/product.js +17 -0
  124. package/lib/esm/sales/models/SaleItems.d.ts +2 -2
  125. package/lib/esm/sales/models/SalePayment.d.ts +2 -1
  126. package/lib/esm/sales/sale.d.ts +18 -0
  127. package/lib/esm/sales/sale.js +109 -0
  128. package/lib/esm/shared/CartItem.js +0 -1
  129. package/lib/esm/shopping/models/CartItem.d.ts +6 -0
  130. package/lib/esm/shopping/models/CartItem.js +1 -0
  131. package/lib/esm/shopping/models/index.d.ts +1 -0
  132. package/lib/esm/shopping/models/index.js +1 -0
  133. package/lib/esm/shops/models/CartItem.d.ts +6 -0
  134. package/lib/esm/shops/models/CartItem.js +1 -0
  135. package/lib/esm/shops/models/Shop.d.ts +1 -1
  136. package/lib/esm/shops/models/index.d.ts +1 -0
  137. package/lib/esm/shops/models/index.js +1 -0
  138. package/lib/esm/users/index.d.ts +1 -0
  139. package/lib/esm/users/index.js +1 -0
  140. package/lib/esm/users/models/User.d.ts +1 -1
  141. package/lib/esm/users/models/index.d.ts +1 -0
  142. package/lib/esm/users/models/index.js +1 -0
  143. package/package.json +4 -4
  144. package/lib/cjs/pos/CartProduct.d.ts +0 -6
  145. package/lib/cjs/pos/hlpShop.d.ts +0 -37
  146. package/lib/cjs/pos/hlpShop.js +0 -216
  147. package/lib/cjs/pos/index.d.ts +0 -1
  148. package/lib/cjs/pos/index.js +0 -8
  149. package/lib/cjs/shops/index.d.ts +0 -1
  150. package/lib/esm/pos/CartProduct.d.ts +0 -6
  151. package/lib/esm/pos/hlpShop.d.ts +0 -37
  152. package/lib/esm/pos/hlpShop.js +0 -210
  153. package/lib/esm/pos/index.d.ts +0 -1
  154. package/lib/esm/pos/index.js +0 -1
  155. package/lib/esm/shops/index.d.ts +0 -1
  156. package/lib/esm/shops/index.js +0 -1
  157. /package/lib/cjs/{models/Market.js → bills/models/Bill.js} +0 -0
  158. /package/lib/cjs/{models/UMarket.js → markets/models/Market.js} +0 -0
  159. /package/lib/cjs/{pos/CartProduct.js → markets/models/UMarket.js} +0 -0
  160. /package/lib/cjs/{models → markets/models}/index.d.ts +0 -0
  161. /package/lib/cjs/{models → markets/models}/index.js +0 -0
  162. /package/lib/esm/{models/Market.js → bills/models/Bill.js} +0 -0
  163. /package/lib/esm/{models/UMarket.js → markets/models/Market.js} +0 -0
  164. /package/lib/esm/{pos/CartProduct.js → markets/models/UMarket.js} +0 -0
  165. /package/lib/esm/{models → markets/models}/index.d.ts +0 -0
  166. /package/lib/esm/{models → markets/models}/index.js +0 -0
@@ -0,0 +1,137 @@
1
+ import { formatToStringCfa } from "asv-hlps";
2
+ import { getTotalAmountAllIncludedOnBill, getTotalAmountTvaOnBill, getTotalAmountWithoutTvaOnBill } from "../../bills/bill";
3
+ import { getTotalAmountAllIncludedOnSale, getTotalAmountWithoutTvaOnSale, getTotalShippingOnSale, getTotalTvaOnSale } from '../../sales/sale';
4
+ export const infoAmountOnBl = (tob) => {
5
+ const totalAmountWithoutTva = (tob.isBack && (tob.backChoice.toLowerCase() === 'autre' || tob.rejectedReason)) ? 0 : formatToStringCfa(getTotalAmountWithoutTvaOnSale(tob, true));
6
+ // const totalPort = formatToStringCfa(HlpSale.getTotalShipping(tob));
7
+ const totalTva = formatToStringCfa(getTotalTvaOnSale(tob, true));
8
+ const totalAmountAllIncluded = (tob.isBack && (tob.backChoice.toLowerCase() === 'autre' || tob.rejectedReason)) ? 0 : formatToStringCfa(getTotalAmountAllIncludedOnSale(tob, true));
9
+ const tabFooter = {
10
+ width: '50%',
11
+ table: {
12
+ headerRows: 1,
13
+ // widths: [ 100, 100, 100, 100 ],
14
+ widths: ['*', '*', '*', '*'],
15
+ heights: [6],
16
+ body: [
17
+ [
18
+ { text: 'TOTAL HT', style: 'headerText' },
19
+ // {text: 'PORT HT', style: 'headerText'},
20
+ { text: 'TOTAL TVA', style: 'headerText' },
21
+ { text: 'TOTAL TTC', style: 'headerText' },
22
+ { text: 'NET A PAYER', style: 'headerText' }
23
+ ],
24
+ [
25
+ { text: totalAmountWithoutTva, style: 'rowText', alignment: 'center' },
26
+ // { text: totalPort, style: 'rowText', alignment: 'center' },
27
+ { text: totalTva, style: 'rowText', alignment: 'center' },
28
+ { text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
29
+ { text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
30
+ ]
31
+ ]
32
+ }
33
+ };
34
+ return tabFooter;
35
+ };
36
+ export const infoAmountOnProforma = (tob) => {
37
+ const totalAmountWithoutTva = (tob.isBack && tob.backChoice.toLowerCase() === 'autre') ? 0 : formatToStringCfa(getTotalAmountWithoutTvaOnSale(tob));
38
+ // const totalPort = formatToStringCfa(HlpSale.getTotalShipping(tob));
39
+ const totalTva = formatToStringCfa(getTotalTvaOnSale(tob));
40
+ const totalAmountAllIncluded = (tob.isBack && tob.backChoice.toLowerCase() === 'autre') ? 0 : formatToStringCfa(getTotalAmountAllIncludedOnSale(tob));
41
+ const tabFooter = {
42
+ width: '50%',
43
+ table: {
44
+ headerRows: 1,
45
+ // widths: [ 100, 100, 100, 100 ],
46
+ widths: ['*', '*', '*', '*'],
47
+ heights: [6],
48
+ body: [
49
+ [
50
+ { text: 'TOTAL HT', style: 'headerText' },
51
+ // {text: 'PORT HT', style: 'headerText'},
52
+ { text: 'TOTAL TVA', style: 'headerText' },
53
+ { text: 'TOTAL TTC', style: 'headerText' },
54
+ { text: 'NET A PAYER', style: 'headerText' }
55
+ ],
56
+ [
57
+ { text: totalAmountWithoutTva, style: 'rowText', alignment: 'center' },
58
+ // { text: totalPort, style: 'rowText', alignment: 'center' },
59
+ { text: totalTva, style: 'rowText', alignment: 'center' },
60
+ { text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
61
+ { text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
62
+ ]
63
+ ]
64
+ }
65
+ };
66
+ return tabFooter;
67
+ };
68
+ export const infoAmounOntSale = (tob) => {
69
+ const totalAmountWithoutTva = (tob.isBack && (tob.backChoice.toLowerCase() === 'autre' || tob.rejectedReason)) ? 0 : formatToStringCfa(getTotalAmountWithoutTvaOnSale(tob, true));
70
+ const totalPort = formatToStringCfa(getTotalShippingOnSale(tob));
71
+ const totalTva = formatToStringCfa(getTotalTvaOnSale(tob, true));
72
+ const totalAmountAllIncluded = (tob.isBack && (tob.backChoice.toLowerCase() === 'autre' || tob.rejectedReason)) ? 0 : formatToStringCfa(getTotalAmountAllIncludedOnSale(tob, true));
73
+ const tabFooter = {
74
+ width: '50%',
75
+ table: {
76
+ headerRows: 1,
77
+ // widths: [ 100, 100, 100, 100 ],
78
+ widths: ['*', '*', '*', '*', '*'],
79
+ heights: [6],
80
+ body: [
81
+ [
82
+ { text: 'TOTAL HT', style: 'headerText' },
83
+ { text: 'PORT HT', style: 'headerText' },
84
+ { text: 'TOTAL TVA', style: 'headerText' },
85
+ { text: 'TOTAL TTC', style: 'headerText' },
86
+ { text: 'NET A PAYER', style: 'headerText' }
87
+ ],
88
+ [
89
+ { text: totalAmountWithoutTva, style: 'rowText', alignment: 'center' },
90
+ { text: totalPort, style: 'rowText', alignment: 'center' },
91
+ { text: totalTva, style: 'rowText', alignment: 'center' },
92
+ { text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
93
+ { text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
94
+ ]
95
+ ]
96
+ }
97
+ };
98
+ return tabFooter;
99
+ };
100
+ export const infoAmountOnBill = (tob) => {
101
+ const totalAmountAllAndBackInclused = getTotalAmountAllIncludedOnBill(tob.sales);
102
+ const totalAmountWithoutTvaAllAndBack = getTotalAmountWithoutTvaOnBill(tob.sales);
103
+ const totalAmountTvaAllAndBack = getTotalAmountTvaOnBill(tob.sales);
104
+ // const totalAmountWithoutTva = formatToStringCfa(HlpSale.getTotalAmountWithoutTvaOnBill(tob.sales));
105
+ const totalAmountWithoutTva = formatToStringCfa(totalAmountWithoutTvaAllAndBack);
106
+ // const totalPort = formatToStringCfa(HlpSale.getTotalShipping(tob));
107
+ const totalTva = formatToStringCfa(totalAmountTvaAllAndBack);
108
+ // const totalTva = formatToStringCfa(HlpSale.getTotalAmountTvaOnBill(tob.sales));
109
+ // const totalAmountAllIncluded = formatToStringCfa(HlpSale.getTotalAmountOnBill(tob.sales));
110
+ const totalAmountAllIncluded = formatToStringCfa(totalAmountAllAndBackInclused);
111
+ const tabFooter = {
112
+ width: '50%',
113
+ table: {
114
+ headerRows: 1,
115
+ // widths: [ 100, 100, 100, 100 ],
116
+ widths: ['*', '*', '*', '*'],
117
+ heights: [6],
118
+ body: [
119
+ [
120
+ { text: 'TOTAL HT', style: 'headerText' },
121
+ // {text: 'PORT HT', style: 'headerText'},
122
+ { text: 'TOTAL TVA', style: 'headerText' },
123
+ { text: 'TOTAL TTC', style: 'headerText' },
124
+ { text: 'NET A PAYER', style: 'headerText' }
125
+ ],
126
+ [
127
+ { text: totalAmountWithoutTva, style: 'rowText', alignment: 'center' },
128
+ // { text: totalPort, style: 'rowText', alignment: 'center' },
129
+ { text: totalTva, style: 'rowText', alignment: 'center' },
130
+ { text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
131
+ { text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
132
+ ]
133
+ ]
134
+ }
135
+ };
136
+ return tabFooter;
137
+ };
@@ -0,0 +1,26 @@
1
+ import { Bill } from 'asv-hlps-models';
2
+ import { Sale } from "asv-hlps-models";
3
+ export declare const infoSale: (tob: Sale) => {
4
+ width: string;
5
+ table: {
6
+ headerRows: number;
7
+ widths: (string | number)[];
8
+ heights: number[];
9
+ body: {
10
+ text: any;
11
+ style: string;
12
+ }[][];
13
+ };
14
+ };
15
+ export declare const infoBill: (tob: Bill) => {
16
+ width: string;
17
+ table: {
18
+ headerRows: number;
19
+ widths: (string | number)[];
20
+ heights: number[];
21
+ body: {
22
+ text: any;
23
+ style: string;
24
+ }[][];
25
+ };
26
+ };
@@ -0,0 +1,75 @@
1
+ import { convertEnDateToFr } from 'asv-hlps';
2
+ import { getNbFreezeOnBill, getNbPackagesOnBill, getNbProductsOnBill, getTotalQtityOnBill } from '../../bills/bill';
3
+ import { getNbProductsOnSale, getTotalQtityOnSale } from '../../sales/sale';
4
+ export const infoSale = (tob) => {
5
+ const totalQtity = getTotalQtityOnSale(tob);
6
+ const nbProducts = getNbProductsOnSale(tob);
7
+ const nbColis = tob.nbPackages;
8
+ const nbFreeze = tob.nbFreeze;
9
+ // const oWidth = [ '*', '*', 75, 75, 75, 75];
10
+ const tabTop = {
11
+ width: '50%',
12
+ table: {
13
+ headerRows: 1,
14
+ widths: ['*', '*', 75, 75, 75, 75],
15
+ heights: [6],
16
+ body: [
17
+ [
18
+ { text: 'FACTURE N°', style: 'headerText' },
19
+ { text: 'DATE', style: 'headerText' },
20
+ { text: 'NBRE DE PDTS', style: 'headerText' },
21
+ { text: 'QUANTITE TOTALE', style: 'headerText' },
22
+ { text: 'NBRE COLIS', style: 'headerText' },
23
+ { text: 'NBRE FROID', style: 'headerText' }
24
+ ],
25
+ [
26
+ { text: tob.ref, style: 'rowText' },
27
+ // { text: moment(tob.createdAt ).format('DD/MM/YYYY'), style: 'rowText'},
28
+ { text: convertEnDateToFr(tob.createdAt, '/'), style: 'rowText' },
29
+ { text: nbProducts, style: 'rowText' },
30
+ { text: totalQtity, style: 'rowText' },
31
+ { text: nbColis, style: 'rowText' },
32
+ { text: nbFreeze, style: 'rowText' },
33
+ ]
34
+ ]
35
+ }
36
+ };
37
+ return tabTop;
38
+ };
39
+ export const infoBill = (tob) => {
40
+ const totalQtity = getTotalQtityOnBill(tob.sales);
41
+ const nbProducts = getNbProductsOnBill(tob.sales);
42
+ const nbColis = getNbPackagesOnBill(tob.sales);
43
+ const nbFreeze = getNbFreezeOnBill(tob.sales);
44
+ const oWidth = ['*', '*', 75, 75, 75, 75];
45
+ const tabTop = {
46
+ width: '50%',
47
+ table: {
48
+ headerRows: 1,
49
+ // widths: [ 125, 125, 125, '*' ],
50
+ widths: oWidth,
51
+ heights: [6],
52
+ // widths: [ '16%', '16%', '16%', '16%' ],
53
+ body: [
54
+ [
55
+ { text: 'FACTURE N°', style: 'headerText' },
56
+ { text: 'DATE', style: 'headerText' },
57
+ { text: 'NBRE DE PDTS', style: 'headerText' },
58
+ { text: 'QUANTITE TOTALE', style: 'headerText' },
59
+ { text: 'NBRE COLIS', style: 'headerText' },
60
+ { text: 'NBRE FROID', style: 'headerText' }
61
+ ],
62
+ [
63
+ { text: tob.ref, style: 'rowText' },
64
+ // { text: moment(tob.createdAt ).format('DD/MM/YYYY'), style: 'rowText'},
65
+ { text: convertEnDateToFr(tob.createdAt, '/'), style: 'rowText' },
66
+ { text: nbProducts, style: 'rowText' },
67
+ { text: totalQtity, style: 'rowText' },
68
+ { text: nbColis, style: 'rowText' },
69
+ { text: nbFreeze, style: 'rowText' },
70
+ ]
71
+ ]
72
+ }
73
+ };
74
+ return tabTop;
75
+ };
@@ -0,0 +1,34 @@
1
+ import { User } from 'asv-hlps-models';
2
+ export declare const displayPdfDate: (label: string, fromDate: string, toDate: string) => string;
3
+ export declare const displayTitle: (title: string) => {
4
+ width: string;
5
+ alignment: string;
6
+ text: string;
7
+ bold: boolean;
8
+ margin: number[];
9
+ fontSize: number;
10
+ };
11
+ export declare const displayClient: (user: User) => {
12
+ absolutePosition: {
13
+ x: number;
14
+ y: number;
15
+ };
16
+ text: ({
17
+ text: string;
18
+ fontSize: number;
19
+ bold?: undefined;
20
+ } | {
21
+ text: string;
22
+ bold: boolean;
23
+ fontSize: number;
24
+ } | {
25
+ text: string;
26
+ fontSize?: undefined;
27
+ bold?: undefined;
28
+ })[];
29
+ color: string;
30
+ width: string;
31
+ fontSize: number;
32
+ bold: boolean;
33
+ alignment: string;
34
+ };
@@ -0,0 +1,47 @@
1
+ import { convertEnDateToFr, formatDateYmdHypen, getSteShortname } from "asv-hlps";
2
+ export const displayPdfDate = (label, fromDate, toDate) => {
3
+ fromDate = (!fromDate) ? formatDateYmdHypen(new Date()) : fromDate;
4
+ toDate = (!toDate) ? fromDate : toDate;
5
+ return label + ' du ' + convertEnDateToFr(fromDate) + ' au ' + convertEnDateToFr(toDate);
6
+ };
7
+ export const displayTitle = (title) => {
8
+ return {
9
+ width: '100%',
10
+ alignment: 'center',
11
+ text: title,
12
+ bold: true,
13
+ margin: [0, 10, 0, 10],
14
+ fontSize: 15,
15
+ };
16
+ };
17
+ export const displayClient = (user) => {
18
+ // const clientSte = user.ste ? HlpUser.getSteShortname(user.ste) : '';
19
+ const clientSte = user.ste ? getSteShortname(user.ste, ['pharmacie', 'clinique', 'hopital']) : '';
20
+ /* const clientLastname = (user.lastname) ? user.lastname : '';
21
+ const clientFirstname = (user.firstname) ? user.firstname : '';
22
+ const clientGender = (user.gender) ? user.gender.abr : ''; */
23
+ const clientName = user.ste ? clientSte : user.fullname;
24
+ const cp = user.cp ? user.cp : '';
25
+ const city = user.city ? user.city : '';
26
+ const nif = user.ste.nif ? user.ste.nif : '';
27
+ const address = user.address ? user.address : '';
28
+ const client = {
29
+ absolutePosition: { x: 310, y: 30 },
30
+ text: [
31
+ { text: 'CLIENT: ', fontSize: 8 },
32
+ { text: user.username + '\n', bold: true, fontSize: 10 },
33
+ { text: clientName + '\n' },
34
+ { text: address + ' ' },
35
+ { text: cp + '\n' },
36
+ { text: city + '\n' },
37
+ // {text: nif + '\n'}
38
+ ],
39
+ color: '#000',
40
+ width: 'auto',
41
+ fontSize: 12,
42
+ bold: true,
43
+ alignment: 'left',
44
+ // margin: [100, 0, 0, 0],
45
+ };
46
+ return client;
47
+ };
@@ -1,13 +1,12 @@
1
1
  import Product from "./models/Product";
2
2
  import ProductStock from "./models/ProductStock";
3
3
  declare class HlpProduct {
4
+ stock: (product: Product, param: "salable" | "packs" | "units") => number;
4
5
  qtityInAllDepots(stock: ProductStock, prms?: {
5
6
  exceptDepots?: string[];
6
7
  main?: "master" | "slave";
7
8
  }): number;
8
9
  getStockSalable(product: Product): number;
9
- stock: (product: Product, param: "salable" | "packs" | "units") => number;
10
- extraFiilters: (row: Product) => string;
11
10
  }
12
11
  declare const _default: HlpProduct;
13
12
  export default _default;
@@ -15,31 +15,22 @@ class HlpProduct {
15
15
  return salable;
16
16
  }
17
17
  };
18
- this.extraFiilters = (row) => row.designation; /* +
19
- row.codeCompta +
20
- (row.tva > 0 ? "@tva" : "") +
21
- (row.isAvailable ? "@dispo" : "") +
22
- (!row.isAvailable ? "@indispo" : "") +
23
- (row.isActive ? "@actif" : "") +
24
- (!row.isActive ? "@inactif" : "") +
25
- (row.isPrivate ? "@private" : "") +
26
- (!row.isPrivate ? "@noprivate" : ""); */
27
18
  }
28
19
  qtityInAllDepots(stock, prms) {
29
20
  const ins = stock.sumIns - stock.sumOuts;
30
21
  return ins <= 0 ? 0 : ins;
31
22
  }
32
23
  getStockSalable(product) {
33
- const stockAllSalable = +this.qtityInAllDepots(product.stock);
24
+ const stockAllSalable = this.qtityInAllDepots(product.stock);
34
25
  const stockProduct = Math.trunc(stockAllSalable / product.qtityUnit);
35
26
  /* let stockSalable: number = 0;
36
27
 
37
- if (stockAllSalable <= stockStore) {
38
- stockSalable = stockAllSalable;
39
- }
40
- if (stockAllSalable > stockStore) {
41
- stockSalable = stockStore;
42
- } */
28
+ if (stockAllSalable <= stockStore) {
29
+ stockSalable = stockAllSalable;
30
+ }
31
+ if (stockAllSalable > stockStore) {
32
+ stockSalable = stockStore;
33
+ } */
43
34
  // return stockSalable || 0;
44
35
  return stockProduct || 0;
45
36
  }
@@ -0,0 +1,53 @@
1
+ import { ProductCat } from "./ProductCat";
2
+ import { ProductStore } from "./ProductStore";
3
+ export interface Product {
4
+ id: number;
5
+ ref?: string;
6
+ designation?: string;
7
+ unitPrice?: number;
8
+ salePrice?: number;
9
+ pght?: number;
10
+ pghtPrice?: number;
11
+ codeHs?: string;
12
+ codeCip?: string;
13
+ codeCip7?: string;
14
+ codeEan?: string;
15
+ condeInam?: string;
16
+ codeCompta?: number;
17
+ codeAmm?: string;
18
+ codeAmmStart?: Date | string;
19
+ codeAmmEnd?: Date | string;
20
+ pvdPrice?: number;
21
+ fees?: number;
22
+ profit?: number;
23
+ profitPhcie?: number;
24
+ publicPrice?: number;
25
+ qtityLimit?: number;
26
+ stockLimit?: number;
27
+ stockMax?: number;
28
+ stockReap?: number;
29
+ stock?: number;
30
+ stockReserved?: number;
31
+ stockSalable?: number;
32
+ qtityPerPackaging?: number;
33
+ qtityPerBox?: number;
34
+ promo?: number;
35
+ isInOrder?: boolean;
36
+ coef?: number;
37
+ promoPerQtity?: number;
38
+ promoEndAt?: Date;
39
+ image?: string;
40
+ description?: string;
41
+ isActive?: boolean;
42
+ tva?: number;
43
+ discountRate?: number;
44
+ createdAt?: Date;
45
+ updatedAt?: Date;
46
+ hasPromo?: boolean;
47
+ inEqeer?: boolean;
48
+ qtityWarning?: boolean;
49
+ isPublished?: boolean;
50
+ isAvailable?: boolean;
51
+ cat?: ProductCat;
52
+ stores?: ProductStore[];
53
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface ProductCat {
2
+ id: number;
3
+ name: string;
4
+ code: string;
5
+ isActive: boolean;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ export interface ProductStore {
2
+ id?: number;
3
+ name?: string;
4
+ qtityLimit?: number;
5
+ stockLimit?: number;
6
+ stockMax?: number;
7
+ stock?: number;
8
+ stockReap?: number;
9
+ stockReserved?: number;
10
+ stockSalable?: number;
11
+ fees?: number;
12
+ pght?: number;
13
+ pvdPrice?: number;
14
+ pghtPrice?: number;
15
+ costPrice?: number;
16
+ salePrice?: number;
17
+ profitPhcie?: number;
18
+ publicPrice?: number;
19
+ isActive?: boolean;
20
+ isAvailable?: boolean;
21
+ isPublished?: boolean;
22
+ hasPromo?: boolean;
23
+ discountRate?: number;
24
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { Market } from "../../models/Market";
1
+ import Market from "../../markets/models/Market";
2
2
  import { Shop } from "../../shops/models/Shop";
3
3
  import ProductCat from "./ProductCat";
4
4
  import ProductImage from "./ProductImage";
@@ -9,6 +9,7 @@ interface Stock {
9
9
  qtityPerPackaging: number;
10
10
  }
11
11
  export default interface Product {
12
+ id: number;
12
13
  capacity: string;
13
14
  cat: ProductCat;
14
15
  createdAt: Date;
@@ -17,7 +18,6 @@ export default interface Product {
17
18
  disabled?: boolean;
18
19
  iconName: string;
19
20
  iconPack: string;
20
- id: number;
21
21
  images: ProductImage[];
22
22
  ins: ProductIn[];
23
23
  isActive: boolean;
@@ -27,14 +27,14 @@ export default interface Product {
27
27
  price: number;
28
28
  publicPrice: number;
29
29
  qtityLimit: number;
30
- qtityUnit: number;
31
- stock: Stock;
32
30
  qtityPerBox: number;
33
31
  qtityPerPackaging: number;
32
+ qtityUnit: number;
34
33
  ref: string;
35
34
  salePrice: number;
36
35
  shop: Shop;
37
- updatedAt: Date;
38
36
  specialPrice?: number;
37
+ stock: Stock;
38
+ updatedAt: Date;
39
39
  }
40
40
  export {};
@@ -0,0 +1,3 @@
1
+ import { Product, User } from "asv-hlps-models";
2
+ export declare const unitPriceByClientCat: (product: Product, client: User, speUnitPrice?: number, addDiscount?: boolean) => number;
3
+ export declare const productCatCode: (product: Product, catCodes: string[]) => boolean;
@@ -0,0 +1,17 @@
1
+ import { calculPercent, userCoef } from "asv-hlps";
2
+ export const unitPriceByClientCat = (product, client, speUnitPrice = 0, addDiscount = false) => {
3
+ if (speUnitPrice > 0) {
4
+ return speUnitPrice;
5
+ }
6
+ // const store = await getCustomRepository(ProductStoreRepository).getOneStoreByParams({storeName: 'cpa', productId: product.id})
7
+ if (product.stores[0].discountRate && addDiscount) {
8
+ return Math.ceil(product.stores[0].salePrice) - Math.ceil(calculPercent(product.stores[0].salePrice, product.stores[0].discountRate));
9
+ }
10
+ const clientCoef = (!client) ? 1 : userCoef(client);
11
+ return (productCatCode(product, ['spe', 'para'])) ?
12
+ Math.ceil(product.stores[0].salePrice) :
13
+ Math.ceil(product.stores[0].salePrice * clientCoef);
14
+ };
15
+ export const productCatCode = (product, catCodes) => {
16
+ return catCodes.includes(product.cat.code && product.cat.code.toLowerCase());
17
+ };
@@ -1,8 +1,8 @@
1
- import CartProduct from "../../pos/CartProduct";
1
+ import CartItem from "../../shopping/models/CartItem";
2
2
  import Sale from "./Sale";
3
3
  export default interface SaleItems {
4
4
  sale?: Sale;
5
- items?: CartProduct[];
5
+ items?: CartItem[];
6
6
  clientId?: number;
7
7
  fromMobile?: boolean;
8
8
  isWaiting?: boolean;
@@ -1,4 +1,5 @@
1
- import { Bank, BankAccount, PaymentMode } from "asv-hlps/lib/cjs/cashs";
1
+ import { Bank, BankAccount } from "asv-hlps/lib/cjs/cashs";
2
+ import PaymentMode from "asv-hlps/lib/cjs/cashs/models/PaymentMode";
2
3
  import User from "../../users/models/User";
3
4
  import Sale from "./Sale";
4
5
  export default interface SalePayment {
@@ -0,0 +1,18 @@
1
+ import { Sale } from "asv-hlps-models";
2
+ export declare const getNbProductsOnSale: (sale: Sale) => number;
3
+ export declare const getTotalTvaOnSale: (sale: Sale, dlvr?: boolean) => number;
4
+ export declare const getSubTotalAmountOnSale: (sale: Sale, dlvr?: boolean) => number;
5
+ export declare const getSubTotalAmountBackOnSale: (sale: Sale) => number;
6
+ export declare const getTotalAmountWithoutTvaOnSale: (sale: Sale, dlvr?: boolean) => number;
7
+ export declare const getTotalAmountWithoutTvaBackOnSale: (sale: Sale) => number;
8
+ export declare const getTotalTvaOnSaleOnSale: (sale: Sale, dlvr?: boolean) => number;
9
+ export declare const getTotalTvaBackOnSale: (sale: Sale) => number;
10
+ export declare const getTotalAmountOnSale: (sale: Sale, dlvr?: boolean) => number;
11
+ export declare const getTotalAmountBackOnSale: (sale: Sale) => number;
12
+ export declare const getTotalAmountAllIncludedOnSale: (sale: Sale, dlvr?: boolean) => number;
13
+ export declare const getTotalShippingOnSale: (sale: Sale) => number;
14
+ export declare const getTotalAmountDiscountOnSale: (sale: Sale, dlvr?: boolean) => number;
15
+ export declare const getTotalQtityOnSale: (sale: Sale, dlvr?: boolean) => number;
16
+ export declare const getTotalQtityFreeOnSale: (sale: Sale) => number;
17
+ export declare const getTotalQtityOdrOrDlvrOnSale: (sale: Sale, dlvr?: boolean) => number;
18
+ export declare const tabLabel: (sale: Sale) => any[];