@tomei/finance 0.6.73 → 0.6.75

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.73",
3
+ "version": "0.6.75",
4
4
  "description": "NestJS package for finance module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -137,6 +137,10 @@ export default class Document extends AccountSystemEntity {
137
137
  return 'finance_Document';
138
138
  }
139
139
 
140
+ public setStatus(status: DocumentStatus) {
141
+ this.setStatus(status);
142
+ }
143
+
140
144
  constructor(dbTransaction?: any, documentData?: any) {
141
145
  super();
142
146
  if (dbTransaction) {
@@ -343,24 +347,27 @@ export default class Document extends AccountSystemEntity {
343
347
 
344
348
  //updated Status to DocumentStatus.SETTLED if Params.AmountToReduce equals to document.Amount.
345
349
  let updatedStatus;
346
- if (AmountToReduce === document.Amount) {
350
+ if (AmountToReduce == document.Amount) {
347
351
  updatedStatus = DocumentStatus.SETTLED;
348
352
  } else {
349
353
  updatedStatus = DocumentStatus.PARTIALSETTLED;
350
354
  }
351
355
 
352
- //Call Document._Repo update method
353
- await this._RepositoryBase.update({
354
- Amount: AmountToReduce,
355
- Status: updatedStatus,
356
- UpdatedAt: document.UpdatedAt,
357
- UpdatedById: document.UpdatedById,
358
- }, {
359
- where: {
360
- DocNo: document.DocNo,
356
+ //Call Document._Repo update method
357
+ await this._RepositoryBase.update(
358
+ {
359
+ Amount: AmountToReduce,
360
+ Status: updatedStatus,
361
+ UpdatedAt: document.UpdatedAt,
362
+ UpdatedById: document.UpdatedById,
361
363
  },
362
- transaction: dbTransaction,
363
- });
364
+ {
365
+ where: {
366
+ DocNo: document.DocNo,
367
+ },
368
+ transaction: dbTransaction,
369
+ },
370
+ );
364
371
 
365
372
  const UpdatedDocument = await this.initDocument(dbTransaction, DocNo);
366
373
 
@@ -391,8 +398,8 @@ export default class Document extends AccountSystemEntity {
391
398
  PostedById: UpdatedDocument.PostedById,
392
399
  PostedDateTime: UpdatedDocument.PostedDateTime,
393
400
  UseAccSystemDocYN: UpdatedDocument.UseAccSystemDocYN,
394
- };;
395
- //Instantiate new activity
401
+ };
402
+ //Instantiate new activity
396
403
  const activity = new Activity();
397
404
  activity.ActivityId = activity.createId();
398
405
  activity.Action = ActionEnum.UPDATE;
@@ -624,11 +631,13 @@ export default class Document extends AccountSystemEntity {
624
631
  <td class="tm_width_4">
625
632
  ${documentItem.Description}
626
633
  </td>
627
- <td class="tm_width_2">${documentItem.Currency} ${documentItem.UnitPrice
628
- }</td>
634
+ <td class="tm_width_2">${documentItem.Currency} ${
635
+ documentItem.UnitPrice
636
+ }</td>
629
637
  <td class="tm_width_1">${documentItem.Quantity}</td>
630
- <td class="tm_width_2 tm_text_right">${documentItem.Currency} ${+documentItem.UnitPrice * +documentItem.Quantity
631
- }</td>
638
+ <td class="tm_width_2 tm_text_right">${documentItem.Currency} ${
639
+ +documentItem.UnitPrice * +documentItem.Quantity
640
+ }</td>
632
641
  </tr>
633
642
  `;
634
643
  });
@@ -843,11 +852,13 @@ export default class Document extends AccountSystemEntity {
843
852
  <td class="tm_width_4">
844
853
  ${documentItem.Description}
845
854
  </td>
846
- <td class="tm_width_2">${documentItem.Currency} ${documentItem.UnitPrice
847
- }</td>
855
+ <td class="tm_width_2">${documentItem.Currency} ${
856
+ documentItem.UnitPrice
857
+ }</td>
848
858
  <td class="tm_width_1">${documentItem.Quantity}</td>
849
- <td class="tm_width_2 tm_text_right">${documentItem.Currency} ${+documentItem.UnitPrice * +documentItem.Quantity
850
- }</td>
859
+ <td class="tm_width_2 tm_text_right">${documentItem.Currency} ${
860
+ +documentItem.UnitPrice * +documentItem.Quantity
861
+ }</td>
851
862
  </tr>
852
863
  `;
853
864
  });
@@ -16,6 +16,7 @@ import { FinanceCustomerRepository } from '../customer/finance-customer.reposito
16
16
  import { LedgerTransactionRepository } from '../ledger-transaction/ledger-transaction.repository';
17
17
  import {
18
18
  DocType,
19
+ DocumentStatus,
19
20
  PaymentStatus,
20
21
  PaymentType,
21
22
  TransactionTypeOptions,
@@ -1014,6 +1015,7 @@ export default class FinanceCompany extends ObjectBase {
1014
1015
 
1015
1016
  /*Set up the document type*/
1016
1017
  creditNote.DocType = DocType.CREDIT_NOTE;
1018
+ creditNote.setStatus(DocumentStatus.SETTLED);
1017
1019
 
1018
1020
  /*Saving the document and document items to the database*/
1019
1021
  await FinanceCompany._DocumentRepository.create(
@@ -1240,7 +1242,10 @@ export default class FinanceCompany extends ObjectBase {
1240
1242
  Description: payment.Description,
1241
1243
  Currency: payment.Currency,
1242
1244
  Amount: payment.Amount,
1243
- Status: collectPaymentType === CollectPaymentType.AUTOMATIC ? PaymentStatus.CONFIRMED : PaymentStatus.PENDING,
1245
+ Status:
1246
+ collectPaymentType === CollectPaymentType.AUTOMATIC
1247
+ ? PaymentStatus.CONFIRMED
1248
+ : PaymentStatus.PENDING,
1244
1249
  PostedToAccSystemYN: 'N',
1245
1250
  ReceivedBy: payment.ReceivedBy,
1246
1251
  IssuedBy: payment.IssuedBy,
@@ -1274,7 +1279,6 @@ export default class FinanceCompany extends ObjectBase {
1274
1279
  }
1275
1280
 
1276
1281
  for (const paymentPaidWithItem of paymentPaidWithItems) {
1277
-
1278
1282
  // Validate payment method type used
1279
1283
  await PaymentMethodType.initMethodType(
1280
1284
  dbTransaction,
@@ -1312,8 +1316,6 @@ export default class FinanceCompany extends ObjectBase {
1312
1316
  }
1313
1317
  }
1314
1318
 
1315
-
1316
-
1317
1319
  /**
1318
1320
  * Method to make payment to a customer.
1319
1321
  *
@@ -1699,7 +1701,7 @@ export default class FinanceCompany extends ObjectBase {
1699
1701
  paymentMethodTypePayload,
1700
1702
  transaction,
1701
1703
  );
1702
- } catch (err) { }
1704
+ } catch (err) {}
1703
1705
  }
1704
1706
  }
1705
1707
  }
@@ -1835,7 +1837,10 @@ export default class FinanceCompany extends ObjectBase {
1835
1837
  Description: payment.Description,
1836
1838
  Currency: payment.Currency,
1837
1839
  Amount: payment.Amount,
1838
- Status: collectPaymentType === CollectPaymentType.MANUAL ? PaymentStatus.PENDING : PaymentStatus.CONFIRMED,
1840
+ Status:
1841
+ collectPaymentType === CollectPaymentType.MANUAL
1842
+ ? PaymentStatus.PENDING
1843
+ : PaymentStatus.CONFIRMED,
1839
1844
  PostedToAccSystemYN: 'N',
1840
1845
  ReceivedBy: payment.ReceivedBy,
1841
1846
  IssuedBy: payment.IssuedBy,
@@ -1961,7 +1966,10 @@ export default class FinanceCompany extends ObjectBase {
1961
1966
  loginUser: LoginUserBase,
1962
1967
  customer: FinanceCustomerBase,
1963
1968
  payment: Payment,
1964
- status: PaymentStatus.CONFIRMED | PaymentStatus.REJECTED | PaymentStatus.FAILED,
1969
+ status:
1970
+ | PaymentStatus.CONFIRMED
1971
+ | PaymentStatus.REJECTED
1972
+ | PaymentStatus.FAILED,
1965
1973
  remarks: string,
1966
1974
  ctAccountNo?: string,
1967
1975
  receiptNo?: string,
@@ -2138,7 +2146,9 @@ export default class FinanceCompany extends ObjectBase {
2138
2146
 
2139
2147
  /*Registering the Journal Entries for the transaction*/
2140
2148
  const transactionDate = new Date();
2141
- const paymentPaidWithItems = await payment.getPaymentPaidWith(dbTransaction);
2149
+ const paymentPaidWithItems = await payment.getPaymentPaidWith(
2150
+ dbTransaction,
2151
+ );
2142
2152
 
2143
2153
  for (const paymentPaidWith of paymentPaidWithItems) {
2144
2154
  let paymentMethodType = await PaymentMethodType.initMethodType(
@@ -2163,7 +2173,7 @@ export default class FinanceCompany extends ObjectBase {
2163
2173
  debitLT.Description = 'Payment Received'; //customer.FullName;
2164
2174
  debitLT.Name = customer.FullName;
2165
2175
  debitLT.RelatedObjectId = payment.PaymentId;
2166
- debitLT.RelatedObjectType = "Payment";
2176
+ debitLT.RelatedObjectType = 'Payment';
2167
2177
  debitLT.RelatedPaymentId = payment.PaymentId;
2168
2178
 
2169
2179
  const creditLT = await journalEntry.newLedgerTransaction(
@@ -2208,9 +2218,8 @@ export default class FinanceCompany extends ObjectBase {
2208
2218
  PaymentId: payment.PaymentId,
2209
2219
  },
2210
2220
  transaction: dbTransaction,
2211
- }
2221
+ },
2212
2222
  );
2213
-
2214
2223
  } catch (error) {
2215
2224
  throw error;
2216
2225
  }