@tomei/finance 0.11.8 → 0.12.0

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 (36) hide show
  1. package/dist/document/document-item.d.ts +6 -1
  2. package/dist/document/document-item.d.ts.map +1 -1
  3. package/dist/document/document-item.js +23 -0
  4. package/dist/document/document-item.js.map +1 -1
  5. package/dist/document/document.d.ts +4 -1
  6. package/dist/document/document.d.ts.map +1 -1
  7. package/dist/document/document.js +188 -167
  8. package/dist/document/document.js.map +1 -1
  9. package/dist/document/interfaces/document-attr.interface.d.ts +4 -1
  10. package/dist/document/interfaces/document-attr.interface.d.ts.map +1 -1
  11. package/dist/document/interfaces/document-attr.interface.js.map +1 -1
  12. package/dist/document/interfaces/document-item-attr.interface.d.ts +4 -0
  13. package/dist/document/interfaces/document-item-attr.interface.d.ts.map +1 -1
  14. package/dist/document/interfaces/document-item-attr.interface.js.map +1 -1
  15. package/dist/enum/discount-type.enum.d.ts +5 -0
  16. package/dist/enum/discount-type.enum.d.ts.map +1 -0
  17. package/dist/enum/discount-type.enum.js +9 -0
  18. package/dist/enum/discount-type.enum.js.map +1 -0
  19. package/dist/enum/index.d.ts +2 -1
  20. package/dist/enum/index.d.ts.map +1 -1
  21. package/dist/enum/index.js +3 -1
  22. package/dist/enum/index.js.map +1 -1
  23. package/dist/finance-company/finance-company.d.ts.map +1 -1
  24. package/dist/finance-company/finance-company.js +18 -0
  25. package/dist/finance-company/finance-company.js.map +1 -1
  26. package/dist/models/document-item.entity.d.ts +6 -1
  27. package/dist/models/document-item.entity.d.ts.map +1 -1
  28. package/dist/models/document-item.entity.js +22 -0
  29. package/dist/models/document-item.entity.js.map +1 -1
  30. package/dist/models/document.entity.d.ts +8 -2
  31. package/dist/models/document.entity.d.ts.map +1 -1
  32. package/dist/models/document.entity.js +24 -1
  33. package/dist/models/document.entity.js.map +1 -1
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/migrations/add-discount-collumn-to-document-related-table.js +91 -0
  36. package/package.json +1 -1
@@ -1,7 +1,8 @@
1
1
  import Document from './document';
2
2
  import { ObjectBase } from '@tomei/general';
3
3
  import { IDocumentItemAttr } from './interfaces/document-item-attr.interface';
