shareneus 1.7.4 → 1.7.6
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/README.md +1 -0
- package/dist/accounting/invoice/invoice-pdf/invoice-pdf.service.js +18 -45
- package/dist/accounting/invoice/reports/excel/analysis-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/category-wise-item-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/cust-wise-sales-details.js +17 -7
- package/dist/accounting/invoice/reports/excel/cust-wise-sales-summary-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/invoice-wise-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/item-wise-doctor-sale-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/items-wise-sales-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/manf-wise-sales-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/operator-wise-details.js +17 -7
- package/dist/accounting/invoice/reports/excel/operator-wise-summary.js +17 -7
- package/dist/accounting/invoice/reports/excel/sa-wise-labor-sales-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/sa-wise-part-sales-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/sale-summary-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/sales-by-service-summary-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/scheduled-drug-summary-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/scheduled-drugs-excel.service.js +17 -7
- package/dist/accounting/invoice/unified-invoice-pdf.service.d.ts +1 -1
- package/dist/accounting/payment-receive/reports/excel/cust-balance-excel.service.js +17 -7
- package/dist/accounting/payment-receive/reports/excel/payment-receive-excel.service.js +17 -7
- package/dist/common/reports/excel/product-without-owner-excel.service.js +17 -7
- package/dist/gst/excel/GSTR-RO-excel.service.js +17 -7
- package/dist/gst/excel/GSTR1-excel.service.js +17 -7
- package/dist/gst/excel/GSTR2-excel.service.js +17 -7
- package/dist/gst/excel/hsn-summary.js +17 -7
- package/dist/gst/excel/tally-sales-import.service.js +17 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/inventory/items/reports/excel/expiring-drugs-excel.service.js +17 -7
- package/dist/inventory/items/reports/excel/item-wise-mout-details.js +17 -7
- package/dist/inventory/items/reports/excel/item-wise-mout-summary.js +17 -7
- package/dist/inventory/items/reports/excel/spares-issue-excel.service.js +17 -7
- package/dist/inventory/items/reports/excel/stock-excel.service.js +17 -7
- package/dist/purchases/payment-made/reports/excel/payments-made-excel.service.js +17 -7
- package/dist/purchases/payment-made/reports/excel/ven-balance-excel.service.js +17 -7
- package/dist/services/reports/excel/insurance-expire-excel.service.js +17 -7
- package/dist/services/reports/excel/next-service-date-excel.service.js +17 -7
- package/dist/services/reports/excel/repair-orders-excel.service.js +17 -7
- package/dist/shared/table-section/pdf-table.header.d.ts +1 -1
- package/dist/shared/table-section/pdf-table.header.js +14 -2
- package/dist/shared/table-section/pdf-table.section.js +6 -13
- package/dist/{accounting/invoice/invoice-pdf.service.js → shared/transactions-pdf.service.js} +15 -15
- package/package.json +1 -1
- package/src/accounting/counter-sales/auto-sales-receipt-pdf.service.ts +569 -0
- package/src/accounting/counter-sales/pos-receipt-pdf.ts +577 -0
- package/src/accounting/counter-sales/sales-receipt-pdf.service.ts +628 -0
- package/src/accounting/counter-sales/sales-receipt-print.service.ts +506 -0
- package/src/accounting/credit-note/cn-print.service.ts +264 -0
- package/src/accounting/credit-note/credit-note-pdf.service.ts +602 -0
- package/src/accounting/credit-note/credit-note-totals.service.ts +424 -0
- package/src/accounting/debit-note/debit-note-pdf.service.ts +681 -0
- package/src/accounting/debit-note/debit-note-print.service.ts +276 -0
- package/src/accounting/debit-note/debit-note-totals.service.ts +361 -0
- package/src/accounting/invoice/hc-inv-pdf.service.ts +880 -0
- package/src/accounting/invoice/inv-pdf.service.ts +812 -0
- package/src/accounting/invoice/inv-print.service.ts +532 -0
- package/src/accounting/invoice/invoice-landscape-pdf.service.ts +947 -0
- package/src/accounting/invoice/invoice-letterhead-pdf.service.ts +813 -0
- package/src/accounting/invoice/invoice-pdf/invoice-pdf.service.ts +359 -0
- package/src/accounting/invoice/invoice-portrait-pdf.ts +972 -0
- package/src/accounting/invoice/invoice-print.service.ts +2906 -0
- package/src/accounting/invoice/invoice-total.service.ts +834 -0
- package/src/accounting/invoice/reports/excel/analysis-excel.service.ts +291 -0
- package/src/accounting/invoice/reports/excel/category-wise-item-excel.service.ts +267 -0
- package/src/accounting/invoice/reports/excel/cust-wise-sales-details.ts +321 -0
- package/src/accounting/invoice/reports/excel/cust-wise-sales-summary-excel.service.ts +300 -0
- package/src/accounting/invoice/reports/excel/invoice-wise-excel.service.ts +859 -0
- package/src/accounting/invoice/reports/excel/item-wise-doctor-sale-excel.service.ts +255 -0
- package/src/accounting/invoice/reports/excel/items-wise-sales-excel.service.ts +312 -0
- package/src/accounting/invoice/reports/excel/manf-wise-sales-excel.service.ts +273 -0
- package/src/accounting/invoice/reports/excel/operator-wise-details.ts +258 -0
- package/src/accounting/invoice/reports/excel/operator-wise-summary.ts +259 -0
- package/src/accounting/invoice/reports/excel/sa-wise-labor-sales-excel.service.ts +230 -0
- package/src/accounting/invoice/reports/excel/sa-wise-part-sales-excel.service.ts +231 -0
- package/src/accounting/invoice/reports/excel/sale-summary-excel.service.ts +326 -0
- package/src/accounting/invoice/reports/excel/sales-by-service-details-excel.service.ts +0 -0
- package/src/accounting/invoice/reports/excel/sales-by-service-summary-excel.service.ts +432 -0
- package/src/accounting/invoice/reports/excel/scheduled-drug-summary-excel.service.ts +373 -0
- package/src/accounting/invoice/reports/excel/scheduled-drugs-excel.service.ts +372 -0
- package/src/accounting/invoice/reports/pdf/analysis-pdf.service.ts +113 -0
- package/src/accounting/invoice/reports/pdf/category-wise-item-pdf.service.ts +107 -0
- package/src/accounting/invoice/reports/pdf/cust-wise-sales-details-pdf.service.ts +125 -0
- package/src/accounting/invoice/reports/pdf/cust-wise-sales-summary-pdf.service.ts +119 -0
- package/src/accounting/invoice/reports/pdf/item-wise-doctor-sale-pdf.service.ts +180 -0
- package/src/accounting/invoice/reports/pdf/item-wise-sales-pdf.service.ts +193 -0
- package/src/accounting/invoice/reports/pdf/manf-wise-sales-pdf.service.ts +188 -0
- package/src/accounting/invoice/reports/pdf/operator-wise-details-pdf.service.ts +118 -0
- package/src/accounting/invoice/reports/pdf/operator-wise-summary-pdf.ts +116 -0
- package/src/accounting/invoice/reports/pdf/sales-by-service-pdf.service.ts +132 -0
- package/src/accounting/invoice/reports/pdf/scheduled-drug-pdf.service.ts +191 -0
- package/src/accounting/invoice/reports/pdf/scheduled-drug-summary-pdf.service.ts +202 -0
- package/src/accounting/invoice/shared-inv-pdf.service.ts +787 -0
- package/src/accounting/invoice/unified-invoice-pdf.service.ts +937 -0
- package/src/accounting/payment-receive/payment-pdf.service.ts +410 -0
- package/src/accounting/payment-receive/payment-receipt-pdf/receipt-pdf.service.ts +470 -0
- package/src/accounting/payment-receive/receipt-print.service.ts +71 -0
- package/src/accounting/payment-receive/reports/excel/cust-balance-excel.service.ts +298 -0
- package/src/accounting/payment-receive/reports/excel/payment-receive-excel.service.ts +221 -0
- package/src/accounting/payment-receive/reports/pdf/customer-balances-pdf.service.ts +182 -0
- package/src/accounting/payment-receive/reports/pdf/payment-report-pdf.service.ts +116 -0
- package/src/aggregation/aggregation.ts +58 -0
- package/src/appointments/appointments/appointment-total.service.ts +298 -0
- package/src/appointments/consultations/consultation-fee-receipt.service.ts +407 -0
- package/src/appointments/consultations/consultation-full-pdf.service.ts +238 -0
- package/src/appointments/consultations/consultation-letterhead-pdf.service.ts +430 -0
- package/src/appointments/consultations/consultation-pdf.service.ts +417 -0
- package/src/common/reports/excel/product-without-owner-excel.service.ts +308 -0
- package/src/common/reports/pdf/product-without-owner-pdf.service.ts +146 -0
- package/src/enums/cache-enums.ts +33 -0
- package/src/enums/code-enums.ts +291 -0
- package/src/enums/country-enums.ts +9 -0
- package/src/enums/enums.ts +364 -0
- package/src/enums/industry-enums.ts +26 -0
- package/src/enums/treatment-enums.ts +9 -0
- package/src/gst/excel/GSTR-RO-excel.service.ts +926 -0
- package/src/gst/excel/GSTR1-excel.service.ts +313 -0
- package/src/gst/excel/GSTR2-excel.service.ts +314 -0
- package/src/gst/excel/hsn-summary.ts +314 -0
- package/src/gst/excel/tally-sales-import.service.ts +767 -0
- package/src/gst/pdf/hsn-summary-pdf.ts +176 -0
- package/src/index.ts +194 -0
- package/src/inventory/items/adjustment-pdf.service.ts +177 -0
- package/src/inventory/items/issue-parts-pdf.service.ts +795 -0
- package/src/inventory/items/item-bar-code-label-pdf.ts +194 -0
- package/src/inventory/items/item-detais-pdf.ts +141 -0
- package/src/inventory/items/item-price-for-pricelist.ts +368 -0
- package/src/inventory/items/reports/excel/expiring-drugs-excel.service.ts +290 -0
- package/src/inventory/items/reports/excel/item-wise-mout-details.ts +284 -0
- package/src/inventory/items/reports/excel/item-wise-mout-summary.ts +279 -0
- package/src/inventory/items/reports/excel/spares-issue-excel.service.ts +494 -0
- package/src/inventory/items/reports/excel/stock-excel.service.ts +319 -0
- package/src/inventory/items/reports/pdf/expiring-drugs-pdf.service.ts +172 -0
- package/src/inventory/items/reports/pdf/item-wise-mout-details-pdf.ts +122 -0
- package/src/inventory/items/reports/pdf/item-wise-mout-summary-pdf.ts +115 -0
- package/src/inventory/items/reports/pdf/reorder-point-pdf.service.ts +163 -0
- package/src/inventory/material-out/mout-pdf.service.ts +545 -0
- package/src/inventory/transfer-order/transfer-order-pdf.service.ts +154 -0
- package/src/purchases/bills/bill-pdf/bill-pdf.service.ts +211 -0
- package/src/purchases/bills/bill-pdf.service.ts +21 -0
- package/src/purchases/payment-made/reports/excel/payments-made-excel.service.ts +313 -0
- package/src/purchases/payment-made/reports/excel/ven-balance-excel.service.ts +307 -0
- package/src/purchases/payment-made/reports/pdf/vendor-balances-pdf.service.ts +114 -0
- package/src/purchases/purchase-order/po-totals.service.ts +343 -0
- package/src/purchases/purchase-order/purchase-order-pdf.service.ts +1016 -0
- package/src/purchases/purchase-order/purchase-order-print.service.ts +279 -0
- package/src/purchases/purchase-order/purchase-order-totals.service.ts +637 -0
- package/src/purchases/vendor-credit-note/vendor-credit-note-pdf.service.ts +1055 -0
- package/src/purchases/vendor-credit-note/vendor-credit-note-print.service.ts +145 -0
- package/src/purchases/vendor-credit-note/vendor-credit-note-totals.service.ts +399 -0
- package/src/purchases/vendor-debit-note/vendor-debit-note-pdf.service.ts +582 -0
- package/src/purchases/vendor-debit-note/vendor-debit-note-print.service.ts +295 -0
- package/src/purchases/vendor-debit-note/vendor-debit-note-totals.service.ts +377 -0
- package/src/sales/delivery-challan/dc-landscape-pdf.service.ts +922 -0
- package/src/sales/delivery-challan/dc-landscape-without-price-pdf.service.ts +869 -0
- package/src/sales/delivery-challan/dc-without-price-pdf.service.ts +505 -0
- package/src/sales/delivery-challan/delivery-challan-pdf.service.ts +461 -0
- package/src/sales/delivery-challan/delivery-challan-print.service.ts +229 -0
- package/src/sales/delivery-challan/delivery-challan-totals.ts +466 -0
- package/src/sales/sales/equipment-design-pdf.service.ts +153 -0
- package/src/sales/sales/pack-ship-pdf.service.ts +128 -0
- package/src/sales/sales/pack-ship-print.service.ts +198 -0
- package/src/sales/sales/sales-pdf.service.ts +658 -0
- package/src/sales/sales/sales-print.service.ts +376 -0
- package/src/sales/sales/sales-totals.service.ts +500 -0
- package/src/sales-receive/sales-receive-pdf.service.ts +602 -0
- package/src/sales-receive/sales-receive-print.service.ts +242 -0
- package/src/sales-receive/sales-receive-totals.service.ts +651 -0
- package/src/services/checklist-pdf.ts +151 -0
- package/src/services/checklists-pdf.ts +133 -0
- package/src/services/est.print-service.ts +1155 -0
- package/src/services/reports/excel/insurance-expire-excel.service.ts +292 -0
- package/src/services/reports/excel/next-service-date-excel.service.ts +317 -0
- package/src/services/reports/excel/repair-orders-excel.service.ts +249 -0
- package/src/services/reports/pdf/insurance-expire-pdf.service.ts +115 -0
- package/src/services/reports/pdf/next-service-date-pdf.service.ts +198 -0
- package/src/services/reports/pdf/repair-orders-pdf.service.ts +184 -0
- package/src/services/ro-pdf.service.ts +1917 -0
- package/src/services/ro-print-service.ts +881 -0
- package/src/services/ro-totals.service.ts +1314 -0
- package/src/services/separate-wo-print.service.ts +396 -0
- package/src/services/service-history-pdf.service.ts +145 -0
- package/src/services/service-price-for-pricelist.ts +649 -0
- package/src/services/technician-pdf.service.ts +234 -0
- package/src/services/technician-print.service.ts +95 -0
- package/src/shared/header-footer-section/pdf-header-footer.section.ts +519 -0
- package/src/shared/header-footer-section/pdf-shared.utils.ts +46 -0
- package/src/shared/math-operations.ts +208 -0
- package/src/shared/party-details-section/pdf-party-details.section.ts +602 -0
- package/src/shared/shared-pdf.service.ts +3042 -0
- package/src/shared/shared-print.service.ts +879 -0
- package/src/shared/table-section/pdf-table.config.ts +8 -0
- package/src/shared/table-section/pdf-table.header.ts +396 -0
- package/src/shared/table-section/pdf-table.row.ts +248 -0
- package/src/shared/table-section/pdf-table.section.ts +447 -0
- package/src/shared/totals-section/pdf-totals.section.ts +921 -0
- package/src/shared/transactions-pdf.service.ts +191 -0
- package/src/shared/util.ts +101 -0
- package/src/tasks/meetings/meeting-pdf.ts +410 -0
- package/src/tasks/tasks/task-pdf.service.ts +238 -0
- package/src/tasks/tasks/task-reports-pdf.service.ts +313 -0
- package/src/tax/index.ts +86 -0
- package/src/tax/tax-calculator.ts +1025 -0
- package/src/tax/tax.types.ts +535 -0
- package/src/transaction-calculations/discounts-distribution.ts +343 -0
- package/src/transaction-calculations/index.ts +3 -0
- package/src/transaction-calculations/total-calculation.ts +443 -0
- package/src/transaction-calculations/transaction-calculation-engine.ts +903 -0
- package/src/utils/my-date.ts +111 -0
- package/src/utils/tr-utils.ts +104 -0
- package/tsconfig.json +2 -2
- /package/dist/{accounting/invoice/invoice-pdf.service.d.ts → shared/transactions-pdf.service.d.ts} +0 -0
|
@@ -0,0 +1,1155 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { ROTypeEnum } from '../enums/code-enums';
|
|
4
|
+
import { EstimateStatusEnum, LaborStatusEnum, PayTypeEnum, ROStatusEnum } from '../enums/enums';
|
|
5
|
+
import { Add, Divide } from '../shared/math-operations';
|
|
6
|
+
import { PrintSharedService } from '../shared/shared-print.service';
|
|
7
|
+
import { MyDate } from '../utils/my-date';
|
|
8
|
+
import { TrUtils } from '../utils/tr-utils';
|
|
9
|
+
import { ROTotalsService } from './ro-totals.service';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export class EstPrintService {
|
|
13
|
+
|
|
14
|
+
static GetTaxAmountFromGroup(item: any, taxGroupKey: string, taxCode: string, fallbackKey: string) {
|
|
15
|
+
const groupedTaxes = item?.[taxGroupKey];
|
|
16
|
+
if (Array.isArray(groupedTaxes)) {
|
|
17
|
+
const matchedTaxes = groupedTaxes.filter((tax: any) => tax?.Code === taxCode);
|
|
18
|
+
if (matchedTaxes.length !== 0) {
|
|
19
|
+
return matchedTaxes.reduce((total: number, tax: any) => Add(total, tax?.Amt), 0);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return TrUtils.SetValueToZeroIfNull(item?.[fallbackKey]);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static GetEstimatePrintInfo(OriginalROData: any, OriginalCustomerData: any, OriginalVehicleData: any, OriginalEntityData: any,
|
|
26
|
+
image: any, Payee: any, InsCompanyName: any, AsCustomerOnly: boolean, AsInsuranceOnly: boolean,
|
|
27
|
+
AsCustomerAndInsurance: boolean, AsInsuranceOrCustomer: boolean, TaxCodes: any, OverallEst: boolean,
|
|
28
|
+
SuppEstIndex: any, AsEstimated: boolean, isInitial: boolean, isReverse: boolean, Consolidate: boolean) {
|
|
29
|
+
let ROPrintData: any = {};
|
|
30
|
+
|
|
31
|
+
let argROData = TrUtils.Stringify(OriginalROData);
|
|
32
|
+
argROData.Comps = TrUtils.IsNull(argROData.Comps) ? [] : argROData.Comps;
|
|
33
|
+
argROData.Ops = TrUtils.IsNull(argROData.Ops) ? [] : argROData.Ops;
|
|
34
|
+
argROData.Parts = TrUtils.IsNull(argROData.Parts) ? [] : argROData.Parts;
|
|
35
|
+
argROData.Colli = TrUtils.IsNull(argROData.Colli) ? [] : argROData.Colli;
|
|
36
|
+
|
|
37
|
+
let IncludeGST: boolean = TrUtils.isTaxable(argROData.Settings.Tax);
|
|
38
|
+
|
|
39
|
+
ROPrintData = this.GetROBasicDetailsForPrint(ROPrintData, argROData, OriginalVehicleData, OverallEst, isInitial);
|
|
40
|
+
|
|
41
|
+
let SType: any;
|
|
42
|
+
|
|
43
|
+
if (!TrUtils.IsNull(OriginalROData.SType)) {
|
|
44
|
+
SType = OriginalROData.SType
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
ROPrintData = this.GetPrintConditionsBasedOnInput(ROPrintData, IncludeGST, Payee,
|
|
48
|
+
AsCustomerOnly, AsInsuranceOnly, AsCustomerAndInsurance, AsInsuranceOrCustomer, SType, Consolidate);
|
|
49
|
+
|
|
50
|
+
ROPrintData.Entity = PrintSharedService.GetFormattedEntityDataForPrint(OriginalEntityData, "Estimate", OriginalROData);
|
|
51
|
+
|
|
52
|
+
ROPrintData = PrintSharedService.GetEntityHeaderStyles(ROPrintData, OriginalEntityData, image);
|
|
53
|
+
|
|
54
|
+
if (Payee === PayTypeEnum.Insurance) {
|
|
55
|
+
ROPrintData = this.GetInsDetailsForPrint(ROPrintData, InsCompanyName, argROData, AsEstimated);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
argROData = this.IfInitialEstimateChangeStatus(argROData, AsEstimated);
|
|
59
|
+
|
|
60
|
+
argROData = this.CheckStatusAndChangeDeclinedItemsToNew(argROData);
|
|
61
|
+
|
|
62
|
+
argROData = this.GetValidItemsForTotals(argROData);
|
|
63
|
+
|
|
64
|
+
if (!OverallEst) {
|
|
65
|
+
argROData = this.GetItemsBySuppEstIndex(argROData, SuppEstIndex);
|
|
66
|
+
|
|
67
|
+
if (!TrUtils.IsNull(SuppEstIndex)) {
|
|
68
|
+
let Index: any = argROData.SuppEst.findIndex((supp: any) => {
|
|
69
|
+
return supp.Id === SuppEstIndex;
|
|
70
|
+
})
|
|
71
|
+
if (Index !== -1 && !TrUtils.IsNull(argROData.SuppEst[Index].Date)) {
|
|
72
|
+
ROPrintData.CrDate = MyDate.ConvertUTCDateToReadable(argROData.SuppEst[Index].Date);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
argROData.Ops = this.SeparateROLaborByPType(argROData.Ops, Payee, AsCustomerOnly,
|
|
78
|
+
AsInsuranceOnly, AsEstimated);
|
|
79
|
+
argROData.Parts = this.SeparateROPartsByPType(argROData.Parts, Payee, AsCustomerOnly,
|
|
80
|
+
AsInsuranceOnly, AsEstimated);
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
argROData.Colli = this.SeparateROCollisionsByItems(argROData.Colli, argROData.Ops, argROData.Parts);
|
|
84
|
+
|
|
85
|
+
// argROData = this.ResetDescForPrint(argROData);
|
|
86
|
+
|
|
87
|
+
argROData.Parts = this.ResetQtyAndUoM(argROData.Parts);
|
|
88
|
+
|
|
89
|
+
if (AsInsuranceOnly || AsCustomerAndInsurance || AsInsuranceOrCustomer) {
|
|
90
|
+
ROPrintData.ShowAccParts = true;
|
|
91
|
+
} else {
|
|
92
|
+
ROPrintData.ShowAccParts = this.CheckAndShowItemsAsAR(argROData);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
argROData = this.ReverseItemsForROPrint(argROData, isReverse);
|
|
96
|
+
|
|
97
|
+
let finalTotalsData: any = ROTotalsService.GetTotalsValue(argROData, TaxCodes, false, true, true, ROPrintData.Entity.Round, ROPrintData.Entity);
|
|
98
|
+
|
|
99
|
+
finalTotalsData = this.CheckAndGetCombinedTotals(AsCustomerAndInsurance, AsInsuranceOrCustomer, finalTotalsData, ROPrintData.Entity.DecimalsNumber);
|
|
100
|
+
|
|
101
|
+
finalTotalsData.Settings = TrUtils.Stringify(argROData.Settings);
|
|
102
|
+
|
|
103
|
+
if (AsCustomerOnly) {
|
|
104
|
+
if (ROPrintData.ShowAccParts) {
|
|
105
|
+
finalTotalsData = this.GetLaborAndPartItemsAfterDisc(finalTotalsData, ROPrintData.Entity.DecimalsNumber);
|
|
106
|
+
} else {
|
|
107
|
+
finalTotalsData = this.GetDetailedInfoForItems(finalTotalsData, ROPrintData.Entity.DecimalsNumber);
|
|
108
|
+
finalTotalsData = this.GetCustTaxInfo(finalTotalsData, IncludeGST, TaxCodes, ROPrintData.Entity.DecimalsNumber);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (AsCustomerAndInsurance) {
|
|
113
|
+
finalTotalsData = this.GetCombinedInfoForItems(finalTotalsData, ROPrintData.Entity.DecimalsNumber);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (AsInsuranceOrCustomer) {
|
|
117
|
+
finalTotalsData.Parts = this.GetSplitInfoForParts(finalTotalsData.Parts, ROPrintData.Entity.DecimalsNumber);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (IncludeGST) {
|
|
121
|
+
finalTotalsData.ShowDetailedLaborTaxInfo = this.CheckLaborTaxItemIndex(finalTotalsData.Ops) !== -1;
|
|
122
|
+
finalTotalsData.ShowDetailedPartTaxInfo = this.CheckPartTaxItemIndex(finalTotalsData.Parts) !== -1;
|
|
123
|
+
} else {
|
|
124
|
+
finalTotalsData.ShowDetailedLaborTaxInfo = false;
|
|
125
|
+
finalTotalsData.ShowDetailedPartTaxInfo = false;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
ROPrintData = TrUtils.ConcatObjects(ROPrintData, finalTotalsData);
|
|
129
|
+
|
|
130
|
+
if (ROPrintData.ShowAccParts) {
|
|
131
|
+
ROPrintData = this.ConvertItemsAsAR(ROPrintData, Consolidate, ROPrintData.Entity.DecimalsNumber);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
ROPrintData.Colli = this.EmptyInvalidCollisionRepairItems(ROPrintData.Colli);
|
|
135
|
+
|
|
136
|
+
ROPrintData = this.GetLineTotals(ROPrintData, IncludeGST, AsCustomerOnly, AsInsuranceOnly, Consolidate, ROPrintData.Entity.DecimalsNumber);
|
|
137
|
+
|
|
138
|
+
ROPrintData.PrintInfo = this.PrepareFormatForEstPrint(ROPrintData, SuppEstIndex, OverallEst, ROTypeEnum.Estimate, AsEstimated);
|
|
139
|
+
|
|
140
|
+
ROPrintData = this.CheckAndCombineDescMPNForAR(ROPrintData.Entity.MPN, ROPrintData);
|
|
141
|
+
|
|
142
|
+
ROPrintData.Vehicle = PrintSharedService.GetVehicleFromServiceAndFormatData(OriginalVehicleData);
|
|
143
|
+
ROPrintData.Customer = PrintSharedService.GetCustomerFromServiceAndFormatData(OriginalCustomerData);
|
|
144
|
+
|
|
145
|
+
if ((Payee === PayTypeEnum.Customer || AsCustomerOnly) && !ROPrintData.ConsolidateGST) {
|
|
146
|
+
// if (PrintSharedService.CheckItemIndexWithDisc(ROPrintData) !== -1) {
|
|
147
|
+
ROPrintData.ShowDiscountColumn = (ROPrintData.Settings.DiscLvl === 'ITM' || ROPrintData.Settings.DiscLvl === 'RECITM') ? true : false;
|
|
148
|
+
|
|
149
|
+
// }
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return ROPrintData;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static GetROBasicDetailsForPrint(ROPrintData: any, argROData: any, Product: any, OverallEst: any, isInitial: boolean) {
|
|
156
|
+
ROPrintData.CrDate = MyDate.ConvertUTCDateToReadable(argROData.CrDate);
|
|
157
|
+
if (!isInitial) {
|
|
158
|
+
ROPrintData.PrDate = MyDate.ConvertUTCDateToReadable(argROData.PrDate);
|
|
159
|
+
} else {
|
|
160
|
+
delete ROPrintData.PrDate;
|
|
161
|
+
}
|
|
162
|
+
ROPrintData.MIn = Product.MIn;
|
|
163
|
+
ROPrintData._id = argROData.Code;
|
|
164
|
+
if (isInitial || TrUtils.IsNull(argROData.SuppEst) || argROData.SuppEst.length === 0 || OverallEst) {
|
|
165
|
+
ROPrintData.Type = 'Estimate';
|
|
166
|
+
ROPrintData.HeaderName = 'Estimate';
|
|
167
|
+
} else {
|
|
168
|
+
ROPrintData.Type = 'Supplementary Estimate';
|
|
169
|
+
ROPrintData.HeaderName = 'Supplementary Estimate';
|
|
170
|
+
}
|
|
171
|
+
ROPrintData.SuppEst = argROData.SuppEst;
|
|
172
|
+
return ROPrintData;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
static GetPrintConditionsBasedOnInput(ROPrintData: any, IncludeGST: boolean, Payee: any,
|
|
176
|
+
AsCustomerOnly: boolean, AsInsuranceOnly: boolean, AsCustomerAndInsurance: boolean,
|
|
177
|
+
AsInsuranceOrCustomer: boolean, SType: any, Consolidate: boolean) {
|
|
178
|
+
|
|
179
|
+
ROPrintData.Payee = Payee;
|
|
180
|
+
ROPrintData.AsCustomerOnly = AsCustomerOnly;
|
|
181
|
+
ROPrintData.AsInsuranceOnly = AsInsuranceOnly;
|
|
182
|
+
ROPrintData.AsCustomerAndInsurance = AsCustomerAndInsurance;
|
|
183
|
+
ROPrintData.AsInsuranceOrCustomer = AsInsuranceOrCustomer;
|
|
184
|
+
|
|
185
|
+
ROPrintData.IncludeGST = IncludeGST;
|
|
186
|
+
ROPrintData.ConsolidateGST = Consolidate;
|
|
187
|
+
ROPrintData.Consolidate = Consolidate;
|
|
188
|
+
|
|
189
|
+
ROPrintData.ShowIGST = (TrUtils.IsNull(SType) || (SType === 'Intra')) ? false : true;
|
|
190
|
+
|
|
191
|
+
ROPrintData.ShowTaxColumn = (IncludeGST && !Consolidate) ? true : false;
|
|
192
|
+
// ROPrintData.ShowDiscountColumn = (Payee === PayTypeEnum.Customer || AsCustomerOnly) ? true : false;
|
|
193
|
+
return ROPrintData;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
static GetInsDetailsForPrint(ROPrintData: any, InsCompanyName: any, argROData: any, AsEstimated: boolean) {
|
|
197
|
+
if (TrUtils.IsNull(argROData.Ins)) {
|
|
198
|
+
argROData.Ins = this.GetDefualtInsData();
|
|
199
|
+
}
|
|
200
|
+
ROPrintData.InsComp = InsCompanyName;
|
|
201
|
+
if (!AsEstimated) {
|
|
202
|
+
ROPrintData.SurName = argROData.Ins.SName;
|
|
203
|
+
ROPrintData.SurEmail = argROData.Ins.SEmail;
|
|
204
|
+
ROPrintData.SurPhone = argROData.Ins.SPhone;
|
|
205
|
+
}
|
|
206
|
+
ROPrintData.PolType = argROData.Ins.Type;
|
|
207
|
+
ROPrintData.PolNo = argROData.Ins.PolNo;
|
|
208
|
+
return ROPrintData;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
static GetDefualtInsData() {
|
|
212
|
+
let ROInsData: any = {
|
|
213
|
+
SName: '',
|
|
214
|
+
SEmail: '',
|
|
215
|
+
SPhone: '',
|
|
216
|
+
PolNo: ''
|
|
217
|
+
};
|
|
218
|
+
return ROInsData;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
static IfInitialEstimateChangeStatus(argROData: any, AsEstimated: boolean) {
|
|
222
|
+
if (AsEstimated) {
|
|
223
|
+
argROData.Sts = ROStatusEnum.New;
|
|
224
|
+
argROData.Ops = this.ChangeLaborStatusToNew(argROData.Ops);
|
|
225
|
+
argROData.Parts = this.ChangePartStatusToNew(argROData.Parts);
|
|
226
|
+
argROData.Colli = this.ChangeColliStatusToNew(argROData.Colli);
|
|
227
|
+
}
|
|
228
|
+
return argROData;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
static ChangeLaborStatusToNew(Operations: any) {
|
|
232
|
+
Operations.forEach((Labor: any) => {
|
|
233
|
+
Labor.Sts = LaborStatusEnum.New;
|
|
234
|
+
});
|
|
235
|
+
return Operations;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
static ChangePartStatusToNew(Parts: any) {
|
|
239
|
+
Parts.forEach((Part: any) => {
|
|
240
|
+
if (!TrUtils.IsNull(Part.CollId)) {
|
|
241
|
+
Part.Sts = LaborStatusEnum.New;
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
return Parts;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
static ChangeColliStatusToNew(Collisions: any) {
|
|
248
|
+
Collisions.forEach((Collision: any) => {
|
|
249
|
+
Collision.Sts = LaborStatusEnum.New;
|
|
250
|
+
});
|
|
251
|
+
return Collisions;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
static CheckStatusAndChangeDeclinedItemsToNew(argROData: any) {
|
|
255
|
+
if (argROData.Sts === ROStatusEnum.New || argROData.Sts === ROStatusEnum.WtngForAppr) {
|
|
256
|
+
argROData = this.ChangeDeclinedStatusToNew(argROData);
|
|
257
|
+
}
|
|
258
|
+
return argROData;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
static ChangeDeclinedStatusToNew(argROData: any) {
|
|
262
|
+
argROData.Ops = this.ChangeDeclinedLaborStatusToNew(argROData.Ops);
|
|
263
|
+
argROData.Parts = this.ChangeDeclinedPartStatusToNew(argROData.Parts);
|
|
264
|
+
argROData.Colli = this.ChangeDeclinedColliStatusToNew(argROData.Colli);
|
|
265
|
+
return argROData;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
static ChangeDeclinedLaborStatusToNew(Operations: any) {
|
|
269
|
+
Operations.forEach((Labor: any) => {
|
|
270
|
+
if (Labor.Sts === LaborStatusEnum.Declined) {
|
|
271
|
+
Labor.Sts = LaborStatusEnum.New;
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
return Operations;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
static ChangeDeclinedPartStatusToNew(Parts: any) {
|
|
278
|
+
Parts.forEach((Part: any) => {
|
|
279
|
+
if (!TrUtils.IsNull(Part.CollId) && Part.Sts === LaborStatusEnum.Declined) {
|
|
280
|
+
Part.Sts = LaborStatusEnum.New;
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
return Parts;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
static ChangeDeclinedColliStatusToNew(Collisions: any) {
|
|
287
|
+
Collisions.forEach((Collision: any) => {
|
|
288
|
+
if (Collision.Sts === LaborStatusEnum.Declined) {
|
|
289
|
+
Collision.Sts = LaborStatusEnum.New;
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
return Collisions;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
static GetValidItemsForTotals(RecordData: any) {
|
|
296
|
+
let RecordStatus: string = RecordData.Sts;
|
|
297
|
+
RecordData.Ops = this.GetLaborByRecordAndLaborStatus(RecordStatus, RecordData.Ops);
|
|
298
|
+
RecordData.Parts = this.GetPartsByRecordAndPartStatus(RecordStatus, RecordData.Parts);
|
|
299
|
+
RecordData.Colli = this.GetCollisionByRecordAndColliStatus(RecordStatus, RecordData.Colli);
|
|
300
|
+
return RecordData;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
static GetLaborByRecordAndLaborStatus(RecordStatus: string, Operations: any) {
|
|
304
|
+
if (RecordStatus === ROStatusEnum.Cancelled || RecordStatus === ROStatusEnum.Declined) {
|
|
305
|
+
return Operations;
|
|
306
|
+
} else {
|
|
307
|
+
return this.GetValidROLaborListByStatus(Operations);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
static GetValidROLaborListByStatus(Operations: any) {
|
|
312
|
+
let opCodesList: any[] = Operations.filter((Operation: any) => {
|
|
313
|
+
if (this.CheckOperationHasActiveStatus(Operation.Sts)) {
|
|
314
|
+
return Operation;
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
return opCodesList;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
static CheckOperationHasActiveStatus(Status: string) {
|
|
321
|
+
return (Status !== LaborStatusEnum.Cancelled && Status !== LaborStatusEnum.Declined) ? true : false;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
static GetPartsByRecordAndPartStatus(RecordStatus: any, Parts: any) {
|
|
325
|
+
if (RecordStatus === ROStatusEnum.Cancelled || RecordStatus === ROStatusEnum.Declined) {
|
|
326
|
+
return Parts;
|
|
327
|
+
} else {
|
|
328
|
+
return this.GetValidROPartsListByStatus(Parts);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
static GetValidROPartsListByStatus(Parts: any) {
|
|
333
|
+
let PartsList: any[] = Parts.filter((Part: any) => {
|
|
334
|
+
if (TrUtils.IsNull(Part.CollId)) {
|
|
335
|
+
return Part;
|
|
336
|
+
} else {
|
|
337
|
+
if (this.CheckOperationHasActiveStatus(Part.Sts)) {
|
|
338
|
+
return Part;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
return PartsList;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
static GetCollisionByRecordAndColliStatus(RecordStatus: string, Collisions: any) {
|
|
346
|
+
if (RecordStatus === ROStatusEnum.Cancelled || RecordStatus === ROStatusEnum.Declined) {
|
|
347
|
+
return Collisions;
|
|
348
|
+
} else {
|
|
349
|
+
return this.GetValidROCollisionListByStatus(Collisions);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
static GetValidROCollisionListByStatus(Collisions: any) {
|
|
354
|
+
let collList: any[] = Collisions.filter((Collision: any) => {
|
|
355
|
+
if (this.CheckOperationHasActiveStatus(Collision.Sts)) {
|
|
356
|
+
return Collision;
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
return collList;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
static GetItemsBySuppEstIndex(argROData: any, SuppEstIndex: any) {
|
|
363
|
+
if (TrUtils.IsNull(SuppEstIndex)) {
|
|
364
|
+
SuppEstIndex = null;
|
|
365
|
+
}
|
|
366
|
+
argROData.Ops = argROData.Ops.filter((Labor: any) => {
|
|
367
|
+
if (TrUtils.IsNull(Labor.SuppEst)) {
|
|
368
|
+
Labor.SuppEst = null;
|
|
369
|
+
}
|
|
370
|
+
return Labor.SuppEst === SuppEstIndex;
|
|
371
|
+
});
|
|
372
|
+
argROData.Parts = argROData.Parts.filter((Part: any) => {
|
|
373
|
+
if (TrUtils.IsNull(Part.SuppEst)) {
|
|
374
|
+
Part.SuppEst = null;
|
|
375
|
+
}
|
|
376
|
+
return Part.SuppEst === SuppEstIndex;
|
|
377
|
+
});
|
|
378
|
+
argROData.Colli = argROData.Colli.filter((Collision: any) => {
|
|
379
|
+
if (TrUtils.IsNull(Collision.SuppEst)) {
|
|
380
|
+
Collision.SuppEst = null;
|
|
381
|
+
}
|
|
382
|
+
return Collision.SuppEst === SuppEstIndex;
|
|
383
|
+
});
|
|
384
|
+
return argROData;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
static SeparateROLaborByPType(Labors: any, PType: any, CustomerOnly: boolean, InsuranceOnly: boolean, AsEstimated: boolean) {
|
|
388
|
+
let LaborList: any[] = [];
|
|
389
|
+
LaborList = Labors.filter((Labor: any) => {
|
|
390
|
+
if (AsEstimated) {
|
|
391
|
+
if (PType === PayTypeEnum.Customer) {
|
|
392
|
+
return Labor.PBy === PayTypeEnum.Customer;
|
|
393
|
+
} else {
|
|
394
|
+
return (Labor.PBy === PayTypeEnum.Insurance || Labor.PBy === PayTypeEnum.Shared);
|
|
395
|
+
}
|
|
396
|
+
} else {
|
|
397
|
+
if (PType === PayTypeEnum.Customer) {
|
|
398
|
+
return Labor.PBy === PType;
|
|
399
|
+
} else {
|
|
400
|
+
if (CustomerOnly) {
|
|
401
|
+
return (Labor.PBy === PayTypeEnum.Shared) && !TrUtils.IsZero(Labor.Pr);
|
|
402
|
+
} else {
|
|
403
|
+
if (InsuranceOnly) {
|
|
404
|
+
return (Labor.PBy === PayTypeEnum.Insurance || Labor.PBy === PayTypeEnum.Shared) && !TrUtils.IsZero(Labor.AssPr);
|
|
405
|
+
} else {
|
|
406
|
+
return (Labor.PBy === PayTypeEnum.Insurance || Labor.PBy === PayTypeEnum.Shared);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
return LaborList;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
static SeparateROPartsByPType(Parts: any, PType: any, CustomerOnly: boolean, InsuranceOnly: boolean, AsEstimated: boolean) {
|
|
416
|
+
let PartsList: any[] = [];
|
|
417
|
+
PartsList = Parts.filter((Part: any) => {
|
|
418
|
+
if (AsEstimated) {
|
|
419
|
+
if (PType === PayTypeEnum.Customer) {
|
|
420
|
+
return Part.PBy === PType;
|
|
421
|
+
} else {
|
|
422
|
+
return (Part.PBy === PayTypeEnum.Insurance || Part.PBy === PayTypeEnum.Shared);
|
|
423
|
+
}
|
|
424
|
+
} else {
|
|
425
|
+
if (PType === PayTypeEnum.Customer) {
|
|
426
|
+
return Part.PBy === PType;
|
|
427
|
+
} else {
|
|
428
|
+
if (CustomerOnly) {
|
|
429
|
+
return (Part.PBy === PayTypeEnum.Shared) && !TrUtils.IsZero(Part.UnPr);
|
|
430
|
+
} else {
|
|
431
|
+
if (InsuranceOnly) {
|
|
432
|
+
return (Part.PBy === PayTypeEnum.Insurance || Part.PBy === PayTypeEnum.Shared) && !TrUtils.IsZero(Part.AssPr);
|
|
433
|
+
} else {
|
|
434
|
+
return (Part.PBy === PayTypeEnum.Insurance || Part.PBy === PayTypeEnum.Shared);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
return PartsList;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
static SeparateROCollisionsByItems(Collisions: any, Ops: any, Parts: any) {
|
|
444
|
+
let CollisionList: any[] = Collisions.filter((Collision: any) => {
|
|
445
|
+
let LaborIndex: any = Ops.findIndex((Labor: any) => {
|
|
446
|
+
return Labor.CollId === Collision._id;
|
|
447
|
+
});
|
|
448
|
+
let PartIndex: any = Parts.findIndex((Part: any) => {
|
|
449
|
+
return Part.CollId === Collision._id;
|
|
450
|
+
});
|
|
451
|
+
if (LaborIndex !== -1 || PartIndex !== -1) {
|
|
452
|
+
return Collision;
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
return CollisionList;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
static ResetQtyAndUoM(Parts: any) {
|
|
459
|
+
Parts.forEach((Item: any) => {
|
|
460
|
+
if (!TrUtils.IsZero(Item.Qty) && !TrUtils.CheckInvalidSelect(Item.UoM)) {
|
|
461
|
+
Item.QtyAndUoM = Item.Qty + ' ' + Item.UoM;
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
return Parts;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
static CheckAndShowItemsAsAR(argROData: any) {
|
|
468
|
+
let AccPartsIndex: any = argROData.Parts.findIndex((Part: any) => {
|
|
469
|
+
return !TrUtils.IsNull((Part.CollId));
|
|
470
|
+
});
|
|
471
|
+
let InsLaborIndex: any = argROData.Ops.findIndex((Labor: any) => {
|
|
472
|
+
return !TrUtils.IsNull((Labor.CollId));
|
|
473
|
+
});
|
|
474
|
+
if (AccPartsIndex !== -1 || InsLaborIndex !== -1) {
|
|
475
|
+
return true;
|
|
476
|
+
} else {
|
|
477
|
+
return false;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
static ConvertItemsAsAR(ROPrintData: any, Consolidate: boolean, DecimalsNumber: number) {
|
|
482
|
+
|
|
483
|
+
ROPrintData.Colli.forEach((Collision: any) => {
|
|
484
|
+
Collision = this.ResetItemsDataById(Collision, ROPrintData.Ops, ROPrintData.Parts);
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
ROPrintData.Ops.forEach((Labor: any) => {
|
|
488
|
+
// console.log('Labor', Labor);
|
|
489
|
+
Labor.NetAmt = TrUtils.FixPriceValue(Labor.NetAmt, DecimalsNumber);
|
|
490
|
+
Labor.CCGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
491
|
+
Labor.CSGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
492
|
+
Labor.CIGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
493
|
+
Labor.Disc = TrUtils.FixPriceValue(Labor.Disc, DecimalsNumber);
|
|
494
|
+
Labor.AssPr = TrUtils.FixPriceValue(Labor.AssPr, DecimalsNumber);
|
|
495
|
+
Labor.ACGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
|
|
496
|
+
Labor.ASGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
|
|
497
|
+
Labor.AIGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
|
|
498
|
+
if (Consolidate) {
|
|
499
|
+
if (Labor.PBy === PayTypeEnum.Customer) {
|
|
500
|
+
Labor.EstPr = TrUtils.FixPriceValue(Labor.CustAfterTax, DecimalsNumber);
|
|
501
|
+
Labor.Pr = TrUtils.FixPriceValue(Labor.CustAfterTax, DecimalsNumber);
|
|
502
|
+
} else {
|
|
503
|
+
Labor.EstPr = TrUtils.FixPriceValue(Labor.InsAfterTax, DecimalsNumber);
|
|
504
|
+
Labor.Pr = TrUtils.FixPriceValue(Labor.InsAfterTax, DecimalsNumber);
|
|
505
|
+
}
|
|
506
|
+
} else {
|
|
507
|
+
Labor.EstPr = TrUtils.FixPriceValue(Labor.EstPr, DecimalsNumber);
|
|
508
|
+
Labor.Pr = TrUtils.FixPriceValue(Labor.Pr, DecimalsNumber);
|
|
509
|
+
}
|
|
510
|
+
Labor.ECGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
|
|
511
|
+
Labor.ESGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
|
|
512
|
+
Labor.EIGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
|
|
513
|
+
if (TrUtils.IsNull(Labor.CollId)) {
|
|
514
|
+
let LaborColli: any = {
|
|
515
|
+
_id: Labor._id,
|
|
516
|
+
Desc: Labor.Desc,
|
|
517
|
+
PBy: Labor.PBy,
|
|
518
|
+
Op_Id: Labor.Op_Id,
|
|
519
|
+
Qty: 0,
|
|
520
|
+
Sts: Labor.Sts
|
|
521
|
+
};
|
|
522
|
+
LaborColli.RRFData = Labor;
|
|
523
|
+
LaborColli.SuppEst = Labor.SuppEst;
|
|
524
|
+
ROPrintData.Colli.push(LaborColli);
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
ROPrintData.Parts.forEach((Part: any) => {
|
|
529
|
+
// console.log('Part', Part);
|
|
530
|
+
|
|
531
|
+
Part.NetAmt = TrUtils.FixPriceValue(Part.NetAmt, DecimalsNumber);
|
|
532
|
+
Part.UnAmt = TrUtils.FixPriceValue(Part.UnAmt, DecimalsNumber);
|
|
533
|
+
Part.CCGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
534
|
+
Part.CSGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
535
|
+
Part.CIGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
536
|
+
Part.Disc = TrUtils.FixPriceValue(Part.Disc, DecimalsNumber);
|
|
537
|
+
Part.AssPr = TrUtils.FixPriceValue(Part.AssPr, DecimalsNumber);
|
|
538
|
+
Part.AssAmt = TrUtils.FixPriceValue(Part.AssAmt, DecimalsNumber);
|
|
539
|
+
Part.ACGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
|
|
540
|
+
Part.ASGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
|
|
541
|
+
Part.AIGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
|
|
542
|
+
Part.EstPr = TrUtils.FixPriceValue(Part.EstPr, DecimalsNumber);
|
|
543
|
+
if (Consolidate) {
|
|
544
|
+
if (Part.PBy === PayTypeEnum.Customer) {
|
|
545
|
+
Part.EstPr = TrUtils.FixPriceValue((Part.CustAfterTax / Part.Qty), DecimalsNumber);
|
|
546
|
+
Part.UnPr = TrUtils.FixPriceValue((Part.CustAfterTax / Part.Qty), DecimalsNumber);
|
|
547
|
+
} else {
|
|
548
|
+
Part.EstPr = TrUtils.FixPriceValue((Part.InsAfterTax / Part.Qty), DecimalsNumber);
|
|
549
|
+
Part.UnPr = TrUtils.FixPriceValue((Part.InsAfterTax / Part.Qty), DecimalsNumber);
|
|
550
|
+
}
|
|
551
|
+
} else {
|
|
552
|
+
Part.EstPr = TrUtils.FixPriceValue(Part.EstPr, DecimalsNumber);
|
|
553
|
+
Part.UnPr = TrUtils.FixPriceValue(Part.UnPr, DecimalsNumber);
|
|
554
|
+
}
|
|
555
|
+
Part.EstAmt = TrUtils.FixPriceValue(Part.EstAmt, DecimalsNumber);
|
|
556
|
+
Part.ECGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
|
|
557
|
+
Part.ESGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
|
|
558
|
+
Part.EIGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
|
|
559
|
+
if (TrUtils.IsNull(Part.CollId)) {
|
|
560
|
+
let LaborIndex: any = ROPrintData.Ops.findIndex((Labor: any) => {
|
|
561
|
+
return Labor._id === Part.OpId;
|
|
562
|
+
});
|
|
563
|
+
let OpsStatus: string = ROPrintData.Ops[LaborIndex].Sts;
|
|
564
|
+
|
|
565
|
+
let PartColli: any = {
|
|
566
|
+
_id: Part._id,
|
|
567
|
+
Desc: Part.Desc,
|
|
568
|
+
PBy: Part.PBy,
|
|
569
|
+
Sts: OpsStatus
|
|
570
|
+
};
|
|
571
|
+
PartColli.PartData = Part;
|
|
572
|
+
PartColli.SuppEst = Part.SuppEst;
|
|
573
|
+
ROPrintData.Colli.push(PartColli);
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
ROPrintData.Ops = [];
|
|
578
|
+
ROPrintData.Parts = [];
|
|
579
|
+
|
|
580
|
+
return ROPrintData;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
static ResetItemsDataById(Collision: any, AddedOperations: any[], AddedParts: any[]) {
|
|
584
|
+
Collision.PartData = TrUtils.IsNull(Collision.PartId)
|
|
585
|
+
? null : this.GetPartDataById(Collision.PartId, AddedParts);
|
|
586
|
+
Collision.RRFData = TrUtils.IsNull(Collision.RRFId)
|
|
587
|
+
? null : this.GetLaborDataById(Collision.RRFId, AddedOperations);
|
|
588
|
+
Collision.PtngData = TrUtils.IsNull(Collision.PainId)
|
|
589
|
+
? null : this.GetLaborDataById(Collision.PainId, AddedOperations);
|
|
590
|
+
Collision.DtngData = TrUtils.IsNull(Collision.RepId)
|
|
591
|
+
? null : this.GetLaborDataById(Collision.RepId, AddedOperations);
|
|
592
|
+
return Collision;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
static GetPartDataById(PartId: any, AddedParts: any[]) {
|
|
596
|
+
let partIndex: any = AddedParts.findIndex((Part: any) => {
|
|
597
|
+
return Part._id === PartId;
|
|
598
|
+
});
|
|
599
|
+
return (partIndex !== -1) ? AddedParts[partIndex] : null;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
static GetLaborDataById(LaborId: any, AddedOperations: any[]) {
|
|
603
|
+
let laborIndex: any = AddedOperations.findIndex((Labor: any) => {
|
|
604
|
+
return Labor._id === LaborId;
|
|
605
|
+
});
|
|
606
|
+
return (laborIndex !== -1) ? AddedOperations[laborIndex] : null;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
static EmptyInvalidCollisionRepairItems(Colli: any) {
|
|
610
|
+
Colli.forEach((CollisionItem: any) => {
|
|
611
|
+
if (!TrUtils.IsNull(CollisionItem.PartData) && !this.CheckOperationHasActiveStatus(CollisionItem.PartData.Sts)) {
|
|
612
|
+
CollisionItem.PartData.EstPr = null;
|
|
613
|
+
CollisionItem.PartData.AssPr = null;
|
|
614
|
+
CollisionItem.PartData.UnPr = null;
|
|
615
|
+
CollisionItem.PartData.Disc = 0;
|
|
616
|
+
CollisionItem.PartData.RecDisc = 0;
|
|
617
|
+
}
|
|
618
|
+
if (!TrUtils.IsNull(CollisionItem.RRFData) && !this.CheckOperationHasActiveStatus(CollisionItem.RRFData.Sts)) {
|
|
619
|
+
CollisionItem.RRFData.EstPr = null;
|
|
620
|
+
CollisionItem.RRFData.AssPr = null;
|
|
621
|
+
CollisionItem.RRFData.Pr = null;
|
|
622
|
+
CollisionItem.RRFData.Disc = 0;
|
|
623
|
+
CollisionItem.RRFData.RecDisc = 0;
|
|
624
|
+
}
|
|
625
|
+
if (!TrUtils.IsNull(CollisionItem.DtngData) && !this.CheckOperationHasActiveStatus(CollisionItem.DtngData.Sts)) {
|
|
626
|
+
CollisionItem.DtngData.EstPr = null;
|
|
627
|
+
CollisionItem.DtngData.AssPr = null;
|
|
628
|
+
CollisionItem.DtngData.Pr = null;
|
|
629
|
+
CollisionItem.DtngData.Disc = 0;
|
|
630
|
+
CollisionItem.DtngData.RecDisc = 0;
|
|
631
|
+
}
|
|
632
|
+
if (!TrUtils.IsNull(CollisionItem.PtngData) && !this.CheckOperationHasActiveStatus(CollisionItem.PtngData.Sts)) {
|
|
633
|
+
CollisionItem.PtngData.EstPr = null;
|
|
634
|
+
CollisionItem.PtngData.AssPr = null;
|
|
635
|
+
CollisionItem.PtngData.Pr = null;
|
|
636
|
+
CollisionItem.PtngData.Disc = 0;
|
|
637
|
+
CollisionItem.PtngData.RecDisc = 0;
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
return Colli;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
static GetLineTotals(ROPrintData: any, IncludeGST: boolean, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, Consolidate: boolean, DecimalsNumber: number) {
|
|
644
|
+
|
|
645
|
+
ROPrintData.Ops.forEach((Labor: any) => {
|
|
646
|
+
Labor.LineTotal = this.GetLaborLineTotal(Labor, IncludeGST, AsCustomerOnly, AsInsuranceOnly, Consolidate, DecimalsNumber);
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
ROPrintData.Parts.forEach((Part: any) => {
|
|
650
|
+
Part.LineTotal = this.GetPartLineTotal(Part, IncludeGST, AsCustomerOnly, AsInsuranceOnly, Consolidate, DecimalsNumber);
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
ROPrintData.Colli.forEach((Collision: any) => {
|
|
654
|
+
let LineTotal: number = 0;
|
|
655
|
+
if (!TrUtils.IsNull(Collision.PartData)) {
|
|
656
|
+
LineTotal += this.GetCollisionPartLineTotal(Collision.PartData, AsCustomerOnly, AsInsuranceOnly, Consolidate);
|
|
657
|
+
}
|
|
658
|
+
if (!TrUtils.IsNull(Collision.RRFData)) {
|
|
659
|
+
LineTotal += this.GetCollisionLaborLineTotal(Collision.RRFData, AsCustomerOnly, AsInsuranceOnly, Consolidate);
|
|
660
|
+
}
|
|
661
|
+
if (!TrUtils.IsNull(Collision.PtngData)) {
|
|
662
|
+
LineTotal += this.GetCollisionLaborLineTotal(Collision.PtngData, AsCustomerOnly, AsInsuranceOnly, Consolidate);
|
|
663
|
+
}
|
|
664
|
+
if (!TrUtils.IsNull(Collision.DtngData)) {
|
|
665
|
+
LineTotal += this.GetCollisionLaborLineTotal(Collision.DtngData, AsCustomerOnly, AsInsuranceOnly, Consolidate);
|
|
666
|
+
}
|
|
667
|
+
Collision.LineTotal = TrUtils.FixPriceValue(LineTotal, DecimalsNumber);
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
return ROPrintData;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
static GetCollisionPartLineTotal(PartData: any, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, Consolidate: boolean) {
|
|
674
|
+
let LineTotal: number = 0;
|
|
675
|
+
if (AsCustomerOnly) {
|
|
676
|
+
if (Consolidate) {
|
|
677
|
+
LineTotal = PartData.CustAfterTax;
|
|
678
|
+
} else {
|
|
679
|
+
LineTotal = PartData.CustAfterPartDisc;
|
|
680
|
+
}
|
|
681
|
+
} else if (AsInsuranceOnly) {
|
|
682
|
+
if (Consolidate) {
|
|
683
|
+
LineTotal = PartData.InsAfterTax;
|
|
684
|
+
} else {
|
|
685
|
+
LineTotal = PartData.InsAfterPartDisc;
|
|
686
|
+
}
|
|
687
|
+
} else {
|
|
688
|
+
if (Consolidate) {
|
|
689
|
+
LineTotal = PartData.InsAfterTax + PartData.CustAfterTax;
|
|
690
|
+
} else {
|
|
691
|
+
LineTotal = PartData.InsAfterPartDisc + PartData.CustAfterPartDisc;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
return LineTotal;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
static GetCollisionLaborLineTotal(LaborData: any, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, Consolidate: boolean) {
|
|
698
|
+
let LineTotal: number = 0;
|
|
699
|
+
if (AsCustomerOnly) {
|
|
700
|
+
if (Consolidate) {
|
|
701
|
+
LineTotal = LaborData.CustAfterTax;
|
|
702
|
+
} else {
|
|
703
|
+
LineTotal = LaborData.CustAfterLaborDisc;
|
|
704
|
+
}
|
|
705
|
+
} else if (AsInsuranceOnly) {
|
|
706
|
+
if (Consolidate) {
|
|
707
|
+
LineTotal = LaborData.InsAfterTax;
|
|
708
|
+
} else {
|
|
709
|
+
LineTotal = LaborData.InsAfterLaborDisc;
|
|
710
|
+
}
|
|
711
|
+
} else {
|
|
712
|
+
if (Consolidate) {
|
|
713
|
+
LineTotal = LaborData.InsAfterTax + LaborData.CustAfterTax;
|
|
714
|
+
} else {
|
|
715
|
+
LineTotal = LaborData.InsAfterLaborDisc + LaborData.CustAfterLaborDisc;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
return LineTotal;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
static GetLaborLineTotal(LaborData: any, IncludeGST: boolean, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, Consolidate: boolean, DecimalsNumber: number) {
|
|
722
|
+
let LineTotal: number = 0;
|
|
723
|
+
if (AsCustomerOnly) {
|
|
724
|
+
if (IncludeGST || Consolidate) {
|
|
725
|
+
LineTotal = LaborData.CustAfterTax;
|
|
726
|
+
} else {
|
|
727
|
+
LineTotal = LaborData.CustAfterLaborDisc;
|
|
728
|
+
}
|
|
729
|
+
} else if (AsInsuranceOnly) {
|
|
730
|
+
if (IncludeGST || Consolidate) {
|
|
731
|
+
LineTotal = LaborData.InsAfterTax;
|
|
732
|
+
} else {
|
|
733
|
+
LineTotal = LaborData.InsAfterLaborDisc;
|
|
734
|
+
}
|
|
735
|
+
} else {
|
|
736
|
+
if (IncludeGST || Consolidate) {
|
|
737
|
+
LineTotal = LaborData.CustAfterTax + LaborData.InsAfterTax;
|
|
738
|
+
} else {
|
|
739
|
+
LineTotal = LaborData.InsAfterLaborDisc + LaborData.CustAfterLaborDisc;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
return TrUtils.FixedTo(LineTotal, DecimalsNumber);
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
static GetPartLineTotal(PartData: any, IncludeGST: boolean, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, Consolidate: boolean, DecimalsNumber: number) {
|
|
746
|
+
let LineTotal: number = 0;
|
|
747
|
+
if (AsCustomerOnly) {
|
|
748
|
+
if (IncludeGST || Consolidate) {
|
|
749
|
+
LineTotal = PartData.CustAfterTax;
|
|
750
|
+
} else {
|
|
751
|
+
LineTotal = PartData.CustAfterPartDisc;
|
|
752
|
+
}
|
|
753
|
+
} else if (AsInsuranceOnly) {
|
|
754
|
+
if (IncludeGST || Consolidate) {
|
|
755
|
+
LineTotal = PartData.InsAfterTax;
|
|
756
|
+
} else {
|
|
757
|
+
LineTotal = PartData.InsAfterPartDisc;
|
|
758
|
+
}
|
|
759
|
+
} else {
|
|
760
|
+
if (IncludeGST || Consolidate) {
|
|
761
|
+
LineTotal = PartData.InsAfterTax + PartData.CustAfterTax;
|
|
762
|
+
} else {
|
|
763
|
+
LineTotal = PartData.InsAfterPartDisc + PartData.CustAfterPartDisc;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
return TrUtils.FixedTo(LineTotal, DecimalsNumber);
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
static ReverseItemsForROPrint(argROData: any, isReverse: boolean) {
|
|
770
|
+
if (isReverse) {
|
|
771
|
+
argROData.Comps = TrUtils.IsNull(argROData.Comps) ? [] : argROData.Comps.reverse();
|
|
772
|
+
argROData.Ops = TrUtils.IsNull(argROData.Ops) ? [] : argROData.Ops.reverse();
|
|
773
|
+
argROData.Parts = TrUtils.IsNull(argROData.Parts) ? [] : argROData.Parts.reverse();
|
|
774
|
+
argROData.Colli = TrUtils.IsNull(argROData.Colli) ? [] : argROData.Colli.reverse();
|
|
775
|
+
} else {
|
|
776
|
+
argROData.Comps = TrUtils.IsNull(argROData.Comps) ? [] : argROData.Comps;
|
|
777
|
+
argROData.Ops = TrUtils.IsNull(argROData.Ops) ? [] : argROData.Ops;
|
|
778
|
+
argROData.Parts = TrUtils.IsNull(argROData.Parts) ? [] : argROData.Parts;
|
|
779
|
+
argROData.Colli = TrUtils.IsNull(argROData.Colli) ? [] : argROData.Colli;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
let ReversedLabors: any[] = [];
|
|
784
|
+
argROData.Comps.forEach((Complaint: any) => {
|
|
785
|
+
argROData.Ops.forEach((Labor: any) => {
|
|
786
|
+
if (Labor.CompId === Complaint._id) {
|
|
787
|
+
ReversedLabors.push(Labor);
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
});
|
|
791
|
+
|
|
792
|
+
argROData.Ops.forEach((Labor: any) => {
|
|
793
|
+
if (TrUtils.IsNull(Labor.CompId)) {
|
|
794
|
+
ReversedLabors.push(Labor);
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
|
|
798
|
+
argROData.Ops = ReversedLabors;
|
|
799
|
+
|
|
800
|
+
let ReversedParts: any[] = [];
|
|
801
|
+
argROData.Ops.forEach((Labor: any) => {
|
|
802
|
+
argROData.Parts.forEach((Part: any) => {
|
|
803
|
+
if (TrUtils.IsNull(Part.CollId) && (Part.OpId === Labor._id)) {
|
|
804
|
+
ReversedParts.push(Part);
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
argROData.Parts.forEach((Part: any) => {
|
|
810
|
+
if (!TrUtils.IsNull(Part.CollId)) {
|
|
811
|
+
ReversedParts.push(Part);
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
argROData.Parts = ReversedParts;
|
|
815
|
+
|
|
816
|
+
return argROData;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
static CheckAndGetCombinedTotals(AsCustomerAndInsurance: boolean, AsInsuranceOrCustomer: boolean, finalTotalsData: any, DecimalsNumber: number) {
|
|
820
|
+
if (AsCustomerAndInsurance || AsInsuranceOrCustomer) {
|
|
821
|
+
finalTotalsData.InsLaborTotalBeforeDisc = TrUtils.FixPriceValue((Number(finalTotalsData.CustLaborTotalBeforeDisc) +
|
|
822
|
+
Number(finalTotalsData.InsLaborTotalBeforeDisc)), DecimalsNumber);
|
|
823
|
+
|
|
824
|
+
finalTotalsData.InsLaborDiscTotal = TrUtils.FixPriceValue((Number(finalTotalsData.CustLaborDiscTotal) +
|
|
825
|
+
Number(finalTotalsData.InsLaborDiscTotal)), DecimalsNumber);
|
|
826
|
+
|
|
827
|
+
finalTotalsData.InsLaborCGST = TrUtils.FixPriceValue((Number(finalTotalsData.CustLaborCGST) +
|
|
828
|
+
Number(finalTotalsData.InsLaborCGST)), DecimalsNumber);
|
|
829
|
+
|
|
830
|
+
finalTotalsData.InsLaborSGST = TrUtils.FixPriceValue((Number(finalTotalsData.CustLaborSGST) +
|
|
831
|
+
Number(finalTotalsData.InsLaborSGST)), DecimalsNumber);
|
|
832
|
+
|
|
833
|
+
finalTotalsData.InsLaborIGST = TrUtils.FixPriceValue((Number(finalTotalsData.CustLaborIGST) +
|
|
834
|
+
Number(finalTotalsData.InsLaborIGST)), DecimalsNumber);
|
|
835
|
+
|
|
836
|
+
finalTotalsData.InsPartIGST = TrUtils.FixPriceValue((Number(finalTotalsData.CustPartIGST) +
|
|
837
|
+
Number(finalTotalsData.InsPartIGST)), DecimalsNumber);
|
|
838
|
+
|
|
839
|
+
finalTotalsData.InsPartsTotalBeforeDisc = TrUtils.FixPriceValue((Number(finalTotalsData.CustPartsTotalBeforeDisc) +
|
|
840
|
+
Number(finalTotalsData.InsPartsTotalBeforeDisc)), DecimalsNumber);
|
|
841
|
+
|
|
842
|
+
finalTotalsData.InsPartsDiscTotal = TrUtils.FixPriceValue((Number(finalTotalsData.CustPartsDiscTotal) +
|
|
843
|
+
Number(finalTotalsData.InsPartsDiscTotal)), DecimalsNumber);
|
|
844
|
+
|
|
845
|
+
finalTotalsData.InsPartCGST = TrUtils.FixPriceValue((Number(finalTotalsData.CustPartCGST) +
|
|
846
|
+
Number(finalTotalsData.InsPartCGST)), DecimalsNumber);
|
|
847
|
+
|
|
848
|
+
finalTotalsData.InsPartSGST = TrUtils.FixPriceValue((Number(finalTotalsData.CustPartSGST) +
|
|
849
|
+
Number(finalTotalsData.InsPartSGST)), DecimalsNumber);
|
|
850
|
+
|
|
851
|
+
finalTotalsData.InsLaborTotalAfterTax = TrUtils.FixPriceValue((Number(finalTotalsData.CustLaborAfterTax) +
|
|
852
|
+
Number(finalTotalsData.InsLaborTotalAfterTax)), DecimalsNumber);
|
|
853
|
+
|
|
854
|
+
finalTotalsData.InsPartsTotalAfterTax = TrUtils.FixPriceValue((Number(finalTotalsData.CustPartAfterTax) +
|
|
855
|
+
Number(finalTotalsData.InsPartsTotalAfterTax)), DecimalsNumber);
|
|
856
|
+
|
|
857
|
+
finalTotalsData.FixedInsTotal = TrUtils.FixPriceValue((Number(finalTotalsData.FixedTotal) +
|
|
858
|
+
Number(finalTotalsData.FixedInsTotal)), DecimalsNumber);
|
|
859
|
+
|
|
860
|
+
finalTotalsData.InsTotalRoundedBy = TrUtils.FixPriceValue((Math.round(Number(finalTotalsData.FixedInsTotal)) - Number(finalTotalsData.FixedInsTotal)), DecimalsNumber);
|
|
861
|
+
|
|
862
|
+
finalTotalsData.InsRoundedTotal = TrUtils.FixPriceValue(Math.round(Number(finalTotalsData.FixedInsTotal)), DecimalsNumber);
|
|
863
|
+
|
|
864
|
+
let InsTaxGroupData: any[] = [];
|
|
865
|
+
finalTotalsData.InsTaxGroupData.forEach((InsTaxGroup: any) => {
|
|
866
|
+
let index: any = finalTotalsData.CustTaxGroupData.findIndex((CustTaxGroup: any) => {
|
|
867
|
+
return CustTaxGroup.HSN === InsTaxGroup.HSN;
|
|
868
|
+
});
|
|
869
|
+
if (index !== -1) {
|
|
870
|
+
InsTaxGroup.TotalTaxAmount = TrUtils.FixPriceValue((Number(InsTaxGroup.TotalTaxAmount) + Number(finalTotalsData.CustTaxGroupData[index].TotalTaxAmount)), DecimalsNumber);
|
|
871
|
+
InsTaxGroup.TotalTaxableAmount = TrUtils.FixPriceValue((Number(InsTaxGroup.TotalTaxableAmount) + Number(finalTotalsData.CustTaxGroupData[index].TotalTaxableAmount)), DecimalsNumber);
|
|
872
|
+
}
|
|
873
|
+
InsTaxGroupData.push(InsTaxGroup);
|
|
874
|
+
});
|
|
875
|
+
finalTotalsData.InsTaxGroupData = InsTaxGroupData;
|
|
876
|
+
}
|
|
877
|
+
return finalTotalsData;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
static GetDetailedInfoForItems(ROTotalsData: any, DecimalsNumber: number) {
|
|
881
|
+
ROTotalsData.Ops = this.GetCustLaborPrintInfo(ROTotalsData.Ops, DecimalsNumber);
|
|
882
|
+
ROTotalsData.Parts = this.GetCustItemsPrintInfo(ROTotalsData.Parts, ROTotalsData.Ops, DecimalsNumber);
|
|
883
|
+
return ROTotalsData;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
static GetCustLaborPrintInfo(LaborList: any, DecimalsNumber: number) {
|
|
887
|
+
LaborList.forEach((Labor: any) => {
|
|
888
|
+
Labor.HSN = Labor.SAC;
|
|
889
|
+
if (Labor.Sts === LaborStatusEnum.New || Labor.Sts === LaborStatusEnum.WtngForAppr) {
|
|
890
|
+
Labor.UnPr = TrUtils.FixPriceValue(Labor.EstPr, DecimalsNumber);
|
|
891
|
+
Labor.Disc = 0;
|
|
892
|
+
Labor.Perc = '';
|
|
893
|
+
} else {
|
|
894
|
+
Labor.UnPr = TrUtils.FixPriceValue(Labor.Pr, DecimalsNumber);
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
return LaborList;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
static GetCustItemsPrintInfo(Items: any, LaborList: any, DecimalsNumber: number) {
|
|
901
|
+
Items.forEach((Item: any) => {
|
|
902
|
+
let LaborStatus = TrUtils.IsNull(Item.CollId) ? this.GetPartParentStatus(Item.OpId, LaborList) : Item.Sts;
|
|
903
|
+
if (LaborStatus === LaborStatusEnum.New || LaborStatus === LaborStatusEnum.WtngForAppr) {
|
|
904
|
+
Item.UnPr = TrUtils.FixPriceValue(Item.EstPr, DecimalsNumber);
|
|
905
|
+
Item.Disc = 0;
|
|
906
|
+
Item.Perc = '';
|
|
907
|
+
} else {
|
|
908
|
+
Item.UnPr = TrUtils.FixPriceValue(Item.UnPr, DecimalsNumber);
|
|
909
|
+
}
|
|
910
|
+
});
|
|
911
|
+
return Items;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
static GetCustTaxInfo(ROTotalsData: any, IncludeGST: boolean, TaxCodes: any[], DecimalsNumber: number) {
|
|
915
|
+
ROTotalsData.Ops = this.GetCustLaborTaxInfo(ROTotalsData.Ops, IncludeGST, TaxCodes, DecimalsNumber);
|
|
916
|
+
ROTotalsData.Parts = this.GetCustPartTaxInfo(ROTotalsData.Parts, ROTotalsData.Ops, IncludeGST, TaxCodes, DecimalsNumber);
|
|
917
|
+
return ROTotalsData;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
static GetCustLaborTaxInfo(LaborList: any, IncludeGST: boolean, TaxCodes: any[], DecimalsNumber: number) {
|
|
921
|
+
LaborList.forEach((Labor: any) => {
|
|
922
|
+
if (Labor.Sts === LaborStatusEnum.New || Labor.Sts === LaborStatusEnum.WtngForAppr) {
|
|
923
|
+
if (IncludeGST) {
|
|
924
|
+
Labor.CGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
|
|
925
|
+
Labor.SGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
|
|
926
|
+
Labor.IGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
|
|
927
|
+
} else {
|
|
928
|
+
Labor.CGSTAmt = 0;
|
|
929
|
+
Labor.SGSTAmt = 0;
|
|
930
|
+
Labor.IGSTAmt = 0;
|
|
931
|
+
}
|
|
932
|
+
} else {
|
|
933
|
+
if (IncludeGST) {
|
|
934
|
+
Labor.CGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
935
|
+
Labor.SGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
936
|
+
Labor.IGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
937
|
+
} else {
|
|
938
|
+
Labor.CGSTAmt = 0;
|
|
939
|
+
Labor.SGSTAmt = 0;
|
|
940
|
+
Labor.IGSTAmt = 0;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
Labor.CGSTPerc = PrintSharedService.GetCGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
|
|
944
|
+
Labor.SGSTPerc = PrintSharedService.GetSGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
|
|
945
|
+
Labor.IGSTPerc = PrintSharedService.GetIGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
|
|
946
|
+
});
|
|
947
|
+
return LaborList;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
static GetCustPartTaxInfo(Items: any, LaborList: any, IncludeGST: boolean, TaxCodes: any[], DecimalsNumber: number) {
|
|
951
|
+
Items.forEach((Item: any) => {
|
|
952
|
+
let LaborStatus = TrUtils.IsNull(Item.CollId) ? this.GetPartParentStatus(Item.OpId, LaborList) : Item.Sts;
|
|
953
|
+
if (LaborStatus === LaborStatusEnum.New || LaborStatus === LaborStatusEnum.WtngForAppr) {
|
|
954
|
+
if (IncludeGST) {
|
|
955
|
+
Item.CGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
|
|
956
|
+
Item.SGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
|
|
957
|
+
Item.IGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
|
|
958
|
+
} else {
|
|
959
|
+
Item.CGSTAmt = 0;
|
|
960
|
+
Item.SGSTAmt = 0;
|
|
961
|
+
Item.IGSTAmt = 0;
|
|
962
|
+
}
|
|
963
|
+
} else {
|
|
964
|
+
if (IncludeGST) {
|
|
965
|
+
Item.CGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
966
|
+
Item.SGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
967
|
+
Item.IGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
968
|
+
} else {
|
|
969
|
+
Item.CGSTAmt = 0;
|
|
970
|
+
Item.SGSTAmt = 0;
|
|
971
|
+
Item.IGSTAmt = 0;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
Item.CGSTPerc = PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
975
|
+
Item.SGSTPerc = PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
976
|
+
Item.IGSTPerc = PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
977
|
+
});
|
|
978
|
+
return Items;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
static GetLaborAndPartItemsAfterDisc(ROTotalsData: any, DecimalsNumber: number) {
|
|
982
|
+
ROTotalsData.Ops = this.GetCustLaborAfterDiscPrintInfo(ROTotalsData.Ops, DecimalsNumber);
|
|
983
|
+
ROTotalsData.Parts = this.GetCustItemsAfterDiscPrintInfo(ROTotalsData.Parts, ROTotalsData.Ops, DecimalsNumber);
|
|
984
|
+
return ROTotalsData;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
static GetCustLaborAfterDiscPrintInfo(LaborList: any, DecimalsNumber: number) {
|
|
988
|
+
LaborList.forEach((Labor: any) => {
|
|
989
|
+
Labor.HSN = Labor.SAC;
|
|
990
|
+
if (Labor.Sts === LaborStatusEnum.New || Labor.Sts === LaborStatusEnum.WtngForAppr) {
|
|
991
|
+
Labor.UnPr = TrUtils.FixPriceValue(Labor.EstPr, DecimalsNumber);
|
|
992
|
+
} else {
|
|
993
|
+
Labor.UnPr = TrUtils.FixPriceValue(Labor.NetAmt, DecimalsNumber);
|
|
994
|
+
}
|
|
995
|
+
});
|
|
996
|
+
return LaborList;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
static GetCustItemsAfterDiscPrintInfo(Items: any, LaborList: any, DecimalsNumber: number) {
|
|
1000
|
+
Items.forEach((Item: any) => {
|
|
1001
|
+
let LaborStatus = TrUtils.IsNull(Item.CollId) ? this.GetPartParentStatus(Item.OpId, LaborList) : Item.Sts;
|
|
1002
|
+
if (LaborStatus === LaborStatusEnum.New || LaborStatus === LaborStatusEnum.WtngForAppr) {
|
|
1003
|
+
Item.UnPr = TrUtils.FixPriceValue(Item.EstPr, DecimalsNumber);
|
|
1004
|
+
} else {
|
|
1005
|
+
Item.UnPr = TrUtils.FixedTo(Divide(Item.NetAmt, Item.Qty), DecimalsNumber);
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
1008
|
+
return Items;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
static GetPartParentStatus(PartOpId: any, LaborList: any) {
|
|
1012
|
+
let index: number = LaborList.findIndex((Labor: any) => {
|
|
1013
|
+
return Labor._id === PartOpId;
|
|
1014
|
+
});
|
|
1015
|
+
return LaborList[index].Sts;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
static GetCombinedInfoForItems(ROTotalsData: any, DecimalsNumber: number) {
|
|
1019
|
+
ROTotalsData.Ops = this.GetLaborCombinedPrintInfo(ROTotalsData.Ops, DecimalsNumber);
|
|
1020
|
+
ROTotalsData.Parts = this.GetItemsCombinedPrintInfo(ROTotalsData.Parts, DecimalsNumber);
|
|
1021
|
+
return ROTotalsData;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
static GetLaborCombinedPrintInfo(LaborList: any, DecimalsNumber: number) {
|
|
1025
|
+
LaborList.forEach((Labor: any) => {
|
|
1026
|
+
Labor.AssPr = TrUtils.FixedTo(Add(Labor.AssPr, Labor.NetAmt), DecimalsNumber);
|
|
1027
|
+
});
|
|
1028
|
+
return LaborList;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
static GetItemsCombinedPrintInfo(Items: any, DecimalsNumber: number) {
|
|
1032
|
+
Items.forEach((Item: any) => {
|
|
1033
|
+
Item.AssPr = TrUtils.FixedTo(Divide(Add(Item.AssAmt, Item.NetAmt), Item.Qty), DecimalsNumber);
|
|
1034
|
+
});
|
|
1035
|
+
return Items;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
static GetSplitInfoForParts(Items: any, DecimalsNumber: number) {
|
|
1039
|
+
Items.forEach((Item: any) => {
|
|
1040
|
+
Item.UnPr = TrUtils.FixedTo(Divide(Item.NetAmt, Item.Qty), DecimalsNumber);
|
|
1041
|
+
});
|
|
1042
|
+
return Items;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
static CheckLaborTaxItemIndex(LaborList: any[]) {
|
|
1046
|
+
let TaxIndex: any = LaborList.findIndex((Labor: any) => {
|
|
1047
|
+
if (!TrUtils.CheckInvalidSelect(Labor.TCode)) {
|
|
1048
|
+
return Labor;
|
|
1049
|
+
}
|
|
1050
|
+
});
|
|
1051
|
+
return TaxIndex;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
static CheckPartTaxItemIndex(PartsList: any[]) {
|
|
1055
|
+
let TaxIndex: any = PartsList.findIndex((Part: any) => {
|
|
1056
|
+
if (!TrUtils.CheckInvalidSelect(Part.TCode)) {
|
|
1057
|
+
return Part;
|
|
1058
|
+
}
|
|
1059
|
+
});
|
|
1060
|
+
return TaxIndex;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
static PrepareFormatForEstPrint(ROPrintData: any, SuppEstCodeValue: any, OverAllEst: boolean, argROType: any, AsEstimated: boolean) {
|
|
1064
|
+
let PrintInfo: any[] = [];
|
|
1065
|
+
if (OverAllEst === true) {
|
|
1066
|
+
let ROLaborParts: any = this.GetFormatForEstPrint(null, null, ROPrintData, argROType, AsEstimated);
|
|
1067
|
+
PrintInfo.push(ROLaborParts);
|
|
1068
|
+
ROPrintData.SuppEst.forEach((SuppEstCode: any, index: any) => {
|
|
1069
|
+
let ROPrintInfo: any = this.GetFormatForEstPrint(SuppEstCode.Id, index, ROPrintData, argROType, AsEstimated);
|
|
1070
|
+
PrintInfo.push(ROPrintInfo);
|
|
1071
|
+
});
|
|
1072
|
+
} else {
|
|
1073
|
+
let SuppEstIndex: any;
|
|
1074
|
+
if (!TrUtils.IsNull(SuppEstCodeValue)) {
|
|
1075
|
+
SuppEstIndex = ROPrintData.SuppEst.findIndex((SuppEst: any) => {
|
|
1076
|
+
return SuppEst.Id === SuppEstCodeValue;
|
|
1077
|
+
});
|
|
1078
|
+
if (SuppEstIndex === -1) {
|
|
1079
|
+
SuppEstIndex = null;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
let ROLaborParts: any = this.GetFormatForEstPrint(SuppEstCodeValue, SuppEstIndex, ROPrintData, argROType, AsEstimated);
|
|
1083
|
+
PrintInfo.push(ROLaborParts);
|
|
1084
|
+
}
|
|
1085
|
+
return PrintInfo;
|
|
1086
|
+
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
static GetFormatForEstPrint(SuppEstCodeValue: any, SuppEstIndex: any, ROPrintData: any, argROType: any, AsEstimated: boolean) {
|
|
1090
|
+
let ROLaborParts: any = {};
|
|
1091
|
+
if (!TrUtils.IsNull(SuppEstIndex)) {
|
|
1092
|
+
ROLaborParts.Text = 'Supp.Est -' + (SuppEstIndex + 1);
|
|
1093
|
+
}
|
|
1094
|
+
ROLaborParts.Ops = this.SeparateLaborListByPTypeAndSuppIndex(ROPrintData.Ops, SuppEstCodeValue);
|
|
1095
|
+
ROLaborParts.Parts = this.SeparateOnlyPartsByPTypeAndSuppIndex(ROPrintData.Parts, SuppEstCodeValue);
|
|
1096
|
+
ROLaborParts.Colli = this.SeparateCollisionBySuppIndex(ROPrintData.Colli, SuppEstCodeValue);
|
|
1097
|
+
|
|
1098
|
+
if (AsEstimated) {
|
|
1099
|
+
ROLaborParts.Sts = EstimateStatusEnum.New;
|
|
1100
|
+
} else {
|
|
1101
|
+
ROLaborParts.Sts = EstimateStatusEnum.Approved;
|
|
1102
|
+
}
|
|
1103
|
+
ROLaborParts.Type = argROType;
|
|
1104
|
+
return ROLaborParts;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
static SeparateLaborListByPTypeAndSuppIndex(Operations: any, SuppEstCodeValue: any) {
|
|
1108
|
+
let Ops: any[] = [];
|
|
1109
|
+
Ops = Operations.filter((Operation: any) => {
|
|
1110
|
+
if (TrUtils.IsNull(Operation.SuppEst)) {
|
|
1111
|
+
Operation.SuppEst = null;
|
|
1112
|
+
}
|
|
1113
|
+
return Operation.SuppEst === SuppEstCodeValue;
|
|
1114
|
+
});
|
|
1115
|
+
return Ops;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
static SeparateOnlyPartsByPTypeAndSuppIndex(Parts: any, SuppEstCodeValue: any) {
|
|
1119
|
+
let SParts: any[] = [];
|
|
1120
|
+
SParts = Parts.filter((Part: any) => {
|
|
1121
|
+
if (TrUtils.IsNull(Part.SuppEst)) {
|
|
1122
|
+
Part.SuppEst = null;
|
|
1123
|
+
}
|
|
1124
|
+
return Part.SuppEst === SuppEstCodeValue;
|
|
1125
|
+
});
|
|
1126
|
+
return SParts;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
static SeparateCollisionBySuppIndex(Collisions: any, SuppEstCodeValue: any) {
|
|
1130
|
+
let FilteredCollisions: any[] = [];
|
|
1131
|
+
FilteredCollisions = Collisions.filter((Collision: any) => {
|
|
1132
|
+
if (TrUtils.IsNull(Collision.SuppEst)) {
|
|
1133
|
+
Collision.SuppEst = null;
|
|
1134
|
+
}
|
|
1135
|
+
if (Collision.SuppEst === SuppEstCodeValue) {
|
|
1136
|
+
return Collision;
|
|
1137
|
+
}
|
|
1138
|
+
});
|
|
1139
|
+
return FilteredCollisions;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
static CheckAndCombineDescMPNForAR(PrintPartNo: boolean, ROPrintData: any) {
|
|
1143
|
+
if (PrintPartNo) {
|
|
1144
|
+
ROPrintData.PrintInfo.forEach((PrintData: any) => {
|
|
1145
|
+
PrintData.Colli.forEach((Collision: any) => {
|
|
1146
|
+
if (!TrUtils.IsNull(Collision.PartData) && !TrUtils.IsEmpty(Collision.PartData.MPN)) {
|
|
1147
|
+
Collision.Desc = Collision.Desc + '/' + Collision.PartData.MPN;
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
return ROPrintData;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
}
|