shareneus 1.5.0 → 1.5.2
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.
|
@@ -3,7 +3,7 @@ export declare class SalesReceivePrintService {
|
|
|
3
3
|
static GetPrintConditionsBasedOnInput(SalesReceivePrintData: any, IncludeGST: boolean, ConsolidateGST: boolean, ForInsurance: boolean, SType: any, OriginalSalesReceiveData: any, IsProforma: boolean): any;
|
|
4
4
|
static GetSalesReceiveTypeHeading(SalesReceivePrintData: any, OriginalSalesReceiveData: any, IncludeGST: boolean, ConsolidateGST: boolean, IsProforma: boolean): any;
|
|
5
5
|
static GetSalesReceiveOtherDetailsForPrint(SalesReceivePrintData: any, OriginalSalesReceiveData: any): any;
|
|
6
|
-
static GetItemsPrintInfo(Items: any, Consolidate: boolean, TaxCodes: any, LineTotal: string, DecimalsNumber: number): any;
|
|
6
|
+
static GetItemsPrintInfo(Items: any, Consolidate: boolean, TaxCodes: any, LineTotal: string, IsTaxable: boolean, DecimalsNumber: number): any;
|
|
7
7
|
static ReverseItemsForSalesReceivePrint(argSalesReceiveData: any): any;
|
|
8
8
|
static PrepareFormatForSalesReceivePrint(SalesReceivePrintData: any, ROType: any, InvoiceStatus: any): any[];
|
|
9
9
|
static GetFormattedProductDataForPrint(OriginalSalesReceiveData: any, SalesReceivePrintData: any): any;
|
|
@@ -4,7 +4,6 @@ exports.SalesReceivePrintService = void 0;
|
|
|
4
4
|
const aggregation_1 = require("../aggregation/aggregation");
|
|
5
5
|
const code_enums_1 = require("../enums/code-enums");
|
|
6
6
|
const enums_1 = require("../enums/enums");
|
|
7
|
-
const math_operations_1 = require("../shared/math-operations");
|
|
8
7
|
const shared_print_service_1 = require("../shared/shared-print.service");
|
|
9
8
|
const my_date_1 = require("../utils/my-date");
|
|
10
9
|
const tr_utils_1 = require("../utils/tr-utils");
|
|
@@ -21,6 +20,7 @@ class SalesReceivePrintService {
|
|
|
21
20
|
SalesReceivePrintData.IsProforma = IsProforma;
|
|
22
21
|
SalesReceivePrintData.Settings = tr_utils_1.TrUtils.Stringify(argSalesReceiveData.Settings);
|
|
23
22
|
SalesReceivePrintData.SType = tr_utils_1.TrUtils.Stringify(argSalesReceiveData.SType);
|
|
23
|
+
SalesReceivePrintData.Items = tr_utils_1.TrUtils.Stringify(argSalesReceiveData.Items);
|
|
24
24
|
let SType = tr_utils_1.TrUtils.IsNull(argSalesReceiveData.SType) ? null : argSalesReceiveData.SType;
|
|
25
25
|
SalesReceivePrintData = this.GetPrintConditionsBasedOnInput(SalesReceivePrintData, IncludeGST, ConsolidateGST, ForInsurance, SType, argSalesReceiveData, IsProforma);
|
|
26
26
|
SalesReceivePrintData.Entity = shared_print_service_1.PrintSharedService.GetFormattedEntityDataForPrint(OriginalEntityData, "Invoice", OriginalSalesReceiveData);
|
|
@@ -30,14 +30,14 @@ class SalesReceivePrintService {
|
|
|
30
30
|
// let finalTotalsData: any = SalesReceiveTotalsService.GetTotalsValue([], argSalesReceiveData.Items, IsTaxable,
|
|
31
31
|
// true,
|
|
32
32
|
// argSalesReceiveData.Disc, argSalesReceiveData.Perc, TaxCodes, true, argSalesReceiveData.Settings, SalesReceivePrintData.Entity);
|
|
33
|
-
let finalTotalsData = (0, sales_total_calculation_1.SalesTotalCalculationsWithDecimals)(argSalesReceiveData.Items, [], IsTaxable, argSalesReceiveData.DecimalsNumber);
|
|
33
|
+
let finalTotalsData = (0, sales_total_calculation_1.SalesTotalCalculationsWithDecimals)(argSalesReceiveData.Items, [], IsTaxable, TaxCodes, argSalesReceiveData.DecimalsNumber);
|
|
34
34
|
if (ConsolidateGST) {
|
|
35
35
|
// finalTotalsData.CustLaborTotalBeforeDisc = finalTotalsData.CustLaborAfterTax;
|
|
36
36
|
// finalTotalsData.CustPartsTotalBeforeDisc = finalTotalsData.CustPartAfterTax;
|
|
37
|
-
finalTotalsData.CustPartsTotalBeforeDisc = (0,
|
|
37
|
+
finalTotalsData.CustPartsTotalBeforeDisc = (0, aggregation_1.addition)(finalTotalsData.totalTaxOnItems, (0, aggregation_1.subtraction)(finalTotalsData.subtotalOnItems, finalTotalsData.totalDiscountOnItems));
|
|
38
38
|
}
|
|
39
39
|
SalesReceivePrintData = tr_utils_1.TrUtils.ConcatObjects(SalesReceivePrintData, finalTotalsData);
|
|
40
|
-
SalesReceivePrintData.Items = this.GetItemsPrintInfo(SalesReceivePrintData.Items, ConsolidateGST, TaxCodes, (_b = (_a = OriginalEntityData.Entity.Settings) === null || _a === void 0 ? void 0 : _a.Acc) === null || _b === void 0 ? void 0 : _b.LTot, SalesReceivePrintData.Entity.DecimalsNumber);
|
|
40
|
+
SalesReceivePrintData.Items = this.GetItemsPrintInfo(SalesReceivePrintData.Items, ConsolidateGST, TaxCodes, (_b = (_a = OriginalEntityData.Entity.Settings) === null || _a === void 0 ? void 0 : _a.Acc) === null || _b === void 0 ? void 0 : _b.LTot, IsTaxable, SalesReceivePrintData.Entity.DecimalsNumber);
|
|
41
41
|
argSalesReceiveData = this.ReverseItemsForSalesReceivePrint(argSalesReceiveData);
|
|
42
42
|
SalesReceivePrintData.PrintInfo = this.PrepareFormatForSalesReceivePrint(SalesReceivePrintData, code_enums_1.ROTypeEnum.Invoice, argSalesReceiveData.Sts);
|
|
43
43
|
SalesReceivePrintData = this.GetFormattedProductDataForPrint(argSalesReceiveData, SalesReceivePrintData);
|
|
@@ -69,10 +69,11 @@ class SalesReceivePrintService {
|
|
|
69
69
|
SalesReceivePrintData.CrDate = my_date_1.MyDate.ConvertUTCDateToReadable(OriginalSalesReceiveData.CrDate);
|
|
70
70
|
return SalesReceivePrintData;
|
|
71
71
|
}
|
|
72
|
-
static GetItemsPrintInfo(Items, Consolidate, TaxCodes, LineTotal, DecimalsNumber) {
|
|
72
|
+
static GetItemsPrintInfo(Items, Consolidate, TaxCodes, LineTotal, IsTaxable, DecimalsNumber) {
|
|
73
73
|
Items.forEach((Item) => {
|
|
74
74
|
if (Consolidate) {
|
|
75
|
-
let
|
|
75
|
+
let AfterPartDisc = (0, aggregation_1.subtraction)(Item.UnAmt, Item.Disc, Item.RecDisc);
|
|
76
|
+
let AfterDiscForEach = (0, aggregation_1.division)(AfterPartDisc, Item.Qty);
|
|
76
77
|
let CTaxAmtPerItem = (0, aggregation_1.division)(Item.CGST, Item.Qty);
|
|
77
78
|
let STaxAmtPerItem = (0, aggregation_1.division)(Item.SGST, Item.Qty);
|
|
78
79
|
let ITaxAmtPerItem = (0, aggregation_1.division)(Item.IGST, Item.Qty);
|
|
@@ -87,6 +88,13 @@ class SalesReceivePrintService {
|
|
|
87
88
|
Item.CGSTPerc = shared_print_service_1.PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
88
89
|
Item.SGSTPerc = shared_print_service_1.PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
89
90
|
Item.IGSTPerc = shared_print_service_1.PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
91
|
+
// Calculate amount after tax based on tax type
|
|
92
|
+
if (IsTaxable) {
|
|
93
|
+
Item.AfterPartTax = (0, aggregation_1.addition)(Item.AfterPartDisc, Item.CGST, Item.SGST, Item.IGST);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
Item.AfterPartTax = Item.AfterPartDisc;
|
|
97
|
+
}
|
|
90
98
|
if (LineTotal === 'AT') {
|
|
91
99
|
Item.LineTotal = tr_utils_1.TrUtils.FixPriceValue(Item.AfterPartTax, DecimalsNumber);
|
|
92
100
|
}
|
|
@@ -181,12 +181,12 @@ function CalculateTaxSummary(items, taxCodes) {
|
|
|
181
181
|
const tax = taxMap[item.TCode];
|
|
182
182
|
if (!tax)
|
|
183
183
|
return acc;
|
|
184
|
-
const
|
|
184
|
+
const percent = (((tax.IGST || 0) + (tax.CGST || 0) + (tax.SGST || 0)) + "%");
|
|
185
185
|
// taxable value after discounts
|
|
186
186
|
const taxable = (0, math_operations_1.Subtract)((0, util_1.GetNumber)(item.UnAmt), (0, math_operations_1.Add)((0, util_1.GetNumber)(item.Disc), (0, util_1.GetNumber)(item.RecDisc)));
|
|
187
|
-
if (!acc[
|
|
188
|
-
acc[
|
|
189
|
-
Tax:
|
|
187
|
+
if (!acc[percent]) {
|
|
188
|
+
acc[percent] = {
|
|
189
|
+
Tax: percent,
|
|
190
190
|
TaxableAmount: 0,
|
|
191
191
|
TaxAmount: 0,
|
|
192
192
|
CGSTAmount: 0,
|
|
@@ -194,11 +194,11 @@ function CalculateTaxSummary(items, taxCodes) {
|
|
|
194
194
|
IGSTAmount: 0
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
|
-
acc[
|
|
198
|
-
acc[
|
|
199
|
-
acc[
|
|
200
|
-
acc[
|
|
201
|
-
acc[
|
|
197
|
+
acc[percent].TaxableAmount = (0, math_operations_1.Add)(acc[percent].TaxableAmount, taxable);
|
|
198
|
+
acc[percent].TaxAmount = (0, math_operations_1.Add)(acc[percent].TaxAmount, (0, math_operations_1.Add)((0, math_operations_1.Divide)((0, math_operations_1.Multiply)(taxable, (0, util_1.GetNumber)(tax.CGST)), 100), (0, math_operations_1.Divide)((0, math_operations_1.Multiply)(taxable, (0, util_1.GetNumber)(tax.SGST)), 100), (0, math_operations_1.Divide)((0, math_operations_1.Multiply)(taxable, (0, util_1.GetNumber)(tax.IGST)), 100)));
|
|
199
|
+
acc[percent].CGSTAmount = (0, math_operations_1.Add)(acc[percent].CGSTAmount, (0, math_operations_1.Divide)((0, math_operations_1.Multiply)(taxable, (0, util_1.GetNumber)(tax.CGST)), 100));
|
|
200
|
+
acc[percent].SGSTAmount = (0, math_operations_1.Add)(acc[percent].SGSTAmount, (0, math_operations_1.Divide)((0, math_operations_1.Multiply)(taxable, (0, util_1.GetNumber)(tax.SGST)), 100));
|
|
201
|
+
acc[percent].IGSTAmount = (0, math_operations_1.Add)(acc[percent].IGSTAmount, (0, math_operations_1.Divide)((0, math_operations_1.Multiply)(taxable, (0, util_1.GetNumber)(tax.IGST)), 100));
|
|
202
202
|
return acc;
|
|
203
203
|
}, {}));
|
|
204
204
|
}
|