4
- export default class DocumentItem extends ObjectBase {
4
+ import { DiscountType } from '../enum/discount-type.enum';
5
+ export default class DocumentItem extends ObjectBase implements IDocumentItemAttr {
5
6
  DocumentItemId: string;
6
7
  DocNo: string;
7
8
  Name: string;
@@ -16,6 +17,9 @@ export default class DocumentItem extends ObjectBase {
16
17
  Quantity: number;
17
18
  QuantityUOM: string;
18
19
  private _Amount;
20
+ AmountBeforeDiscount: number;
21
+ DiscountType: DiscountType;
22
+ DiscountValue: number;
19
23
  TaxCode: string;
20
24
  TaxAmount: number;
21
25
  TaxRate: number;
@@ -42,6 +46,7 @@ export default class DocumentItem extends ObjectBase {
42
46
  set Amount(amount: number);
43
47
  constructor(dbTransaction: any, document: Document);
44
48
  init(params: IDocumentItemAttr): void;
49
+ calculateAmount(): void;
45
50
  static initDocumentItems(dbTransaction: any, document: Document): Promise<DocumentItem[]>;
46
51
  }
47
52
  //# sourceMappingURL=document-item.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document-item.d.ts","sourceRoot":"","sources":["../../src/document/document-item.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAE9E,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,UAAU;IAClD,cAAc,SAAS;IACvB,KAAK,SAAM;IACX,IAAI,SAAM;IACV,MAAM,SAAM;IACZ,WAAW,CAAC,SAAM;IAClB,MAAM,SAAM;IACZ,QAAQ,SAAM;IACd,OAAO,SAAM;IACb,YAAY,SAAM;IAClB,QAAQ,SAAS;IACjB,SAAS,SAAK;IACd,QAAQ,SAAK;IACb,WAAW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;CA+BrB"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const general_1 = require("@tomei/general");
4
4
  const document_item_repository_1 = require("./document-item.repository");
5
5
  const general_2 = require("@tomei/general");
6
+ const discount_type_enum_1 = require("../enum/discount-type.enum");
6
7
  class DocumentItem extends general_1.ObjectBase {
7
8
  get ObjectType() {
8
9
  return this._ObjectType;
@@ -51,6 +52,8 @@ class DocumentItem extends general_1.ObjectBase {
51
52
  this.Quantity = 0;
52
53
  this.QuantityUOM = 'Pieces';
53
54
  this._Amount = 0;
55
+ this.AmountBeforeDiscount = 0;
56
+ this.DiscountValue = 0;
54
57
  this.TaxCode = '';
55
58
  this.TaxAmount = 0;
56
59
  this.TaxRate = 0;
@@ -80,6 +83,10 @@ class DocumentItem extends general_1.ObjectBase {
80
83
  this.Quantity = params.Quantity || this.Quantity;
81
84
  this.QuantityUOM = params.QuantityUOM || this.QuantityUOM;
82
85
  this._Amount = params.Amount || this._Amount;
86
+ this.AmountBeforeDiscount =
87
+ params.AmountBeforeDiscount || this.AmountBeforeDiscount;
88
+ this.DiscountType = params.DiscountType || this.DiscountType;
89
+ this.DiscountValue = params.DiscountValue || this.DiscountValue;
83
90
  this.TaxCode = params.TaxCode || this.TaxCode;
84
91
  this.TaxAmount = params.TaxAmount || this.TaxAmount;
85
92
  this.TaxRate = params.TaxRate || this.TaxRate;
@@ -92,6 +99,22 @@ class DocumentItem extends general_1.ObjectBase {
92
99
  this.PostedById = params.PostedById || this.PostedById;
93
100
  this.PostedDateTime = params.PostedDateTime || this.PostedDateTime;
94
101
  }
102
+ calculateAmount() {
103
+ const baseAmount = this.UnitPrice * this.Quantity;
104
+ this.AmountBeforeDiscount = baseAmount;
105
+ this._Amount = baseAmount;
106
+ if (this.DiscountType === discount_type_enum_1.DiscountType.Percentage) {
107
+ const discountValue = baseAmount * (this.DiscountValue / 100);
108
+ this._Amount = baseAmount - discountValue;
109
+ }
110
+ else if (this.DiscountType === discount_type_enum_1.DiscountType.Fixed) {
111
+ this._Amount = baseAmount - this.DiscountValue;
112
+ }
113
+ this._Amount = Math.round(this._Amount * 100) / 100;
114
+ if (this._Amount < 0) {
115
+ this._Amount = 0;
116
+ }
117
+ }
95
118
  static async initDocumentItems(dbTransaction, document) {
96
119
  try {
97
120
  const documentItems = await this._RepositoryBase.findAll({
@@ -1 +1 @@
1
- {"version":3,"file":"document-item.js","sourceRoot":"","sources":["../../src/document/document-item.ts"],"names":[],"mappings":";;AACA,4CAA4C;AAC5C,yEAAoE;AACpE,4CAA4C;AAG5C,MAAqB,YAAa,SAAQ,oBAAU;IA0BlD,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAQD,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IACD,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,SAAS;QACX,OAAO,sBAAsB,CAAC;IAChC,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAI,QAAQ,CAAC,QAAkB;QAC7B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,IAAI,aAAa,CAAC,aAAkB;QAClC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACtC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,IAAI,MAAM,CAAC,MAAc;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC;IACrC,CAAC;IAED,YAAY,aAAkB,EAAE,QAAkB;QAChD,KAAK,EAAE,CAAC;QAxEV,mBAAc,GAAG,KAAK,CAAC;QACvB,UA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CACnC,aAAkB,EAClB,QAAkB;QAElB,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;gBACvD,KAAK,EAAE;oBACL,KAAK,EAAE,QAAQ,CAAC,KAAK;iBACtB;gBACD,WAAW,EAAE,aAAa;aAC3B,CAAC,CAAC;YAEH,IAAI,aAAa,EAAE,CAAC;gBAClB,MAAM,mBAAmB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE;oBAC7D,MAAM,EAAE,GAAG,IAAI,YAAY,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;oBACrD,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,YAAY,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;oBAClD,OAAO,EAAE,CAAC;gBACZ,CAAC,CAAC,CAAC;gBAEH,OAAO,mBAAmB,CAAC;YAC7B,CAAC;iBAAM,CAAC;gBACN,MAAM,aAAa,GAAG,IAAI,oBAAU,CAClC,UAAU,EACV,0BAA0B,EAC1B,gCAAgC,CACjC,CAAC;gBAEF,MAAM,aAAa,CAAC;YACtB,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;;AAhJc,4BAAe,GAAG,IAAI,iDAAsB,EAAE,AAA/B,CAAgC;kBApC3C,YAAY"}
@@ -1,5 +1,5 @@
1
1
  import { CommonService as MediaCommonService, MediasModel } from '@tomei/media';
2
- import { DocumentStatus, DocType } from '../enum';
2
+ import { DocumentStatus, DocType, DiscountType } from '../enum';
3
3
  import { IDocumentAttr } from './interfaces/document-attr.interface';
4
4
  import { IDocumentFindAll } from './interfaces/document-find-all.interface';
5
5
  import DocumentItem from './document-item';
@@ -27,6 +27,9 @@ export default class Document extends AccountSystemEntity {
27
27
  UpdatedById: string;
28
28
  UpdatedAt: Date;
29
29
  UseAccSystemDocYN: string;
30
+ AmountBeforeDiscount: number;
31
+ DiscountType: DiscountType;
32
+ DiscountValue: number;
30
33
  protected _ObjectType: string;
31
34
  get ObjectType(): string;
32
35
  private _DocHTMLFileMediaId;
@@ -1 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/document/document.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,aAAa,IAAI,kBAAkB,EAEnC,WAAW,EAEZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,mBAAmB,MAAM,sBAAsB,CAAC;AACvD,OAAO,aAAa,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAc,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAK3D,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,mBAAmB;IACvD,KAAK,SAAS;IACd,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,QAAQ,CAAc;IAC9B,QAAQ,SAAS;IACjB,OAAO,CAAC,OAAO,CAAK;IACpB,WAAW,SAAM;IACjB,OAAO,CAAC,OAAO,CAAyB;IACxC,UAAU,SAAM;IAChB,UAAU,SAAM;IAChB,YAAY,SAAM;IAClB,eAAe,SAAM;IACrB,iBAAiB,SAAM;IACvB,WAAW,SAAM;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,SAAM;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,iBAAiB,SAAO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Ae,CACnB,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,mBAAmB,EAC9B,WAAW,CAAC,EAAE,GAAG,EACjB,IAAI,CAAC,EAAE,IAAI,GACV,OAAO,CAAC;QACT,SAAS,EAAE,WAAW,CAAC;QACvB,QAAQ,EAAE,WAAW,CAAC;KACvB,CAAC;IAmDI,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,mBAAmB;IAUlE,eAAe,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAsBnE,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;WAqB/C,OAAO,CACzB,SAAS,EAAE,aAAa,EACxB,aAAa,EAAE,GAAG,EAClB,IAAI,CAAC,EAAE,MAAM,EACb,GAAG,CAAC,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,gBAAgB,EACzB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAC1B,gBAAgB,CAAC,EAAE,cAAc,GAChC,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC;CAwKrD"}
@@ -125,6 +125,8 @@ class Document extends account_system_entity_1.AccountSystemEntity {
125
125
  this.CreatedById = '';
126
126
  this.UpdatedById = '';
127
127
  this.UseAccSystemDocYN = 'N';
128
+ this.AmountBeforeDiscount = 0;
129
+ this.DiscountValue = 0;
128
130
  this._ObjectType = 'Document';
129
131
  this._DocHTMLFileMediaId = '';
130
132
  this._DocPDFFileMediaId = '';
@@ -240,9 +242,28 @@ class Document extends account_system_entity_1.AccountSystemEntity {
240
242
  }
241
243
  async reCalculateAmount() {
242
244
  const roundToTwoDecimals = (value) => Math.round(value * 100) / 100;
243
- this.Amount = 0;
245
+ let totalBeforeDiscount = 0;
246
+ let totalAfterItemDiscount = 0;
244
247
  for (const documentItem of this._DocumentItems) {
245
- this.Amount = roundToTwoDecimals(this.Amount + documentItem.Amount);
248
+ documentItem.calculateAmount();
249
+ totalBeforeDiscount += documentItem.AmountBeforeDiscount;
250
+ totalAfterItemDiscount += documentItem.Amount;
251
+ }
252
+ let finalAfterDiscount = totalAfterItemDiscount;
253
+ if (this.DiscountType === enum_1.DiscountType.Percentage) {
254
+ finalAfterDiscount =
255
+ totalAfterItemDiscount -
256
+ totalAfterItemDiscount * (this.DiscountValue / 100);
257
+ }
258
+ else if (this.DiscountType === enum_1.DiscountType.Fixed) {
259
+ finalAfterDiscount = totalAfterItemDiscount - this.DiscountValue;
260
+ }
261
+ totalBeforeDiscount = roundToTwoDecimals(totalBeforeDiscount);
262
+ finalAfterDiscount = roundToTwoDecimals(finalAfterDiscount);
263
+ this.AmountBeforeDiscount = totalBeforeDiscount;
264
+ this.Amount = finalAfterDiscount;
265
+ if (this.Amount < 0) {
266
+ this.Amount = 0;
246
267
  }
247
268
  }
248
269
  get DocumentItems() {
@@ -405,31 +426,31 @@ class Document extends account_system_entity_1.AccountSystemEntity {
405
426
  }, imgTag);
406
427
  const currentDate = date.toLocaleDateString('en-GB');
407
428
  const invoiceNo = this.DocNo;
408
- const invoiceTitleInfo = `
409
- <div class="tm_invoice_seperator tm_gray_bg"></div>
410
- <div class="tm_invoice_info_list">
411
- <p class="tm_invoice_number tm_m0">
412
- Invoice No: <b class="tm_primary_color">${invoiceNo}</b>
413
- </p>
414
- <p class="tm_invoice_date tm_m0">
415
- Date: <b class="tm_primary_color">${currentDate}</b>
416
- </p>
417
- </div>
429
+ const invoiceTitleInfo = `
430
+ <div class="tm_invoice_seperator tm_gray_bg"></div>
431
+ <div class="tm_invoice_info_list">
432
+ <p class="tm_invoice_number tm_m0">
433
+ Invoice No: <b class="tm_primary_color">${invoiceNo}</b>
434
+ </p>
435
+ <p class="tm_invoice_date tm_m0">
436
+ Date: <b class="tm_primary_color">${currentDate}</b>
437
+ </p>
438
+ </div>
418
439
  `;
419
440
  const invoiceTitleInfoHandle = await page.$('.tm_invoice_info');
420
441
  await invoiceTitleInfoHandle.evaluate((invoice, invoiceTitleInfo) => {
421
442
  invoice.innerHTML = invoiceTitleInfo;
422
443
  }, invoiceTitleInfo);
423
- const invoiceCustomerContent = `
424
- <p class="tm_mb2">
425
- <b class="tm_primary_color">Invoice To:</b>
426
- </p>
427
- <p>
428
- ${customer.FullName} <br />
429
- ${customer.DefaultAddress.AddressLine1}, ${customer.DefaultAddress.City} <br />
430
- ${customer.DefaultAddress.Country} <br />
431
- ${customer.Email}
432
- </p>
444
+ const invoiceCustomerContent = `
445
+ <p class="tm_mb2">
446
+ <b class="tm_primary_color">Invoice To:</b>
447
+ </p>
448
+ <p>
449
+ ${customer.FullName} <br />
450
+ ${customer.DefaultAddress.AddressLine1}, ${customer.DefaultAddress.City} <br />
451
+ ${customer.DefaultAddress.Country} <br />
452
+ ${customer.Email}
453
+ </p>
433
454
  `;
434
455
  const invoiceCustomerHandle = await page.$('.tm_customer_detail');
435
456
  await invoiceCustomerHandle.evaluate((invoice, invoiceCustomerContent) => {
@@ -447,64 +468,64 @@ class Document extends account_system_entity_1.AccountSystemEntity {
447
468
  }, invoicePaymentInfoContent);
448
469
  const invoiceSubtotal = +this.Amount;
449
470
  const invoiceTax = 0;
450
- const invoiceRightFooterContent = `
451
- <table>
452
- <tbody>
453
- <tr>
454
- <td
455
- class="tm_width_3 tm_primary_color tm_border_none tm_bold"
456
- >
457
- Subtotal
458
- </td>
459
- <td
460
- class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_bold"
461
- >
462
- ${this.Currency} ${invoiceSubtotal.toFixed(2)}
463
- </td>
464
- </tr>
465
- <tr>
466
- <td
467
- class="tm_width_3 tm_primary_color tm_border_none tm_pt0"
468
- >
469
- Tax <span class="tm_ternary_color">(0%)</span>
470
- </td>
471
- <td
472
- class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_pt0"
473
- >
474
- ${this.Currency} ${invoiceTax.toFixed(2)}
475
- </td>
476
- </tr>
477
- <tr class="tm_border_top tm_border_bottom">
478
- <td
479
- class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color"
480
- >
481
- Grand Total
482
- </td>
483
- <td
484
- class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color tm_text_right"
485
- >
486
- ${this.Currency} ${(invoiceSubtotal + invoiceTax).toFixed(2)}
487
- </td>
488
- </tr>
489
- </tbody>
490
- </table>
471
+ const invoiceRightFooterContent = `
472
+ <table>
473
+ <tbody>
474
+ <tr>
475
+ <td
476
+ class="tm_width_3 tm_primary_color tm_border_none tm_bold"
477
+ >
478
+ Subtotal
479
+ </td>
480
+ <td
481
+ class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_bold"
482
+ >
483
+ ${this.Currency} ${invoiceSubtotal.toFixed(2)}
484
+ </td>
485
+ </tr>
486
+ <tr>
487
+ <td
488
+ class="tm_width_3 tm_primary_color tm_border_none tm_pt0"
489
+ >
490
+ Tax <span class="tm_ternary_color">(0%)</span>
491
+ </td>
492
+ <td
493
+ class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_pt0"
494
+ >
495
+ ${this.Currency} ${invoiceTax.toFixed(2)}
496
+ </td>
497
+ </tr>
498
+ <tr class="tm_border_top tm_border_bottom">
499
+ <td
500
+ class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color"
501
+ >
502
+ Grand Total
503
+ </td>
504
+ <td
505
+ class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color tm_text_right"
506
+ >
507
+ ${this.Currency} ${(invoiceSubtotal + invoiceTax).toFixed(2)}
508
+ </td>
509
+ </tr>
510
+ </tbody>
511
+ </table>
491
512
  `;
492
513
  const invoiceRightFooterHandle = await page.$('.tm_item_total_section');
493
514
  await invoiceRightFooterHandle.evaluate((invoice, invoiceRightFooterContent) => {
494
515
  invoice.innerHTML = invoiceRightFooterContent;
495
516
  }, invoiceRightFooterContent);
496
- const invoiceTNCContent = `
497
- <li>
498
- All payment must be made to:
499
- <ul>
500
- <li>Bank: <b>RHB BANK BHD</b></li>
501
- <li>Account Name: <b>TXG Financial Solutions Sdn Bhd</b></li>
502
- <li>Account No.: <b>2142 13000 17954</b></li>
503
- </ul>
504
- </li>
505
- <li>
506
- Once payment has been made, please email your transaction confirmation slip to <i>payment@ezcash.com.my</i>
507
- </li>
517
+ const invoiceTNCContent = `
518
+ <li>
519
+ All payment must be made to:
520
+ <ul>
521
+ <li>Bank: <b>RHB BANK BHD</b></li>
522
+ <li>Account Name: <b>TXG Financial Solutions Sdn Bhd</b></li>
523
+ <li>Account No.: <b>2142 13000 17954</b></li>
524
+ </ul>
525
+ </li>
526
+ <li>
527
+ Once payment has been made, please email your transaction confirmation slip to <i>payment@ezcash.com.my</i>
528
+ </li>
508
529
  `;
509
530
  const invoiceTNCHandle = await page.$('.tm_tnc_content');
510
531
  await invoiceTNCHandle.evaluate((invoice, invoiceTNCContent) => {
@@ -513,16 +534,16 @@ class Document extends account_system_entity_1.AccountSystemEntity {
513
534
  const invoiceDocumentItems = await this.DocumentItems;
514
535
  let invoiceItemContent = ``;
515
536
  invoiceDocumentItems.forEach((documentItem, i) => {
516
- invoiceItemContent += `
517
- <tr>
518
- <td class="tm_width_3">${i + 1}. ${documentItem.Name}</td>
519
- <td class="tm_width_4">
520
- ${documentItem.Description}
521
- </td>
522
- <td class="tm_width_2">${documentItem.Currency} ${documentItem.UnitPrice}</td>
523
- <td class="tm_width_1">${documentItem.Quantity}</td>
524
- <td class="tm_width_2 tm_text_right">${documentItem.Currency} ${(+documentItem.UnitPrice * +documentItem.Quantity).toFixed(2)}</td>
525
- </tr>
537
+ invoiceItemContent += `
538
+ <tr>
539
+ <td class="tm_width_3">${i + 1}. ${documentItem.Name}</td>
540
+ <td class="tm_width_4">
541
+ ${documentItem.Description}
542
+ </td>
543
+ <td class="tm_width_2">${documentItem.Currency} ${documentItem.UnitPrice}</td>
544
+ <td class="tm_width_1">${documentItem.Quantity}</td>
545
+ <td class="tm_width_2 tm_text_right">${documentItem.Currency} ${(+documentItem.UnitPrice * +documentItem.Quantity).toFixed(2)}</td>
546
+ </tr>
526
547
  `;
527
548
  });
528
549
  const invoiceDocumentItemHandle = await page.$('.tm_items_content');
@@ -578,40 +599,40 @@ class Document extends account_system_entity_1.AccountSystemEntity {
578
599
  }, imgTag);
579
600
  const currentDate = date.toLocaleDateString('en-GB');
580
601
  const receiptNo = this.DocNo;
581
- const receiptTitle = `
582
- <div class="tm_primary_color tm_f50 tm_text_uppercase">
583
- Receipt
584
- </div>
602
+ const receiptTitle = `
603
+ <div class="tm_primary_color tm_f50 tm_text_uppercase">
604
+ Receipt
605
+ </div>
585
606
  `;
586
607
  const receiptTitleHandle = await page.$('.tm_invoice_title');
587
608
  await receiptTitleHandle.evaluate((receipt, receiptTitle) => {
588
609
  receipt.innerHTML = receiptTitle;
589
610
  }, receiptTitle);
590
- const receiptTitleInfo = `
591
- <div class="tm_invoice_seperator tm_gray_bg"></div>
592
- <div class="tm_invoice_info_list">
593
- <p class="tm_invoice_number tm_m0">
594
- Receipt No: <b class="tm_primary_color">${receiptNo}</b>
595
- </p>
596
- <p class="tm_invoice_date tm_m0">
597
- Date: <b class="tm_primary_color">${currentDate}</b>
598
- </p>
599
- </div>
611
+ const receiptTitleInfo = `
612
+ <div class="tm_invoice_seperator tm_gray_bg"></div>
613
+ <div class="tm_invoice_info_list">
614
+ <p class="tm_invoice_number tm_m0">
615
+ Receipt No: <b class="tm_primary_color">${receiptNo}</b>
616
+ </p>
617
+ <p class="tm_invoice_date tm_m0">
618
+ Date: <b class="tm_primary_color">${currentDate}</b>
619
+ </p>
620
+ </div>
600
621
  `;
601
622
  const receiptTitleInfoHandle = await page.$('.tm_invoice_info');
602
623
  await receiptTitleInfoHandle.evaluate((receipt, receiptTitleInfo) => {
603
624
  receipt.innerHTML = receiptTitleInfo;
604
625
  }, receiptTitleInfo);
605
- const receiptCustomerContent = `
606
- <p class="tm_mb2">
607
- <b class="tm_primary_color">Issued To:</b>
608
- </p>
609
- <p>
610
- ${customer.FullName} <br />
611
- ${customer.DefaultAddress.AddressLine1}, ${customer.DefaultAddress.City} <br />
612
- ${customer.DefaultAddress.Country} <br />
613
- ${customer.Email}
614
- </p>
626
+ const receiptCustomerContent = `
627
+ <p class="tm_mb2">
628
+ <b class="tm_primary_color">Issued To:</b>
629
+ </p>
630
+ <p>
631
+ ${customer.FullName} <br />
632
+ ${customer.DefaultAddress.AddressLine1}, ${customer.DefaultAddress.City} <br />
633
+ ${customer.DefaultAddress.Country} <br />
634
+ ${customer.Email}
635
+ </p>
615
636
  `;
616
637
  const receiptCustomerHandle = await page.$('.tm_customer_detail');
617
638
  await receiptCustomerHandle.evaluate((receipt, receiptCustomerContent) => {
@@ -629,47 +650,47 @@ class Document extends account_system_entity_1.AccountSystemEntity {
629
650
  }, receiptPaymentInfoContent);
630
651
  const receiptSubtotal = +this.Amount;
631
652
  const receiptTax = 0;
632
- const receiptRightFooterContent = `
633
- <table>
634
- <tbody>
635
- <tr>
636
- <td
637
- class="tm_width_3 tm_primary_color tm_border_none tm_bold"
638
- >
639
- Subtotal
640
- </td>
641
- <td
642
- class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_bold"
643
- >
644
- ${this.Currency} ${receiptSubtotal}
645
- </td>
646
- </tr>
647
- <tr>
648
- <td
649
- class="tm_width_3 tm_primary_color tm_border_none tm_pt0"
650
- >
651
- Tax <span class="tm_ternary_color">(0%)</span>
652
- </td>
653
- <td
654
- class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_pt0"
655
- >
656
- ${this.Currency} ${receiptTax}
657
- </td>
658
- </tr>
659
- <tr class="tm_border_top tm_border_bottom">
660
- <td
661
- class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color"
662
- >
663
- Grand Total
664
- </td>
665
- <td
666
- class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color tm_text_right"
667
- >
668
- ${this.Currency} ${receiptSubtotal + receiptTax}
669
- </td>
670
- </tr>
671
- </tbody>
672
- </table>
653
+ const receiptRightFooterContent = `
654
+ <table>
655
+ <tbody>
656
+ <tr>
657
+ <td
658
+ class="tm_width_3 tm_primary_color tm_border_none tm_bold"
659
+ >
660
+ Subtotal
661
+ </td>
662
+ <td
663
+ class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_bold"
664
+ >
665
+ ${this.Currency} ${receiptSubtotal}
666
+ </td>
667
+ </tr>
668
+ <tr>
669
+ <td
670
+ class="tm_width_3 tm_primary_color tm_border_none tm_pt0"
671
+ >
672
+ Tax <span class="tm_ternary_color">(0%)</span>
673
+ </td>
674
+ <td
675
+ class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_pt0"
676
+ >
677
+ ${this.Currency} ${receiptTax}
678
+ </td>
679
+ </tr>
680
+ <tr class="tm_border_top tm_border_bottom">
681
+ <td
682
+ class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color"
683
+ >
684
+ Grand Total
685
+ </td>
686
+ <td
687
+ class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color tm_text_right"
688
+ >
689
+ ${this.Currency} ${receiptSubtotal + receiptTax}
690
+ </td>
691
+ </tr>
692
+ </tbody>
693
+ </table>
673
694
  `;
674
695
  const receiptRightFooterHandle = await page.$('.tm_item_total_section');
675
696
  await receiptRightFooterHandle.evaluate((receipt, receiptRightFooterContent) => {
@@ -678,29 +699,29 @@ class Document extends account_system_entity_1.AccountSystemEntity {
678
699
  const receiptDocumentItems = await this.DocumentItems;
679
700
  let receiptItemContent = ``;
680
701
  receiptDocumentItems.forEach((documentItem, i) => {
681
- receiptItemContent += `
682
- <tr>
683
- <td class="tm_width_3">${i + 1}. ${documentItem.Name}</td>
684
- <td class="tm_width_4">
685
- ${documentItem.Description}
686
- </td>
687
- <td class="tm_width_2">${documentItem.Currency} ${documentItem.UnitPrice}</td>
688
- <td class="tm_width_1">${documentItem.Quantity}</td>
689
- <td class="tm_width_2 tm_text_right">${documentItem.Currency} ${+documentItem.UnitPrice * +documentItem.Quantity}</td>
690
- </tr>
702
+ receiptItemContent += `
703
+ <tr>
704
+ <td class="tm_width_3">${i + 1}. ${documentItem.Name}</td>
705
+ <td class="tm_width_4">
706
+ ${documentItem.Description}
707
+ </td>
708
+ <td class="tm_width_2">${documentItem.Currency} ${documentItem.UnitPrice}</td>
709
+ <td class="tm_width_1">${documentItem.Quantity}</td>
710
+ <td class="tm_width_2 tm_text_right">${documentItem.Currency} ${+documentItem.UnitPrice * +documentItem.Quantity}</td>
711
+ </tr>
691
712
  `;
692
713
  });
693
714
  const receiptDocumentItemHandle = await page.$('.tm_items_content');
694
715
  await receiptDocumentItemHandle.evaluate((receipt, receiptItemContent) => {
695
716
  receipt.innerHTML = receiptItemContent;
696
717
  }, receiptItemContent);
697
- const receiptFooterContent = `
698
- <p class="tm_mb5 tm_text_center tm_f11">
699
- <i>
700
- Thank you for your payment. This is computer generated receipt
701
- - no signature is required.
702
- </i>
703
- </p>
718
+ const receiptFooterContent = `
719
+ <p class="tm_mb5 tm_text_center tm_f11">
720
+ <i>
721
+ Thank you for your payment. This is computer generated receipt
722
+ - no signature is required.
723
+ </i>
724
+ </p>
704
725
  `;
705
726
  const receiptFooterHandle = await page.$('.tm_footer_section');
706
727
  await receiptFooterHandle.evaluate((receipt, receiptFooterContent) => {