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,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PurchaseOrderPrintService = void 0;
|
|
4
|
+
const code_enums_1 = require("../enums/code-enums");
|
|
5
|
+
const my_date_1 = require("../utils/my-date");
|
|
6
|
+
const tr_utils_1 = require("../utils/tr-utils");
|
|
7
|
+
const purchase_order_totals_service_1 = require("./purchase-order-totals.service");
|
|
8
|
+
const shared_print_service_1 = require("./shared-print.service");
|
|
9
|
+
class PurchaseOrderPrintService {
|
|
10
|
+
//Prepare Pdf Data For Purchase Order And Bill
|
|
11
|
+
static GetDataForPurchaseOrderPrint(argPurchaseOrderData, EntityData, image, VendorData, TaxCodes, IsFormPO) {
|
|
12
|
+
let PurchaseOrderData = tr_utils_1.TrUtils.Stringify(argPurchaseOrderData);
|
|
13
|
+
let PurchaseOrderPDFData = {};
|
|
14
|
+
PurchaseOrderPDFData.Settings = tr_utils_1.TrUtils.Stringify(argPurchaseOrderData.Settings);
|
|
15
|
+
PurchaseOrderPDFData.Adjust = argPurchaseOrderData.Adjust;
|
|
16
|
+
// let IsTaxable: boolean = (PurchaseOrderData.Tax === 3) ? true : false;
|
|
17
|
+
let IsTaxable = true;
|
|
18
|
+
// PurchaseOrderPDFData.ShowTaxColumn = (PurchaseOrderData.Tax === 3) ? true : false;
|
|
19
|
+
// PurchaseOrderPDFData.HasTaxIncluded = (PurchaseOrderData.Tax === 2) ? true : false;
|
|
20
|
+
// PurchaseOrderPDFData.HideDiscountColumn = (PurchaseOrderData.Tax === 2) ? true : false;
|
|
21
|
+
PurchaseOrderPDFData.ShowTaxColumn = true;
|
|
22
|
+
PurchaseOrderPDFData.HasTaxIncluded = false;
|
|
23
|
+
PurchaseOrderPDFData.HideDiscountColumn = false;
|
|
24
|
+
let SType;
|
|
25
|
+
if (!tr_utils_1.TrUtils.IsNull(argPurchaseOrderData.Settings) && !tr_utils_1.TrUtils.IsNull(argPurchaseOrderData.Settings.PoS)) {
|
|
26
|
+
SType = argPurchaseOrderData.Settings.PoS.SType;
|
|
27
|
+
}
|
|
28
|
+
// PurchaseOrderPDFData.HasNoTax = (PurchaseOrderData.Tax === 1) ? true : false;
|
|
29
|
+
PurchaseOrderPDFData.HasNoTax = false;
|
|
30
|
+
PurchaseOrderPDFData.ShowIGST = (tr_utils_1.TrUtils.IsNull(SType) || (SType === 'Intra')) ? false : true;
|
|
31
|
+
if (IsFormPO) {
|
|
32
|
+
PurchaseOrderPDFData.Id = PurchaseOrderData.Code;
|
|
33
|
+
PurchaseOrderPDFData.CrDate = my_date_1.MyDate.ConvertUTCDateToReadable(PurchaseOrderData.CrDate);
|
|
34
|
+
PurchaseOrderPDFData.DeDate = my_date_1.MyDate.ConvertUTCDateToReadable(PurchaseOrderData.DeDate);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
PurchaseOrderPDFData.Id = PurchaseOrderData.BNo;
|
|
38
|
+
PurchaseOrderPDFData.CrDate = my_date_1.MyDate.ConvertUTCDateToReadable(PurchaseOrderData.CrDate);
|
|
39
|
+
PurchaseOrderPDFData.DeDate = my_date_1.MyDate.ConvertUTCDateToReadable(PurchaseOrderData.DeDate);
|
|
40
|
+
}
|
|
41
|
+
PurchaseOrderPDFData.Items = tr_utils_1.TrUtils.Stringify(PurchaseOrderData.Items);
|
|
42
|
+
// PurchaseOrderPDFData.Items = this.GetPartsDescription(PurchaseOrderPDFData.Items);
|
|
43
|
+
PurchaseOrderPDFData.Items = this.GetQtyWithUoM(PurchaseOrderPDFData.Items);
|
|
44
|
+
let DetailedTotalsInfo;
|
|
45
|
+
if (IsFormPO) {
|
|
46
|
+
DetailedTotalsInfo = purchase_order_totals_service_1.PurchaseOrderTotalsService.GetTotalsValue(PurchaseOrderPDFData.Items, IsTaxable, true, TaxCodes, PurchaseOrderPDFData.Tax, true, PurchaseOrderPDFData.HasNoTax, false, 0, false, PurchaseOrderPDFData.Adjust);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
DetailedTotalsInfo = purchase_order_totals_service_1.PurchaseOrderTotalsService.GetTotalsValue(PurchaseOrderPDFData.Items, IsTaxable, true, TaxCodes, PurchaseOrderPDFData.Tax, true, PurchaseOrderPDFData.HasNoTax, true, PurchaseOrderData.Disc, PurchaseOrderData.Perc, PurchaseOrderPDFData.Adjust);
|
|
50
|
+
}
|
|
51
|
+
PurchaseOrderPDFData = this.ConcatTotalsInfo(PurchaseOrderPDFData, DetailedTotalsInfo);
|
|
52
|
+
PurchaseOrderPDFData.Entity = shared_print_service_1.PrintSharedService.GetFormattedEntityDataForPrint(EntityData, code_enums_1.PrintTypesEnum.PurOrder, PurchaseOrderData);
|
|
53
|
+
PurchaseOrderPDFData = shared_print_service_1.PrintSharedService.GetEntityHeaderStyles(PurchaseOrderPDFData, EntityData, image);
|
|
54
|
+
if (IsFormPO) {
|
|
55
|
+
PurchaseOrderPDFData.HeaderName = 'Purchase Order';
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
if (argPurchaseOrderData.Expense) {
|
|
59
|
+
PurchaseOrderPDFData.HeaderName = 'Expense';
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
PurchaseOrderPDFData.HeaderName = 'Bill';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
PurchaseOrderPDFData.Vendor = this.GetVendorDataForPrint(tr_utils_1.TrUtils.Stringify(VendorData));
|
|
66
|
+
PurchaseOrderPDFData = this.FixPriceValuesForPrint(PurchaseOrderPDFData, TaxCodes);
|
|
67
|
+
return PurchaseOrderPDFData;
|
|
68
|
+
}
|
|
69
|
+
static GetVendorDataForPrint(argVendorData) {
|
|
70
|
+
if (tr_utils_1.TrUtils.IsNull(argVendorData)) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
let VendorPDFData = {};
|
|
74
|
+
let VendorData = tr_utils_1.TrUtils.Stringify(argVendorData);
|
|
75
|
+
// VendorPDFData.VendorType = VendorData.Type;
|
|
76
|
+
// if (VendorData.Type === CustomerTypesEnum.Individual) {
|
|
77
|
+
VendorPDFData.Name = VendorData.Name;
|
|
78
|
+
VendorPDFData.Contact = [
|
|
79
|
+
{ Type: 'M', No: VendorData.Ph }
|
|
80
|
+
];
|
|
81
|
+
// } else {
|
|
82
|
+
// VendorPDFData.Name = VendorData.CName;
|
|
83
|
+
// VendorPDFData.Contact = [
|
|
84
|
+
// { Type: 'M', No: VendorData.MPhone }
|
|
85
|
+
// ]
|
|
86
|
+
// }
|
|
87
|
+
VendorPDFData.Address = [];
|
|
88
|
+
if (!tr_utils_1.TrUtils.IsNull(VendorData.Adrs)) {
|
|
89
|
+
VendorPDFData.Address.push(VendorData.Adrs.A1);
|
|
90
|
+
if (!tr_utils_1.TrUtils.IsEmpty(VendorData.Adrs.A2)) {
|
|
91
|
+
VendorPDFData.Address.push(VendorData.Adrs.A2);
|
|
92
|
+
}
|
|
93
|
+
VendorPDFData.Address.push(VendorData.Adrs.Ct);
|
|
94
|
+
}
|
|
95
|
+
return VendorPDFData;
|
|
96
|
+
}
|
|
97
|
+
static GetQtyWithUoM(Items) {
|
|
98
|
+
Items.forEach((Part) => {
|
|
99
|
+
if (tr_utils_1.TrUtils.IsNull(Part.Ind)) {
|
|
100
|
+
if (!tr_utils_1.TrUtils.IsZero(Part.Qty) && !tr_utils_1.TrUtils.CheckInvalidSelect(Part.UoM)) {
|
|
101
|
+
Part.QtyAndUoM = Part.Qty + ' ' + Part.UoM;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
if (tr_utils_1.TrUtils.IsNull(Part.OpCode)) {
|
|
106
|
+
if (!tr_utils_1.TrUtils.IsZero(Part.Qty) && !tr_utils_1.TrUtils.CheckInvalidSelect(Part.UoM)) {
|
|
107
|
+
Part.QtyAndUoM = Part.Qty + ' ' + Part.UoM;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return Items;
|
|
113
|
+
}
|
|
114
|
+
static ConcatTotalsInfo(PurchaseOrderPDFData, DetailedTotalsInfo) {
|
|
115
|
+
PurchaseOrderPDFData = tr_utils_1.TrUtils.ConcatObjects(PurchaseOrderPDFData, DetailedTotalsInfo);
|
|
116
|
+
return PurchaseOrderPDFData;
|
|
117
|
+
}
|
|
118
|
+
static FixPriceValuesForPrint(PrintData, TaxCodes) {
|
|
119
|
+
PrintData.ShowDetailedPartTaxInfo = false;
|
|
120
|
+
PrintData.Items.forEach((Part) => {
|
|
121
|
+
if (tr_utils_1.TrUtils.IsNull(Part.UnCo)) {
|
|
122
|
+
Part.UnCo = Part.UnPr;
|
|
123
|
+
}
|
|
124
|
+
Part.UnCo = tr_utils_1.TrUtils.FixPriceValue(Part.UnCo);
|
|
125
|
+
Part.DiscountedPrice = tr_utils_1.TrUtils.FixPriceValue(Part.DiscountedPrice);
|
|
126
|
+
Part.AfterTax = tr_utils_1.TrUtils.FixPriceValue(Part.AfterTax);
|
|
127
|
+
Part.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Part.CGST);
|
|
128
|
+
Part.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Part.IGST);
|
|
129
|
+
Part.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Part.SGST);
|
|
130
|
+
if (!tr_utils_1.TrUtils.CheckInvalidSelect(Part.TCode)) {
|
|
131
|
+
PrintData.ShowDetailedPartTaxInfo = true;
|
|
132
|
+
}
|
|
133
|
+
Part.CGSTPerc = shared_print_service_1.PrintSharedService.GetCGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
|
|
134
|
+
Part.SGSTPerc = shared_print_service_1.PrintSharedService.GetSGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
|
|
135
|
+
Part.IGSTPerc = shared_print_service_1.PrintSharedService.GetIGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
|
|
136
|
+
});
|
|
137
|
+
PrintData.PartsDiscTotal = tr_utils_1.TrUtils.FixPriceValue(PrintData.PartsDiscTotal);
|
|
138
|
+
PrintData.PartsTotalAfterDisc = tr_utils_1.TrUtils.FixPriceValue(PrintData.PartsTotalAfterDisc);
|
|
139
|
+
PrintData.PartsTotalBeforeDisc = tr_utils_1.TrUtils.FixPriceValue(PrintData.PartsTotalBeforeDisc);
|
|
140
|
+
PrintData.TaxTotal = tr_utils_1.TrUtils.FixPriceValue(PrintData.TaxTotal);
|
|
141
|
+
PrintData.PartCGST = tr_utils_1.TrUtils.FixPriceValue(PrintData.PartCGST);
|
|
142
|
+
PrintData.PartIGST = tr_utils_1.TrUtils.FixPriceValue(PrintData.PartIGST);
|
|
143
|
+
PrintData.PartSGST = tr_utils_1.TrUtils.FixPriceValue(PrintData.PartSGST);
|
|
144
|
+
PrintData.PartAfterTax = tr_utils_1.TrUtils.FixPriceValue(PrintData.PartAfterTax);
|
|
145
|
+
PrintData.TotalRoundedBy = tr_utils_1.TrUtils.FixPriceValue(PrintData.TotalRoundedBy);
|
|
146
|
+
PrintData.RoundedTotal = tr_utils_1.TrUtils.FixPriceValue(PrintData.RoundedTotal);
|
|
147
|
+
return PrintData;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.PurchaseOrderPrintService = PurchaseOrderPrintService;
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PurchaseOrderTotalsService = void 0;
|
|
4
|
+
const aggregation_1 = require("../aggregation/aggregation");
|
|
5
|
+
const code_enums_1 = require("../enums/code-enums");
|
|
6
|
+
const tr_utils_1 = require("../utils/tr-utils");
|
|
7
|
+
class PurchaseOrderTotalsService {
|
|
8
|
+
static GetTotalsValue(argPartsList, IsTaxable, DetailedTotalsInfo, TaxCodes, Tax, ReturnPartsAlso, HasNoTax, GetSubTotal, Discount, DiscInPerc, Adjust) {
|
|
9
|
+
let PartsList = tr_utils_1.TrUtils.IsNull(argPartsList) ? [] : tr_utils_1.TrUtils.Stringify(argPartsList);
|
|
10
|
+
// PartsList = this.ResetPartValuesIfInvalid(PartsList);
|
|
11
|
+
// PartsList = this.GetPartsDiscountPrice(PartsList);
|
|
12
|
+
// PartsList = this.GetPartsAfterDiscount(PartsList);
|
|
13
|
+
PartsList = this.GetPartsTaxAmount(PartsList, IsTaxable, TaxCodes);
|
|
14
|
+
// PartsList = this.GetPartsAfterTax(PartsList);
|
|
15
|
+
let finalTotalsData = this.GetTotalsInfo(PartsList, IsTaxable, TaxCodes, HasNoTax, GetSubTotal, Discount, DiscInPerc, Adjust);
|
|
16
|
+
if (ReturnPartsAlso) {
|
|
17
|
+
finalTotalsData.Items = PartsList;
|
|
18
|
+
}
|
|
19
|
+
if (DetailedTotalsInfo === true) {
|
|
20
|
+
finalTotalsData = this.GetDetailedTotalsData(finalTotalsData, IsTaxable, PartsList, TaxCodes, Tax, HasNoTax);
|
|
21
|
+
}
|
|
22
|
+
return finalTotalsData;
|
|
23
|
+
}
|
|
24
|
+
static CheckPartStatusAndReturn(PartsList) {
|
|
25
|
+
PartsList = PartsList.filter((Part) => {
|
|
26
|
+
return Part.Sts !== code_enums_1.POPartStatusEnum.Del && Part.Sts !== code_enums_1.POPartStatusEnum.Deleted;
|
|
27
|
+
});
|
|
28
|
+
return PartsList;
|
|
29
|
+
}
|
|
30
|
+
static ResetPartValueIfInvalid(Part) {
|
|
31
|
+
// if (TrUtils.IsNull(Part.Ind)) {
|
|
32
|
+
if (tr_utils_1.TrUtils.IsNull(Part.UnCo)) {
|
|
33
|
+
Part.UnCo = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.UnPr);
|
|
34
|
+
}
|
|
35
|
+
Part.UnCo = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.UnCo);
|
|
36
|
+
Part.Disc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.Disc);
|
|
37
|
+
Part.SGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.SGST);
|
|
38
|
+
Part.IGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.IGST);
|
|
39
|
+
Part.CGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.CGST);
|
|
40
|
+
// }
|
|
41
|
+
return Part;
|
|
42
|
+
}
|
|
43
|
+
static GetPartDiscountedPrice(Disc, RecDisc) {
|
|
44
|
+
// if (DiscInPerc) {
|
|
45
|
+
// return TrUtils.FixedTo(((Price * Qty) * Disc) / 100);
|
|
46
|
+
// } else {
|
|
47
|
+
return (0, aggregation_1.addition)(Disc, tr_utils_1.TrUtils.SetValueToZeroIfNull(RecDisc));
|
|
48
|
+
// }
|
|
49
|
+
}
|
|
50
|
+
static GetPartsTaxAmount(Items, IsTaxable, TaxCodes) {
|
|
51
|
+
Items.forEach((Part) => {
|
|
52
|
+
Part = this.ResetPartValueIfInvalid(Part);
|
|
53
|
+
// Part.CGSTAmt = this.GetCGSTTaxAmount(Part.AfterDiscountPrice, IsTaxable, Part.TCode, TaxCodes);
|
|
54
|
+
// Part.IGSTAmt = this.GetIGSTTaxAmount(Part.AfterDiscountPrice, IsTaxable, Part.TCode, TaxCodes);
|
|
55
|
+
// Part.SGSTAmt = this.GetSGSTTaxAmount(Part.AfterDiscountPrice, IsTaxable, Part.TCode, TaxCodes);
|
|
56
|
+
if (tr_utils_1.TrUtils.IsNull(Part.Ind)) {
|
|
57
|
+
Part.DiscountedPrice = this.GetPartDiscountedPrice(Part.Disc, Part.RecDisc);
|
|
58
|
+
Part.AfterDiscountPrice = Part.NetAmt;
|
|
59
|
+
}
|
|
60
|
+
Part.GSTAmt = (0, aggregation_1.addition)(Part.SGST, Part.CGST, Part.IGST);
|
|
61
|
+
Part.Desc = Part.Name;
|
|
62
|
+
let Price = 0;
|
|
63
|
+
if (IsTaxable) {
|
|
64
|
+
// if (!TrUtils(Part.Perc)) {
|
|
65
|
+
Price = (0, aggregation_1.multiply)(Part.UnCo, Part.Qty);
|
|
66
|
+
Part.LineTotal = tr_utils_1.TrUtils.FixedTo((0, aggregation_1.addition)((0, aggregation_1.subtraction)(Price, Part.Disc), Part.GSTAmt));
|
|
67
|
+
// } else {
|
|
68
|
+
// Part.LineTotal = TrUtils.FixedTo((Part.UnPr - Part.Disc) + Part.GSTAmt);
|
|
69
|
+
// }
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// let DiscPrice: any = 0;
|
|
73
|
+
// if (Part.Perc) {
|
|
74
|
+
Price = (0, aggregation_1.multiply)(Part.UnCo, Part.Qty);
|
|
75
|
+
Part.LineTotal = tr_utils_1.TrUtils.FixedTo((0, aggregation_1.subtraction)(Price, Part.Disc));
|
|
76
|
+
// } else {
|
|
77
|
+
// Part.LineTotal = TrUtils.FixedTo((Part.UnPr - Part.Disc));
|
|
78
|
+
// }
|
|
79
|
+
}
|
|
80
|
+
Part.AfterTax = (0, aggregation_1.addition)(Part.AfterDiscountPrice, Part.GSTAmt);
|
|
81
|
+
});
|
|
82
|
+
return Items;
|
|
83
|
+
}
|
|
84
|
+
static GetGSTValueBasedOnTaxCode(TCode, argTaxCodes) {
|
|
85
|
+
if (tr_utils_1.TrUtils.IsNull(TCode)) {
|
|
86
|
+
return [0, 0, 0];
|
|
87
|
+
}
|
|
88
|
+
let TaxCodes = tr_utils_1.TrUtils.Stringify(argTaxCodes);
|
|
89
|
+
let TCodeIndex = TaxCodes.findIndex((TaxCode) => {
|
|
90
|
+
return TaxCode._id === Number(TCode);
|
|
91
|
+
});
|
|
92
|
+
if (TCodeIndex !== -1) {
|
|
93
|
+
// // if (TrUtils.IsNull(TaxCodes[TCodeIndex].CGST)) {
|
|
94
|
+
// // return 0;
|
|
95
|
+
// // } else {
|
|
96
|
+
// return [TaxCodes[TCodeIndex].CGST, TaxCodes[TCodeIndex].SGST, TaxCodes[TCodeIndex].IGST];
|
|
97
|
+
// // }
|
|
98
|
+
if (TaxCodes[TCodeIndex].Type === 'Intra') {
|
|
99
|
+
return [TaxCodes[TCodeIndex].CGST, TaxCodes[TCodeIndex].SGST, 0];
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
return [0, 0, TaxCodes[TCodeIndex].IGST];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
return [0, 0, 0];
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
static GetTotalsInfo(PartsList, IsTaxable, TaxCodes, HasNoTax, GetSubTotal, Discount, DiscInPerc, Adjust) {
|
|
110
|
+
let finalTotalsData = {};
|
|
111
|
+
let PartsInfo = this.GetPartsTotalTaxAndAfterDiscount(PartsList);
|
|
112
|
+
let PartsTotalAfterDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(PartsInfo[0]);
|
|
113
|
+
let PartsDiscTotal = tr_utils_1.TrUtils.SetValueToZeroIfNull(PartsInfo[1]);
|
|
114
|
+
let PartsTaxTotal = tr_utils_1.TrUtils.SetValueToZeroIfNull(PartsInfo[2]);
|
|
115
|
+
finalTotalsData.SubTotal = (0, aggregation_1.addition)(PartsTotalAfterDisc, PartsDiscTotal);
|
|
116
|
+
finalTotalsData.Adj = tr_utils_1.TrUtils.FixPriceValue(Adjust);
|
|
117
|
+
// if (GetSubTotal) {
|
|
118
|
+
// finalTotalsData.SubTotal = this.GetTotalBasedOnTaxType(PartsTotalAfterDisc, PartsTaxTotal,
|
|
119
|
+
// IsTaxable);
|
|
120
|
+
// let Total: number = finalTotalsData.SubTotal;
|
|
121
|
+
// if (HasNoTax && !TrUtils.IsNull(Discount)) {
|
|
122
|
+
// if (DiscInPerc) {
|
|
123
|
+
// Total = TrUtils.FixedTo(((finalTotalsData.SubTotal) -
|
|
124
|
+
// ((finalTotalsData.SubTotal) * Discount) / 100));
|
|
125
|
+
// } else {
|
|
126
|
+
// Total = TrUtils.FixedTo((finalTotalsData.SubTotal) - Discount);
|
|
127
|
+
// }
|
|
128
|
+
// }
|
|
129
|
+
// finalTotalsData.Total = Total;
|
|
130
|
+
// } else {
|
|
131
|
+
finalTotalsData.Total = this.GetTotalBasedOnTaxType(PartsTotalAfterDisc, PartsTaxTotal, IsTaxable, Adjust);
|
|
132
|
+
// }
|
|
133
|
+
// finalTotalsData.Round = TrUtils.FixedTo(Math.round(finalTotalsData.Total) - finalTotalsData.Total);
|
|
134
|
+
// finalTotalsData.Total = Math.round(finalTotalsData.Total);
|
|
135
|
+
return finalTotalsData;
|
|
136
|
+
}
|
|
137
|
+
static GetPartsTotalTaxAndAfterDiscount(PartsList) {
|
|
138
|
+
let PartsTotalAfterDisc = 0;
|
|
139
|
+
let PartsDiscountedTotal = 0;
|
|
140
|
+
let TotalTaxAmt = 0;
|
|
141
|
+
PartsList.forEach((Part) => {
|
|
142
|
+
PartsTotalAfterDisc = (0, aggregation_1.addition)(PartsTotalAfterDisc, Part.AfterDiscountPrice);
|
|
143
|
+
PartsDiscountedTotal = (0, aggregation_1.addition)(PartsDiscountedTotal, Part.DiscountedPrice);
|
|
144
|
+
TotalTaxAmt = (0, aggregation_1.addition)(TotalTaxAmt, Part.GSTAmt);
|
|
145
|
+
});
|
|
146
|
+
return [PartsTotalAfterDisc, PartsDiscountedTotal, TotalTaxAmt];
|
|
147
|
+
}
|
|
148
|
+
static GetTotalBasedOnTaxType(PartsTotalAfterDisc, PartsTaxAmount, IsTaxable, Adjust) {
|
|
149
|
+
let Total = 0;
|
|
150
|
+
if (IsTaxable) {
|
|
151
|
+
Total = (0, aggregation_1.addition)(PartsTotalAfterDisc, PartsTaxAmount);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
Total = PartsTotalAfterDisc;
|
|
155
|
+
}
|
|
156
|
+
let finalTotal = (0, aggregation_1.addition)(Total, tr_utils_1.TrUtils.SetValueToZeroIfNull(Adjust));
|
|
157
|
+
return tr_utils_1.TrUtils.FixedTo(finalTotal);
|
|
158
|
+
}
|
|
159
|
+
static GetDetailedTotalsData(finalTotalsData, IsTaxable, PartsList, TaxCodes, Tax, HasNoTax) {
|
|
160
|
+
let PartsInfo = this.GetPartsTotalTaxAndAfterDiscount(PartsList);
|
|
161
|
+
finalTotalsData.PartsDiscTotal = tr_utils_1.TrUtils.SetValueToZeroIfNull(PartsInfo[1]);
|
|
162
|
+
finalTotalsData.PartsTotalAfterDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(PartsInfo[0]);
|
|
163
|
+
finalTotalsData.PartsTotalBeforeDisc = (0, aggregation_1.addition)(finalTotalsData.PartsTotalAfterDisc, finalTotalsData.PartsDiscTotal);
|
|
164
|
+
// finalTotalsData.TaxTotal = this.GetPartsTaxTotal(PartsList);
|
|
165
|
+
finalTotalsData.TaxTotal = tr_utils_1.TrUtils.SetValueToZeroIfNull(PartsInfo[2]);
|
|
166
|
+
let TaxAmt = this.GetPartGSTTaxTotal(PartsList);
|
|
167
|
+
// finalTotalsData.PartCGST = this.GetPartCGSTTaxTotal(PartsList);
|
|
168
|
+
// finalTotalsData.PartIGST = this.GetPartIGSTTaxTotal(PartsList);
|
|
169
|
+
// finalTotalsData.PartSGST = this.GetPartSGSTTaxTotal(PartsList);
|
|
170
|
+
finalTotalsData.PartCGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxAmt[0]);
|
|
171
|
+
finalTotalsData.PartSGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxAmt[1]);
|
|
172
|
+
finalTotalsData.PartIGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxAmt[2]);
|
|
173
|
+
finalTotalsData.PartAfterTax = (0, aggregation_1.addition)(finalTotalsData.PartsTotalAfterDisc, finalTotalsData.TaxTotal);
|
|
174
|
+
finalTotalsData.IsTaxable = IsTaxable;
|
|
175
|
+
finalTotalsData.Tax = Tax;
|
|
176
|
+
finalTotalsData.HasNoTax = HasNoTax;
|
|
177
|
+
finalTotalsData.TaxGroupData = this.GetPartsTaxGroupingFor(PartsList, TaxCodes);
|
|
178
|
+
// finalTotalsData.TotalRoundedBy = TrUtils.FixedTo(Math.round(finalTotalsData.Total) - finalTotalsData.Total);
|
|
179
|
+
finalTotalsData.RoundedTotal = Math.round(finalTotalsData.Total);
|
|
180
|
+
// finalTotalsData.Round = TrUtils.FixedTo(Math.round(finalTotalsData.Total) - finalTotalsData.Total);
|
|
181
|
+
// finalTotalsData.Total = Math.round(finalTotalsData.Total);
|
|
182
|
+
return finalTotalsData;
|
|
183
|
+
}
|
|
184
|
+
static GetPartGSTTaxTotal(PartsList) {
|
|
185
|
+
let CGSTAmt = 0;
|
|
186
|
+
let SGSTAmt = 0;
|
|
187
|
+
let IGSTAmt = 0;
|
|
188
|
+
PartsList.forEach((Part) => {
|
|
189
|
+
CGSTAmt = (0, aggregation_1.addition)(CGSTAmt, Part.CGST);
|
|
190
|
+
SGSTAmt = (0, aggregation_1.addition)(SGSTAmt, Part.SGST);
|
|
191
|
+
IGSTAmt = (0, aggregation_1.addition)(IGSTAmt, Part.IGST);
|
|
192
|
+
});
|
|
193
|
+
return [CGSTAmt, SGSTAmt, IGSTAmt];
|
|
194
|
+
}
|
|
195
|
+
static GetPartsTaxGroupingFor(PartsList, TaxCodes) {
|
|
196
|
+
return this.GetTaxGroupingForPartsByHSN(tr_utils_1.TrUtils.Stringify(PartsList), TaxCodes);
|
|
197
|
+
}
|
|
198
|
+
static GetTaxGroupingForPartsByHSN(Items, TaxCodes) {
|
|
199
|
+
Items = this.GetCombinedTaxPercentage(Items, TaxCodes);
|
|
200
|
+
// Items = this.ResetPartsHSNIfInvalid(Items);
|
|
201
|
+
let FinalMatchedParts = this.ComparePartsByHSN(Items, TaxCodes);
|
|
202
|
+
return this.GetTaxGroupingInfoByHSN(FinalMatchedParts, TaxCodes);
|
|
203
|
+
}
|
|
204
|
+
static GetCombinedTaxPercentage(Items, TaxCodes) {
|
|
205
|
+
Items.forEach((Part) => {
|
|
206
|
+
if (tr_utils_1.TrUtils.IsNull(Part.HSN)) {
|
|
207
|
+
Part.HSN = '';
|
|
208
|
+
}
|
|
209
|
+
let TaxInfo = this.GetGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
|
|
210
|
+
Part.CGSTAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[0]);
|
|
211
|
+
Part.SGSTAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[1]);
|
|
212
|
+
Part.IGSTAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[2]);
|
|
213
|
+
// Part.CGSTAmt = this.GetCGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
|
|
214
|
+
// Part.SGSTAmt = this.GetSGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
|
|
215
|
+
// Part.IGSTAmt = this.GetIGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
|
|
216
|
+
Part.CombinedTaxPercentage = (0, aggregation_1.addition)(Part.CGSTAmt, Part.SGSTAmt, Part.IGSTAmt);
|
|
217
|
+
});
|
|
218
|
+
return Items;
|
|
219
|
+
}
|
|
220
|
+
static ComparePartsByHSN(Items, TaxCodes) {
|
|
221
|
+
let FinalMatchedParts = [];
|
|
222
|
+
Items.forEach((Part) => {
|
|
223
|
+
let MatchedPartsBasedOnHSN = Items.filter((argPart) => {
|
|
224
|
+
let PartFound = false;
|
|
225
|
+
FinalMatchedParts.forEach((FinalArgParts) => {
|
|
226
|
+
let PartIndex = FinalArgParts.findIndex((FinalArgPart) => {
|
|
227
|
+
return FinalArgPart._id === argPart._id;
|
|
228
|
+
});
|
|
229
|
+
if (PartIndex !== -1) {
|
|
230
|
+
PartFound = true;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
// let argCGST = this.GetCGSTValueBasedOnTaxCode(argPart.TCode, TaxCodes);
|
|
234
|
+
// let argSGST = this.GetSGSTValueBasedOnTaxCode(argPart.TCode, TaxCodes);
|
|
235
|
+
// let argIGST = this.GetIGSTValueBasedOnTaxCode(argPart.TCode, TaxCodes);
|
|
236
|
+
// let partCGST = this.GetCGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
|
|
237
|
+
// let partSGST = this.GetSGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
|
|
238
|
+
// let partIGST = this.GetIGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
|
|
239
|
+
return (argPart.HSN === Part.HSN) && (!PartFound) &&
|
|
240
|
+
(argPart.CGSTAmt === Part.CGSTAmt) && (argPart.IGSTAmt === Part.IGSTAmt) &&
|
|
241
|
+
(argPart.SGSTAmt === Part.SGSTAmt);
|
|
242
|
+
});
|
|
243
|
+
if (MatchedPartsBasedOnHSN.length !== 0) {
|
|
244
|
+
FinalMatchedParts.push(MatchedPartsBasedOnHSN);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
return FinalMatchedParts;
|
|
248
|
+
}
|
|
249
|
+
static GetTaxGroupingInfoByHSN(FinalMatchedParts, TaxCodes) {
|
|
250
|
+
let HSNTaxInfo = [];
|
|
251
|
+
FinalMatchedParts.forEach((MatchedPart) => {
|
|
252
|
+
let TaxInfo = {};
|
|
253
|
+
let TaxOnAmount = 0;
|
|
254
|
+
let TaxAmount = 0;
|
|
255
|
+
let HSN = MatchedPart[0].HSN;
|
|
256
|
+
TaxInfo.CombinedTaxPercentage = MatchedPart[0].CombinedTaxPercentage;
|
|
257
|
+
MatchedPart.forEach((argMatchedGSTPart) => {
|
|
258
|
+
TaxOnAmount = (0, aggregation_1.addition)(TaxOnAmount, argMatchedGSTPart.AfterDiscountPrice);
|
|
259
|
+
TaxAmount = (0, aggregation_1.addition)(TaxAmount, argMatchedGSTPart.CGST);
|
|
260
|
+
TaxAmount = (0, aggregation_1.addition)(TaxAmount, argMatchedGSTPart.IGST);
|
|
261
|
+
TaxAmount = (0, aggregation_1.addition)(TaxAmount, argMatchedGSTPart.SGST);
|
|
262
|
+
});
|
|
263
|
+
TaxInfo.HSN = HSN;
|
|
264
|
+
TaxInfo.TotalTaxableAmount = tr_utils_1.TrUtils.FixPriceValue(TaxOnAmount);
|
|
265
|
+
TaxInfo.TotalTaxAmount = tr_utils_1.TrUtils.FixPriceValue(TaxAmount);
|
|
266
|
+
TaxInfo.PartsCount = MatchedPart.length;
|
|
267
|
+
// let CGST = this.GetCGSTValueBasedOnTaxCode(MatchedPart[0].TCode, TaxCodes);
|
|
268
|
+
// let SGST = this.GetSGSTValueBasedOnTaxCode(MatchedPart[0].TCode, TaxCodes);
|
|
269
|
+
// let IGST = this.GetIGSTValueBasedOnTaxCode(MatchedPart[0].TCode, TaxCodes);
|
|
270
|
+
TaxInfo.CGST = MatchedPart[0].CGSTAmt;
|
|
271
|
+
TaxInfo.IGST = MatchedPart[0].IGSTAmt;
|
|
272
|
+
TaxInfo.SGST = MatchedPart[0].SGSTAmt;
|
|
273
|
+
if (TaxOnAmount !== 0) {
|
|
274
|
+
HSNTaxInfo.push(TaxInfo);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
return HSNTaxInfo;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
exports.PurchaseOrderTotalsService = PurchaseOrderTotalsService;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReceiptPrintService = void 0;
|
|
4
|
+
const my_date_1 = require("../utils/my-date");
|
|
5
|
+
const tr_utils_1 = require("../utils/tr-utils");
|
|
6
|
+
const shared_print_service_1 = require("./shared-print.service");
|
|
7
|
+
class ReceiptPrintService {
|
|
8
|
+
static GetReceiptPrint(argPaymentViewData, EntityData, image) {
|
|
9
|
+
let PaymentViewData = tr_utils_1.TrUtils.Stringify(argPaymentViewData);
|
|
10
|
+
let ReceiptData = {};
|
|
11
|
+
ReceiptData.Entity = shared_print_service_1.PrintSharedService.GetFormattedEntityDataForPrint(EntityData, "Receipt", argPaymentViewData);
|
|
12
|
+
ReceiptData = shared_print_service_1.PrintSharedService.GetEntityHeaderStyles(ReceiptData, EntityData, image);
|
|
13
|
+
ReceiptData.FullName = PaymentViewData.Name;
|
|
14
|
+
// if (PaymentViewData.PType === 'Cash') {
|
|
15
|
+
// ReceiptData.TypeNumber = PaymentViewData.Amt;
|
|
16
|
+
// } else
|
|
17
|
+
if (PaymentViewData.PType === 'Cheque' || PaymentViewData.PType === 'MasterCard') {
|
|
18
|
+
ReceiptData.TypeNumber = PaymentViewData.CNo;
|
|
19
|
+
}
|
|
20
|
+
else if (PaymentViewData.PType === 'Visa') {
|
|
21
|
+
ReceiptData.TypeNumber = PaymentViewData.CNo;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
ReceiptData.TypeNumber = '';
|
|
25
|
+
}
|
|
26
|
+
ReceiptData.TotalAmount = PaymentViewData.Amt;
|
|
27
|
+
ReceiptData.PaidDate = my_date_1.MyDate.ConvertUTCDateToReadable(PaymentViewData.Date);
|
|
28
|
+
ReceiptData.Ids = this.GetRecordIds(PaymentViewData);
|
|
29
|
+
ReceiptData.Type = 'Receipt';
|
|
30
|
+
ReceiptData.HeaderName = 'Receipt';
|
|
31
|
+
ReceiptData.PaymentId = PaymentViewData.Code;
|
|
32
|
+
ReceiptData.PaymentType = PaymentViewData.PType;
|
|
33
|
+
return ReceiptData;
|
|
34
|
+
}
|
|
35
|
+
static GetRecordIds(PaymentViewData) {
|
|
36
|
+
let IdList = [];
|
|
37
|
+
var i = 0;
|
|
38
|
+
if (!tr_utils_1.TrUtils.IsNull(PaymentViewData.Invs) && PaymentViewData.Invs.length !== 0) {
|
|
39
|
+
for (i = 0; i < PaymentViewData.Invs.length; i++) {
|
|
40
|
+
let Id = PaymentViewData.Invs[i].Code;
|
|
41
|
+
if (!tr_utils_1.TrUtils.IsNull(PaymentViewData.Invs[i].RegNo)) {
|
|
42
|
+
Id = Id + '(' + PaymentViewData.Invs[i].RegNo + ')';
|
|
43
|
+
}
|
|
44
|
+
IdList.push(Id);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return IdList;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.ReceiptPrintService = ReceiptPrintService;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReorderPointPDFService = void 0;
|
|
4
|
+
const my_date_1 = require("../utils/my-date");
|
|
5
|
+
const tr_utils_1 = require("../utils/tr-utils");
|
|
6
|
+
class ReorderPointPDFService {
|
|
7
|
+
static GetPrint(ReOrderPointData) {
|
|
8
|
+
// console.log('ReOrderPointData', ReOrderPointData);
|
|
9
|
+
let dd = {
|
|
10
|
+
// info: {
|
|
11
|
+
// title: this.GetFileName(ROPrintData),
|
|
12
|
+
// },
|
|
13
|
+
info: {
|
|
14
|
+
title: 'ReOrderPoint',
|
|
15
|
+
},
|
|
16
|
+
header: function (currentPage, pageCount, pageSize) {
|
|
17
|
+
return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 25, fontSize: 8, marginTop: 2 };
|
|
18
|
+
},
|
|
19
|
+
pageMargins: [25, 15, 25, 15],
|
|
20
|
+
pageSize: 'A4',
|
|
21
|
+
content: [
|
|
22
|
+
{ text: ReOrderPointData.Entity.CName, style: ['headerstyle'], alignment: 'center', fontSize: 20 },
|
|
23
|
+
{ text: 'Reorder Point (' + 'As of ' + my_date_1.MyDate.ConvertUTCDateToReadable(my_date_1.MyDate.GetDateTimeNowInUTC()) + ')', style: ['headerstyle'], alignment: 'center', fontSize: 12 },
|
|
24
|
+
{ text: 'Items need to be Ordered', style: ['headerstyle'], alignment: 'left', fontSize: 10, marginTop: 10, decoration: 'underline' },
|
|
25
|
+
this.GetItemsTable(ReOrderPointData.Items),
|
|
26
|
+
this.GetSignatures(ReOrderPointData.Entity.CName, ReOrderPointData.Type, ReOrderPointData.For),
|
|
27
|
+
],
|
|
28
|
+
styles: {
|
|
29
|
+
headerstyle: {
|
|
30
|
+
fontFamily: 'Calibri',
|
|
31
|
+
fontSize: 9
|
|
32
|
+
},
|
|
33
|
+
Sign: {
|
|
34
|
+
fontSize: 8,
|
|
35
|
+
margin: [0, 30, 0, 5]
|
|
36
|
+
},
|
|
37
|
+
forCompany: {
|
|
38
|
+
// margin: [0, 10, 30, 0],
|
|
39
|
+
marginRight: 5,
|
|
40
|
+
marginTop: 10,
|
|
41
|
+
fontSize: 9,
|
|
42
|
+
alignment: 'right'
|
|
43
|
+
},
|
|
44
|
+
tableheader: {
|
|
45
|
+
bold: true,
|
|
46
|
+
fontFamily: 'Calibri',
|
|
47
|
+
margin: [0, 1, 0, 5],
|
|
48
|
+
alignment: 'center'
|
|
49
|
+
},
|
|
50
|
+
tableheader1: {
|
|
51
|
+
bold: true,
|
|
52
|
+
fontFamily: 'Calibri',
|
|
53
|
+
margin: [0, 2, 0, 2],
|
|
54
|
+
alignment: 'center'
|
|
55
|
+
},
|
|
56
|
+
tableExample: {
|
|
57
|
+
fontSize: 9
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return dd;
|
|
62
|
+
}
|
|
63
|
+
static CustomerAndVehicleDetailsAfterLine() {
|
|
64
|
+
return {
|
|
65
|
+
canvas: [
|
|
66
|
+
{
|
|
67
|
+
type: 'line',
|
|
68
|
+
lineColor: 'gray',
|
|
69
|
+
x1: 0,
|
|
70
|
+
y1: 0,
|
|
71
|
+
x2: 575,
|
|
72
|
+
y2: 0,
|
|
73
|
+
lineWidth: 1
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
static GetSignatures(CName, For, Type) {
|
|
79
|
+
return {
|
|
80
|
+
columns: [{
|
|
81
|
+
stack: [
|
|
82
|
+
this.CompanyName(CName),
|
|
83
|
+
]
|
|
84
|
+
}],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
static CompanyName(CName) {
|
|
88
|
+
return {
|
|
89
|
+
style: 'forCompany',
|
|
90
|
+
text: ['For ', { text: CName, }],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
static GetItemsTable(Items) {
|
|
94
|
+
return {
|
|
95
|
+
style: 'tableExample',
|
|
96
|
+
marginTop: 3,
|
|
97
|
+
marginBottom: 5,
|
|
98
|
+
table: {
|
|
99
|
+
widths: ['*', 70, 50, 50, 'auto'],
|
|
100
|
+
headerRows: 1,
|
|
101
|
+
body: this.BuildTableBodyForLaborAndParts(Items)
|
|
102
|
+
},
|
|
103
|
+
layout: {
|
|
104
|
+
hLineWidth: function (i, node) {
|
|
105
|
+
return (i === 0 || i === 1 || i === node.table.body.length) ? 1 : 0.5;
|
|
106
|
+
},
|
|
107
|
+
vLineWidth: function (i, node) {
|
|
108
|
+
return (i === 0 || i === node.table.widths.length) ? 1 : 0.5;
|
|
109
|
+
},
|
|
110
|
+
hLineColor: function (i, node) {
|
|
111
|
+
return (i === 0 || i === 1 || i === node.table.body.length) ? 'gray' : 'lightgrey';
|
|
112
|
+
},
|
|
113
|
+
vLineColor: function (i, node) {
|
|
114
|
+
return 'gray';
|
|
115
|
+
},
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
static BuildTableBodyForLaborAndParts(Items) {
|
|
120
|
+
let body = this.GetHeaderNames();
|
|
121
|
+
Items.forEach((item, index) => {
|
|
122
|
+
var _a;
|
|
123
|
+
let dataRow = [];
|
|
124
|
+
let VName;
|
|
125
|
+
if (tr_utils_1.TrUtils.IsNull(item === null || item === void 0 ? void 0 : item.Vendor) || tr_utils_1.TrUtils.IsNull(item === null || item === void 0 ? void 0 : item.Vendor[0])) {
|
|
126
|
+
VName = '';
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
VName = (_a = item === null || item === void 0 ? void 0 : item.Vendor[0]) === null || _a === void 0 ? void 0 : _a.DName;
|
|
130
|
+
}
|
|
131
|
+
dataRow.push({ text: item.Name, });
|
|
132
|
+
dataRow.push({ text: item.Qty, alignment: 'right', style: ['headerstyle'], });
|
|
133
|
+
dataRow.push({ text: item.Min, alignment: 'right', style: ['headerstyle'], });
|
|
134
|
+
dataRow.push({ text: item.Max, alignment: 'right', style: ['headerstyle'], });
|
|
135
|
+
dataRow.push({ text: VName, alignment: 'left', style: ['headerstyle'], });
|
|
136
|
+
body.push(dataRow);
|
|
137
|
+
});
|
|
138
|
+
return body;
|
|
139
|
+
}
|
|
140
|
+
static GetHeaderNames() {
|
|
141
|
+
let HeadingNames;
|
|
142
|
+
HeadingNames = [[{ text: 'Name', style: 'tableheader1', Field: 'Name', alignment: 'left', line: true },
|
|
143
|
+
{ text: 'Qty On Hand', style: 'tableheader1', Field: 'Qty', alignment: 'right' },
|
|
144
|
+
{ text: 'Min Qty', style: 'tableheader1', Field: 'Min', alignment: 'right' },
|
|
145
|
+
{ text: 'Max Qty', style: 'tableheader1', Field: 'Max', alignment: 'right' },
|
|
146
|
+
{ text: 'Vendor', style: 'tableheader1', Field: 'Vendor', alignment: 'left' },
|
|
147
|
+
]];
|
|
148
|
+
return HeadingNames;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.ReorderPointPDFService = ReorderPointPDFService;
|