asv-hlps 1.3.46 → 1.3.48

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 (107) hide show
  1. package/lib/cjs/auth/models/AuthTag.d.ts +1 -1
  2. package/lib/cjs/auth/models/AuthTagCat.d.ts +1 -1
  3. package/lib/cjs/bills/index.d.ts +1 -0
  4. package/lib/cjs/bills/index.js +1 -0
  5. package/lib/cjs/bills/pipes/index.d.ts +3 -0
  6. package/lib/cjs/bills/pipes/index.js +12 -0
  7. package/lib/cjs/estates/models/EstateCat.d.ts +1 -1
  8. package/lib/cjs/estates/models/EstateElt.d.ts +1 -1
  9. package/lib/cjs/estates/models/EstateLevel.d.ts +1 -1
  10. package/lib/cjs/estates/models/EstatePor.d.ts +1 -1
  11. package/lib/cjs/index.d.ts +7 -0
  12. package/lib/cjs/index.js +7 -0
  13. package/lib/cjs/pdfs/amountInvoice.d.ts +66 -0
  14. package/lib/cjs/pdfs/amountInvoice.js +152 -0
  15. package/lib/cjs/pdfs/index.d.ts +3 -0
  16. package/lib/cjs/pdfs/index.js +19 -0
  17. package/lib/cjs/pdfs/infoInvoice.d.ts +32 -0
  18. package/lib/cjs/pdfs/infoInvoice.js +79 -0
  19. package/lib/cjs/pdfs/tools.d.ts +41 -0
  20. package/lib/cjs/pdfs/tools.js +54 -0
  21. package/lib/cjs/products/index.d.ts +1 -0
  22. package/lib/cjs/products/index.js +1 -0
  23. package/lib/cjs/products/models/ProductMvt.d.ts +1 -1
  24. package/lib/cjs/products/product.d.ts +4 -0
  25. package/lib/cjs/products/product.js +23 -0
  26. package/lib/cjs/query-builder/hlpQbuilder.d.ts +1 -1
  27. package/lib/cjs/sales/index.d.ts +2 -0
  28. package/lib/cjs/sales/index.js +18 -0
  29. package/lib/cjs/sales/sale.js +1 -1
  30. package/lib/cjs/shared/index.d.ts +1 -6
  31. package/lib/cjs/shared/index.js +14 -5
  32. package/lib/cjs/shared/models/EDate.d.ts +8 -0
  33. package/lib/cjs/shared/models/EDate.js +11 -0
  34. package/lib/cjs/shared/models/EInOutMotive.d.ts +13 -0
  35. package/lib/cjs/shared/models/EInOutMotive.js +16 -0
  36. package/lib/cjs/shared/models/EPayMethod.d.ts +6 -0
  37. package/lib/cjs/shared/models/EPayMethod.js +9 -0
  38. package/lib/cjs/shared/models/IParam.d.ts +26 -0
  39. package/lib/cjs/shared/models/IParam.js +2 -0
  40. package/lib/cjs/shared/models/IPath.d.ts +14 -0
  41. package/lib/cjs/shared/models/IPath.js +11 -0
  42. package/lib/cjs/shared/models/NaAc.d.ts +6 -0
  43. package/lib/cjs/shared/models/NaAc.js +2 -0
  44. package/lib/cjs/shared/models/NaCoAc.d.ts +4 -0
  45. package/lib/cjs/shared/models/NaCoAc.js +2 -0
  46. package/lib/cjs/shared/models/NaCoShortAc.d.ts +4 -0
  47. package/lib/cjs/shared/models/NaCoShortAc.js +2 -0
  48. package/lib/cjs/shared/models/index.d.ts +6 -0
  49. package/lib/cjs/shared/models/index.js +8 -0
  50. package/lib/cjs/users/index.d.ts +1 -0
  51. package/lib/cjs/users/index.js +1 -0
  52. package/lib/cjs/users/models/UserGrp.d.ts +1 -1
  53. package/lib/cjs/users/models/UserRole.d.ts +1 -1
  54. package/lib/esm/auth/models/AuthTag.d.ts +1 -1
  55. package/lib/esm/auth/models/AuthTagCat.d.ts +1 -1
  56. package/lib/esm/bills/index.d.ts +1 -0
  57. package/lib/esm/bills/index.js +1 -0
  58. package/lib/esm/bills/pipes/index.d.ts +3 -0
  59. package/lib/esm/bills/pipes/index.js +3 -0
  60. package/lib/esm/estates/models/EstateCat.d.ts +1 -1
  61. package/lib/esm/estates/models/EstateElt.d.ts +1 -1
  62. package/lib/esm/estates/models/EstateLevel.d.ts +1 -1
  63. package/lib/esm/estates/models/EstatePor.d.ts +1 -1
  64. package/lib/esm/index.d.ts +7 -0
  65. package/lib/esm/index.js +7 -0
  66. package/lib/esm/pdfs/amountInvoice.d.ts +66 -0
  67. package/lib/esm/pdfs/amountInvoice.js +145 -0
  68. package/lib/esm/pdfs/index.d.ts +3 -0
  69. package/lib/esm/pdfs/index.js +3 -0
  70. package/lib/esm/pdfs/infoInvoice.d.ts +32 -0
  71. package/lib/esm/pdfs/infoInvoice.js +74 -0
  72. package/lib/esm/pdfs/tools.d.ts +41 -0
  73. package/lib/esm/pdfs/tools.js +48 -0
  74. package/lib/esm/products/index.d.ts +1 -0
  75. package/lib/esm/products/index.js +1 -0
  76. package/lib/esm/products/models/ProductMvt.d.ts +1 -1
  77. package/lib/esm/products/product.d.ts +4 -0
  78. package/lib/esm/products/product.js +18 -0
  79. package/lib/esm/query-builder/hlpQbuilder.d.ts +1 -1
  80. package/lib/esm/sales/index.d.ts +2 -0
  81. package/lib/esm/sales/index.js +2 -0
  82. package/lib/esm/sales/sale.js +1 -1
  83. package/lib/esm/shared/index.d.ts +1 -6
  84. package/lib/esm/shared/index.js +1 -1
  85. package/lib/esm/shared/models/EDate.d.ts +8 -0
  86. package/lib/esm/shared/models/EDate.js +9 -0
  87. package/lib/esm/shared/models/EInOutMotive.d.ts +13 -0
  88. package/lib/esm/shared/models/EInOutMotive.js +14 -0
  89. package/lib/esm/shared/models/EPayMethod.d.ts +6 -0
  90. package/lib/esm/shared/models/EPayMethod.js +7 -0
  91. package/lib/esm/shared/models/IParam.d.ts +26 -0
  92. package/lib/esm/shared/models/IParam.js +1 -0
  93. package/lib/esm/shared/models/IPath.d.ts +14 -0
  94. package/lib/esm/shared/models/IPath.js +10 -0
  95. package/lib/esm/shared/models/NaAc.d.ts +6 -0
  96. package/lib/esm/shared/models/NaAc.js +1 -0
  97. package/lib/esm/shared/models/NaCoAc.d.ts +4 -0
  98. package/lib/esm/shared/models/NaCoAc.js +1 -0
  99. package/lib/esm/shared/models/NaCoShortAc.d.ts +4 -0
  100. package/lib/esm/shared/models/NaCoShortAc.js +1 -0
  101. package/lib/esm/shared/models/index.d.ts +6 -0
  102. package/lib/esm/shared/models/index.js +1 -0
  103. package/lib/esm/users/index.d.ts +1 -0
  104. package/lib/esm/users/index.js +1 -0
  105. package/lib/esm/users/models/UserGrp.d.ts +1 -1
  106. package/lib/esm/users/models/UserRole.d.ts +1 -1
  107. package/package.json +1 -1
