shareneus 1.5.2 → 1.5.4

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.
Files changed (47) hide show
  1. package/dist/accounting/counter-sales/sales-receipt-print.service.js +9 -9
  2. package/dist/accounting/credit-note/cn-print.service.js +7 -7
  3. package/dist/accounting/credit-note/credit-note-totals.service.d.ts +2 -2
  4. package/dist/accounting/credit-note/credit-note-totals.service.js +33 -33
  5. package/dist/accounting/debit-note/debit-note-print.service.js +8 -8
  6. package/dist/accounting/debit-note/debit-note-totals.service.d.ts +2 -2
  7. package/dist/accounting/debit-note/debit-note-totals.service.js +27 -27
  8. package/dist/accounting/invoice/inv-pdf.service.js +12 -12
  9. package/dist/accounting/invoice/inv-print.service.js +11 -11
  10. package/dist/accounting/invoice/invoice-landscape-pdf.service.js +4 -4
  11. package/dist/accounting/invoice/invoice-letterhead-pdf.service.js +12 -12
  12. package/dist/accounting/invoice/invoice-portrait-pdf.js +5 -5
  13. package/dist/accounting/invoice/invoice-total.service.d.ts +8 -8
  14. package/dist/accounting/invoice/invoice-total.service.js +79 -79
  15. package/dist/accounting/invoice/reports/excel/items-wise-sales-excel.service.js +2 -2
  16. package/dist/accounting/invoice/reports/excel/sa-wise-labor-sales-excel.service.js +4 -4
  17. package/dist/accounting/invoice/reports/excel/sa-wise-part-sales-excel.service.js +4 -4
  18. package/dist/accounting/invoice/reports/excel/sale-summary-excel.service.js +3 -3
  19. package/dist/accounting/invoice/reports/excel/sales-by-service-summary-excel.service.js +3 -3
  20. package/dist/accounting/invoice/reports/pdf/item-wise-sales-pdf.service.js +2 -2
  21. package/dist/accounting/invoice/reports/pdf/manf-wise-sales-pdf.service.js +2 -2
  22. package/dist/accounting/invoice/reports/pdf/sales-by-service-pdf.service.js +2 -2
  23. package/dist/appointments/appointments/appointment-total.service.js +12 -12
  24. package/dist/appointments/consultations/consultation-fee-receipt.service.js +2 -2
  25. package/dist/purchases/purchase-order/po-totals.service.js +13 -13
  26. package/dist/purchases/purchase-order/purchase-order-totals.service.d.ts +1 -1
  27. package/dist/purchases/purchase-order/purchase-order-totals.service.js +58 -58
  28. package/dist/purchases/vendor-credit-note/vendor-credit-note-totals.service.d.ts +1 -1
  29. package/dist/purchases/vendor-credit-note/vendor-credit-note-totals.service.js +20 -20
  30. package/dist/purchases/vendor-debit-note/vendor-debit-note-print.service.js +7 -7
  31. package/dist/purchases/vendor-debit-note/vendor-debit-note-totals.service.d.ts +2 -2
  32. package/dist/purchases/vendor-debit-note/vendor-debit-note-totals.service.js +26 -26
  33. package/dist/sales/delivery-challan/dc-landscape-pdf.service.js +4 -4
  34. package/dist/sales/delivery-challan/delivery-challan-print.service.js +7 -7
  35. package/dist/sales/delivery-challan/delivery-challan-totals.js +35 -35
  36. package/dist/sales/sales/sales-print.service.js +9 -9
  37. package/dist/sales/sales/sales-totals.service.js +32 -32
  38. package/dist/sales-receive/sales-receive-print.service.js +10 -10
  39. package/dist/sales-receive/sales-receive-totals.service.d.ts +2 -2
  40. package/dist/sales-receive/sales-receive-totals.service.js +32 -32
  41. package/dist/services/est.print-service.js +5 -5
  42. package/dist/services/ro-print-service.js +13 -13
  43. package/dist/services/ro-totals.service.d.ts +4 -4
  44. package/dist/services/ro-totals.service.js +140 -140
  45. package/dist/shared/math-operations.js +46 -41
  46. package/dist/shared/shared-pdf.service.js +8 -8
  47. package/package.json +1 -1
