shareneus 1.0.5
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/aggregation/aggregation.js +60 -0
- package/dist/enums/cache-enums.js +37 -0
- package/dist/enums/code-enums.js +288 -0
- package/dist/enums/enums.js +362 -0
- package/dist/enums/industry-enums.js +24 -0
- package/dist/excel-files/GSTR-RO-excel.service.js +935 -0
- package/dist/excel-files/GSTR1-excel.service.js +295 -0
- package/dist/excel-files/GSTR2-excel.service.js +295 -0
- package/dist/excel-files/analysis-excel.service.js +297 -0
- package/dist/excel-files/category-wise-item-excel.service.js +274 -0
- package/dist/excel-files/cust-balance-excel.service.js +287 -0
- package/dist/excel-files/cust-wise-sales-details.js +320 -0
- package/dist/excel-files/cust-wise-sales-summary-excel.service.js +302 -0
- package/dist/excel-files/expiring-drugs-excel.service.js +292 -0
- package/dist/excel-files/insurance-expire-excel.service.js +301 -0
- package/dist/excel-files/invoice-wise-excel.service.js +857 -0
- package/dist/excel-files/item-wise-doctor-sale-excel.service.js +258 -0
- package/dist/excel-files/item-wise-mout-details.js +292 -0
- package/dist/excel-files/item-wise-mout-summary.js +286 -0
- package/dist/excel-files/items-wise-sales-excel.service.js +314 -0
- package/dist/excel-files/manf-wise-sales-excel.service.js +276 -0
- package/dist/excel-files/operator-wise-details.js +265 -0
- package/dist/excel-files/operator-wise-summary.js +266 -0
- package/dist/excel-files/payment-receive-excel.service.js +225 -0
- package/dist/excel-files/payments-made-excel.service.js +302 -0
- package/dist/excel-files/repair-orders-excel.service.js +255 -0
- package/dist/excel-files/sa-wise-labor-sales-excel.service.js +232 -0
- package/dist/excel-files/sa-wise-part-sales-excel.service.js +232 -0
- package/dist/excel-files/sale-summary-excel.service.js +326 -0
- package/dist/excel-files/sales-by-service-details-excel.service.js +1 -0
- package/dist/excel-files/sales-by-service-summary-excel.service.js +422 -0
- package/dist/excel-files/scheduled-drug-summary-excel.service.js +367 -0
- package/dist/excel-files/scheduled-drugs-excel.service.js +366 -0
- package/dist/excel-files/spares-issue-excel.service.js +492 -0
- package/dist/excel-files/stock-excel.service.js +283 -0
- package/dist/excel-files/tally-sales-import.service.js +765 -0
- package/dist/excel-files/ven-balance-excel.service.js +293 -0
- package/dist/index.js +237 -0
- package/dist/services/analysis-pdf.service.js +105 -0
- package/dist/services/appointment-total.service.js +253 -0
- package/dist/services/auto-sales-receipt-pdf.service.js +539 -0
- package/dist/services/category-wise-item-pdf.service.js +98 -0
- package/dist/services/checklist-pdf.js +140 -0
- package/dist/services/checklists-pdf.js +124 -0
- package/dist/services/cn-print.service.js +211 -0
- package/dist/services/consultation-fee-receipt.service.js +378 -0
- package/dist/services/consultation-full-pdf.service.js +220 -0
- package/dist/services/consultation-pdf.service.js +360 -0
- package/dist/services/credit-note-pdf.service.js +578 -0
- package/dist/services/credit-note-totals.service.js +328 -0
- package/dist/services/cust-wise-sales-details-pdf.service.js +118 -0
- package/dist/services/cust-wise-sales-summary-pdf.service.js +111 -0
- package/dist/services/customer-balances-pdf.service.js +169 -0
- package/dist/services/dc-landscape-pdf.service.js +903 -0
- package/dist/services/dc-landscape-without-price-pdf.service.js +853 -0
- package/dist/services/dc-without-price-pdf.service.js +489 -0
- package/dist/services/debit-note-pdf.service.js +673 -0
- package/dist/services/debit-note-print.service.js +234 -0
- package/dist/services/debit-note-totals.service.js +293 -0
- package/dist/services/delivery-challan-pdf.service.js +434 -0
- package/dist/services/delivery-challan-print.service.js +177 -0
- package/dist/services/delivery-challan-totals.js +339 -0
- package/dist/services/equipment-design-pdf.service.js +144 -0
- package/dist/services/est.print-service.js +1053 -0
- package/dist/services/expiring-drugs-pdf.service.js +156 -0
- package/dist/services/hc-inv-pdf.service.js +837 -0
- package/dist/services/insurance-expire-pdf.service.js +99 -0
- package/dist/services/inv-pdf.service.js +785 -0
- package/dist/services/inv-print.service.js +415 -0
- package/dist/services/invoice-landscape-pdf.service.js +909 -0
- package/dist/services/invoice-total.service.js +659 -0
- package/dist/services/issue-parts-pdf.service.js +763 -0
- package/dist/services/item-detais-pdf.js +136 -0
- package/dist/services/item-wise-doctor-sale-pdf.service.js +164 -0
- package/dist/services/item-wise-mout-details-pdf.js +107 -0
- package/dist/services/item-wise-mout-summary-pdf.js +99 -0
- package/dist/services/item-wise-sales-pdf.service.js +178 -0
- package/dist/services/manf-wise-sales-pdf.service.js +173 -0
- package/dist/services/meeting-pdf.js +369 -0
- package/dist/services/mout-pdf.service.js +503 -0
- package/dist/services/operator-wise-details-pdf.service.js +103 -0
- package/dist/services/operator-wise-summary-pdf.js +101 -0
- package/dist/services/pack-ship-pdf.service.js +105 -0
- package/dist/services/pack-ship-print.service.js +167 -0
- package/dist/services/payment-pdf.service.js +373 -0
- package/dist/services/payment-report-pdf.service.js +106 -0
- package/dist/services/po-totals.service.js +279 -0
- package/dist/services/pos-receipt-pdf.js +438 -0
- package/dist/services/purchase-order-pdf.service.js +924 -0
- package/dist/services/purchase-order-print.service.js +150 -0
- package/dist/services/purchase-order-totals.service.js +280 -0
- package/dist/services/receipt-print.service.js +50 -0
- package/dist/services/reorder-point-pdf.service.js +151 -0
- package/dist/services/repair-orders-pdf.service.js +172 -0
- package/dist/services/ro-pdf.service.js +1764 -0
- package/dist/services/ro-print-service.js +737 -0
- package/dist/services/ro-totals.service.js +1241 -0
- package/dist/services/sales-by-service-pdf.service.js +116 -0
- package/dist/services/sales-pdf.service.js +630 -0
- package/dist/services/sales-print.service.js +305 -0
- package/dist/services/sales-receipt-pdf.service.js +611 -0
- package/dist/services/sales-receipt-print.service.js +425 -0
- package/dist/services/sales-totals.service.js +339 -0
- package/dist/services/scheduled-drug-pdf.service.js +176 -0
- package/dist/services/scheduled-drug-summary-pdf.service.js +188 -0
- package/dist/services/separate-wo-print.service.js +351 -0
- package/dist/services/shared-inv-pdf.service.js +763 -0
- package/dist/services/shared-pdf.service.js +2569 -0
- package/dist/services/shared-print.service.js +885 -0
- package/dist/services/task-pdf.service.js +220 -0
- package/dist/services/task-reports-pdf.service.js +296 -0
- package/dist/services/technician-pdf.service.js +238 -0
- package/dist/services/technician-print.service.js +87 -0
- package/dist/services/transfer-order-pdf.service.js +139 -0
- package/dist/services/vendor-balances-pdf.service.js +101 -0
- package/dist/services/vendor-credit-note-pdf.service.js +1007 -0
- package/dist/services/vendor-credit-note-print.service.js +104 -0
- package/dist/services/vendor-credit-note-totals.service.js +327 -0
- package/dist/services/vendor-debit-note-pdf.service.js +561 -0
- package/dist/services/vendor-debit-note-print.service.js +245 -0
- package/dist/services/vendor-debit-note-totals.service.js +305 -0
- package/dist/utils/my-date.js +652 -0
- package/dist/utils/tr-utils.js +354 -0
- package/package.json +24 -0
- package/tsconfig.json +109 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeliveryChallanTotalsService = void 0;
|
|
4
|
+
const aggregation_1 = require("../aggregation/aggregation");
|
|
5
|
+
const tr_utils_1 = require("../utils/tr-utils");
|
|
6
|
+
class DeliveryChallanTotalsService {
|
|
7
|
+
static GetTotalsValue(PartsList, IsIndependentTax, DetailedInfo, Disc, Perc, TaxCodes, WithItems, Settings, isRoundable) {
|
|
8
|
+
// LPerc = TrUtils.SetPercToStringIfNull(LPerc);
|
|
9
|
+
Perc = tr_utils_1.TrUtils.SetPercToStringIfNull(Perc);
|
|
10
|
+
// LDisc = TrUtils.SetValueToZeroIfNull(LDisc);
|
|
11
|
+
Disc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Disc);
|
|
12
|
+
PartsList = this.CalculateLaborPartValues(PartsList, IsIndependentTax);
|
|
13
|
+
let finalTotalsData = this.GetFinalChallanDataForSave(PartsList, IsIndependentTax, Disc, Perc, DetailedInfo, Settings, isRoundable);
|
|
14
|
+
if (DetailedInfo) {
|
|
15
|
+
finalTotalsData = this.GetDetailedTotalsData(finalTotalsData, IsIndependentTax, PartsList, TaxCodes);
|
|
16
|
+
}
|
|
17
|
+
if (WithItems) {
|
|
18
|
+
finalTotalsData.Items = PartsList;
|
|
19
|
+
}
|
|
20
|
+
return finalTotalsData;
|
|
21
|
+
}
|
|
22
|
+
static CalculateLaborPartValues(PartsList, IsIndependentTax) {
|
|
23
|
+
PartsList = this.ResetLaborPartValues(PartsList, IsIndependentTax);
|
|
24
|
+
// PartsList = this.GetLaborPartsDiscountPrice(PartsList);
|
|
25
|
+
// PartsList = this.GetLaborPartsAfterDiscount(PartsList);
|
|
26
|
+
// PartsList = this.GetPartsAfterTax(PartsList, IsIndependentTax);
|
|
27
|
+
return PartsList;
|
|
28
|
+
}
|
|
29
|
+
static ResetLaborPartValues(PartsList, IsIndependentTax) {
|
|
30
|
+
PartsList.forEach((Part) => {
|
|
31
|
+
Part = this.ResetLaborPartValueIfInvalid(Part);
|
|
32
|
+
Part.DiscountedPrice = (0, aggregation_1.addition)(Part.Disc, tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.RecDisc));
|
|
33
|
+
Part.AfterPartDisc = Part.NetAmt;
|
|
34
|
+
if (IsIndependentTax) {
|
|
35
|
+
Part.AfterPartTax = (0, aggregation_1.addition)(Part.AfterPartDisc, Part.CGST, Part.SGST, Part.IGST);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
Part.AfterPartTax = Part.AfterPartDisc;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return PartsList;
|
|
42
|
+
}
|
|
43
|
+
static ResetLaborPartValueIfInvalid(Part) {
|
|
44
|
+
Part.UnPr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.UnPr);
|
|
45
|
+
Part.Disc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.Disc);
|
|
46
|
+
Part.RecDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.RecDisc);
|
|
47
|
+
Part.CGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.CGST);
|
|
48
|
+
Part.SGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.SGST);
|
|
49
|
+
Part.IGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.IGST);
|
|
50
|
+
return Part;
|
|
51
|
+
}
|
|
52
|
+
static GetFinalChallanDataForSave(PartsList, IsIndependentTax, Disc, Perc, DetailedInfo, Settings, isRoundable) {
|
|
53
|
+
let finalTotalsData = {};
|
|
54
|
+
finalTotalsData = this.SetMainDiscountValues(Disc, Perc, finalTotalsData, DetailedInfo);
|
|
55
|
+
finalTotalsData.Settings = Settings;
|
|
56
|
+
finalTotalsData = this.GetFinalCustomerTotalsData(finalTotalsData, PartsList, IsIndependentTax, DetailedInfo, isRoundable);
|
|
57
|
+
return finalTotalsData;
|
|
58
|
+
}
|
|
59
|
+
static SetMainDiscountValues(Disc, Perc, finalTotalsData, DetailedInfo) {
|
|
60
|
+
finalTotalsData.Disc = Disc;
|
|
61
|
+
finalTotalsData.Perc = Perc;
|
|
62
|
+
if (DetailedInfo) {
|
|
63
|
+
finalTotalsData.FixedDisc = Disc;
|
|
64
|
+
}
|
|
65
|
+
return finalTotalsData;
|
|
66
|
+
}
|
|
67
|
+
static GetFinalCustomerTotalsData(finalTotalsData, PartsList, IsIndependentTax, DetailedInfo, isRoundable) {
|
|
68
|
+
let CustomerAfterDiscTotals = this.GetSubTotalFor(PartsList);
|
|
69
|
+
// let CustLaborTaxTotal = this.GetLaborTaxTotalFor(IsIndependentTax);
|
|
70
|
+
let CustPartTaxTotal = this.GetPartsTaxTotalFor(PartsList, IsIndependentTax);
|
|
71
|
+
// console.log('CustPartTaxTotal', CustPartTaxTotal);
|
|
72
|
+
finalTotalsData.SubTotal = tr_utils_1.TrUtils.FixedTo(CustomerAfterDiscTotals);
|
|
73
|
+
let CustTotal = this.GetCustomerTotalBasedOnTaxType(CustPartTaxTotal, PartsList, IsIndependentTax);
|
|
74
|
+
// console.log('CustTotal', CustTotal);
|
|
75
|
+
if (isRoundable) {
|
|
76
|
+
finalTotalsData.Round = tr_utils_1.TrUtils.FixedTo(Math.round(CustTotal) - CustTotal);
|
|
77
|
+
finalTotalsData.Total = Math.round(CustTotal);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
finalTotalsData.Total = tr_utils_1.TrUtils.FixedTo(CustTotal);
|
|
81
|
+
}
|
|
82
|
+
if (DetailedInfo) {
|
|
83
|
+
finalTotalsData.FixedSubTotal = tr_utils_1.TrUtils.FixedTo(CustomerAfterDiscTotals);
|
|
84
|
+
finalTotalsData.FixedTotal = tr_utils_1.TrUtils.FixedTo(CustTotal);
|
|
85
|
+
}
|
|
86
|
+
return finalTotalsData;
|
|
87
|
+
}
|
|
88
|
+
static GetSubTotalFor(PartsList) {
|
|
89
|
+
// let LaborTotalAfterDisc: any = this.GetLaborTotalAfterDiscount(LaborList);
|
|
90
|
+
let PartsTotalAfterDisc = this.GetPartsTotalAfterDiscount(PartsList);
|
|
91
|
+
return PartsTotalAfterDisc;
|
|
92
|
+
}
|
|
93
|
+
static GetPartsTotalAfterDiscount(PartsList) {
|
|
94
|
+
let PartsTotalAfterDisc = 0;
|
|
95
|
+
// console.log('PartsList', PartsList);
|
|
96
|
+
PartsList.forEach((Part) => {
|
|
97
|
+
PartsTotalAfterDisc = (0, aggregation_1.addition)(PartsTotalAfterDisc, Part.AfterPartDisc);
|
|
98
|
+
});
|
|
99
|
+
return PartsTotalAfterDisc;
|
|
100
|
+
}
|
|
101
|
+
static GetDetailedTotalsData(finalTotalsData, IsIndependentTax, PartsList, TaxCodes) {
|
|
102
|
+
// finalTotalsData.CustLaborDiscTotal = this.GetLaborDiscountedTotal(opCodesList);
|
|
103
|
+
finalTotalsData.CustPartsDiscTotal = this.GetPartDiscountedTotal(PartsList);
|
|
104
|
+
// finalTotalsData.CustLaborTotalAfterDisc = this.GetLaborTotalAfterDiscount(opCodesList);
|
|
105
|
+
finalTotalsData.CustPartsTotalAfterDisc = this.GetPartsTotalAfterDiscount(PartsList);
|
|
106
|
+
finalTotalsData.CustLaborTotalBeforeDisc = (0, aggregation_1.addition)(finalTotalsData.CustLaborTotalAfterDisc, finalTotalsData.CustLaborDiscTotal);
|
|
107
|
+
finalTotalsData.CustPartsTotalBeforeDisc = (0, aggregation_1.addition)(finalTotalsData.CustPartsTotalAfterDisc, finalTotalsData.CustPartsDiscTotal);
|
|
108
|
+
// finalTotalsData.CustLaborITax = this.GetLaborTaxTotalFor(opCodesList, IsIndependentTax);
|
|
109
|
+
// finalTotalsData.CustLaborSGST = this.GetLaborSGSTTaxTotal(opCodesList, IsIndependentTax);
|
|
110
|
+
// finalTotalsData.CustLaborCGST = this.GetLaborCGSTTaxTotal(opCodesList, IsIndependentTax);
|
|
111
|
+
// finalTotalsData.CustLaborIGST = this.GetLaborIGSTTaxTotal(opCodesList, IsIndependentTax);
|
|
112
|
+
// finalTotalsData.CustPartITax = this.GetPartsTaxTotalFor(PartsList, IsIndependentTax);
|
|
113
|
+
// finalTotalsData.CustPartCGST = this.GetPartCGSTTaxTotal(PartsList, IsIndependentTax);
|
|
114
|
+
// finalTotalsData.CustPartIGST = this.GetPartIGSTTaxTotal(PartsList, IsIndependentTax);
|
|
115
|
+
// finalTotalsData.CustPartSGST = this.GetPartSGSTTaxTotal(PartsList, IsIndependentTax);
|
|
116
|
+
let TaxInfo = this.GetPartGSTTaxTotal(PartsList, IsIndependentTax);
|
|
117
|
+
finalTotalsData.CustPartITax = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[3]);
|
|
118
|
+
finalTotalsData.CustPartCGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[0]);
|
|
119
|
+
finalTotalsData.CustPartIGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[2]);
|
|
120
|
+
finalTotalsData.CustPartSGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[1]);
|
|
121
|
+
// finalTotalsData.CustLaborAfterTax = TrUtils.FixedTo(finalTotalsData.CustLaborITax + finalTotalsData.CustLaborTotalAfterDisc);
|
|
122
|
+
finalTotalsData.CustPartAfterTax = (0, aggregation_1.addition)(finalTotalsData.CustPartITax, finalTotalsData.CustPartsTotalAfterDisc);
|
|
123
|
+
finalTotalsData.CustTaxGroupData = this.GetTaxGroupingForPartsByHSN(PartsList, TaxCodes);
|
|
124
|
+
finalTotalsData.CustTotalRoundedBy = tr_utils_1.TrUtils.FixedTo(finalTotalsData.Round);
|
|
125
|
+
finalTotalsData.CustRoundedTotal = tr_utils_1.TrUtils.FixedTo(finalTotalsData.Total);
|
|
126
|
+
for (var key in finalTotalsData) {
|
|
127
|
+
if (key !== 'Total' && key !== 'SubTotal' &&
|
|
128
|
+
key !== 'LDisc' && key !== 'LPerc' && key !== 'PDisc' &&
|
|
129
|
+
key !== 'PPerc' && key !== 'Disc' && key !== 'Perc' && key !== 'Tax'
|
|
130
|
+
&& typeof finalTotalsData[key] === 'number') {
|
|
131
|
+
finalTotalsData[key] = tr_utils_1.TrUtils.FixPriceValue(finalTotalsData[key]);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return finalTotalsData;
|
|
135
|
+
}
|
|
136
|
+
static GetLaborDiscountedTotal(LaborList) {
|
|
137
|
+
let LaborDiscountedTotal = 0;
|
|
138
|
+
LaborList.forEach((Labor) => {
|
|
139
|
+
LaborDiscountedTotal = (0, aggregation_1.addition)(LaborDiscountedTotal, Labor.DiscountedPrice);
|
|
140
|
+
});
|
|
141
|
+
return LaborDiscountedTotal;
|
|
142
|
+
}
|
|
143
|
+
static GetPartDiscountedTotal(PartsList) {
|
|
144
|
+
let PartsDiscountedTotal = 0;
|
|
145
|
+
PartsList.forEach((Part) => {
|
|
146
|
+
PartsDiscountedTotal = (0, aggregation_1.addition)(PartsDiscountedTotal, Part.DiscountedPrice);
|
|
147
|
+
});
|
|
148
|
+
return PartsDiscountedTotal;
|
|
149
|
+
}
|
|
150
|
+
static GetPartsTaxTotalFor(PartsList, IsIndependentTax) {
|
|
151
|
+
let TotalTaxAmt = 0;
|
|
152
|
+
if (IsIndependentTax) {
|
|
153
|
+
PartsList.forEach((Part) => {
|
|
154
|
+
TotalTaxAmt = (0, aggregation_1.addition)(TotalTaxAmt, Part.CGST, Part.SGST, Part.IGST);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
return TotalTaxAmt;
|
|
158
|
+
}
|
|
159
|
+
static GetCustomerTotalBasedOnTaxType(PartsTaxAmount, PartsList, IsIndependentTax) {
|
|
160
|
+
// let LaborTotalAfterDisc: any = this.GetLaborTotalAfterDiscount(LaborList);
|
|
161
|
+
let PartsTotalAfterDisc = this.GetPartsTotalAfterDiscount(PartsList);
|
|
162
|
+
if (IsIndependentTax) {
|
|
163
|
+
return (0, aggregation_1.addition)(PartsTotalAfterDisc, PartsTaxAmount);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
return PartsTotalAfterDisc;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
static LaborTotalAfterDiscount(LaborTotalAfterDisc, LaborTaxAmount, MainLDisc, LDiscInPerc) {
|
|
170
|
+
let LaborTotal = (0, aggregation_1.addition)(LaborTotalAfterDisc, LaborTaxAmount);
|
|
171
|
+
if (!tr_utils_1.TrUtils.IsZero(MainLDisc)) {
|
|
172
|
+
if (!tr_utils_1.TrUtils.IsEmpty(LDiscInPerc)) {
|
|
173
|
+
LaborTotal = (0, aggregation_1.subtraction)(LaborTotal, (0, aggregation_1.division)((0, aggregation_1.multiply)(LaborTotal, Number(LDiscInPerc)), 100));
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
LaborTotal = (0, aggregation_1.subtraction)(LaborTotal, MainLDisc);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return LaborTotal;
|
|
180
|
+
}
|
|
181
|
+
static ItemsTotalAfterDiscount(PartsTotalAfterDisc, PartsTaxAmount, MainPDisc, PDiscInPerc) {
|
|
182
|
+
let ItemsTotal = (0, aggregation_1.addition)(PartsTotalAfterDisc, PartsTaxAmount);
|
|
183
|
+
if (!tr_utils_1.TrUtils.IsZero(MainPDisc)) {
|
|
184
|
+
if (!tr_utils_1.TrUtils.IsEmpty(PDiscInPerc)) {
|
|
185
|
+
ItemsTotal = (0, aggregation_1.subtraction)(ItemsTotal, (0, aggregation_1.division)((0, aggregation_1.multiply)(ItemsTotal, Number(PDiscInPerc)), 100));
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
ItemsTotal = (0, aggregation_1.subtraction)(ItemsTotal, MainPDisc);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return ItemsTotal;
|
|
192
|
+
}
|
|
193
|
+
static GetLaborCGSTTaxTotal(opCodesList, IsIndependentTax) {
|
|
194
|
+
let TotalTaxAmt = 0;
|
|
195
|
+
if (IsIndependentTax) {
|
|
196
|
+
opCodesList.forEach((Labor) => {
|
|
197
|
+
TotalTaxAmt = (0, aggregation_1.addition)(TotalTaxAmt, Labor.CGST);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return TotalTaxAmt;
|
|
201
|
+
}
|
|
202
|
+
static GetLaborIGSTTaxTotal(opCodesList, IsIndependentTax) {
|
|
203
|
+
let TotalTaxAmt = 0;
|
|
204
|
+
if (IsIndependentTax) {
|
|
205
|
+
opCodesList.forEach((Labor) => {
|
|
206
|
+
TotalTaxAmt = (0, aggregation_1.addition)(TotalTaxAmt, Labor.IGST);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
return TotalTaxAmt;
|
|
210
|
+
}
|
|
211
|
+
static GetLaborSGSTTaxTotal(opCodesList, IsIndependentTax) {
|
|
212
|
+
let TotalTaxAmt = 0;
|
|
213
|
+
if (IsIndependentTax) {
|
|
214
|
+
opCodesList.forEach((Labor) => {
|
|
215
|
+
TotalTaxAmt = (0, aggregation_1.addition)(TotalTaxAmt, Labor.SGST);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
return TotalTaxAmt;
|
|
219
|
+
}
|
|
220
|
+
static GetPartGSTTaxTotal(PartsList, IsIndependentTax) {
|
|
221
|
+
let TotalCGSTAmt = 0;
|
|
222
|
+
let TotalSGSTAmt = 0;
|
|
223
|
+
let TotalIGSTAmt = 0;
|
|
224
|
+
let TotalTaxAmt = 0;
|
|
225
|
+
if (IsIndependentTax) {
|
|
226
|
+
PartsList.forEach((Part) => {
|
|
227
|
+
TotalCGSTAmt = (0, aggregation_1.addition)(TotalCGSTAmt, Part.CGST);
|
|
228
|
+
TotalSGSTAmt = (0, aggregation_1.addition)(TotalSGSTAmt, Part.SGST);
|
|
229
|
+
TotalIGSTAmt = (0, aggregation_1.addition)(TotalIGSTAmt, Part.IGST);
|
|
230
|
+
TotalTaxAmt = (0, aggregation_1.addition)(TotalTaxAmt, Part.CGST, Part.SGST, Part.IGST);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
return [TotalCGSTAmt, TotalSGSTAmt, TotalIGSTAmt, TotalTaxAmt];
|
|
234
|
+
}
|
|
235
|
+
static GetTaxGroupingForPartsByHSN(Parts, TaxCodes) {
|
|
236
|
+
Parts = this.GetCombinedTaxPercentage(Parts, TaxCodes);
|
|
237
|
+
// Parts = this.ResetPartsHSNIfInvalid(Parts);
|
|
238
|
+
let FinalMatchedParts = this.ComparePartsByHSN(Parts, TaxCodes);
|
|
239
|
+
return this.GetTaxGroupingInfoByHSN(FinalMatchedParts, TaxCodes);
|
|
240
|
+
}
|
|
241
|
+
static GetCombinedTaxPercentage(Parts, TaxCodes) {
|
|
242
|
+
Parts.forEach((Part) => {
|
|
243
|
+
if (tr_utils_1.TrUtils.IsNull(Part.HSN)) {
|
|
244
|
+
Part.HSN = '';
|
|
245
|
+
}
|
|
246
|
+
let GSTValues = this.GetGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
|
|
247
|
+
Part.CGSTAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(GSTValues[0]);
|
|
248
|
+
Part.SGSTAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(GSTValues[1]);
|
|
249
|
+
Part.IGSTAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(GSTValues[2]);
|
|
250
|
+
Part.CombinedTaxPercentage = (0, aggregation_1.addition)(Part.CGSTAmt, Part.SGSTAmt, Part.IGSTAmt);
|
|
251
|
+
});
|
|
252
|
+
return Parts;
|
|
253
|
+
}
|
|
254
|
+
static ComparePartsByHSN(Parts, TaxCodes) {
|
|
255
|
+
let FinalMatchedParts = [];
|
|
256
|
+
Parts.forEach((Part) => {
|
|
257
|
+
let MatchedPartsBasedOnHSN = Parts.filter((argPart) => {
|
|
258
|
+
let PartFound = false;
|
|
259
|
+
FinalMatchedParts.forEach((FinalArgParts) => {
|
|
260
|
+
let PartIndex = FinalArgParts.findIndex((FinalArgPart) => {
|
|
261
|
+
return FinalArgPart._id === argPart._id;
|
|
262
|
+
});
|
|
263
|
+
if (PartIndex !== -1) {
|
|
264
|
+
PartFound = true;
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
// let argGSTValues: any[] = this.GetGSTValueBasedOnTaxCode(argPart.TCode, TaxCodes);
|
|
268
|
+
// let argCGST = argGSTValues[0];
|
|
269
|
+
// let argSGST = argGSTValues[1];
|
|
270
|
+
// let argIGST = argGSTValues[2];
|
|
271
|
+
// let partGSTValues: any[] = this.GetGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
|
|
272
|
+
// let partCGST = partGSTValues[0];
|
|
273
|
+
// let partSGST = partGSTValues[1];
|
|
274
|
+
// let partIGST = partGSTValues[2];
|
|
275
|
+
return (argPart.HSN === Part.HSN) && (!PartFound) &&
|
|
276
|
+
(argPart.CGSTAmt === Part.CGSTAmt) && (argPart.IGSTAmt === Part.IGSTAmt) &&
|
|
277
|
+
(argPart.SGSTAmt === Part.SGSTAmt);
|
|
278
|
+
});
|
|
279
|
+
if (MatchedPartsBasedOnHSN.length !== 0) {
|
|
280
|
+
FinalMatchedParts.push(MatchedPartsBasedOnHSN);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
return FinalMatchedParts;
|
|
284
|
+
}
|
|
285
|
+
static GetTaxGroupingInfoByHSN(FinalMatchedParts, TaxCodes) {
|
|
286
|
+
let HSNTaxInfo = [];
|
|
287
|
+
FinalMatchedParts.forEach((MatchedPart) => {
|
|
288
|
+
let TaxInfo = {};
|
|
289
|
+
let TaxOnAmount = 0;
|
|
290
|
+
let TaxAmount = 0;
|
|
291
|
+
let HSN = MatchedPart[0].HSN;
|
|
292
|
+
TaxInfo.CombinedTaxPercentage = MatchedPart[0].CombinedTaxPercentage;
|
|
293
|
+
MatchedPart.forEach((argMatchedGSTPart) => {
|
|
294
|
+
TaxOnAmount = (0, aggregation_1.addition)(TaxOnAmount, argMatchedGSTPart.AfterPartDisc);
|
|
295
|
+
TaxAmount = (0, aggregation_1.addition)(TaxAmount, argMatchedGSTPart.CGST);
|
|
296
|
+
TaxAmount = (0, aggregation_1.addition)(TaxAmount, argMatchedGSTPart.IGST);
|
|
297
|
+
TaxAmount = (0, aggregation_1.addition)(TaxAmount, argMatchedGSTPart.SGST);
|
|
298
|
+
});
|
|
299
|
+
TaxInfo.HSN = HSN;
|
|
300
|
+
TaxInfo.TotalTaxableAmount = tr_utils_1.TrUtils.FixPriceValue(TaxOnAmount);
|
|
301
|
+
TaxInfo.TotalTaxAmount = tr_utils_1.TrUtils.FixPriceValue(TaxAmount);
|
|
302
|
+
TaxInfo.ItemsCount = MatchedPart.length;
|
|
303
|
+
// let GSTValues: any[] = this.GetGSTValueBasedOnTaxCode(MatchedPart[0].TCode, TaxCodes);
|
|
304
|
+
// TaxInfo.CGST = GSTValues[0];
|
|
305
|
+
// TaxInfo.SGST = GSTValues[1];
|
|
306
|
+
// TaxInfo.IGST = GSTValues[2];
|
|
307
|
+
TaxInfo.CGST = MatchedPart[0].CGSTAmt;
|
|
308
|
+
TaxInfo.IGST = MatchedPart[0].IGSTAmt;
|
|
309
|
+
TaxInfo.SGST = MatchedPart[0].SGSTAmt;
|
|
310
|
+
if (TaxOnAmount !== 0) {
|
|
311
|
+
HSNTaxInfo.push(TaxInfo);
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
return HSNTaxInfo;
|
|
315
|
+
}
|
|
316
|
+
static GetGSTValueBasedOnTaxCode(TCode, TaxCodes) {
|
|
317
|
+
let CGST = 0;
|
|
318
|
+
let SGST = 0;
|
|
319
|
+
let IGST = 0;
|
|
320
|
+
if (tr_utils_1.TrUtils.IsNull(TCode)) {
|
|
321
|
+
return [CGST, SGST, IGST];
|
|
322
|
+
}
|
|
323
|
+
let TCodeIndex = TaxCodes.findIndex((TaxCode) => {
|
|
324
|
+
return TaxCode._id === Number(TCode);
|
|
325
|
+
});
|
|
326
|
+
if (TCodeIndex !== -1) {
|
|
327
|
+
if (TaxCodes[TCodeIndex].Type === 'Intra') {
|
|
328
|
+
return [TaxCodes[TCodeIndex].CGST, TaxCodes[TCodeIndex].SGST, 0];
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
return [0, 0, TaxCodes[TCodeIndex].IGST];
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
return [CGST, SGST, IGST];
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
exports.DeliveryChallanTotalsService = DeliveryChallanTotalsService;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EquipmentDesignPdf = void 0;
|
|
4
|
+
const shared_print_service_1 = require("./shared-print.service");
|
|
5
|
+
const shared_pdf_service_1 = require("./shared-pdf.service");
|
|
6
|
+
const tr_utils_1 = require("../utils/tr-utils");
|
|
7
|
+
class EquipmentDesignPdf {
|
|
8
|
+
static GetEquipmentPdf(Entity, Image, Sites, Items) {
|
|
9
|
+
var dd = {
|
|
10
|
+
info: {
|
|
11
|
+
title: 'Equipment Design',
|
|
12
|
+
},
|
|
13
|
+
background: function (currentPage, pageSize) {
|
|
14
|
+
return shared_pdf_service_1.SharedPDFService.GetWatermarkImage(Image, pageSize, Entity.Wmark);
|
|
15
|
+
},
|
|
16
|
+
header: function (currentPage, pageCount) {
|
|
17
|
+
return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
|
|
18
|
+
},
|
|
19
|
+
pageMargins: [10, 15, 10, 15],
|
|
20
|
+
content: this.GetContentData(Entity, Sites, Items, Image),
|
|
21
|
+
// styles: SharedPDFService.GetStyles()
|
|
22
|
+
};
|
|
23
|
+
return dd;
|
|
24
|
+
}
|
|
25
|
+
static GetContentData(Entity, Sites, Items, Image) {
|
|
26
|
+
let EntityData = shared_print_service_1.PrintSharedService.GetFormattedEntityDataForPrint(tr_utils_1.TrUtils.Stringify(Entity), '', null);
|
|
27
|
+
Entity = shared_print_service_1.PrintSharedService.GetEntityHeaderStyles(Entity, Entity, Image);
|
|
28
|
+
EntityData.HColor = Entity.HColor;
|
|
29
|
+
return [
|
|
30
|
+
// SharedPDFService.MainHeading(EntityData.CName, EntityData.Header, Image, EntityData.HColor, null),
|
|
31
|
+
{ text: EntityData.CName, fontSize: 26, bold: true, color: EntityData.HColor, alignment: 'center' },
|
|
32
|
+
{ text: 'EQUIPMENT DESIGN', bold: true, alignment: 'center', marginBottom: 20, marginTop: 20, decoration: 'underline' },
|
|
33
|
+
{
|
|
34
|
+
style: 'tableExample',
|
|
35
|
+
color: '#444',
|
|
36
|
+
table: {
|
|
37
|
+
widths: ['auto', '*', '*', '*', '*'],
|
|
38
|
+
headerRows: 1,
|
|
39
|
+
body: this.getsites(Sites, Items)
|
|
40
|
+
},
|
|
41
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
static getsites(Sites, Items) {
|
|
46
|
+
let mainsites = [];
|
|
47
|
+
mainsites = Sites.filter((site) => {
|
|
48
|
+
return tr_utils_1.TrUtils.IsNull(site.Parent);
|
|
49
|
+
});
|
|
50
|
+
mainsites.forEach((site, pindex) => {
|
|
51
|
+
site.Index = pindex + 1;
|
|
52
|
+
site.children = this.GetChildren(Sites, site.Id, site.Index);
|
|
53
|
+
});
|
|
54
|
+
var body = [[{ text: 'SNO', bold: true }, { text: 'Location', bold: true }, { text: 'Quantity', bold: true }, { text: 'Tonnage(TR)', bold: true }, { text: 'Model', bold: true }]];
|
|
55
|
+
var SNO = 0;
|
|
56
|
+
mainsites.forEach((item) => {
|
|
57
|
+
var lo = [];
|
|
58
|
+
// lo.push({ text: item.Name, colSpan: item.children.length });
|
|
59
|
+
// lo.push({});
|
|
60
|
+
let Itemdata = this.GetItem(item.ItemId, Items);
|
|
61
|
+
if (tr_utils_1.TrUtils.IsNull(Itemdata.TR)) {
|
|
62
|
+
Itemdata.TR = '';
|
|
63
|
+
}
|
|
64
|
+
if (tr_utils_1.TrUtils.IsNull(Itemdata.Model)) {
|
|
65
|
+
Itemdata.Model = '';
|
|
66
|
+
}
|
|
67
|
+
if (tr_utils_1.TrUtils.IsNull(item.Qty)) {
|
|
68
|
+
item.Qty = '';
|
|
69
|
+
}
|
|
70
|
+
if (tr_utils_1.TrUtils.IsNull(item.children) || item.children.length === 0) {
|
|
71
|
+
lo.push({ text: item.Index });
|
|
72
|
+
lo.push({ text: item.Name });
|
|
73
|
+
lo.push({ text: item.Qty });
|
|
74
|
+
lo.push({ text: Itemdata.TR });
|
|
75
|
+
lo.push({ text: Itemdata.Model });
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
lo.push({ text: item.Index });
|
|
79
|
+
lo.push({ text: item.Name, colSpan: 4 });
|
|
80
|
+
lo.push({});
|
|
81
|
+
lo.push({});
|
|
82
|
+
lo.push({});
|
|
83
|
+
}
|
|
84
|
+
body.push(lo);
|
|
85
|
+
body = this.tablechilderan(Sites, item.Id, body, Items);
|
|
86
|
+
});
|
|
87
|
+
return body;
|
|
88
|
+
}
|
|
89
|
+
static GetChildren(Sites, siteid, pindex) {
|
|
90
|
+
let children = Sites.filter((site) => {
|
|
91
|
+
return site.Parent === siteid;
|
|
92
|
+
});
|
|
93
|
+
children.forEach((child, cindex) => {
|
|
94
|
+
child.Index = pindex + '.' + (cindex + 1);
|
|
95
|
+
child.children = this.GetChildren(Sites, child.Id, child.Index);
|
|
96
|
+
});
|
|
97
|
+
return children;
|
|
98
|
+
}
|
|
99
|
+
static tablechilderan(Sites, siteid, body, Items) {
|
|
100
|
+
let children = Sites.filter((site) => {
|
|
101
|
+
return site.Parent === siteid;
|
|
102
|
+
});
|
|
103
|
+
children.forEach((child, cindex) => {
|
|
104
|
+
var sm = [];
|
|
105
|
+
// sm.push({ text: child.Name, colSpan: child.children.length })
|
|
106
|
+
// sm.push({ text: 'High wall' });
|
|
107
|
+
let Itemdata = this.GetItem(child.ItemId, Items);
|
|
108
|
+
if (tr_utils_1.TrUtils.IsNull(Itemdata.TR)) {
|
|
109
|
+
Itemdata.TR = '';
|
|
110
|
+
}
|
|
111
|
+
if (tr_utils_1.TrUtils.IsNull(Itemdata.Model)) {
|
|
112
|
+
Itemdata.Model = '';
|
|
113
|
+
}
|
|
114
|
+
if (tr_utils_1.TrUtils.IsNull(child.Qty)) {
|
|
115
|
+
child.Qty = '';
|
|
116
|
+
}
|
|
117
|
+
if (child.children.length === 0) {
|
|
118
|
+
sm.push({ text: child.Index });
|
|
119
|
+
sm.push({ text: child.Name });
|
|
120
|
+
sm.push({ text: child.Qty });
|
|
121
|
+
sm.push({ text: Itemdata.TR });
|
|
122
|
+
sm.push({ text: Itemdata.Model });
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// sm.splice(1, 0, { text: child.Name, colSpan: 4 });
|
|
126
|
+
sm.push({ text: child.Index });
|
|
127
|
+
sm.push({ text: child.Name, colSpan: 4 });
|
|
128
|
+
sm.push({});
|
|
129
|
+
sm.push({});
|
|
130
|
+
sm.push({});
|
|
131
|
+
}
|
|
132
|
+
body.push(sm);
|
|
133
|
+
this.tablechilderan(Sites, child.Id, body, Items);
|
|
134
|
+
});
|
|
135
|
+
return body;
|
|
136
|
+
}
|
|
137
|
+
static GetItem(ItemId, Items) {
|
|
138
|
+
let Index = Items.findIndex((item) => {
|
|
139
|
+
return item._id === ItemId;
|
|
140
|
+
});
|
|
141
|
+
return (Index !== -1) ? Items[Index] : {};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.EquipmentDesignPdf = EquipmentDesignPdf;
|