@@ -0,0 +1,41 @@
1
+ import { Ste } from "../users";
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: <T extends {
12
+ ste: Ste;
13
+ fullname: string;
14
+ cp: string;
15
+ city: string;
16
+ address: string;
17
+ username: string;
18
+ }>(user: T) => {
19
+ absolutePosition: {
20
+ x: number;
21
+ y: number;
22
+ };
23
+ text: ({
24
+ text: string;
25
+ fontSize: number;
26
+ bold?: undefined;
27
+ } | {
28
+ text: string;
29
+ bold: boolean;
30
+ fontSize: number;
31
+ } | {
32
+ text: string;
33
+ fontSize?: undefined;
34
+ bold?: undefined;
35
+ })[];
36
+ color: string;
37
+ width: string;
38
+ fontSize: number;
39
+ bold: boolean;
40
+ alignment: string;
41
+ };
@@ -0,0 +1,48 @@
1
+ import { getSteShortname } from "../users/user";
2
+ import { dateFormatter } from "../utils";
3
+ export const displayPdfDate = (label, fromDate, toDate) => {
4
+ fromDate = !fromDate ? dateFormatter(new Date(), "ymd", "-") : fromDate;
5
+ toDate = !toDate ? fromDate : toDate;
6
+ return label + " du " + dateFormatter(fromDate) + " au " + dateFormatter(toDate);
7
+ };
8
+ export const displayTitle = (title) => {
9
+ return {
10
+ width: "100%",
11
+ alignment: "center",
12
+ text: title,
13
+ bold: true,
14
+ margin: [0, 10, 0, 10],
15
+ fontSize: 15,
16
+ };
17
+ };
18
+ export const displayClient = (user) => {
19
+ // const clientSte = user.ste ? HlpUser.getSteShortname(user.ste) : '';
20
+ const clientSte = user.ste ? getSteShortname(user.ste, ["pharmacie", "clinique", "hopital"]) : "";
21
+ /* const clientLastname = (user.lastname) ? user.lastname : '';
22
+ const clientFirstname = (user.firstname) ? user.firstname : '';
23
+ const clientGender = (user.gender) ? user.gender.abr : ''; */
24
+ const clientName = user.ste ? clientSte : user.fullname;
25
+ const cp = user.cp ? user.cp : "";
26
+ const city = user.city ? user.city : "";
27
+ const nif = user.ste.nif ? user.ste.nif : "";
28
+ const address = user.address ? user.address : "";
29
+ const client = {
30
+ absolutePosition: { x: 310, y: 30 },
31
+ text: [
32
+ { text: "CLIENT: ", fontSize: 8 },
33
+ { text: user.username + "\n", bold: true, fontSize: 10 },
34
+ { text: clientName + "\n" },
35
+ { text: address + " " },
36
+ { text: cp + "\n" },
37
+ { text: city + "\n" },
38
+ // {text: nif + '\n'}
39
+ ],
40
+ color: "#000",
41
+ width: "auto",
42
+ fontSize: 12,
43
+ bold: true,
44
+ alignment: "left",
45
+ // margin: [100, 0, 0, 0],
46
+ };
47
+ return client;
48
+ };
@@ -1,2 +1,3 @@
1
1
  export { default as HlpProduct } from "./hlpProduct";