@@ -33,7 +33,7 @@ function Add(...numbers) {
33
33
  result = result.plus(bigNumber);
34
34
  }
35
35
  // Convert back to JavaScript number type
36
- return result.toNumber();
36
+ return Number(result.toString());
37
37
  }
38
38
  /**
39
39
  * Subtracts multiple numbers with high precision using Big.js
@@ -53,7 +53,7 @@ function Subtract(...numbers) {
53
53
  result = result.minus(bigNumber);
54
54
  }
55
55
  // Convert back to JavaScript number type
56
- return result.toNumber();
56
+ return Number(result.toString());
57
57
  }
58
58
  /**
59
59
  * Multiplies multiple numbers with high precision using Big.js
@@ -72,10 +72,10 @@ function Multiply(...numbers) {
72
72
  // Multiply each subsequent number with the result using a for loop
73
73
  for (let i = 1; i < numbers.length; i++) {
74
74
  const bigNumber = new big_js_1.default(numbers[i]);
75
- result = result.mul(bigNumber);
75
+ result = result.times(bigNumber);
76
76
  }
77
77
  // Convert back to JavaScript number type
78
- return result.toNumber();
78
+ return Number(result.toString());
79
79
  }
80
80
  /**
81
81
  * Divides multiple numbers with high precision using Big.js
@@ -101,7 +101,7 @@ function Divide(...numbers) {
101
101
  result = result.div(bigNumber);
102
102
  }
103
103
  // Convert back to JavaScript number type
104
- return result.toNumber();
104
+ return Number(result.toString());
105
105
  }
106
106
  /**
107
107
  * Calculates discounted or marked-up price based on a percentage
@@ -111,29 +111,26 @@ function Divide(...numbers) {
111
111
  * @returns The final price after discount/markup as a number
112
112
  */
113
113
  function CalcDiscPrice(originalPrice, discountPercentage, markUp = false) {
114
- console.log("DiscountedPrice");
115
- console.log(originalPrice);
116
- console.log(discountPercentage);
114
+ const price = (0, util_js_1.GetNumber)(originalPrice);
115
+ const perc = (0, util_js_1.GetNumber)(discountPercentage);
116
+ const discountAmount = Multiply(price, Divide(perc, 100));
117
+ return markUp ? Add(price, discountAmount) : Subtract(price, discountAmount);
117
118
  // Convert inputs to Big.js objects for precision
118
- const price = new big_js_1.default((0, util_js_1.GetNumber)(originalPrice));
119
- const percentage = new big_js_1.default((0, util_js_1.GetNumber)(discountPercentage)).div(100);
120
- // Calculate the amount to add or subtract
121
- const discountAmount = price.mul(percentage);
122
- console.log(discountAmount.toNumber());
123
- console.log(markUp);
124
- // Calculate final price directly with Big.js
125
- let result;
126
- if (markUp) {
127
- // Perform markup calculation (add the calculated amount)
128
- result = price.plus(discountAmount);
129
- }
130
- else {
131
- // Perform discount calculation (subtract the calculated amount)
132
- result = price.minus(discountAmount);
133
- }
134
- const finalPrice = result.toNumber();
135
- console.log(finalPrice);
136
- return finalPrice;
119
+ // const price = new Big(GetNumber(originalPrice));
120
+ // const percentage = new Big(GetNumber(discountPercentage)).div(100);
121
+ // // Calculate the amount to add or subtract
122
+ // const discountAmount = price.mul(percentage);
123
+ // // Calculate final price directly with Big.js
124
+ // let result: any;
125
+ // if (markUp) {
126
+ // // Perform markup calculation (add the calculated amount)
127
+ // result = price.plus(discountAmount);
128
+ // } else {
129
+ // // Perform discount calculation (subtract the calculated amount)
130
+ // result = price.minus(discountAmount);
131
+ // }
132
+ // const finalPrice = result.toNumber();
133
+ // return finalPrice;
137
134
  }
138
135
  /**
139
136
  * Calculates a price with markup applied
@@ -142,14 +139,18 @@ function CalcDiscPrice(originalPrice, discountPercentage, markUp = false) {
142
139
  * @returns The final marked-up price as a number
143
140
  */
144
141
  function CalcMarkup(originalPrice, markupPercentage) {
142
+ const price = (0, util_js_1.GetNumber)(originalPrice);
143
+ const perc = (0, util_js_1.GetNumber)(markupPercentage);
144
+ const markupAmount = Multiply(price, Divide(perc, 100));
145
+ return Add(price, markupAmount);
145
146
  // Convert inputs to Big.js objects for precision
146
- const price = new big_js_1.default((0, util_js_1.GetNumber)(originalPrice));
147
- const percentage = new big_js_1.default((0, util_js_1.GetNumber)(markupPercentage)).div(100);
148
- // Calculate markup amount based on percentage of original price
149
- const markupAmount = price.mul(percentage);
150
- // Add markup amount to original price
151
- const result = price.plus(markupAmount);
152
- return result.toNumber();
147
+ // const price = new Big(GetNumber(originalPrice));
148
+ // const percentage = new Big(GetNumber(markupPercentage)).div(100);
149
+ // // Calculate markup amount based on percentage of original price
150
+ // const markupAmount = price.mul(percentage);
151
+ // // Add markup amount to original price
152
+ // const result = price.plus(markupAmount);
153
+ // return result.toNumber();
153
154
  }
154
155
  /**
155
156
  * Calculates a price with markdown (discount) applied
@@ -158,14 +159,18 @@ function CalcMarkup(originalPrice, markupPercentage) {
158
159
  * @returns The final marked-down price as a number
159
160
  */
160
161
  function CalcMarkdown(originalPrice, markdownPercentage) {
162
+ const price = (0, util_js_1.GetNumber)(originalPrice);
163
+ const perc = (0, util_js_1.GetNumber)(markdownPercentage);
164
+ const markdownAmount = Multiply(price, Divide(perc, 100));
165
+ return Subtract(price, markdownAmount);
161
166
  // Convert inputs to Big.js objects for precision
162
- const price = new big_js_1.default((0, util_js_1.GetNumber)(originalPrice));
163
- const percentage = new big_js_1.default((0, util_js_1.GetNumber)(markdownPercentage)).div(100);
164
- // Calculate markdown amount based on percentage of original price
165
- const markdownAmount = price.mul(percentage);
166
- // Subtract markdown amount from original price
167
- const result = price.minus(markdownAmount);
168
- return result.toNumber();
167
+ // const price = new Big(GetNumber(originalPrice));
168
+ // const percentage = new Big(GetNumber(markdownPercentage)).div(100);
169
+ // // Calculate markdown amount based on percentage of original price
170
+ // const markdownAmount = price.mul(percentage);
171
+ // // Subtract markdown amount from original price
172
+ // const result = price.minus(markdownAmount);
173
+ // return result.toNumber();
169
174
  }
170
175
  /**
171
176
  * Calculates the margin value as a percentage based on price and cost
@@ -5,10 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SharedPDFService = void 0;
7
7
  const jsbarcode_1 = __importDefault(require("jsbarcode"));
8
- const aggregation_1 = require("../aggregation/aggregation");
9
8
  const enums_1 = require("../enums/enums");
10
9
  const my_date_1 = require("../utils/my-date");
11
10
  const tr_utils_1 = require("../utils/tr-utils");
11
+ const math_operations_1 = require("./math-operations");
12
12
  class SharedPDFService {
13
13
  static MainHeading(CName, Entity, Image, HColor, CopyName) {
14
14
  let headerstyle;
@@ -1612,12 +1612,12 @@ class SharedPDFService {
1612
1612
  let totalDisc;
1613
1613
  let totalTax;
1614
1614
  if (!Consolidate) {
1615
- totalTax = tr_utils_1.TrUtils.FixPriceValue((0, aggregation_1.addition)(Number(LaborTotalTax), Number(PartTotalTax)), RecordData.Entity.DecimalsNumber);
1615
+ totalTax = tr_utils_1.TrUtils.FixPriceValue((0, math_operations_1.Add)(Number(LaborTotalTax), Number(PartTotalTax)), RecordData.Entity.DecimalsNumber);
1616
1616
  if (istaxable) {
1617
- totalDisc = tr_utils_1.TrUtils.FixPriceValue((0, aggregation_1.addition)(Number(OverAllMainLaborDiscount), Number(OverAllMainPartsDiscount)), RecordData.Entity.DecimalsNumber);
1617
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue((0, math_operations_1.Add)(Number(OverAllMainLaborDiscount), Number(OverAllMainPartsDiscount)), RecordData.Entity.DecimalsNumber);
1618
1618
  }
1619
1619
  else {
1620
- totalDisc = tr_utils_1.TrUtils.FixPriceValue((0, aggregation_1.addition)(Number(OverAllMainLaborDiscount), Number(OverAllMainPartsDiscount)), RecordData.Entity.DecimalsNumber);
1620
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue((0, math_operations_1.Add)(Number(OverAllMainLaborDiscount), Number(OverAllMainPartsDiscount)), RecordData.Entity.DecimalsNumber);
1621
1621
  }
1622
1622
  }
1623
1623
  // let serviceName: string;
@@ -1740,12 +1740,12 @@ class SharedPDFService {
1740
1740
  let totalDisc;
1741
1741
  let totalTax;
1742
1742
  if (!Consolidate) {
1743
- totalTax = tr_utils_1.TrUtils.FixPriceValue((0, aggregation_1.addition)(Number(LaborTotalTax), Number(PartTotalTax)), RecordData.Entity.DecimalsNumber);
1743
+ totalTax = tr_utils_1.TrUtils.FixPriceValue((0, math_operations_1.Add)(Number(LaborTotalTax), Number(PartTotalTax)), RecordData.Entity.DecimalsNumber);
1744
1744
  if (istaxable) {
1745
- totalDisc = tr_utils_1.TrUtils.FixPriceValue((0, aggregation_1.addition)(Number(OverAllMainLaborDiscount), Number(OverAllMainPartsDiscount)), RecordData.Entity.DecimalsNumber);
1745
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue((0, math_operations_1.Add)(Number(OverAllMainLaborDiscount), Number(OverAllMainPartsDiscount)), RecordData.Entity.DecimalsNumber);
1746
1746
  }
1747
1747
  else {
1748
- totalDisc = tr_utils_1.TrUtils.FixPriceValue((0, aggregation_1.addition)(Number(OverAllMainLaborDiscount), Number(OverAllMainPartsDiscount)), RecordData.Entity.DecimalsNumber);
1748
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue((0, math_operations_1.Add)(Number(OverAllMainLaborDiscount), Number(OverAllMainPartsDiscount)), RecordData.Entity.DecimalsNumber);
1749
1749
  }
1750
1750
  }
1751
1751
  return {
@@ -1989,7 +1989,7 @@ class SharedPDFService {
1989
1989
  }
1990
1990
  else {
1991
1991
  if (!Consolidate) {
1992
- AccountFields.unshift({ name: 'SubTotal', value: tr_utils_1.TrUtils.FixPriceValue((0, aggregation_1.addition)(tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(LaborAfterGST)), tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(PartsAfterGST))), DecimalsNumber) });
1992
+ AccountFields.unshift({ name: 'SubTotal', value: tr_utils_1.TrUtils.FixPriceValue((0, math_operations_1.Add)(tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(LaborAfterGST)), tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(PartsAfterGST))), DecimalsNumber) });
1993
1993
  }
1994
1994
  }
1995
1995
  if (!tr_utils_1.TrUtils.IsEmpty(totalTax)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.5.02",
3
+ "version": "1.5.04",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",