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,305 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SalesPrintService = void 0;
|
|
4
|
+
const shared_print_service_1 = require("./shared-print.service");
|
|
5
|
+
const sales_totals_service_1 = require("./sales-totals.service");
|
|
6
|
+
const tr_utils_1 = require("../utils/tr-utils");
|
|
7
|
+
const code_enums_1 = require("../enums/code-enums");
|
|
8
|
+
const my_date_1 = require("../utils/my-date");
|
|
9
|
+
const enums_1 = require("../enums/enums");
|
|
10
|
+
const aggregation_1 = require("../aggregation/aggregation");
|
|
11
|
+
class SalesPrintService {
|
|
12
|
+
static GetSalesPrintInfo(OriginalInvoiceData, OriginalEntityData, image, IncludeGST, ConsolidateGST, TaxCodes, IsProforma, isOtherIndustry) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
let ForInsurance = !tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.BillTo.InsId);
|
|
15
|
+
let InvoicePrintData = {};
|
|
16
|
+
let argInvoiceData = tr_utils_1.TrUtils.Stringify(OriginalInvoiceData);
|
|
17
|
+
if (!IncludeGST) {
|
|
18
|
+
argInvoiceData.Settings.Tax = 'NO';
|
|
19
|
+
}
|
|
20
|
+
InvoicePrintData.IsProforma = IsProforma;
|
|
21
|
+
InvoicePrintData.Settings = tr_utils_1.TrUtils.Stringify(argInvoiceData.Settings);
|
|
22
|
+
let SType;
|
|
23
|
+
if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.Settings) && !tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.Settings.PoS)) {
|
|
24
|
+
SType = OriginalInvoiceData.Settings.PoS.SType;
|
|
25
|
+
}
|
|
26
|
+
InvoicePrintData = this.GetPrintConditionsBasedOnInput(InvoicePrintData, IncludeGST, ConsolidateGST, ForInsurance, SType, argInvoiceData, IsProforma);
|
|
27
|
+
InvoicePrintData.Entity = shared_print_service_1.PrintSharedService.GetFormattedEntityDataForPrint(OriginalEntityData, OriginalInvoiceData.Type, OriginalInvoiceData);
|
|
28
|
+
InvoicePrintData = shared_print_service_1.PrintSharedService.GetEntityHeaderStyles(InvoicePrintData, OriginalEntityData, image);
|
|
29
|
+
InvoicePrintData = this.GetInvoiceOtherDetailsForPrint(InvoicePrintData, argInvoiceData);
|
|
30
|
+
// console.log(InvoicePrintData);
|
|
31
|
+
let IsTaxable = (IncludeGST && tr_utils_1.TrUtils.isTaxable(argInvoiceData.Settings.Tax)) ? true : false;
|
|
32
|
+
// argInvoiceData.Items = argInvoiceData.Items.filter((item: any) => {
|
|
33
|
+
// return TrUtils.IsNull(item.Type);
|
|
34
|
+
// });
|
|
35
|
+
let finalTotalsData = sales_totals_service_1.SalesTotalsService.GetTotalsValue(argInvoiceData.Items, IsTaxable, true, argInvoiceData.PDisc, argInvoiceData.PPerc, argInvoiceData.Disc, argInvoiceData.Perc, TaxCodes, true, argInvoiceData.Settings, InvoicePrintData.Entity.Round);
|
|
36
|
+
if (ConsolidateGST) {
|
|
37
|
+
finalTotalsData.CustPartsTotalBeforeDisc = finalTotalsData.CustItemAfterTax;
|
|
38
|
+
}
|
|
39
|
+
InvoicePrintData = tr_utils_1.TrUtils.ConcatObjects(InvoicePrintData, finalTotalsData);
|
|
40
|
+
// InvoicePrintData.Ops = this.GetLaborPrintInfo(InvoicePrintData.Ops, ConsolidateGST, TaxCodes);
|
|
41
|
+
InvoicePrintData.Items = this.GetItemsPrintInfo(InvoicePrintData.Items, ConsolidateGST, TaxCodes, isOtherIndustry, (_b = (_a = OriginalEntityData.Entity.Settings) === null || _a === void 0 ? void 0 : _a.Acc) === null || _b === void 0 ? void 0 : _b.LTot);
|
|
42
|
+
// argInvoiceData = this.ReverseItemsForInvoicePrint(argInvoiceData);
|
|
43
|
+
InvoicePrintData.PrintInfo = this.PrepareFormatForInvoicePrint(InvoicePrintData, code_enums_1.SOTypeEnum.SO, argInvoiceData.Sts);
|
|
44
|
+
InvoicePrintData = this.GetFormattedProductDataForPrint(argInvoiceData, InvoicePrintData);
|
|
45
|
+
InvoicePrintData = this.GetBillNameForInvoicePrint(argInvoiceData, InvoicePrintData);
|
|
46
|
+
InvoicePrintData = this.GetShipToForSOPrint(argInvoiceData, InvoicePrintData);
|
|
47
|
+
if (tr_utils_1.TrUtils.IsNull(argInvoiceData.Payments)) {
|
|
48
|
+
argInvoiceData.Payments = [];
|
|
49
|
+
}
|
|
50
|
+
let PaymentData = this.GetPaymentsTotal(argInvoiceData.Payments, InvoicePrintData.Total, argInvoiceData.Sts);
|
|
51
|
+
if (argInvoiceData.Settings.DiscLvl !== 'REC') {
|
|
52
|
+
InvoicePrintData.FixedDisc = null;
|
|
53
|
+
}
|
|
54
|
+
InvoicePrintData.Due = PaymentData.Due;
|
|
55
|
+
InvoicePrintData.Paid = PaymentData.Paid;
|
|
56
|
+
if (!tr_utils_1.TrUtils.IsNull(PaymentData.Sts)) {
|
|
57
|
+
InvoicePrintData.Sts = PaymentData.Sts;
|
|
58
|
+
}
|
|
59
|
+
InvoicePrintData.Consolidate = ConsolidateGST;
|
|
60
|
+
if (!ForInsurance && !ConsolidateGST) {
|
|
61
|
+
// if (PrintSharedService.CheckItemIndexWithDisc(InvoicePrintData) !== -1) {
|
|
62
|
+
InvoicePrintData.ShowDiscountColumn = (OriginalInvoiceData.Settings.DiscLvl === 'ITM' || OriginalInvoiceData.Settings.DiscLvl === 'RECITM') ? true : false;
|
|
63
|
+
// }
|
|
64
|
+
}
|
|
65
|
+
InvoicePrintData.From = 'Sales';
|
|
66
|
+
return InvoicePrintData;
|
|
67
|
+
}
|
|
68
|
+
static GetPrintConditionsBasedOnInput(InvoicePrintData, IncludeGST, ConsolidateGST, ForInsurance, SType, OriginalInvoiceData, IsProforma) {
|
|
69
|
+
InvoicePrintData.ForInsurance = ForInsurance;
|
|
70
|
+
InvoicePrintData.For = 'SO';
|
|
71
|
+
InvoicePrintData.IncludeGST = IncludeGST;
|
|
72
|
+
InvoicePrintData.ConsolidateGST = ConsolidateGST;
|
|
73
|
+
InvoicePrintData.ShowAccParts = false;
|
|
74
|
+
InvoicePrintData.ShowIGST = (tr_utils_1.TrUtils.IsNull(SType) || (SType === 'Intra')) ? false : true;
|
|
75
|
+
InvoicePrintData.ShowTaxColumn = (IncludeGST && !ConsolidateGST) ? true : false;
|
|
76
|
+
// InvoicePrintData.ShowDiscountColumn = (!ForInsurance && !ConsolidateGST) ? true : false;
|
|
77
|
+
InvoicePrintData = this.GetInvoiceTypeHeading(InvoicePrintData, OriginalInvoiceData, IncludeGST, ConsolidateGST, IsProforma);
|
|
78
|
+
InvoicePrintData.PrDate = tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.PrDate) ? '' : my_date_1.MyDate.ConvertUTCDateToReadable(OriginalInvoiceData.PrDate);
|
|
79
|
+
return InvoicePrintData;
|
|
80
|
+
}
|
|
81
|
+
static GetInvoiceTypeHeading(InvoicePrintData, OriginalInvoiceData, IncludeGST, ConsolidateGST, IsProforma) {
|
|
82
|
+
if (IsProforma) {
|
|
83
|
+
InvoicePrintData.HeaderName = 'pro-forma Invoice';
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
InvoicePrintData.HeaderName = OriginalInvoiceData.Type;
|
|
87
|
+
}
|
|
88
|
+
return InvoicePrintData;
|
|
89
|
+
}
|
|
90
|
+
static GetInvoiceOtherDetailsForPrint(InvoicePrintData, OriginalInvoiceData) {
|
|
91
|
+
InvoicePrintData.Type = OriginalInvoiceData.Type;
|
|
92
|
+
InvoicePrintData._id = OriginalInvoiceData.Code;
|
|
93
|
+
InvoicePrintData.Sts = OriginalInvoiceData.Sts;
|
|
94
|
+
InvoicePrintData.CrDate = my_date_1.MyDate.ConvertUTCDateToReadable(OriginalInvoiceData.CrDate);
|
|
95
|
+
InvoicePrintData.RefNo = OriginalInvoiceData.RefNo;
|
|
96
|
+
return InvoicePrintData;
|
|
97
|
+
}
|
|
98
|
+
static GetItemsPrintInfo(Items, Consolidate, TaxCodes, isOtherIndustry, LineTotal) {
|
|
99
|
+
let Amt = 0;
|
|
100
|
+
let TaxAmt = 0;
|
|
101
|
+
let TotalAmt = 0;
|
|
102
|
+
let DiscAmt = 0;
|
|
103
|
+
Items.forEach((Item) => {
|
|
104
|
+
if (tr_utils_1.TrUtils.IsNull(Item.Type) || Item.Type === 'Lab') {
|
|
105
|
+
Amt = Amt + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.UnAmt);
|
|
106
|
+
DiscAmt = DiscAmt + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.Disc) + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.RecDisc);
|
|
107
|
+
TaxAmt = TaxAmt + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.CGST) + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.SGST)
|
|
108
|
+
+ tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.IGST);
|
|
109
|
+
TotalAmt = TotalAmt + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.NetAmt) +
|
|
110
|
+
tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.CGST) + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.SGST)
|
|
111
|
+
+ tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.IGST);
|
|
112
|
+
if (Consolidate) {
|
|
113
|
+
let AfterDiscForEach = Item.AfterItemDisc / Item.Qty;
|
|
114
|
+
let CTaxAmtPerItem = Item.CGST / Item.Qty;
|
|
115
|
+
let STaxAmtPerItem = Item.SGST / Item.Qty;
|
|
116
|
+
let ITaxAmtPerItem = Item.IGST / Item.Qty;
|
|
117
|
+
Item.UnPr = tr_utils_1.TrUtils.FixedTo(AfterDiscForEach + CTaxAmtPerItem + STaxAmtPerItem + ITaxAmtPerItem);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
Item.UnPr = tr_utils_1.TrUtils.FixPriceValue(Item.UnPr);
|
|
121
|
+
}
|
|
122
|
+
if (isOtherIndustry && tr_utils_1.TrUtils.IsNull(Item.Type) && !tr_utils_1.TrUtils.IsNull(Item.Model) && !tr_utils_1.TrUtils.IsNull(Item.TR)) {
|
|
123
|
+
Item.Desc = Item.Desc + '( ' + Item.Model + ', ' + Item.TR + ' TR )';
|
|
124
|
+
}
|
|
125
|
+
Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.CGST);
|
|
126
|
+
Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.SGST);
|
|
127
|
+
Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.IGST);
|
|
128
|
+
Item.CGSTPerc = shared_print_service_1.PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
129
|
+
Item.SGSTPerc = shared_print_service_1.PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
130
|
+
Item.IGSTPerc = shared_print_service_1.PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
131
|
+
if (LineTotal === 'AT') {
|
|
132
|
+
Item.LineTotal = tr_utils_1.TrUtils.FixPriceValue(Item.AfterItemTax);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
Item.LineTotal = tr_utils_1.TrUtils.FixPriceValue((0, aggregation_1.subtraction)(Item.UnAmt, Item.Disc));
|
|
136
|
+
}
|
|
137
|
+
if (!tr_utils_1.TrUtils.IsZero(Item.Qty) && !tr_utils_1.TrUtils.CheckInvalidSelect(Item.UoM)) {
|
|
138
|
+
Item.QtyAndUoM = Item.Qty + ' ' + Item.UoM;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
if (Item.Type === 'Sub') {
|
|
143
|
+
Item.LineTotal = tr_utils_1.TrUtils.FixedTo(Amt);
|
|
144
|
+
Amt = 0;
|
|
145
|
+
}
|
|
146
|
+
if (Item.Type === 'Tax') {
|
|
147
|
+
Item.LineTotal = tr_utils_1.TrUtils.FixedTo(TaxAmt);
|
|
148
|
+
TaxAmt = 0;
|
|
149
|
+
}
|
|
150
|
+
if (Item.Type === 'Disc') {
|
|
151
|
+
Item.LineTotal = tr_utils_1.TrUtils.FixedTo(DiscAmt);
|
|
152
|
+
DiscAmt = 0;
|
|
153
|
+
}
|
|
154
|
+
if (Item.Type === 'Tot') {
|
|
155
|
+
Item.LineTotal = tr_utils_1.TrUtils.FixedTo(TotalAmt);
|
|
156
|
+
TotalAmt = 0;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
return Items;
|
|
161
|
+
}
|
|
162
|
+
static ReverseItemsForInvoicePrint(argInvoiceData) {
|
|
163
|
+
// argInvoiceData.Ops = argInvoiceData.Ops.reverse();
|
|
164
|
+
argInvoiceData.Items = argInvoiceData.Items.reverse();
|
|
165
|
+
return argInvoiceData;
|
|
166
|
+
}
|
|
167
|
+
static PrepareFormatForInvoicePrint(InvoicePrintData, ROType, InvoiceStatus) {
|
|
168
|
+
let PrintInfo = [];
|
|
169
|
+
let ROLaborParts = {};
|
|
170
|
+
// ROLaborParts.Ops = InvoicePrintData.Ops;
|
|
171
|
+
ROLaborParts.Items = InvoicePrintData.Items;
|
|
172
|
+
ROLaborParts.Sts = InvoiceStatus;
|
|
173
|
+
ROLaborParts.Type = ROType;
|
|
174
|
+
PrintInfo.push(ROLaborParts);
|
|
175
|
+
return PrintInfo;
|
|
176
|
+
}
|
|
177
|
+
static GetFormattedProductDataForPrint(OriginalInvoiceData, InvoicePrintData) {
|
|
178
|
+
if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.Prod)) {
|
|
179
|
+
InvoicePrintData.Product = OriginalInvoiceData.Prod;
|
|
180
|
+
if (tr_utils_1.TrUtils.IsNull(InvoicePrintData.Product.VIN)) {
|
|
181
|
+
InvoicePrintData.Product.VIN = '';
|
|
182
|
+
}
|
|
183
|
+
if (tr_utils_1.TrUtils.IsNull(InvoicePrintData.Product.RegNo)) {
|
|
184
|
+
InvoicePrintData.Product.RegNo = '';
|
|
185
|
+
}
|
|
186
|
+
if (tr_utils_1.TrUtils.IsNull(InvoicePrintData.Product.EngNo)) {
|
|
187
|
+
InvoicePrintData.Product.EngNo = '';
|
|
188
|
+
}
|
|
189
|
+
InvoicePrintData.MIn = OriginalInvoiceData.Prod.MIn;
|
|
190
|
+
InvoicePrintData.MOut = OriginalInvoiceData.Prod.MOut;
|
|
191
|
+
}
|
|
192
|
+
return InvoicePrintData;
|
|
193
|
+
}
|
|
194
|
+
static GetShipToForSOPrint(OriginalInvoiceData, InvoicePrintData) {
|
|
195
|
+
let Customer = {};
|
|
196
|
+
Customer.Name = OriginalInvoiceData.ShipTo.Name;
|
|
197
|
+
Customer.DLNo = OriginalInvoiceData.ShipTo.DLNo;
|
|
198
|
+
Customer.Adrs = [];
|
|
199
|
+
Customer.Cons = [];
|
|
200
|
+
if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.ShipTo.Adrs)) {
|
|
201
|
+
Customer.Adrs.push(OriginalInvoiceData.ShipTo.Adrs.A1);
|
|
202
|
+
if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.ShipTo.Adrs.A2)) {
|
|
203
|
+
Customer.Adrs.push(OriginalInvoiceData.ShipTo.Adrs.A2);
|
|
204
|
+
}
|
|
205
|
+
if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.ShipTo.Adrs.Ct)) {
|
|
206
|
+
Customer.Adrs.push(OriginalInvoiceData.ShipTo.Adrs.Ct);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
Customer.GSTIN = OriginalInvoiceData.ShipTo.GSTIN;
|
|
210
|
+
if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.ShipTo.Ph)) {
|
|
211
|
+
Customer.Cons = [
|
|
212
|
+
{
|
|
213
|
+
Type: 'M',
|
|
214
|
+
No: OriginalInvoiceData.ShipTo.Ph
|
|
215
|
+
}
|
|
216
|
+
];
|
|
217
|
+
}
|
|
218
|
+
InvoicePrintData.ShippmentTo = Customer;
|
|
219
|
+
if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.ShipTo.InsId)) {
|
|
220
|
+
InvoicePrintData.Cust = this.GetCustomerDetails(OriginalInvoiceData);
|
|
221
|
+
}
|
|
222
|
+
return InvoicePrintData;
|
|
223
|
+
}
|
|
224
|
+
static GetBillNameForInvoicePrint(OriginalInvoiceData, InvoicePrintData) {
|
|
225
|
+
let Customer = {};
|
|
226
|
+
Customer.Name = OriginalInvoiceData.BillTo.Name;
|
|
227
|
+
Customer.DLNo = OriginalInvoiceData.BillTo.DLNo;
|
|
228
|
+
Customer.Adrs = [];
|
|
229
|
+
Customer.Cons = [];
|
|
230
|
+
if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.BillTo.Adrs)) {
|
|
231
|
+
Customer.Adrs.push(OriginalInvoiceData.BillTo.Adrs.A1);
|
|
232
|
+
if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.BillTo.Adrs.A2)) {
|
|
233
|
+
Customer.Adrs.push(OriginalInvoiceData.BillTo.Adrs.A2);
|
|
234
|
+
}
|
|
235
|
+
if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.BillTo.Adrs.Ct)) {
|
|
236
|
+
Customer.Adrs.push(OriginalInvoiceData.BillTo.Adrs.Ct);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
Customer.GSTIN = OriginalInvoiceData.BillTo.GSTIN;
|
|
240
|
+
if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.BillTo.Ph)) {
|
|
241
|
+
Customer.Cons = [
|
|
242
|
+
{
|
|
243
|
+
Type: 'M',
|
|
244
|
+
No: OriginalInvoiceData.BillTo.Ph
|
|
245
|
+
}
|
|
246
|
+
];
|
|
247
|
+
}
|
|
248
|
+
InvoicePrintData.Customer = Customer;
|
|
249
|
+
if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.BillTo.InsId)) {
|
|
250
|
+
InvoicePrintData.Cust = this.GetCustomerDetails(OriginalInvoiceData);
|
|
251
|
+
}
|
|
252
|
+
return InvoicePrintData;
|
|
253
|
+
}
|
|
254
|
+
static GetCustomerDetails(OriginalInvoiceData) {
|
|
255
|
+
let Customer = {};
|
|
256
|
+
Customer.Name = this.GetBillToName(OriginalInvoiceData.Cust.Title, OriginalInvoiceData.Cust.Name);
|
|
257
|
+
Customer.Cons = [];
|
|
258
|
+
if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.Cust.Ph)) {
|
|
259
|
+
Customer.Cons = [
|
|
260
|
+
{
|
|
261
|
+
Type: 'M',
|
|
262
|
+
No: OriginalInvoiceData.Cust.Ph
|
|
263
|
+
}
|
|
264
|
+
];
|
|
265
|
+
}
|
|
266
|
+
Customer.GSTIN = OriginalInvoiceData.Cust.GSTIN;
|
|
267
|
+
Customer.Adrs = [];
|
|
268
|
+
if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.Cust.Adrs)) {
|
|
269
|
+
Customer.Adrs.push(OriginalInvoiceData.Cust.Adrs.A1);
|
|
270
|
+
if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.Cust.Adrs.A2)) {
|
|
271
|
+
Customer.Adrs.push(OriginalInvoiceData.Cust.Adrs.A2);
|
|
272
|
+
}
|
|
273
|
+
Customer.Adrs.push(OriginalInvoiceData.Cust.Adrs.Ct);
|
|
274
|
+
}
|
|
275
|
+
Customer.ConName = OriginalInvoiceData.Cust.ConName;
|
|
276
|
+
Customer.ConPh = OriginalInvoiceData.Cust.ConPhone;
|
|
277
|
+
return Customer;
|
|
278
|
+
}
|
|
279
|
+
static GetBillToName(Title, Name) {
|
|
280
|
+
return tr_utils_1.TrUtils.IsEmpty(Title) ? Name : Title + ' ' + Name;
|
|
281
|
+
}
|
|
282
|
+
static GetPaymentsTotal(InvoicePayments, Total, InvoiceStatus) {
|
|
283
|
+
var i = 0;
|
|
284
|
+
let Data = {};
|
|
285
|
+
let PaidTotal = 0;
|
|
286
|
+
for (i = 0; i < InvoicePayments.length; i++) {
|
|
287
|
+
PaidTotal += InvoicePayments[i].Paid;
|
|
288
|
+
}
|
|
289
|
+
if (InvoiceStatus === enums_1.InvoiceStatusEnum.Closed) {
|
|
290
|
+
Data.Due = 0;
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
Data.Due = tr_utils_1.TrUtils.FixedTo(Total - PaidTotal);
|
|
294
|
+
}
|
|
295
|
+
if (Data.Due < 0) {
|
|
296
|
+
Data.Due = 0;
|
|
297
|
+
}
|
|
298
|
+
if (Data.Due === 0) {
|
|
299
|
+
Data.Sts = enums_1.InvoiceStatusEnum.Closed;
|
|
300
|
+
}
|
|
301
|
+
Data.Paid = tr_utils_1.TrUtils.FixedTo(PaidTotal);
|
|
302
|
+
return Data;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
exports.SalesPrintService = SalesPrintService;
|