@tomei/finance 0.3.21 → 0.3.23

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.3.21",
3
+ "version": "0.3.23",
4
4
  "description": "NestJS package for finance module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -923,17 +923,17 @@ export default class FinanceCompany extends ObjectBase {
923
923
  }
924
924
 
925
925
  creditTransaction.Currency = creditNote.Currency;
926
- creditTransaction.DebitAmount = creditNote.Amount;
926
+ creditTransaction.CreditAmount = creditNote.Amount;
927
927
  creditTransaction.Date = transactionDate;
928
928
  creditTransaction.Name = creditNote.DocNo;
929
929
 
930
930
  for (const invoiceItem of documentItems) {
931
931
  const itemLedger = await journalEntry.newLedgerTransaction(
932
- TransactionTypeOptions.CREDIT,
932
+ TransactionTypeOptions.DEBIT,
933
933
  );
934
934
  itemLedger.AccountNo = invoiceItem.CtAccountNo;
935
935
  itemLedger.Currency = invoiceItem.Currency;
936
- itemLedger.CreditAmount = invoiceItem.Amount;
936
+ itemLedger.DebitAmount = invoiceItem.Amount;
937
937
  itemLedger.Date = transactionDate;
938
938
  itemLedger.Name = invoiceItem.Name;
939
939
  }
@@ -1034,6 +1034,7 @@ export default class FinanceCompany extends ObjectBase {
1034
1034
  });
1035
1035
 
1036
1036
  const journalEntry = new JournalEntry(dbTransaction);
1037
+ journalEntry.init({ CompanyId: this.CompanyId });
1037
1038
  const transactionDate = new Date();
1038
1039
 
1039
1040
  const debitLT = await journalEntry.newLedgerTransaction(
@@ -1041,7 +1042,7 @@ export default class FinanceCompany extends ObjectBase {
1041
1042
  );
1042
1043
  debitLT.AccountNo = paymentMethodType.AccountNo;
1043
1044
  debitLT.Currency = payment.Currency;
1044
- debitLT.CreditAmount = payment.Amount;
1045
+ debitLT.DebitAmount = payment.Amount;
1045
1046
  debitLT.Date = transactionDate;
1046
1047
  debitLT.Name = customer.FullName;
1047
1048
 
@@ -1056,7 +1057,7 @@ export default class FinanceCompany extends ObjectBase {
1056
1057
  creditLT.AccountNo = customer.CustSystemCode + '-AR';
1057
1058
  }
1058
1059
  creditLT.Currency = payment.Currency;
1059
- creditLT.DebitAmount = payment.Amount;
1060
+ creditLT.CreditAmount = payment.Amount;
1060
1061
  creditLT.Date = transactionDate;
1061
1062
  creditLT.Name = paymentMethodType.Name;
1062
1063
 
@@ -1,11 +1,11 @@
1
1
  export interface IJournalEntryAttr {
2
- CompanyId: string;
3
- JournalEntryId: string;
2
+ CompanyId?: string;
3
+ JournalEntryId?: string;
4
4
  Date?: Date;
5
- Name: string;
5
+ Name?: string;
6
6
  Description?: string;
7
7
  AccSystemRefId?: string;
8
- PostedToAccSystemYN: string;
8
+ PostedToAccSystemYN?: string;
9
9
  PostedById?: string;
10
10
  PostedDateTime?: Date;
11
11
  }
@@ -80,7 +80,7 @@ export default class JournalEntry extends AccountSystemEntity {
80
80
  } else {
81
81
  this.init({
82
82
  JournalEntryId: cuid(),
83
- CompanyId: this.CompanyId,
83
+ CompanyId: '',
84
84
  Date: new Date(),
85
85
  Name: '',
86
86
  Description: '',
@@ -214,13 +214,14 @@ export default class JournalEntry extends AccountSystemEntity {
214
214
  // }
215
215
 
216
216
  init(params: IJournalEntryAttr) {
217
- this.JournalEntryId = params.JournalEntryId;
218
- this.Date = params.Date;
219
- this.Name = params.Name;
220
- this.Description = params.Description;
221
- this.PostedById = params.PostedById;
222
- this.PostedToAccSystemYN = params.PostedToAccSystemYN;
223
- this.PostedDateTime = params.PostedDateTime;
217
+ if(params.JournalEntryId) this.JournalEntryId = params.JournalEntryId;
218
+ if(params.CompanyId) this.CompanyId = params.CompanyId;
219
+ if(params.Date) this.Date = params.Date;
220
+ if(params.Name) this.Name = params.Name;
221
+ if(params.Description) this.Description = params.Description;
222
+ if(params.PostedById) this.PostedById = params.PostedById;
223
+ if(params.PostedToAccSystemYN) this.PostedToAccSystemYN = params.PostedToAccSystemYN;
224
+ if(params.PostedDateTime) this.PostedDateTime = params.PostedDateTime;
224
225
  }
225
226
 
226
227
  getData() {