@unimaze/billing 0.21.31 → 0.21.32

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.
@@ -110,8 +110,10 @@ var SingleBillingLine = function (props) {
110
110
  (0, react_1.useEffect)(function () {
111
111
  if (props.outsideVatScope) {
112
112
  setTaxCatType(enums_1.AvailableTaxCategoryTypeEnum.OutsideTaxScope);
113
+ (0, BillingLineUtility_1.assignTaxCategoryToAllLines)(props.formInstance, enums_1.AvailableTaxCategoryTypeEnum.OutsideTaxScope);
113
114
  }
114
115
  else {
116
+ (0, BillingLineUtility_1.assignTaxCategoryToAllLines)(props.formInstance, enums_1.AvailableTaxCategoryTypeEnum.StandardRated);
115
117
  setTaxCatType(enums_1.AvailableTaxCategoryTypeEnum.StandardRated);
116
118
  }
117
119
  }, [props.outsideVatScope]);
@@ -29,4 +29,5 @@ interface TaxDisplay {
29
29
  export declare const combinedTaxesForLines: (invoiceLines: BillingLineMetadataOverride[]) => TaxDisplay[];
30
30
  export declare const getUnitOfMeasureUnitLabel: (unitOfMeasure: any) => string;
31
31
  export declare const getDiscountLabel: (discountValue: string, discountType: string, currencyCode: string, discountText: string) => string;
32
+ export declare const assignTaxCategoryToAllLines: (formInstance: FormInstance, taxToAssign: AvailableTaxCategoryTypeEnum) => void;
32
33
  export {};
@@ -25,7 +25,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.getDiscountLabel = exports.getUnitOfMeasureUnitLabel = exports.combinedTaxesForLines = exports.getFieldNames = exports.getTaxCategoryDisabled = exports.getTotals = exports.getCorrectInputNode = exports.generateTaxCategoryLabel = exports.calculateTaxPercentage = exports.calculateTaxAmount = exports.calculateTaxableAmount = exports.calculateDiscountAmount = exports.billingLinesFieldsMetadata = void 0;
28
+ exports.assignTaxCategoryToAllLines = exports.getDiscountLabel = exports.getUnitOfMeasureUnitLabel = exports.combinedTaxesForLines = exports.getFieldNames = exports.getTaxCategoryDisabled = exports.getTotals = exports.getCorrectInputNode = exports.generateTaxCategoryLabel = exports.calculateTaxPercentage = exports.calculateTaxAmount = exports.calculateTaxableAmount = exports.calculateDiscountAmount = exports.billingLinesFieldsMetadata = void 0;
29
29
  var mapi_1 = require("@unimaze/api-clients/lib/mapi");
30
30
  var api_1 = require("@unimaze/api-clients/lib/mapi/api");
31
31
  var react_1 = __importDefault(require("react"));
@@ -220,3 +220,15 @@ var getDiscountLabel = function (discountValue, discountType, currencyCode, disc
220
220
  return "".concat(discountValue).concat(discountType === "PERCENTAGE" ? "%" : " ".concat(currencyCode), " ").concat(discountText);
221
221
  };
222
222
  exports.getDiscountLabel = getDiscountLabel;
223
+ var assignTaxCategoryToAllLines = function (formInstance, taxToAssign) {
224
+ var clonedLines = (0, lodash_1.cloneDeep)(formInstance.getFieldValue(["invoice", "invoiceLines"]));
225
+ clonedLines.forEach(function (line) {
226
+ line.taxCategoryType = taxToAssign;
227
+ });
228
+ formInstance.setFieldsValue({
229
+ invoice: {
230
+ invoiceLines: clonedLines,
231
+ },
232
+ });
233
+ };
234
+ exports.assignTaxCategoryToAllLines = assignTaxCategoryToAllLines;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unimaze/billing",
3
- "version": "0.21.31",
3
+ "version": "0.21.32",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",