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,737 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ROPrintService = void 0;
|
|
4
|
+
const aggregation_1 = require("../aggregation/aggregation");
|
|
5
|
+
const code_enums_1 = require("../enums/code-enums");
|
|
6
|
+
const enums_1 = require("../enums/enums");
|
|
7
|
+
const my_date_1 = require("../utils/my-date");
|
|
8
|
+
const tr_utils_1 = require("../utils/tr-utils");
|
|
9
|
+
const ro_totals_service_1 = require("./ro-totals.service");
|
|
10
|
+
const shared_print_service_1 = require("./shared-print.service");
|
|
11
|
+
class ROPrintService {
|
|
12
|
+
static GetRepairOrderPrintInfo(OriginalROData, OriginalCustomerData, OriginalVehicleData, OriginalEntityData, image, IncludeGST, ConsolidateGST, Payee, InsCompanyName, AsCustomerOnly, AsInsuranceOnly, TaxCodes, OrderType, isReverse) {
|
|
13
|
+
let ROPrintData = {};
|
|
14
|
+
let argROData = tr_utils_1.TrUtils.Stringify(OriginalROData);
|
|
15
|
+
argROData.Comps = tr_utils_1.TrUtils.IsNull(argROData.Comps) ? [] : argROData.Comps;
|
|
16
|
+
argROData.Ops = tr_utils_1.TrUtils.IsNull(argROData.Ops) ? [] : argROData.Ops;
|
|
17
|
+
argROData.Parts = tr_utils_1.TrUtils.IsNull(argROData.Parts) ? [] : argROData.Parts;
|
|
18
|
+
argROData.Colli = tr_utils_1.TrUtils.IsNull(argROData.Colli) ? [] : argROData.Colli;
|
|
19
|
+
if (!IncludeGST) {
|
|
20
|
+
argROData.Settings.Tax = 'NO';
|
|
21
|
+
}
|
|
22
|
+
let SType;
|
|
23
|
+
if (!tr_utils_1.TrUtils.IsNull(OriginalROData.Settings) && !tr_utils_1.TrUtils.IsNull(OriginalROData.Settings.PoS)) {
|
|
24
|
+
SType = OriginalROData.Settings.PoS.SType;
|
|
25
|
+
}
|
|
26
|
+
ROPrintData = this.GetROBasicDetailsForPrint(ROPrintData, argROData, OriginalVehicleData, OrderType);
|
|
27
|
+
ROPrintData = this.GetPrintConditionsBasedOnInput(ROPrintData, IncludeGST, ConsolidateGST, Payee, AsCustomerOnly, AsInsuranceOnly, SType);
|
|
28
|
+
ROPrintData.Entity = shared_print_service_1.PrintSharedService.GetFormattedEntityDataForPrint(OriginalEntityData, "Work Order", OriginalROData);
|
|
29
|
+
ROPrintData = shared_print_service_1.PrintSharedService.GetEntityHeaderStyles(ROPrintData, OriginalEntityData, image);
|
|
30
|
+
if (Payee === enums_1.PayTypeEnum.Insurance) {
|
|
31
|
+
ROPrintData = this.GetInsDetailsForPrint(ROPrintData, InsCompanyName, argROData);
|
|
32
|
+
}
|
|
33
|
+
argROData = this.CheckStatusAndChangeDeclinedItemsToNew(argROData);
|
|
34
|
+
argROData = this.GetValidItemsForTotals(argROData);
|
|
35
|
+
argROData.Ops = this.SeparateROLaborByPType(argROData.Ops, Payee, AsCustomerOnly, AsInsuranceOnly);
|
|
36
|
+
argROData.Parts = this.SeparateROPartsByPType(argROData.Parts, Payee, AsCustomerOnly, AsInsuranceOnly);
|
|
37
|
+
argROData.Colli = this.SeparateROCollisionsByPType(argROData.Colli, argROData.Ops, argROData.Parts);
|
|
38
|
+
// argROData = this.ResetDescForPrint(argROData);
|
|
39
|
+
argROData.Parts = this.ResetQtyAndUoM(argROData.Parts);
|
|
40
|
+
if (AsInsuranceOnly) {
|
|
41
|
+
ROPrintData.ShowAccParts = true;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
ROPrintData.ShowAccParts = this.CheckAndShowItemsAsAR(argROData);
|
|
45
|
+
}
|
|
46
|
+
argROData = this.ReverseItemsForROPrint(argROData, isReverse);
|
|
47
|
+
let finalTotalsData = ro_totals_service_1.ROTotalsService.GetTotalsValue(argROData, TaxCodes, true, true, true, ROPrintData.Entity.Round);
|
|
48
|
+
finalTotalsData.Settings = tr_utils_1.TrUtils.Stringify(argROData.Settings);
|
|
49
|
+
finalTotalsData = this.GetDetailedInfoForItems(finalTotalsData, IncludeGST, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly, TaxCodes);
|
|
50
|
+
if (ConsolidateGST) {
|
|
51
|
+
finalTotalsData.CustLaborTotalBeforeDisc = finalTotalsData.CustLaborAfterTax;
|
|
52
|
+
finalTotalsData.CustPartsTotalBeforeDisc = finalTotalsData.CustPartAfterTax;
|
|
53
|
+
}
|
|
54
|
+
ROPrintData = tr_utils_1.TrUtils.ConcatObjects(ROPrintData, finalTotalsData);
|
|
55
|
+
if (ROPrintData.ShowAccParts) {
|
|
56
|
+
ROPrintData = this.ConvertItemsAsAR(ROPrintData);
|
|
57
|
+
}
|
|
58
|
+
ROPrintData.Colli = this.EmptyInvalidCollisionRepairItems(ROPrintData.Colli);
|
|
59
|
+
ROPrintData.Comps = tr_utils_1.TrUtils.Stringify(argROData.Comps);
|
|
60
|
+
ROPrintData.EstTotal = tr_utils_1.TrUtils.Stringify(argROData.EstTotal);
|
|
61
|
+
ROPrintData.Advisor = this.GetEmployeeData(argROData.EmpData);
|
|
62
|
+
ROPrintData.VehMore = tr_utils_1.TrUtils.Stringify(argROData.VehMore);
|
|
63
|
+
ROPrintData.SANotes = tr_utils_1.TrUtils.Stringify(argROData.SANotes);
|
|
64
|
+
ROPrintData.OrdType = tr_utils_1.TrUtils.Stringify(argROData.OrdType);
|
|
65
|
+
ROPrintData = this.GetLineTotals(ROPrintData, IncludeGST, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly);
|
|
66
|
+
ROPrintData.PrintInfo = this.PrepareFormatForROPrint(ROPrintData, Payee, code_enums_1.ROTypeEnum.RepairOrder);
|
|
67
|
+
ROPrintData = this.CheckAndCombineDescMPNForAR(ROPrintData.Entity.MPN, ROPrintData);
|
|
68
|
+
ROPrintData.Vehicle = shared_print_service_1.PrintSharedService.GetVehicleFromServiceAndFormatData(OriginalVehicleData);
|
|
69
|
+
ROPrintData.Customer = shared_print_service_1.PrintSharedService.GetCustomerFromServiceAndFormatData(OriginalCustomerData);
|
|
70
|
+
if (!tr_utils_1.TrUtils.IsNull(OriginalROData.SrvLoc)) {
|
|
71
|
+
let location = {};
|
|
72
|
+
location.Adrs = shared_print_service_1.PrintSharedService.GetAddress(OriginalROData.SrvLoc.Adrs);
|
|
73
|
+
location.Name = OriginalROData.SrvLoc.ConName;
|
|
74
|
+
if (!tr_utils_1.TrUtils.IsNull(OriginalROData.SrvLoc.ConPh)) {
|
|
75
|
+
location.Cons = [
|
|
76
|
+
{
|
|
77
|
+
Type: 'M',
|
|
78
|
+
No: OriginalROData.SrvLoc.ConPh
|
|
79
|
+
}
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
ROPrintData.Location = location;
|
|
83
|
+
}
|
|
84
|
+
ROPrintData.Consolidate = ConsolidateGST;
|
|
85
|
+
ROPrintData.ShowDiscountColumn = false;
|
|
86
|
+
if ((Payee === enums_1.PayTypeEnum.Customer || AsCustomerOnly) && !ROPrintData.ConsolidateGST) {
|
|
87
|
+
if (shared_print_service_1.PrintSharedService.CheckItemIndexWithDisc(ROPrintData) !== -1) {
|
|
88
|
+
ROPrintData.ShowDiscountColumn = (ROPrintData.Settings.DiscLvl === 'ITM' || ROPrintData.Settings.DiscLvl === 'RECITM') ? true : false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return ROPrintData;
|
|
92
|
+
}
|
|
93
|
+
static GetEmployeeData(empData) {
|
|
94
|
+
let SA = {};
|
|
95
|
+
if (!tr_utils_1.TrUtils.IsNull(empData)) {
|
|
96
|
+
SA.Name = empData.DName;
|
|
97
|
+
SA.Ph = empData.Cons.Phones.Main;
|
|
98
|
+
}
|
|
99
|
+
return SA;
|
|
100
|
+
}
|
|
101
|
+
static GetROBasicDetailsForPrint(ROPrintData, argROData, Product, OrderType) {
|
|
102
|
+
ROPrintData.CrDate = my_date_1.MyDate.ConvertUTCDateToReadable(argROData.CrDate);
|
|
103
|
+
ROPrintData.PrDate = my_date_1.MyDate.ConvertUTCDateToReadable(argROData.PrDate);
|
|
104
|
+
ROPrintData.MIn = Product.MIn;
|
|
105
|
+
ROPrintData._id = argROData.Code;
|
|
106
|
+
ROPrintData.Type = 'Work Order';
|
|
107
|
+
ROPrintData.HeaderName = OrderType;
|
|
108
|
+
return ROPrintData;
|
|
109
|
+
}
|
|
110
|
+
static GetPrintConditionsBasedOnInput(ROPrintData, IncludeGST, ConsolidateGST, Payee, AsCustomerOnly, AsInsuranceOnly, SType) {
|
|
111
|
+
ROPrintData.Payee = Payee;
|
|
112
|
+
ROPrintData.AsCustomerOnly = AsCustomerOnly;
|
|
113
|
+
ROPrintData.AsInsuranceOnly = AsInsuranceOnly;
|
|
114
|
+
ROPrintData.IncludeGST = IncludeGST;
|
|
115
|
+
ROPrintData.ConsolidateGST = ConsolidateGST;
|
|
116
|
+
ROPrintData.ShowIGST = (tr_utils_1.TrUtils.IsNull(SType) || (SType === 'Intra')) ? false : true;
|
|
117
|
+
ROPrintData.ShowTaxColumn = (IncludeGST && !ConsolidateGST) ? true : false;
|
|
118
|
+
// ROPrintData.ShowDiscountColumn = ((Payee === PayTypeEnum.Customer || AsCustomerOnly) && !ConsolidateGST) ? true : false;
|
|
119
|
+
return ROPrintData;
|
|
120
|
+
}
|
|
121
|
+
static GetInsDetailsForPrint(ROPrintData, InsCompanyName, argROData) {
|
|
122
|
+
if (tr_utils_1.TrUtils.IsNull(argROData.Ins)) {
|
|
123
|
+
argROData.Ins = this.GetDefualtInsData();
|
|
124
|
+
}
|
|
125
|
+
ROPrintData.InsComp = InsCompanyName;
|
|
126
|
+
ROPrintData.SurName = argROData.Ins.SName;
|
|
127
|
+
ROPrintData.SurEmail = argROData.Ins.SEmail;
|
|
128
|
+
ROPrintData.SurPhone = argROData.Ins.SPhone;
|
|
129
|
+
ROPrintData.PolType = argROData.Ins.Type;
|
|
130
|
+
ROPrintData.PolNo = argROData.Ins.PolNo;
|
|
131
|
+
return ROPrintData;
|
|
132
|
+
}
|
|
133
|
+
static GetDefualtInsData() {
|
|
134
|
+
let ROInsData = {
|
|
135
|
+
SName: '',
|
|
136
|
+
SEmail: '',
|
|
137
|
+
SPhone: '',
|
|
138
|
+
PolNo: ''
|
|
139
|
+
};
|
|
140
|
+
return ROInsData;
|
|
141
|
+
}
|
|
142
|
+
static CheckStatusAndChangeDeclinedItemsToNew(argROData) {
|
|
143
|
+
if (argROData.Sts === enums_1.ROStatusEnum.New || argROData.Sts === enums_1.ROStatusEnum.WtngForAppr) {
|
|
144
|
+
argROData = this.ChangeDeclinedStatusToNew(argROData);
|
|
145
|
+
}
|
|
146
|
+
return argROData;
|
|
147
|
+
}
|
|
148
|
+
static ChangeDeclinedStatusToNew(argROData) {
|
|
149
|
+
argROData.Ops = this.ChangeDeclinedLaborStatusToNew(argROData.Ops);
|
|
150
|
+
argROData.Parts = this.ChangeDeclinedPartStatusToNew(argROData.Parts);
|
|
151
|
+
argROData.Colli = this.ChangeDeclinedColliStatusToNew(argROData.Colli);
|
|
152
|
+
return argROData;
|
|
153
|
+
}
|
|
154
|
+
static ChangeDeclinedLaborStatusToNew(Operations) {
|
|
155
|
+
Operations.forEach((Labor) => {
|
|
156
|
+
if (Labor.Sts === enums_1.LaborStatusEnum.Declined) {
|
|
157
|
+
Labor.Sts = enums_1.LaborStatusEnum.New;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
return Operations;
|
|
161
|
+
}
|
|
162
|
+
static ChangeDeclinedPartStatusToNew(Parts) {
|
|
163
|
+
Parts.forEach((Part) => {
|
|
164
|
+
if (!tr_utils_1.TrUtils.IsNull(Part.CollId) && Part.Sts === enums_1.LaborStatusEnum.Declined) {
|
|
165
|
+
Part.Sts = enums_1.LaborStatusEnum.New;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
return Parts;
|
|
169
|
+
}
|
|
170
|
+
static ChangeDeclinedColliStatusToNew(Collisions) {
|
|
171
|
+
Collisions.forEach((Collision) => {
|
|
172
|
+
if (Collision.Sts === enums_1.LaborStatusEnum.Declined) {
|
|
173
|
+
Collision.Sts = enums_1.LaborStatusEnum.New;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
return Collisions;
|
|
177
|
+
}
|
|
178
|
+
static GetValidItemsForTotals(RecordData) {
|
|
179
|
+
let RecordStatus = RecordData.Sts;
|
|
180
|
+
RecordData.Ops = this.GetLaborByRecordAndLaborStatus(RecordStatus, RecordData.Ops);
|
|
181
|
+
RecordData.Parts = this.GetPartsByRecordAndPartStatus(RecordStatus, RecordData.Parts);
|
|
182
|
+
RecordData.Colli = this.GetCollisionByRecordAndColliStatus(RecordStatus, RecordData.Colli);
|
|
183
|
+
return RecordData;
|
|
184
|
+
}
|
|
185
|
+
static GetLaborByRecordAndLaborStatus(RecordStatus, Operations) {
|
|
186
|
+
if (RecordStatus === enums_1.ROStatusEnum.Cancelled || RecordStatus === enums_1.ROStatusEnum.Declined) {
|
|
187
|
+
return Operations;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
return this.GetValidROLaborListByStatus(Operations);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
static GetValidROLaborListByStatus(Operations) {
|
|
194
|
+
let opCodesList = Operations.filter((Operation) => {
|
|
195
|
+
if (this.CheckOperationHasActiveStatus(Operation.Sts)) {
|
|
196
|
+
return Operation;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
return opCodesList;
|
|
200
|
+
}
|
|
201
|
+
static CheckOperationHasActiveStatus(Status) {
|
|
202
|
+
return (Status !== enums_1.LaborStatusEnum.Cancelled && Status !== enums_1.LaborStatusEnum.Declined) ? true : false;
|
|
203
|
+
}
|
|
204
|
+
static GetPartsByRecordAndPartStatus(RecordStatus, Parts) {
|
|
205
|
+
if (RecordStatus === enums_1.ROStatusEnum.Cancelled || RecordStatus === enums_1.ROStatusEnum.Declined) {
|
|
206
|
+
return Parts;
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
return this.GetValidROPartsListByStatus(Parts);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
static GetValidROPartsListByStatus(Parts) {
|
|
213
|
+
let PartsList = Parts.filter((Part) => {
|
|
214
|
+
if (tr_utils_1.TrUtils.IsNull(Part.CollId)) {
|
|
215
|
+
return Part;
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
if (this.CheckOperationHasActiveStatus(Part.Sts)) {
|
|
219
|
+
return Part;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
return PartsList;
|
|
224
|
+
}
|
|
225
|
+
static GetCollisionByRecordAndColliStatus(RecordStatus, Collisions) {
|
|
226
|
+
if (RecordStatus === enums_1.ROStatusEnum.Cancelled || RecordStatus === enums_1.ROStatusEnum.Declined) {
|
|
227
|
+
return Collisions;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
return this.GetValidROCollisionListByStatus(Collisions);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
static GetValidROCollisionListByStatus(Collisions) {
|
|
234
|
+
let collList = Collisions.filter((Collision) => {
|
|
235
|
+
if (this.CheckOperationHasActiveStatus(Collision.Sts)) {
|
|
236
|
+
return Collision;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
return collList;
|
|
240
|
+
}
|
|
241
|
+
static SeparateROLaborByPType(Labors, PType, CustomerOnly, InsuranceOnly) {
|
|
242
|
+
let LaborList = [];
|
|
243
|
+
LaborList = Labors.filter((Labor) => {
|
|
244
|
+
if (PType === enums_1.PayTypeEnum.Customer) {
|
|
245
|
+
return !tr_utils_1.TrUtils.IsZero(Labor.Pr);
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
return !tr_utils_1.TrUtils.IsZero(Labor.AssPr);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
return LaborList;
|
|
252
|
+
}
|
|
253
|
+
static SeparateROPartsByPType(Parts, PType, CustomerOnly, InsuranceOnly) {
|
|
254
|
+
let PartsList = [];
|
|
255
|
+
PartsList = Parts.filter((Part) => {
|
|
256
|
+
if (PType === enums_1.PayTypeEnum.Customer) {
|
|
257
|
+
return !tr_utils_1.TrUtils.IsZero(Part.UnPr);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
return !tr_utils_1.TrUtils.IsZero(Part.AssPr);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
return PartsList;
|
|
264
|
+
}
|
|
265
|
+
static SeparateROCollisionsByPType(Collisions, Ops, Parts) {
|
|
266
|
+
let CollisionList = Collisions.filter((Collision) => {
|
|
267
|
+
let LaborIndex = Ops.findIndex((Labor) => {
|
|
268
|
+
return Labor.CollId === Collision._id;
|
|
269
|
+
});
|
|
270
|
+
let PartIndex = Parts.findIndex((Part) => {
|
|
271
|
+
return Part.CollId === Collision._id;
|
|
272
|
+
});
|
|
273
|
+
if (LaborIndex !== -1 || PartIndex !== -1) {
|
|
274
|
+
return Collision;
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
return CollisionList;
|
|
278
|
+
}
|
|
279
|
+
static ResetQtyAndUoM(Parts) {
|
|
280
|
+
Parts.forEach((Item) => {
|
|
281
|
+
if (!tr_utils_1.TrUtils.IsZero(Item.Qty) && !tr_utils_1.TrUtils.CheckInvalidSelect(Item.UoM)) {
|
|
282
|
+
Item.QtyAndUoM = Item.Qty + ' ' + Item.UoM;
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
return Parts;
|
|
286
|
+
}
|
|
287
|
+
static CheckAndShowItemsAsAR(argROData) {
|
|
288
|
+
let AccPartsIndex = argROData.Parts.findIndex((Part) => {
|
|
289
|
+
return !tr_utils_1.TrUtils.IsNull((Part.CollId));
|
|
290
|
+
});
|
|
291
|
+
let InsLaborIndex = argROData.Ops.findIndex((Labor) => {
|
|
292
|
+
return !tr_utils_1.TrUtils.IsNull((Labor.CollId));
|
|
293
|
+
});
|
|
294
|
+
if (AccPartsIndex !== -1 || InsLaborIndex !== -1) {
|
|
295
|
+
return true;
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
static ConvertItemsAsAR(ROPrintData) {
|
|
302
|
+
ROPrintData.Colli.forEach((Collision) => {
|
|
303
|
+
Collision = this.ResetItemsDataById(Collision, ROPrintData.Ops, ROPrintData.Parts);
|
|
304
|
+
});
|
|
305
|
+
ROPrintData.Ops.forEach((Labor) => {
|
|
306
|
+
if (tr_utils_1.TrUtils.IsNull(Labor.CollId)) {
|
|
307
|
+
let LaborColli = {
|
|
308
|
+
_id: Labor._id,
|
|
309
|
+
Desc: Labor.Desc,
|
|
310
|
+
PBy: Labor.PBy,
|
|
311
|
+
Op_Id: Labor.Op_Id,
|
|
312
|
+
Qty: 0,
|
|
313
|
+
Sts: Labor.Sts
|
|
314
|
+
};
|
|
315
|
+
LaborColli.RRFData = Labor;
|
|
316
|
+
ROPrintData.Colli.push(LaborColli);
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
ROPrintData.Parts.forEach((Part) => {
|
|
320
|
+
if (tr_utils_1.TrUtils.IsNull(Part.CollId)) {
|
|
321
|
+
let LaborIndex = ROPrintData.Ops.findIndex((Labor) => {
|
|
322
|
+
return Labor._id === Part.OpId;
|
|
323
|
+
});
|
|
324
|
+
let OpsStatus = ROPrintData.Ops[LaborIndex].Sts;
|
|
325
|
+
let PartColli = {
|
|
326
|
+
_id: Part._id,
|
|
327
|
+
Desc: Part.Desc,
|
|
328
|
+
PBy: Part.PBy,
|
|
329
|
+
Sts: OpsStatus
|
|
330
|
+
};
|
|
331
|
+
PartColli.PartData = Part;
|
|
332
|
+
ROPrintData.Colli.push(PartColli);
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
ROPrintData.Ops = [];
|
|
336
|
+
ROPrintData.Parts = [];
|
|
337
|
+
return ROPrintData;
|
|
338
|
+
}
|
|
339
|
+
static ResetItemsDataById(Collision, AddedOperations, AddedParts) {
|
|
340
|
+
Collision.PartData = tr_utils_1.TrUtils.IsNull(Collision.PartId)
|
|
341
|
+
? null : this.GetPartDataById(Collision.PartId, AddedParts);
|
|
342
|
+
Collision.RRFData = tr_utils_1.TrUtils.IsNull(Collision.RRFId)
|
|
343
|
+
? null : this.GetLaborDataById(Collision.RRFId, AddedOperations);
|
|
344
|
+
Collision.PtngData = tr_utils_1.TrUtils.IsNull(Collision.PainId)
|
|
345
|
+
? null : this.GetLaborDataById(Collision.PainId, AddedOperations);
|
|
346
|
+
Collision.DtngData = tr_utils_1.TrUtils.IsNull(Collision.RepId)
|
|
347
|
+
? null : this.GetLaborDataById(Collision.RepId, AddedOperations);
|
|
348
|
+
}
|
|
349
|
+
static GetPartDataById(PartId, AddedParts) {
|
|
350
|
+
let partIndex = AddedParts.findIndex((Part) => {
|
|
351
|
+
return Part._id === PartId;
|
|
352
|
+
});
|
|
353
|
+
return (partIndex !== -1) ? AddedParts[partIndex] : null;
|
|
354
|
+
}
|
|
355
|
+
static GetLaborDataById(LaborId, AddedOperations) {
|
|
356
|
+
let laborIndex = AddedOperations.findIndex((Labor) => {
|
|
357
|
+
return Labor._id === LaborId;
|
|
358
|
+
});
|
|
359
|
+
return (laborIndex !== -1) ? AddedOperations[laborIndex] : null;
|
|
360
|
+
}
|
|
361
|
+
static EmptyInvalidCollisionRepairItems(Colli) {
|
|
362
|
+
Colli.forEach((CollisionItem) => {
|
|
363
|
+
if (!tr_utils_1.TrUtils.IsNull(CollisionItem.PartData) && !this.CheckOperationHasActiveStatus(CollisionItem.PartData.Sts)) {
|
|
364
|
+
CollisionItem.PartData.AssPr = null;
|
|
365
|
+
CollisionItem.PartData.UnPr = null;
|
|
366
|
+
CollisionItem.PartData.Disc = 0;
|
|
367
|
+
CollisionItem.PartData.RecDisc = 0;
|
|
368
|
+
}
|
|
369
|
+
if (!tr_utils_1.TrUtils.IsNull(CollisionItem.RRFData) && !this.CheckOperationHasActiveStatus(CollisionItem.RRFData.Sts)) {
|
|
370
|
+
CollisionItem.RRFData.AssPr = null;
|
|
371
|
+
CollisionItem.RRFData.Pr = null;
|
|
372
|
+
CollisionItem.RRFData.Disc = 0;
|
|
373
|
+
CollisionItem.RRFData.RecDisc = 0;
|
|
374
|
+
}
|
|
375
|
+
if (!tr_utils_1.TrUtils.IsNull(CollisionItem.DtngData) && !this.CheckOperationHasActiveStatus(CollisionItem.DtngData.Sts)) {
|
|
376
|
+
CollisionItem.DtngData.AssPr = null;
|
|
377
|
+
CollisionItem.DtngData.Pr = null;
|
|
378
|
+
CollisionItem.DtngData.Disc = 0;
|
|
379
|
+
CollisionItem.DtngData.RecDisc = 0;
|
|
380
|
+
}
|
|
381
|
+
if (!tr_utils_1.TrUtils.IsNull(CollisionItem.PtngData) && !this.CheckOperationHasActiveStatus(CollisionItem.PtngData.Sts)) {
|
|
382
|
+
CollisionItem.PtngData.AssPr = null;
|
|
383
|
+
CollisionItem.PtngData.Pr = null;
|
|
384
|
+
CollisionItem.PtngData.Disc = 0;
|
|
385
|
+
CollisionItem.PtngData.RecDisc = 0;
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
return Colli;
|
|
389
|
+
}
|
|
390
|
+
static GetLineTotals(ROPrintData, IncludeGST, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly) {
|
|
391
|
+
ROPrintData.Ops.forEach((Labor) => {
|
|
392
|
+
Labor.LineTotal = this.GetLaborLineTotal(Labor, IncludeGST, AsCustomerOnly, AsInsuranceOnly);
|
|
393
|
+
});
|
|
394
|
+
ROPrintData.Parts.forEach((Part) => {
|
|
395
|
+
Part.LineTotal = this.GetPartLineTotal(Part, IncludeGST, AsCustomerOnly, AsInsuranceOnly);
|
|
396
|
+
});
|
|
397
|
+
ROPrintData.Colli.forEach((Collision) => {
|
|
398
|
+
let LineTotal = 0;
|
|
399
|
+
if (!tr_utils_1.TrUtils.IsNull(Collision.PartData)) {
|
|
400
|
+
LineTotal = (0, aggregation_1.addition)(LineTotal, this.GetCollisionPartLineTotal(Collision.PartData, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly));
|
|
401
|
+
}
|
|
402
|
+
if (!tr_utils_1.TrUtils.IsNull(Collision.RRFData)) {
|
|
403
|
+
LineTotal = (0, aggregation_1.addition)(LineTotal, this.GetCollisionLaborLineTotal(Collision.RRFData, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly));
|
|
404
|
+
}
|
|
405
|
+
if (!tr_utils_1.TrUtils.IsNull(Collision.PtngData)) {
|
|
406
|
+
LineTotal = (0, aggregation_1.addition)(LineTotal, this.GetCollisionLaborLineTotal(Collision.PtngData, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly));
|
|
407
|
+
}
|
|
408
|
+
if (!tr_utils_1.TrUtils.IsNull(Collision.DtngData)) {
|
|
409
|
+
LineTotal = (0, aggregation_1.addition)(LineTotal, this.GetCollisionLaborLineTotal(Collision.DtngData, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly));
|
|
410
|
+
}
|
|
411
|
+
Collision.LineTotal = tr_utils_1.TrUtils.FixPriceValue(LineTotal);
|
|
412
|
+
});
|
|
413
|
+
return ROPrintData;
|
|
414
|
+
}
|
|
415
|
+
static GetCollisionPartLineTotal(PartData, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly) {
|
|
416
|
+
let LineTotal = 0;
|
|
417
|
+
if (AsCustomerOnly) {
|
|
418
|
+
if (ConsolidateGST) {
|
|
419
|
+
LineTotal = PartData.CustAfterTaxPerItem;
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
LineTotal = PartData.CustAfterPartDisc;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
else if (AsInsuranceOnly) {
|
|
426
|
+
if (ConsolidateGST) {
|
|
427
|
+
LineTotal = PartData.InsAfterTaxPerItem;
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
LineTotal = PartData.InsAfterPartDisc;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
if (ConsolidateGST) {
|
|
435
|
+
LineTotal = (0, aggregation_1.addition)(PartData.InsAfterTaxPerItem, PartData.CustAfterTaxPerItem);
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
LineTotal = (0, aggregation_1.addition)(PartData.InsAfterPartDisc, PartData.CustAfterPartDisc);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return Number(LineTotal);
|
|
442
|
+
}
|
|
443
|
+
static GetCollisionLaborLineTotal(LaborData, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly) {
|
|
444
|
+
let LineTotal = 0;
|
|
445
|
+
if (AsCustomerOnly) {
|
|
446
|
+
if (ConsolidateGST) {
|
|
447
|
+
LineTotal = LaborData.CustAfterTax;
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
LineTotal = LaborData.CustAfterLaborDisc;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
else if (AsInsuranceOnly) {
|
|
454
|
+
if (ConsolidateGST) {
|
|
455
|
+
LineTotal = LaborData.InsAfterTax;
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
LineTotal = LaborData.InsAfterLaborDisc;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
if (ConsolidateGST) {
|
|
463
|
+
LineTotal = (0, aggregation_1.addition)(LaborData.CustAfterTax, LaborData.InsAfterTax);
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
LineTotal = (0, aggregation_1.addition)(LaborData.InsAfterLaborDisc, LaborData.CustAfterLaborDisc);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return Number(LineTotal);
|
|
470
|
+
}
|
|
471
|
+
static GetLaborLineTotal(LaborData, IncludeGST, AsCustomerOnly, AsInsuranceOnly) {
|
|
472
|
+
let LineTotal = 0;
|
|
473
|
+
if (AsCustomerOnly) {
|
|
474
|
+
if (IncludeGST) {
|
|
475
|
+
LineTotal = LaborData.CustAfterTax;
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
LineTotal = LaborData.CustAfterLaborDisc;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
else if (AsInsuranceOnly) {
|
|
482
|
+
if (IncludeGST) {
|
|
483
|
+
LineTotal = LaborData.InsAfterTax;
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
LineTotal = LaborData.InsAfterLaborDisc;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
if (IncludeGST) {
|
|
491
|
+
LineTotal = (0, aggregation_1.addition)(LaborData.CustAfterTax, LaborData.InsAfterTax);
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
LineTotal = (0, aggregation_1.addition)(LaborData.InsAfterLaborDisc, LaborData.CustAfterLaborDisc);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return tr_utils_1.TrUtils.FixPriceValue(LineTotal);
|
|
498
|
+
}
|
|
499
|
+
static GetPartLineTotal(PartData, IncludeGST, AsCustomerOnly, AsInsuranceOnly) {
|
|
500
|
+
let LineTotal = 0;
|
|
501
|
+
if (AsCustomerOnly) {
|
|
502
|
+
if (IncludeGST) {
|
|
503
|
+
LineTotal = PartData.CustAfterTax;
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
LineTotal = PartData.CustAfterPartDisc;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
else if (AsInsuranceOnly) {
|
|
510
|
+
if (IncludeGST) {
|
|
511
|
+
LineTotal = PartData.InsAfterTax;
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
LineTotal = PartData.InsAfterPartDisc;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
if (IncludeGST) {
|
|
519
|
+
LineTotal = (0, aggregation_1.addition)(PartData.InsAfterTax, PartData.CustAfterTax);
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
LineTotal = (0, aggregation_1.addition)(PartData.InsAfterPartDisc, PartData.CustAfterPartDisc);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
return tr_utils_1.TrUtils.FixPriceValue(LineTotal);
|
|
526
|
+
}
|
|
527
|
+
static ReverseItemsForROPrint(argROData, isReverse) {
|
|
528
|
+
if (isReverse) {
|
|
529
|
+
argROData.Comps = tr_utils_1.TrUtils.IsNull(argROData.Comps) ? [] : argROData.Comps.reverse();
|
|
530
|
+
argROData.Ops = tr_utils_1.TrUtils.IsNull(argROData.Ops) ? [] : argROData.Ops.reverse();
|
|
531
|
+
argROData.Parts = tr_utils_1.TrUtils.IsNull(argROData.Parts) ? [] : argROData.Parts.reverse();
|
|
532
|
+
argROData.Colli = tr_utils_1.TrUtils.IsNull(argROData.Colli) ? [] : argROData.Colli.reverse();
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
argROData.Comps = tr_utils_1.TrUtils.IsNull(argROData.Comps) ? [] : argROData.Comps;
|
|
536
|
+
argROData.Ops = tr_utils_1.TrUtils.IsNull(argROData.Ops) ? [] : argROData.Ops;
|
|
537
|
+
argROData.Parts = tr_utils_1.TrUtils.IsNull(argROData.Parts) ? [] : argROData.Parts;
|
|
538
|
+
argROData.Colli = tr_utils_1.TrUtils.IsNull(argROData.Colli) ? [] : argROData.Colli;
|
|
539
|
+
}
|
|
540
|
+
let ReversedLabors = [];
|
|
541
|
+
argROData.Comps.forEach((Complaint) => {
|
|
542
|
+
argROData.Ops.forEach((Labor) => {
|
|
543
|
+
if (Labor.CompId === Complaint._id) {
|
|
544
|
+
ReversedLabors.push(Labor);
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
});
|
|
548
|
+
argROData.Ops.forEach((Labor) => {
|
|
549
|
+
if (tr_utils_1.TrUtils.IsNull(Labor.CompId)) {
|
|
550
|
+
ReversedLabors.push(Labor);
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
argROData.Ops = ReversedLabors;
|
|
554
|
+
let ReversedParts = [];
|
|
555
|
+
argROData.Ops.forEach((Labor) => {
|
|
556
|
+
argROData.Parts.forEach((Part) => {
|
|
557
|
+
if (tr_utils_1.TrUtils.IsNull(Part.CollId) && (Part.OpId === Labor._id)) {
|
|
558
|
+
ReversedParts.push(Part);
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
});
|
|
562
|
+
argROData.Parts.forEach((Part) => {
|
|
563
|
+
if (!tr_utils_1.TrUtils.IsNull(Part.CollId)) {
|
|
564
|
+
ReversedParts.push(Part);
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
argROData.Parts = ReversedParts;
|
|
568
|
+
return argROData;
|
|
569
|
+
}
|
|
570
|
+
static GetDetailedInfoForItems(ROTotalsData, IncludeGST, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly, TaxCodes) {
|
|
571
|
+
ROTotalsData.Ops = this.GetLaborPrintInfo(ROTotalsData.Ops, ConsolidateGST, IncludeGST, AsCustomerOnly, AsInsuranceOnly, TaxCodes);
|
|
572
|
+
ROTotalsData.Parts = this.GetItemsPrintInfo(tr_utils_1.TrUtils.Stringify(ROTotalsData.Parts), ConsolidateGST, IncludeGST, AsCustomerOnly, AsInsuranceOnly, TaxCodes);
|
|
573
|
+
if (IncludeGST && !ConsolidateGST) {
|
|
574
|
+
ROTotalsData.ShowDetailedLaborTaxInfo = this.CheckLaborTaxItemIndex(ROTotalsData.Ops) !== -1;
|
|
575
|
+
ROTotalsData.ShowDetailedPartTaxInfo = this.CheckPartTaxItemIndex(ROTotalsData.Parts) !== -1;
|
|
576
|
+
}
|
|
577
|
+
else {
|
|
578
|
+
ROTotalsData.ShowDetailedLaborTaxInfo = false;
|
|
579
|
+
ROTotalsData.ShowDetailedPartTaxInfo = false;
|
|
580
|
+
}
|
|
581
|
+
return ROTotalsData;
|
|
582
|
+
}
|
|
583
|
+
static GetLaborPrintInfo(LaborList, ConsolidateGST, IncludeGST, AsCustomerOnly, AsInsuranceOnly, TaxCodes) {
|
|
584
|
+
LaborList.forEach((Labor) => {
|
|
585
|
+
Labor.HSN = Labor.SAC;
|
|
586
|
+
if (AsCustomerOnly) {
|
|
587
|
+
if (IncludeGST) {
|
|
588
|
+
if (ConsolidateGST) {
|
|
589
|
+
Labor.UnPr = tr_utils_1.TrUtils.FixedTo(Labor.CustAfterTax);
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
Labor.UnPr = tr_utils_1.TrUtils.FixedTo(Labor.Pr);
|
|
593
|
+
}
|
|
594
|
+
Labor.CGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor.CCGST);
|
|
595
|
+
Labor.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor.CSGST);
|
|
596
|
+
Labor.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor.CIGST);
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
Labor.UnPr = tr_utils_1.TrUtils.FixedTo(Labor.Pr);
|
|
600
|
+
Labor.CGSTAmt = 0;
|
|
601
|
+
Labor.SGSTAmt = 0;
|
|
602
|
+
Labor.IGSTAmt = 0;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
else if (AsInsuranceOnly) {
|
|
606
|
+
if (IncludeGST) {
|
|
607
|
+
if (ConsolidateGST) {
|
|
608
|
+
Labor.UnPr = tr_utils_1.TrUtils.FixedTo(Labor.InsAfterTax);
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
Labor.UnPr = tr_utils_1.TrUtils.FixedTo(Labor.AssPr);
|
|
612
|
+
}
|
|
613
|
+
Labor.CGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor.ACGST);
|
|
614
|
+
Labor.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor.ASGST);
|
|
615
|
+
Labor.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor.AIGST);
|
|
616
|
+
}
|
|
617
|
+
else {
|
|
618
|
+
Labor.UnPr = tr_utils_1.TrUtils.FixedTo(Labor.AssPr);
|
|
619
|
+
Labor.CGSTAmt = 0;
|
|
620
|
+
Labor.SGSTAmt = 0;
|
|
621
|
+
Labor.IGSTAmt = 0;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
Labor.CGSTPerc = shared_print_service_1.PrintSharedService.GetCGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
|
|
625
|
+
Labor.SGSTPerc = shared_print_service_1.PrintSharedService.GetSGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
|
|
626
|
+
Labor.IGSTPerc = shared_print_service_1.PrintSharedService.GetIGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
|
|
627
|
+
});
|
|
628
|
+
return LaborList;
|
|
629
|
+
}
|
|
630
|
+
static GetItemsPrintInfo(Items, ConsolidateGST, IncludeGST, AsCustomerOnly, AsInsuranceOnly, TaxCodes) {
|
|
631
|
+
Items.forEach((Item) => {
|
|
632
|
+
if (AsCustomerOnly) {
|
|
633
|
+
if (IncludeGST) {
|
|
634
|
+
if (ConsolidateGST) {
|
|
635
|
+
Item.UnPr = tr_utils_1.TrUtils.FixedTo(Item.CustAfterTaxPerItem);
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
Item.UnPr = tr_utils_1.TrUtils.FixedTo(Item.UnPr);
|
|
639
|
+
}
|
|
640
|
+
Item.CGSTAmt = tr_utils_1.TrUtils.FixedTo(Item.CCGST);
|
|
641
|
+
Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Item.CSGST);
|
|
642
|
+
Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Item.CIGST);
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
Item.UnPr = tr_utils_1.TrUtils.FixedTo(Item.UnPr);
|
|
646
|
+
Item.CGSTAmt = 0;
|
|
647
|
+
Item.SGSTAmt = 0;
|
|
648
|
+
Item.IGSTAmt = 0;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
else if (AsInsuranceOnly) {
|
|
652
|
+
if (IncludeGST) {
|
|
653
|
+
if (ConsolidateGST) {
|
|
654
|
+
Item.UnPr = tr_utils_1.TrUtils.FixedTo(Item.InsAfterTaxPerItem);
|
|
655
|
+
}
|
|
656
|
+
else {
|
|
657
|
+
Item.UnPr = tr_utils_1.TrUtils.FixedTo(Item.AssPr);
|
|
658
|
+
}
|
|
659
|
+
Item.CGSTAmt = tr_utils_1.TrUtils.FixedTo(Item.ACGST);
|
|
660
|
+
Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Item.ASGST);
|
|
661
|
+
Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Item.AIGST);
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
664
|
+
Item.UnPr = tr_utils_1.TrUtils.FixedTo(Item.AssPr);
|
|
665
|
+
Item.CGSTAmt = 0;
|
|
666
|
+
Item.SGSTAmt = 0;
|
|
667
|
+
Item.IGSTAmt = 0;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
if (!tr_utils_1.TrUtils.IsZero(Item.Qty) && !tr_utils_1.TrUtils.CheckInvalidSelect(Item.UoM)) {
|
|
671
|
+
Item.QtyAndUoM = Item.Qty + ' ' + Item.UoM;
|
|
672
|
+
}
|
|
673
|
+
Item.CGSTPerc = shared_print_service_1.PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
674
|
+
Item.SGSTPerc = shared_print_service_1.PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
675
|
+
Item.IGSTPerc = shared_print_service_1.PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
676
|
+
});
|
|
677
|
+
return Items;
|
|
678
|
+
}
|
|
679
|
+
static CheckLaborTaxItemIndex(LaborList) {
|
|
680
|
+
let TaxIndex = LaborList.findIndex((Labor) => {
|
|
681
|
+
if (!tr_utils_1.TrUtils.CheckInvalidSelect(Labor.TCode)) {
|
|
682
|
+
return Labor;
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
return TaxIndex;
|
|
686
|
+
}
|
|
687
|
+
static CheckPartTaxItemIndex(PartsList) {
|
|
688
|
+
let TaxIndex = PartsList.findIndex((Part) => {
|
|
689
|
+
if (!tr_utils_1.TrUtils.CheckInvalidSelect(Part.TCode)) {
|
|
690
|
+
return Part;
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
return TaxIndex;
|
|
694
|
+
}
|
|
695
|
+
static PrepareFormatForROPrint(ROPrintData, For, argROType) {
|
|
696
|
+
let PrintInfo = [];
|
|
697
|
+
let ROLaborParts = this.GetFormatForROPrint(For, ROPrintData, argROType);
|
|
698
|
+
PrintInfo.push(ROLaborParts);
|
|
699
|
+
return PrintInfo;
|
|
700
|
+
}
|
|
701
|
+
static GetFormatForROPrint(For, ROPrintData, argROType) {
|
|
702
|
+
let ROLaborParts = {};
|
|
703
|
+
ROLaborParts.Ops = ROPrintData.Ops;
|
|
704
|
+
ROLaborParts.Parts = ROPrintData.Parts;
|
|
705
|
+
ROLaborParts.Colli = ROPrintData.Colli;
|
|
706
|
+
let NewOpFound = ROLaborParts.Ops.findIndex((Labor) => {
|
|
707
|
+
return Labor.Sts === enums_1.LaborStatusEnum.New || Labor.Sts === enums_1.LaborStatusEnum.WtngForAppr;
|
|
708
|
+
});
|
|
709
|
+
let NewPartFound = ROLaborParts.Parts.findIndex((Part) => {
|
|
710
|
+
return !tr_utils_1.TrUtils.IsNull(Part.CollId) && (Part.Sts === enums_1.LaborStatusEnum.New || Part.Sts === enums_1.LaborStatusEnum.WtngForAppr);
|
|
711
|
+
});
|
|
712
|
+
let NewIndPartFound = ROLaborParts.Colli.findIndex((IndPart) => {
|
|
713
|
+
return IndPart.Sts === enums_1.LaborStatusEnum.New || IndPart.Sts === enums_1.LaborStatusEnum.WtngForAppr;
|
|
714
|
+
});
|
|
715
|
+
if (NewOpFound !== -1 || NewIndPartFound !== -1 || NewPartFound !== -1) {
|
|
716
|
+
ROLaborParts.Sts = enums_1.ROStatusEnum.New;
|
|
717
|
+
}
|
|
718
|
+
else {
|
|
719
|
+
ROLaborParts.Sts = enums_1.ROStatusEnum.Approved;
|
|
720
|
+
}
|
|
721
|
+
ROLaborParts.Type = argROType;
|
|
722
|
+
return ROLaborParts;
|
|
723
|
+
}
|
|
724
|
+
static CheckAndCombineDescMPNForAR(PrintPartNo, ROPrintData) {
|
|
725
|
+
if (PrintPartNo) {
|
|
726
|
+
ROPrintData.PrintInfo.forEach((PrintData) => {
|
|
727
|
+
PrintData.Colli.forEach((Collision) => {
|
|
728
|
+
if (!tr_utils_1.TrUtils.IsNull(Collision.PartData) && !tr_utils_1.TrUtils.IsEmpty(Collision.PartData.MPN)) {
|
|
729
|
+
Collision.Desc = Collision.Desc + '/' + Collision.PartData.MPN;
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
return ROPrintData;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
exports.ROPrintService = ROPrintService;
|