@tomei/finance 0.6.96 → 0.6.98

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.96",
3
+ "version": "0.6.98",
4
4
  "description": "NestJS package for finance module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -225,23 +225,50 @@ export default class Account extends AccountSystemEntity {
225
225
 
226
226
  if (data) {
227
227
  console.log('Account Save: THERE IS DATA FOUND');
228
-
229
- this.AccountNo = data.AccountNo;
230
- this.AccSystemRefId = data.AccSystemRefId;
231
- this.Name = data.Name;
232
- this.Description = data.Description;
233
- this.AccountType = data.AccountType;
234
- this.AccountSubtype = data.AccountSubType;
235
- this.CompanyId = data.CompanyId;
236
- this.OwnerId = data.OwnerId;
237
- this.OwnerType = data.OwnerType;
238
- this.RelatedObjectId = data.RelatedObjectId;
239
- this.RelatedObjectType = data.RelatedObjectType;
240
- this.PostedToAccSystemYN = data.PostedToAccSystemYN;
241
- this.ParentAccountNo = data.ParentAccountNo;
228
+ const oldAccountNo = data.AccountNo;
229
+ this.AccountNo = this.AccountNo || data.AccountNo;
230
+ this.AccSystemRefId = this.AccSystemRefId || data.AccSystemRefId;
231
+ this.Name = this.Name || data.Name;
232
+ this.Description = this.Description || data.Description;
233
+ this.AccountType = this.AccountType || data.AccountType;
234
+ this.AccountSubtype = this.AccountSubtype || data.AccountSubType;
235
+ this.CompanyId = this.CompanyId || data.CompanyId;
236
+ this.OwnerId = this.OwnerId || data.OwnerId;
237
+ this.OwnerType = this.OwnerType || data.OwnerType;
238
+ this.RelatedObjectId = this.RelatedObjectId || data.RelatedObjectId;
239
+ this.RelatedObjectType = this.RelatedObjectType || data.RelatedObjectType;
240
+ this.PostedToAccSystemYN = this.PostedToAccSystemYN || data.PostedToAccSystemYN;
241
+ this.ParentAccountNo = this.ParentAccountNo || data.ParentAccountNo;
242
242
  this.CreatedAt = data.CreatedAt;
243
243
  this.CreatedById = data.CreatedById;
244
244
  this.UpdatedAt = new Date();
245
+ this.UpdatedById = userId;
246
+
247
+ await this.RepositoryBase.update(
248
+ {
249
+ AccountNo: this.AccountNo,
250
+ AccSystemRefId: this.AccSystemRefId,
251
+ Name: this.Name,
252
+ Description: this.Description,
253
+ AccountType: this.AccountType,
254
+ AccountSubtype: this.AccountSubtype,
255
+ CompanyId: this.CompanyId,
256
+ OwnerId: this.OwnerId,
257
+ OwnerType: this.OwnerType,
258
+ RelatedObjectId: this.RelatedObjectId,
259
+ RelatedObjectType: this.RelatedObjectType,
260
+ PostedToAccSystemYN: this.PostedToAccSystemYN,
261
+ ParentAccountNo: this.ParentAccountNo,
262
+ UpdatedAt: this.UpdatedAt,
263
+ UpdatedById: this.UpdatedById,
264
+ },
265
+ {
266
+ where: {
267
+ AccountNo: oldAccountNo,
268
+ },
269
+ transaction: dbTransaction,
270
+ },
271
+ );
245
272
  } else {
246
273
  console.log('Account Save: THERE IS NO DATA FOUND');
247
274
 
@@ -8,7 +8,7 @@ import { Injectable } from '@nestjs/common';
8
8
  export abstract class AccountSystemEntity extends ObjectBase {
9
9
  CompanyId = '';
10
10
  PostedToAccSystemYN = 'N';
11
- AccSystemRefId = '';
11
+ AccSystemRefId = 'REF';
12
12
  PostedById = '';
13
13
  PostedDateTime: Date;
14
14
  protected abstract _ObjectType: string;
@@ -154,6 +154,7 @@ export default abstract class FinanceCustomerBase
154
154
  this._AccountReceivable.AccountType = 'Account Receivable';
155
155
  this._AccountReceivable.OwnerId = this.CustomerId;
156
156
  this._AccountReceivable.OwnerType = type(this);
157
+
157
158
  }
158
159
  return this._AccountReceivable;
159
160
  }