@tomei/finance 0.6.56 → 0.6.58

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/finance",
3
- "version": "0.6.56",
3
+ "version": "0.6.58",
4
4
  "description": "NestJS package for finance module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -497,13 +497,11 @@ export default class Document extends AccountSystemEntity {
497
497
  <td class="tm_width_4">
498
498
  ${documentItem.Description}
499
499
  </td>
500
- <td class="tm_width_2">${documentItem.Currency} ${
501
- documentItem.UnitPrice
502
- }</td>
500
+ <td class="tm_width_2">${documentItem.Currency} ${documentItem.UnitPrice
501
+ }</td>
503
502
  <td class="tm_width_1">${documentItem.Quantity}</td>
504
- <td class="tm_width_2 tm_text_right">${documentItem.Currency} ${
505
- +documentItem.UnitPrice * +documentItem.Quantity
506
- }</td>
503
+ <td class="tm_width_2 tm_text_right">${documentItem.Currency} ${+documentItem.UnitPrice * +documentItem.Quantity
504
+ }</td>
507
505
  </tr>
508
506
  `;
509
507
  });
@@ -718,13 +716,11 @@ export default class Document extends AccountSystemEntity {
718
716
  <td class="tm_width_4">
719
717
  ${documentItem.Description}
720
718
  </td>
721
- <td class="tm_width_2">${documentItem.Currency} ${
722
- documentItem.UnitPrice
723
- }</td>
719
+ <td class="tm_width_2">${documentItem.Currency} ${documentItem.UnitPrice
720
+ }</td>
724
721
  <td class="tm_width_1">${documentItem.Quantity}</td>
725
- <td class="tm_width_2 tm_text_right">${documentItem.Currency} ${
726
- +documentItem.UnitPrice * +documentItem.Quantity
727
- }</td>
722
+ <td class="tm_width_2 tm_text_right">${documentItem.Currency} ${+documentItem.UnitPrice * +documentItem.Quantity
723
+ }</td>
728
724
  </tr>
729
725
  `;
730
726
  });
@@ -827,7 +823,7 @@ export default class Document extends AccountSystemEntity {
827
823
  /* insert FileStream on htmlPayload */
828
824
  const htmlPayload: InternalMediaDto = {
829
825
  ObjectId: this.DocNo,
830
- ObjectType: this.DocType,
826
+ ObjectType: 'Document',
831
827
  Type: MediaType.Document,
832
828
  FileName: `${this.DocType}-${this.DocNo}`,
833
829
  FileStream: await Document.DEFAULT_INVOICE_TEMPLATE_HTML(),
@@ -849,7 +845,7 @@ export default class Document extends AccountSystemEntity {
849
845
  /* insert FileStream on pdfPayload */
850
846
  const pdfPayload: InternalMediaDto = {
851
847
  ObjectId: this.DocNo,
852
- ObjectType: this.DocType,
848
+ ObjectType: 'Document',
853
849
  Type: MediaType.Document,
854
850
  FileName: `${this.DocType}-${this.DocNo}`,
855
851
  FileStream: await this.DEFAULT_INVOICE_TEMPLATE_PDF(customer),
@@ -916,7 +912,7 @@ export default class Document extends AccountSystemEntity {
916
912
  /* insert FileStream on htmlPayload */
917
913
  const htmlPayload: InternalMediaDto = {
918
914
  ObjectId: this.DocNo,
919
- ObjectType: this.DocType,
915
+ ObjectType: 'Document',
920
916
  Type: MediaType.Document,
921
917
  FileName: `${this.DocType}-${this.DocNo}`,
922
918
  FileStream: await Document.DEFAULT_INVOICE_TEMPLATE_HTML(),
@@ -937,7 +933,7 @@ export default class Document extends AccountSystemEntity {
937
933
  /* insert FileStream on pdfPayload */
938
934
  const pdfPayload: InternalMediaDto = {
939
935
  ObjectId: this.DocNo,
940
- ObjectType: this.DocType,
936
+ ObjectType: 'Document',
941
937
  Type: MediaType.Document,
942
938
  FileName: `${this.DocType}-${this.DocNo}`,
943
939
  FileStream: await this.DEFAULT_RECEIPT_TEMPLATE_PDF(customer),
@@ -0,0 +1,4 @@
1
+ export enum CollectPaymentType {
2
+ MANUAL = 'MANUAL',
3
+ AUTOMATIC = 'AUTOMATIC'
4
+ }
@@ -40,6 +40,7 @@ import { ActionEnum, Activity } from '@tomei/activity-history';
40
40
  import { ApplicationConfig } from '@tomei/config';
41
41
  import { TaxRepository } from '../tax/tax.repository';
42
42
  import { Tax } from '../tax/tax';
43
+ import { CollectPaymentType } from '../enum/collect-payment-type';
43
44
 
44
45
  export default class FinanceCompany extends ObjectBase {
45
46
  private _CompanyId = 'New';
@@ -1183,6 +1184,7 @@ export default class FinanceCompany extends ObjectBase {
1183
1184
  dbTransaction: any,
1184
1185
  loginUser: LoginUserBase,
1185
1186
  payment: Payment,
1187
+ collectPaymentType: CollectPaymentType = CollectPaymentType.AUTOMATIC,
1186
1188
  ): Promise<Payment> {
1187
1189
  try {
1188
1190
  /*validation 1: Make sure that the payment has at least 1 payment item*/
@@ -1215,7 +1217,7 @@ export default class FinanceCompany extends ObjectBase {
1215
1217
  Description: payment.Description,
1216
1218
  Currency: payment.Currency,
1217
1219
  Amount: payment.Amount,
1218
- Status: PaymentStatus.PENDING,
1220
+ Status: collectPaymentType === CollectPaymentType.AUTOMATIC ? PaymentStatus.CONFIRMED : PaymentStatus.PENDING,
1219
1221
  PostedToAccSystemYN: 'N',
1220
1222
  ReceivedBy: payment.ReceivedBy,
1221
1223
  IssuedBy: payment.IssuedBy,
@@ -1731,6 +1733,7 @@ export default class FinanceCompany extends ObjectBase {
1731
1733
  Amount: number;
1732
1734
  }[],
1733
1735
  receiptNo?: string,
1736
+ collectPaymentType: CollectPaymentType = CollectPaymentType.AUTOMATIC,
1734
1737
  ): Promise<Payment> {
1735
1738
  //Method to collect payment for multiple customer.
1736
1739
  try {
@@ -1809,7 +1812,7 @@ export default class FinanceCompany extends ObjectBase {
1809
1812
  Description: payment.Description,
1810
1813
  Currency: payment.Currency,
1811
1814
  Amount: payment.Amount,
1812
- Status: PaymentStatus.PENDING,
1815
+ Status: collectPaymentType === CollectPaymentType.MANUAL ? PaymentStatus.PENDING : PaymentStatus.CONFIRMED,
1813
1816
  PostedToAccSystemYN: 'N',
1814
1817
  ReceivedBy: payment.ReceivedBy,
1815
1818
  IssuedBy: payment.IssuedBy,