2
2
  export * from "./models";
3
+ export * from "./product";
@@ -1,2 +1,3 @@
1
1
  export { default as HlpProduct } from "./hlpProduct";
2
2
  export * from "./models";
3
+ export * from "./product";
@@ -1,5 +1,5 @@
1
1
  import Currency from "../../cashs/models/Currency";
2
- import EInOutMotive from "../../shared/EInOutMotive";
2
+ import EInOutMotive from "../../shared/models/EInOutMotive";
3
3
  import Ste from "../../users/models/Ste";
4
4
  import User from "../../users/models/User";
5
5
  export default interface ProductMvt {
@@ -0,0 +1,4 @@
1
+ import User from "../users/models/User";
2
+ import Product from "./models/Product";
3
+ export declare const unitPriceByClientCat: (product: Product, client: User, speUnitPrice?: number, addDiscount?: boolean) => number;
4
+ export declare const productCatCode: (product: Product, catCodes: string[]) => boolean;
@@ -0,0 +1,18 @@
1
+ import { userCoef } from "../users/user";
2
+ import { calculPercent } from "../utils";
3
+ export const unitPriceByClientCat = (product, client, speUnitPrice = 0, addDiscount = false) => {
4
+ if (speUnitPrice > 0) {
5
+ return speUnitPrice;
6
+ }
7
+ // const store = await getCustomRepository(ProductStoreRepository).getOneStoreByParams({storeName: 'cpa', productId: product.id})
8
+ if (product.stores[0].discountRate && addDiscount) {
9
+ return Math.ceil(product.stores[0].salePrice) - Math.ceil(calculPercent(product.stores[0].salePrice, product.stores[0].discountRate));
10
+ }
11
+ const clientCoef = !client ? 1 : userCoef(client);
12
+ return productCatCode(product, ["spe", "para"])
13
+ ? Math.ceil(product.stores[0].salePrice)
14
+ : Math.ceil(product.stores[0].salePrice * clientCoef);
15
+ };
16
+ export const productCatCode = (product, catCodes) => {
17
+ return catCodes.includes(product.cat.code && product.cat.code.toLowerCase());
18
+ };
@@ -1,5 +1,5 @@
1
1
  import { SelectQueryBuilder } from "typeorm";
2
- import IParam from "../shared/IParam";
2
+ import IParam from "../shared/models/IParam";
3
3
  declare class HlpQBuilder {
4
4
  userWhereParams(qb: SelectQueryBuilder<any>, prms: IParam): void;
5
5
  }
@@ -0,0 +1,2 @@
1
+ export * from "./models";
2
+ export * from "./sale";
@@ -0,0 +1,2 @@
1
+ export * from "./models";
2
+ export * from "./sale";
@@ -1,4 +1,4 @@
1
- import { unitPriceByClientCat } from "../product";
1
+ import { unitPriceByClientCat } from "../products/product";
2
2
  import { labelSteName } from "../users/user";
3
3
  import { dateFormatter, formatToStringCfa, removeBackSlashOccurences } from "../utils";
4
4
  export const getNbProductsOnSale = (sale) => {
@@ -1,6 +1 @@
1
- export { default as EInOutMotive } from "./EInOutMotive";
2
- export { default as IParam } from "./IParam";
3
- export { default as IPath } from "./IPath";
4
- export { default as NaAc } from "./NaAc";
5
- export { default as NaCoAc } from "./NaCoAc";
6
- export { default as NaCoShortAc } from "./NaCoShortAc";
1
+ export * from "./models";
@@ -1 +1 @@
1
- export { default as EInOutMotive } from "./EInOutMotive";
1
+ export * from "./models";
@@ -0,0 +1,8 @@
1
+ declare enum EDate {
2
+ CURRENT_DATE = "currentDate",
3
+ CURRENT_MONTH = "currentMonth",
4
+ SUB_CURRENT_MONTH = "subCurrentMonth",
5
+ CURRENT_YEAR = "currentYear",
6
+ SUB_CURRENT_YEAR = "subCurrentYear"
7
+ }
8
+ export default EDate;
@@ -0,0 +1,9 @@
1
+ var EDate;
2
+ (function (EDate) {
3
+ EDate["CURRENT_DATE"] = "currentDate";
4
+ EDate["CURRENT_MONTH"] = "currentMonth";
5
+ EDate["SUB_CURRENT_MONTH"] = "subCurrentMonth";
6
+ EDate["CURRENT_YEAR"] = "currentYear";
7
+ EDate["SUB_CURRENT_YEAR"] = "subCurrentYear";
8
+ })(EDate || (EDate = {}));
9
+ export default EDate;
@@ -0,0 +1,13 @@
1
+ declare enum EInOutMotive {
2
+ SALE = "vente",
3
+ BUY = "achat",
4
+ OUT = "outs",
5
+ IN = "ins",
6
+ INVENTORY = "inventory",
7
+ BEFORE_INVENTORY = "before_inventory",
8
+ ADJUSTMENT = "adjustment",
9
+ TRANSFERT = "transfert",
10
+ ON_EDIT = "modif stock",
11
+ GHOST = "Fantome"
12
+ }
13
+ export default EInOutMotive;
@@ -0,0 +1,14 @@
1
+ var EInOutMotive;
2
+ (function (EInOutMotive) {
3
+ EInOutMotive["SALE"] = "vente";
4
+ EInOutMotive["BUY"] = "achat";
5
+ EInOutMotive["OUT"] = "outs";
6
+ EInOutMotive["IN"] = "ins";
7
+ EInOutMotive["INVENTORY"] = "inventory";
8
+ EInOutMotive["BEFORE_INVENTORY"] = "before_inventory";
9
+ EInOutMotive["ADJUSTMENT"] = "adjustment";
10
+ EInOutMotive["TRANSFERT"] = "transfert";
11
+ EInOutMotive["ON_EDIT"] = "modif stock";
12
+ EInOutMotive["GHOST"] = "Fantome";
13
+ })(EInOutMotive || (EInOutMotive = {}));
14
+ export default EInOutMotive;
@@ -0,0 +1,6 @@
1
+ declare enum EPayMethod {
2
+ CASH = "esp\u00E8ces",
3
+ TRANSFER = "virement",
4
+ BANKCHECK = "ch\u00E8que"
5
+ }
6
+ export default EPayMethod;
@@ -0,0 +1,7 @@
1
+ var EPayMethod;
2
+ (function (EPayMethod) {
3
+ EPayMethod["CASH"] = "esp\u00E8ces";
4
+ EPayMethod["TRANSFER"] = "virement";
5
+ EPayMethod["BANKCHECK"] = "ch\u00E8que";
6
+ })(EPayMethod || (EPayMethod = {}));
7
+ export default EPayMethod;
@@ -0,0 +1,26 @@
1
+ import EDate from "./EDate";
2
+ export default interface IInOrNot {
3
+ ins?: string[];
4
+ notIns?: string[];
5
+ steId?: number;
6
+ steName?: string;
7
+ }
8
+ export default interface IParam {
9
+ steId?: number;
10
+ userId?: number;
11
+ clientId?: number;
12
+ code?: string;
13
+ role?: string;
14
+ steName?: string;
15
+ steNames?: string[];
16
+ steGrpCodes?: IInOrNot;
17
+ grpCodes?: IInOrNot;
18
+ roleCodes?: IInOrNot;
19
+ roleCode?: string;
20
+ opDate?: EDate;
21
+ store?: string;
22
+ dates?: any;
23
+ storeName?: string;
24
+ grpByYear?: boolean;
25
+ grpByYearMonth?: boolean;
26
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ export default interface IPath {
2
+ id: number | string;
3
+ key?: string | number;
4
+ title: any;
5
+ link?: string;
6
+ default?: boolean;
7
+ icon?: string;
8
+ param?: any;
9
+ auth?: boolean;
10
+ ms?: boolean;
11
+ disabled?: boolean;
12
+ state?: any;
13
+ Content?: any;
14
+ }
@@ -0,0 +1,10 @@
1
+ export {};
2
+ /* export type HeaderTableColumnType = {
3
+ thLabel: any;
4
+ content?: any;
5
+ accessor?: any;
6
+ style?: any;
7
+ auth?: AuthParam;
8
+ tooltipH?: any;
9
+ tooltipB?: any;
10
+ }; */
@@ -0,0 +1,6 @@
1
+ export default interface NaAc {
2
+ id?: number;
3
+ name?: string;
4
+ isActive?: boolean;
5
+ disabled?: boolean;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import NaAc from "./NaAc";
2
+ export default interface NaCoAc extends NaAc {
3
+ code?: string;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import NaCoAc from "./NaCoAc";
2
+ export default interface NaCoShortAc extends NaCoAc {
3
+ shortname?: string;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export { default as EInOutMotive } from "./EInOutMotive";
2
+ export { default as IParam } from "./IParam";
3
+ export { default as IPath } from "./IPath";
4
+ export { default as NaAc } from "./NaAc";
5
+ export { default as NaCoAc } from "./NaCoAc";
6
+ export { default as NaCoShortAc } from "./NaCoShortAc";
@@ -0,0 +1 @@
1
+ export { default as EInOutMotive } from "./EInOutMotive";
@@ -1 +1,2 @@
1
1
  export * from "./models";
2
+ export * from "./user";
@@ -1 +1,2 @@
1
1
  export * from "./models";
2
+ export * from "./user";
@@ -1,4 +1,4 @@
1
- import NaCoShortAc from "../../shared/NaCoShortAc";
1
+ import NaCoShortAc from "../../shared/models/NaCoShortAc";
2
2
  export default interface UserGrp extends NaCoShortAc {
3
3
  coef?: number;
4
4
  }
@@ -1,4 +1,4 @@
1
- import NaCoShortAc from "../../shared/NaCoShortAc";
1
+ import NaCoShortAc from "../../shared/models/NaCoShortAc";
2
2
  export default interface UserRole extends NaCoShortAc {
3
3
  extern?: boolean;
4
4
  intern?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.3.46",
3
+ "version": "1.3.48",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",