@tomei/finance 0.3.7 → 0.3.9
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 +3 -3
- package/dist/customer/customer.js +20 -16
- package/dist/customer/customer.js.map +1 -1
- package/dist/finance-company/finance-company.d.ts +3 -1
- package/dist/finance-company/finance-company.js +11 -4
- 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 +25 -19
- package/src/finance-company/finance-company.ts +19 -7
package/package.json
CHANGED
package/src/customer/customer.ts
CHANGED
|
@@ -46,33 +46,35 @@ 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
|
|
|
72
74
|
/*
|
|
73
75
|
* Get the billing address for a person.
|
|
74
76
|
**/
|
|
75
|
-
abstract getBillingAddress(): Promise<IAddress>;
|
|
77
|
+
abstract getBillingAddress(params: any): Promise<IAddress>;
|
|
76
78
|
|
|
77
79
|
init(person: LoginUserBase) {
|
|
78
80
|
this.FullName = person.FullName;
|
|
@@ -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,
|
|
@@ -39,7 +39,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
39
39
|
private static _FinanceCustomerRepository = new FinanceCustomerRepository();
|
|
40
40
|
private static _LedgerTransactionRepository =
|
|
41
41
|
new LedgerTransactionRepository();
|
|
42
|
-
|
|
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}`;
|
|
@@ -249,11 +258,9 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
249
258
|
const financeCustomerData =
|
|
250
259
|
await FinanceCompany._FinanceCustomerRepository.findOne({
|
|
251
260
|
where: {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
AccSystemCustomerId: custSystemCode,
|
|
256
|
-
CustomerRefId: custSystemRefId,
|
|
261
|
+
CompanyId: this._CompanyId,
|
|
262
|
+
CustSystemCode: custSystemCode,
|
|
263
|
+
CustSystemRefId: custSystemRefId,
|
|
257
264
|
},
|
|
258
265
|
});
|
|
259
266
|
|
|
@@ -266,7 +273,12 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
266
273
|
customer,
|
|
267
274
|
});
|
|
268
275
|
|
|
269
|
-
const newCustomer = await customer.save(
|
|
276
|
+
const newCustomer = await customer.save(
|
|
277
|
+
customerId,
|
|
278
|
+
custSystemCode,
|
|
279
|
+
custSystemRefId,
|
|
280
|
+
dbTransaction,
|
|
281
|
+
);
|
|
270
282
|
|
|
271
283
|
const payload = {
|
|
272
284
|
Action: 'Create',
|