@tomei/finance 0.3.6 → 0.3.8
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/dist/customer/customer.d.ts +2 -2
- package/dist/customer/customer.js +20 -16
- package/dist/customer/customer.js.map +1 -1
- package/dist/finance-company/finance-company.d.ts +5 -5
- package/dist/finance-company/finance-company.js +17 -6
- package/dist/finance-company/finance-company.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/customer/customer.ts +24 -18
- package/src/finance-company/finance-company.ts +28 -15
package/package.json
CHANGED
package/src/customer/customer.ts
CHANGED
|
@@ -46,26 +46,28 @@ export default abstract class FinanceCustomerBase
|
|
|
46
46
|
RepositoryBase: IRepositoryBase<any>;
|
|
47
47
|
|
|
48
48
|
constructor(
|
|
49
|
-
custSystemRefId
|
|
50
|
-
custSystemCode
|
|
51
|
-
sFinanceCompanyId
|
|
49
|
+
custSystemRefId?: string,
|
|
50
|
+
custSystemCode?: string,
|
|
51
|
+
sFinanceCompanyId?: string,
|
|
52
52
|
) {
|
|
53
53
|
super();
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
54
|
+
if (custSystemRefId && custSystemCode && sFinanceCompanyId) {
|
|
55
|
+
const financeCustomerData =
|
|
56
|
+
FinanceCustomerBase._FinanceCustomerRepository.findOne({
|
|
57
|
+
where: {
|
|
58
|
+
CompanyId: sFinanceCompanyId,
|
|
59
|
+
CustSystemCode: custSystemCode,
|
|
60
|
+
CustSystemRefId: custSystemRefId,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
if (financeCustomerData) {
|
|
64
|
+
this.CompanyId = sFinanceCompanyId;
|
|
65
|
+
this.CustSystemCode = custSystemCode;
|
|
66
|
+
this.CustSystemRefId = custSystemRefId;
|
|
67
|
+
} else {
|
|
68
|
+
const notFoundError = new RecordNotFoundError('No Record Found');
|
|
69
|
+
throw notFoundError;
|
|
70
|
+
}
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
|
|
@@ -85,8 +87,12 @@ export default abstract class FinanceCustomerBase
|
|
|
85
87
|
|
|
86
88
|
async save(
|
|
87
89
|
customerId: string,
|
|
90
|
+
custSystemCode: string,
|
|
91
|
+
custSystemRefId: string,
|
|
88
92
|
dbTransaction?: any,
|
|
89
93
|
): Promise<FinanceCustomerModel> {
|
|
94
|
+
this.CustSystemCode = custSystemCode;
|
|
95
|
+
this.CustSystemRefId = custSystemRefId;
|
|
90
96
|
const data = await FinanceCustomerBase._FinanceCustomerRepository.create(
|
|
91
97
|
{
|
|
92
98
|
CustomerId: customerId,
|
|
@@ -36,10 +36,10 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
36
36
|
private static _PaymentItemRepository = new PaymentItemRepository();
|
|
37
37
|
private static _DocumentRepository = new DocumentRepository();
|
|
38
38
|
private static _DocumentItemRepository = new DocumentItemRepository();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
private static _FinanceCustomerRepository = new FinanceCustomerRepository();
|
|
40
|
+
private static _LedgerTransactionRepository =
|
|
41
|
+
new LedgerTransactionRepository();
|
|
42
|
+
private _AccountingSystem: IAccountSystem;
|
|
43
43
|
|
|
44
44
|
get CompSystemCode(): string {
|
|
45
45
|
return this._CompSystemCode;
|
|
@@ -85,6 +85,14 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
85
85
|
return 'finance_Company';
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
get AccountingSystem(): IAccountSystem {
|
|
89
|
+
return this._AccountingSystem;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
set AccountingSystem(system: IAccountSystem) {
|
|
93
|
+
this._AccountingSystem = system;
|
|
94
|
+
}
|
|
95
|
+
|
|
88
96
|
constructor(
|
|
89
97
|
compSystemCode: string,
|
|
90
98
|
compSystemRefId: string,
|
|
@@ -165,6 +173,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
165
173
|
|
|
166
174
|
/*Retrieve and store the CompanyId from the result*/
|
|
167
175
|
financeCompany.ObjectId = company.CompanyId;
|
|
176
|
+
financeCompany._CompanyId = company.CompanyId;
|
|
168
177
|
|
|
169
178
|
/*Add the details into the hashtable*/
|
|
170
179
|
const sKey = `${compSystemCode}-${compSystemRefId}-${accSystemCode}`;
|
|
@@ -246,15 +255,14 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
246
255
|
);
|
|
247
256
|
}
|
|
248
257
|
|
|
249
|
-
const financeCustomerData =
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
+
const financeCustomerData =
|
|
259
|
+
await FinanceCompany._FinanceCustomerRepository.findOne({
|
|
260
|
+
where: {
|
|
261
|
+
CompanyId: this._CompanyId,
|
|
262
|
+
CustSystemCode: custSystemCode,
|
|
263
|
+
CustSystemRefId: custSystemRefId,
|
|
264
|
+
},
|
|
265
|
+
});
|
|
258
266
|
|
|
259
267
|
if (financeCustomerData) {
|
|
260
268
|
throw new Error('Customer already created previously.');
|
|
@@ -265,7 +273,12 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
265
273
|
customer,
|
|
266
274
|
});
|
|
267
275
|
|
|
268
|
-
const newCustomer = await customer.save(
|
|
276
|
+
const newCustomer = await customer.save(
|
|
277
|
+
customerId,
|
|
278
|
+
custSystemCode,
|
|
279
|
+
custSystemRefId,
|
|
280
|
+
dbTransaction,
|
|
281
|
+
);
|
|
269
282
|
|
|
270
283
|
const payload = {
|
|
271
284
|
Action: 'Create',
|
|
@@ -315,7 +328,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
315
328
|
const newJournalEntry = await journalEntry.save('test', dbTransaction);
|
|
316
329
|
|
|
317
330
|
const allLedgerTransactions =
|
|
318
|
-
await
|
|
331
|
+
await FinanceCompany._LedgerTransactionRepository.findAll({});
|
|
319
332
|
|
|
320
333
|
for (const ledgerTransaction of allLedgerTransactions) {
|
|
321
334
|
ledgerTransaction.JournalEntryId = newJournalEntry.JournalEntryId;
|