@tomei/finance 0.3.93 → 0.3.95

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.93",
3
+ "version": "0.3.95",
4
4
  "description": "NestJS package for finance module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -132,11 +132,6 @@ export default abstract class FinanceCustomerBase
132
132
  if (this._AccountReceivable) {
133
133
  resolve(this._AccountReceivable);
134
134
  } else {
135
- // FinanceDb.getConnection()
136
- // .transaction()
137
- // transaction
138
- // .then((t) => {
139
- // transaction = t;
140
135
  return (
141
136
  FinanceCustomerBase._AccountRepository
142
137
  .findOne({
@@ -183,11 +178,6 @@ export default abstract class FinanceCustomerBase
183
178
  if (this._AccountPayable) {
184
179
  resolve(this._AccountPayable);
185
180
  } else {
186
- // FinanceDb.getConnection()
187
- // .transaction()
188
- // transaction
189
- // .then((t) => {
190
- // transaction = t;
191
181
  return (
192
182
  FinanceCustomerBase._AccountRepository
193
183
  .findOne({
@@ -269,6 +259,7 @@ export default abstract class FinanceCustomerBase
269
259
  custSystemRefId: string,
270
260
  custSystemCode: string,
271
261
  sFinanceCompanyId: string,
262
+ dbTransaction?: any,
272
263
  ): Promise<boolean> {
273
264
  const data = await FinanceCustomerBase._FinanceCustomerRepository.findAll({
274
265
  where: {
@@ -276,6 +267,7 @@ export default abstract class FinanceCustomerBase
276
267
  CustSystemCode: custSystemCode,
277
268
  CompanyId: sFinanceCompanyId,
278
269
  },
270
+ transaction: dbTransaction,
279
271
  });
280
272
 
281
273
  if (data.length > 0) {
@@ -638,20 +638,17 @@ export default class FinanceCompany extends ObjectBase {
638
638
 
639
639
  const savedItems = htCreditAccountAmount.list();
640
640
 
641
- for (let i = 0; i < savedItems.length; i++) {
641
+ for (const item of savedItems) {
642
642
  const journalEntry = new JournalEntry(dbTransaction);
643
643
  //Temporary fix to successfully save journal entry in PostJournal
644
644
  journalEntry.init({
645
645
  CompanyId: this.CompanyId,
646
646
  Name: 'Issue Invoice ' + invoice.DocNo,
647
647
  });
648
- const account = await Account.initAccount(
649
- dbTransaction,
650
- savedItems[i].value[0],
651
- );
652
- const creditAmount = savedItems[i].value[1];
653
- const currency = htCreditAccountCurrency.get(savedItems[i].value[0]);
654
- const purpose = htCreditAccountPurpose.get(savedItems[i].value[0]);
648
+ const account = await Account.initAccount(dbTransaction, item.value[0]);
649
+ const creditAmount = item.value[1];
650
+ const currency = htCreditAccountCurrency.get(item.value[0]);
651
+ const purpose = htCreditAccountPurpose.get(item.value[0]);
655
652
 
656
653
  const dt = await journalEntry.newLedgerTransaction(
657
654
  TransactionTypeOptions.DEBIT,
@@ -668,14 +665,14 @@ export default class FinanceCompany extends ObjectBase {
668
665
  dt.Currency = currency ? currency : 'MYR';
669
666
  dt.DebitAmount = creditAmount ? creditAmount : 0.0;
670
667
  dt.Date = transactionDate;
671
- dt.Description = `Transaction for ${purpose} - ${savedItems[i].value[0]}`;
668
+ dt.Description = `Transaction for ${purpose}`;
672
669
  dt.Name = `Transaction for ${purpose}`;
673
670
  dt.RelatedDocNo = invoice.DocNo;
674
671
 
675
672
  const ct = await journalEntry.newLedgerTransaction(
676
673
  TransactionTypeOptions.CREDIT,
677
674
  );
678
- ct.AccountNo = savedItems[i].value[0];
675
+ ct.AccountNo = item.value[0];
679
676
  ct.Currency = currency ? currency : 'MYR';
680
677
  ct.CreditAmount = creditAmount ? creditAmount : 0.0;
681
678
  ct.Date = transactionDate;