law-common 11.3.23-beta.0 → 11.3.23-beta.1

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.
@@ -76,4 +76,5 @@ export declare class VendorAdvanceEntityModel extends BaseEntityModel<EntityEnum
76
76
  getUpdateActionVisibility(currentUser: UserEntityModel): {
77
77
  [key: string]: () => boolean;
78
78
  };
79
+ getBalanceAmount(): number;
79
80
  }
@@ -215,6 +215,10 @@ class VendorAdvanceEntityModel extends base_entity_model_1.BaseEntityModel {
215
215
  getUpdateActionVisibility(currentUser) {
216
216
  return {};
217
217
  }
218
+ getBalanceAmount() {
219
+ var _a;
220
+ return this.netAmount - ((_a = this.appliedAmount) !== null && _a !== void 0 ? _a : 0);
221
+ }
218
222
  }
219
223
  exports.VendorAdvanceEntityModel = VendorAdvanceEntityModel;
220
224
  // vendorInvoiceAdvances?: VendorInvoiceAdvanceEntityModel[];
@@ -66,4 +66,8 @@ export declare class VendorInvoiceAdvanceEntityModel extends BaseEntityModel<Ent
66
66
  getUpdateActionVisibility(currentUser: UserEntityModel): {
67
67
  [key: string]: () => boolean;
68
68
  };
69
+ static getMaxAmount({ vendorInvoiceModel, vendorAdvanceModel, }: {
70
+ vendorInvoiceModel: VendorInvoiceEntityModel;
71
+ vendorAdvanceModel: VendorAdvanceEntityModel;
72
+ }): number;
69
73
  }
@@ -204,6 +204,12 @@ class VendorInvoiceAdvanceEntityModel extends base_entity_model_1.BaseEntityMode
204
204
  getUpdateActionVisibility(currentUser) {
205
205
  return {};
206
206
  }
207
+ static getMaxAmount({ vendorInvoiceModel, vendorAdvanceModel, }) {
208
+ var _a, _b;
209
+ const vendorInvoiceBalance = (_a = vendorInvoiceModel === null || vendorInvoiceModel === void 0 ? void 0 : vendorInvoiceModel.getBalanceAmount()) !== null && _a !== void 0 ? _a : 0;
210
+ const vendorAdvanceBalance = (_b = vendorAdvanceModel === null || vendorAdvanceModel === void 0 ? void 0 : vendorAdvanceModel.getBalanceAmount()) !== null && _b !== void 0 ? _b : 0;
211
+ return Math.min(vendorInvoiceBalance, vendorAdvanceBalance);
212
+ }
207
213
  }
208
214
  exports.VendorInvoiceAdvanceEntityModel = VendorInvoiceAdvanceEntityModel;
209
215
  VendorInvoiceAdvanceEntityModel.relationConfigs = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "11.3.23-beta.0",
3
+ "version": "11.3.23-beta.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [