shareneus 1.5.1 → 1.5.3
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/accounting/counter-sales/sales-receipt-print.service.js +8 -9
- package/dist/accounting/credit-note/cn-print.service.js +7 -7
- package/dist/accounting/credit-note/credit-note-totals.service.d.ts +2 -2
- package/dist/accounting/credit-note/credit-note-totals.service.js +33 -33
- package/dist/accounting/debit-note/debit-note-print.service.js +8 -8
- package/dist/accounting/debit-note/debit-note-totals.service.d.ts +2 -2
- package/dist/accounting/debit-note/debit-note-totals.service.js +27 -27
- package/dist/accounting/invoice/inv-pdf.service.js +12 -12
- package/dist/accounting/invoice/inv-print.service.js +11 -11
- package/dist/accounting/invoice/invoice-landscape-pdf.service.js +4 -4
- package/dist/accounting/invoice/invoice-letterhead-pdf.service.js +12 -12
- package/dist/accounting/invoice/invoice-portrait-pdf.js +5 -5
- package/dist/accounting/invoice/invoice-total.service.d.ts +8 -8
- package/dist/accounting/invoice/invoice-total.service.js +79 -79
- package/dist/accounting/invoice/reports/excel/items-wise-sales-excel.service.js +2 -2
- package/dist/accounting/invoice/reports/excel/sa-wise-labor-sales-excel.service.js +4 -4
- package/dist/accounting/invoice/reports/excel/sa-wise-part-sales-excel.service.js +4 -4
- package/dist/accounting/invoice/reports/excel/sale-summary-excel.service.js +3 -3
- package/dist/accounting/invoice/reports/excel/sales-by-service-summary-excel.service.js +3 -3
- package/dist/accounting/invoice/reports/pdf/item-wise-sales-pdf.service.js +2 -2
- package/dist/accounting/invoice/reports/pdf/manf-wise-sales-pdf.service.js +2 -2
- package/dist/accounting/invoice/reports/pdf/sales-by-service-pdf.service.js +2 -2
- package/dist/appointments/appointments/appointment-total.service.js +12 -12
- package/dist/appointments/consultations/consultation-fee-receipt.service.js +2 -2
- package/dist/purchases/purchase-order/po-totals.service.js +13 -13
- package/dist/purchases/purchase-order/purchase-order-totals.service.d.ts +1 -1
- package/dist/purchases/purchase-order/purchase-order-totals.service.js +58 -58
- package/dist/purchases/vendor-credit-note/vendor-credit-note-totals.service.d.ts +1 -1
- package/dist/purchases/vendor-credit-note/vendor-credit-note-totals.service.js +20 -20
- package/dist/purchases/vendor-debit-note/vendor-debit-note-print.service.js +7 -7
- package/dist/purchases/vendor-debit-note/vendor-debit-note-totals.service.d.ts +2 -2
- package/dist/purchases/vendor-debit-note/vendor-debit-note-totals.service.js +26 -26
- package/dist/sales/delivery-challan/dc-landscape-pdf.service.js +4 -4
- package/dist/sales/delivery-challan/delivery-challan-print.service.js +7 -7
- package/dist/sales/delivery-challan/delivery-challan-totals.js +35 -35
- package/dist/sales/sales/sales-print.service.js +9 -9
- package/dist/sales/sales/sales-totals.service.js +32 -32
- package/dist/sales-receive/sales-receive-print.service.js +10 -10
- package/dist/sales-receive/sales-receive-totals.service.d.ts +2 -2
- package/dist/sales-receive/sales-receive-totals.service.js +32 -32
- package/dist/sales-receive/sales-total-calculation.js +1 -1
- package/dist/services/est.print-service.js +5 -5
- package/dist/services/ro-print-service.js +13 -13
- package/dist/services/ro-totals.service.d.ts +4 -4
- package/dist/services/ro-totals.service.js +140 -140
- package/dist/shared/math-operations.js +46 -41
- package/dist/shared/shared-pdf.service.js +8 -8
- 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.
|
|
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.
|
|
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.
|
|
75
|
+
result = result.times(bigNumber);
|
|
76
76
|
}
|
|
77
77
|
// Convert back to JavaScript number type
|
|
78
|
-
return result.
|
|
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.
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
|
119
|
-
const percentage = new
|
|
120
|
-
// Calculate the amount to add or subtract
|
|
121
|
-
const discountAmount = price.mul(percentage);
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
//
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
|
147
|
-
const percentage = new
|
|
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
|
|
163
|
-
const percentage = new
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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)) {
|