shareneus 1.4.34 → 1.4.35
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 +13 -13
- package/dist/excel-files/GSTR-RO-excel.service.js +3 -3
- package/dist/excel-files/GSTR1-excel.service.js +7 -7
- package/dist/excel-files/GSTR2-excel.service.js +6 -6
- package/dist/excel-files/analysis-excel.service.js +4 -4
- package/dist/excel-files/category-wise-item-excel.service.js +10 -10
- package/dist/excel-files/cust-balance-excel.service.js +5 -5
- package/dist/excel-files/cust-wise-sales-details.js +5 -5
- package/dist/excel-files/cust-wise-sales-summary-excel.service.js +5 -5
- package/dist/excel-files/expiring-drugs-excel.service.js +7 -7
- package/dist/excel-files/insurance-expire-excel.service.js +4 -4
- package/dist/excel-files/invoice-wise-excel.service.js +3 -3
- package/dist/excel-files/item-wise-doctor-sale-excel.service.js +7 -7
- package/dist/excel-files/item-wise-mout-details.js +4 -4
- package/dist/excel-files/item-wise-mout-summary.js +4 -4
- package/dist/excel-files/items-wise-sales-excel.service.js +10 -10
- package/dist/excel-files/manf-wise-sales-excel.service.js +4 -4
- package/dist/excel-files/next-service-date-excel.service.js +5 -5
- package/dist/excel-files/operator-wise-details.js +4 -4
- package/dist/excel-files/operator-wise-summary.js +4 -4
- package/dist/excel-files/payment-receive-excel.service.js +6 -6
- package/dist/excel-files/payments-made-excel.service.js +6 -6
- package/dist/excel-files/repair-orders-excel.service.js +10 -10
- package/dist/excel-files/sa-wise-labor-sales-excel.service.js +6 -6
- package/dist/excel-files/sa-wise-part-sales-excel.service.js +6 -6
- package/dist/excel-files/sale-summary-excel.service.js +3 -3
- package/dist/excel-files/sales-by-service-summary-excel.service.js +14 -14
- package/dist/excel-files/scheduled-drug-summary-excel.service.js +8 -8
- package/dist/excel-files/scheduled-drugs-excel.service.js +10 -10
- package/dist/excel-files/spares-issue-excel.service.js +14 -14
- package/dist/excel-files/stock-excel.service.js +3 -3
- package/dist/excel-files/tally-sales-import.service.js +3 -3
- package/dist/excel-files/ven-balance-excel.service.js +3 -3
- package/dist/index.js +9 -9
- package/dist/services/analysis-pdf.service.js +8 -8
- package/dist/services/appointment-total.service.js +37 -37
- package/dist/services/auto-sales-receipt-pdf.service.js +24 -24
- package/dist/services/category-wise-item-pdf.service.js +6 -6
- package/dist/services/checklist-pdf.js +3 -3
- package/dist/services/cn-print.service.js +33 -33
- package/dist/services/consultation-fee-receipt.service.js +16 -16
- package/dist/services/consultation-full-pdf.service.js +10 -10
- package/dist/services/consultation-letterhead-pdf.service.js +15 -15
- package/dist/services/consultation-pdf.service.js +15 -15
- package/dist/services/credit-note-pdf.service.js +16 -16
- package/dist/services/credit-note-totals.service.js +31 -31
- package/dist/services/cust-wise-sales-details-pdf.service.js +8 -8
- package/dist/services/cust-wise-sales-summary-pdf.service.js +7 -7
- package/dist/services/customer-balances-pdf.service.js +7 -7
- package/dist/services/dc-landscape-pdf.service.js +28 -28
- package/dist/services/dc-landscape-without-price-pdf.service.js +24 -24
- package/dist/services/dc-without-price-pdf.service.js +15 -15
- package/dist/services/debit-note-pdf.service.js +14 -14
- package/dist/services/debit-note-print.service.js +33 -33
- package/dist/services/debit-note-totals.service.js +28 -28
- package/dist/services/delivery-challan-pdf.service.js +16 -16
- package/dist/services/delivery-challan-print.service.js +26 -26
- package/dist/services/delivery-challan-totals.js +32 -32
- package/dist/services/equipment-design-pdf.service.js +10 -10
- package/dist/services/est.print-service.js +150 -150
- package/dist/services/expiring-drugs-pdf.service.js +6 -6
- package/dist/services/hc-inv-pdf.service.js +42 -42
- package/dist/services/insurance-expire-pdf.service.js +1 -1
- package/dist/services/inv-pdf.service.js +54 -54
- package/dist/services/inv-print.service.js +59 -59
- package/dist/services/invoice-landscape-pdf.service.js +29 -29
- package/dist/services/invoice-letterhead-pdf.service.js +54 -54
- package/dist/services/invoice-portrait-pdf.js +51 -51
- package/dist/services/invoice-total.service.js +78 -78
- package/dist/services/issue-parts-pdf.service.js +43 -43
- package/dist/services/item-bar-code-label-pdf.js +2 -2
- package/dist/services/item-price-for-pricelist.js +178 -0
- package/dist/services/item-wise-doctor-sale-pdf.service.js +3 -3
- package/dist/services/item-wise-mout-details-pdf.js +3 -3
- package/dist/services/item-wise-mout-summary-pdf.js +2 -2
- package/dist/services/item-wise-sales-pdf.service.js +6 -6
- package/dist/services/manf-wise-sales-pdf.service.js +5 -5
- package/dist/services/meeting-pdf.js +14 -14
- package/dist/services/mout-pdf.service.js +17 -17
- package/dist/services/next-service-date-pdf.service.js +1 -1
- package/dist/services/operator-wise-details-pdf.service.js +8 -8
- package/dist/services/operator-wise-summary-pdf.js +7 -7
- package/dist/services/pack-ship-pdf.service.js +3 -3
- package/dist/services/pack-ship-print.service.js +26 -26
- package/dist/services/payment-pdf.service.js +4 -4
- package/dist/services/payment-report-pdf.service.js +3 -3
- package/dist/services/po-totals.service.js +28 -28
- package/dist/services/pos-receipt-pdf.js +19 -19
- package/dist/services/purchase-order-pdf.service.js +40 -40
- package/dist/services/purchase-order-print.service.js +43 -43
- package/dist/services/purchase-order-totals.service.js +53 -53
- package/dist/services/receipt-print.service.js +5 -5
- package/dist/services/reorder-point-pdf.service.js +3 -3
- package/dist/services/repair-orders-pdf.service.js +3 -3
- package/dist/services/ro-pdf.service.js +80 -80
- package/dist/services/ro-print-service.js +87 -87
- package/dist/services/ro-totals.service.js +123 -123
- package/dist/services/sales-by-service-pdf.service.js +6 -6
- package/dist/services/sales-pdf.service.js +23 -23
- package/dist/services/sales-print.service.js +54 -54
- package/dist/services/sales-receipt-pdf.service.js +25 -25
- package/dist/services/sales-receipt-print.service.js +62 -62
- package/dist/services/sales-totals.service.js +33 -33
- package/dist/services/scheduled-drug-pdf.service.js +7 -7
- package/dist/services/scheduled-drug-summary-pdf.service.js +4 -4
- package/dist/services/separate-wo-print.service.js +9 -9
- package/dist/services/shared-inv-pdf.service.js +44 -44
- package/dist/services/shared-pdf.service.js +119 -119
- package/dist/services/shared-print.service.js +68 -68
- package/dist/services/task-pdf.service.js +10 -10
- package/dist/services/task-reports-pdf.service.js +9 -9
- package/dist/services/technician-pdf.service.js +10 -10
- package/dist/services/technician-print.service.js +9 -9
- package/dist/services/vendor-balances-pdf.service.js +6 -6
- package/dist/services/vendor-credit-note-pdf.service.js +27 -27
- package/dist/services/vendor-credit-note-print.service.js +29 -29
- package/dist/services/vendor-credit-note-totals.service.js +37 -37
- package/dist/services/vendor-debit-note-pdf.service.js +16 -16
- package/dist/services/vendor-debit-note-print.service.js +29 -29
- package/dist/services/vendor-debit-note-totals.service.js +30 -30
- package/dist/{utils → shared}/my-date.js +31 -31
- package/package.json +1 -1
- package/dist/services/pricelist-item-final-price.service.js +0 -177
- /package/dist/{utils/tr-utils.js → shared/utils.js} +0 -0
|
@@ -4,47 +4,47 @@ exports.DebitNotePrintService = void 0;
|
|
|
4
4
|
const shared_print_service_1 = require("./shared-print.service");
|
|
5
5
|
const debit_note_totals_service_1 = require("./debit-note-totals.service");
|
|
6
6
|
const code_enums_1 = require("../enums/code-enums");
|
|
7
|
-
const
|
|
7
|
+
const utils_1 = require("../shared/utils");
|
|
8
8
|
const enums_1 = require("../enums/enums");
|
|
9
|
-
const my_date_1 = require("../
|
|
9
|
+
const my_date_1 = require("../shared/my-date");
|
|
10
10
|
const aggregation_1 = require("../aggregation/aggregation");
|
|
11
11
|
class DebitNotePrintService {
|
|
12
12
|
static GetDebitNotePrintInfo(OriginalInvoiceData, OriginalEntityData, image, IncludeGST, ConsolidateGST, TaxCodes, IsProforma, IsCustBillTo) {
|
|
13
13
|
var _a, _b;
|
|
14
14
|
let InvoicePrintData = {};
|
|
15
|
-
let argInvoiceData =
|
|
15
|
+
let argInvoiceData = utils_1.TrUtils.Stringify(OriginalInvoiceData);
|
|
16
16
|
if (!IncludeGST) {
|
|
17
17
|
argInvoiceData.Settings.Tax = 'NO';
|
|
18
18
|
}
|
|
19
19
|
InvoicePrintData.IsProforma = IsProforma;
|
|
20
|
-
InvoicePrintData.Settings =
|
|
20
|
+
InvoicePrintData.Settings = utils_1.TrUtils.Stringify(argInvoiceData.Settings);
|
|
21
21
|
let SType;
|
|
22
|
-
if (!
|
|
22
|
+
if (!utils_1.TrUtils.IsNull(argInvoiceData.SType)) {
|
|
23
23
|
SType = argInvoiceData.SType;
|
|
24
24
|
}
|
|
25
25
|
InvoicePrintData = this.GetPrintConditionsBasedOnInput(InvoicePrintData, IncludeGST, ConsolidateGST, SType, argInvoiceData, IsProforma, IsCustBillTo);
|
|
26
26
|
InvoicePrintData.Entity = shared_print_service_1.PrintSharedService.GetFormattedEntityDataForPrint(OriginalEntityData, "Invoice", OriginalInvoiceData);
|
|
27
27
|
InvoicePrintData = shared_print_service_1.PrintSharedService.GetEntityHeaderStyles(InvoicePrintData, OriginalEntityData, image);
|
|
28
28
|
InvoicePrintData = this.GetInvoiceOtherDetailsForPrint(InvoicePrintData, argInvoiceData, IsCustBillTo);
|
|
29
|
-
let IsTaxable = (IncludeGST &&
|
|
29
|
+
let IsTaxable = (IncludeGST && utils_1.TrUtils.isTaxable(argInvoiceData.Settings.Tax)) ? true : false;
|
|
30
30
|
let finalTotalsData = debit_note_totals_service_1.DebitNoteTotalsService.GetTotalsValue(argInvoiceData.Items, IsTaxable, true, argInvoiceData.Disc, argInvoiceData.Perc, TaxCodes, true, argInvoiceData.Settings);
|
|
31
31
|
if (ConsolidateGST) {
|
|
32
32
|
finalTotalsData.CustLaborTotalBeforeDisc = finalTotalsData.CustLaborAfterTax;
|
|
33
33
|
finalTotalsData.CustPartsTotalBeforeDisc = finalTotalsData.CustPartAfterTax;
|
|
34
34
|
}
|
|
35
|
-
InvoicePrintData =
|
|
35
|
+
InvoicePrintData = utils_1.TrUtils.ConcatObjects(InvoicePrintData, finalTotalsData);
|
|
36
36
|
InvoicePrintData.Items = this.GetItemsPrintInfo(InvoicePrintData.Items, ConsolidateGST, TaxCodes, (_b = (_a = OriginalEntityData.Entity.Settings) === null || _a === void 0 ? void 0 : _a.Acc) === null || _b === void 0 ? void 0 : _b.LTot);
|
|
37
37
|
argInvoiceData = this.ReverseItemsForInvoicePrint(argInvoiceData);
|
|
38
38
|
InvoicePrintData.PrintInfo = this.PrepareFormatForInvoicePrint(InvoicePrintData, code_enums_1.ROTypeEnum.Invoice, argInvoiceData.Sts);
|
|
39
39
|
InvoicePrintData = this.GetFormattedProductDataForPrint(argInvoiceData, InvoicePrintData);
|
|
40
40
|
InvoicePrintData = this.GetBillNameForInvoicePrint(argInvoiceData, InvoicePrintData, IsCustBillTo);
|
|
41
|
-
if (
|
|
41
|
+
if (utils_1.TrUtils.IsNull(argInvoiceData.Payments)) {
|
|
42
42
|
argInvoiceData.Payments = [];
|
|
43
43
|
}
|
|
44
44
|
let PaymentData = this.GetPaymentsTotal(argInvoiceData.Payments, InvoicePrintData.Total, argInvoiceData.Sts);
|
|
45
45
|
InvoicePrintData.Due = PaymentData.Due;
|
|
46
46
|
InvoicePrintData.Paid = PaymentData.Paid;
|
|
47
|
-
if (!
|
|
47
|
+
if (!utils_1.TrUtils.IsNull(PaymentData.Sts)) {
|
|
48
48
|
InvoicePrintData.Sts = PaymentData.Sts;
|
|
49
49
|
}
|
|
50
50
|
InvoicePrintData.Consolidate = ConsolidateGST;
|
|
@@ -58,11 +58,11 @@ class DebitNotePrintService {
|
|
|
58
58
|
InvoicePrintData.IncludeGST = IncludeGST;
|
|
59
59
|
InvoicePrintData.ConsolidateGST = ConsolidateGST;
|
|
60
60
|
InvoicePrintData.ShowAccParts = false;
|
|
61
|
-
InvoicePrintData.ShowIGST = (
|
|
61
|
+
InvoicePrintData.ShowIGST = (utils_1.TrUtils.IsNull(SType) || (SType === 'Intra')) ? false : true;
|
|
62
62
|
InvoicePrintData.ShowTaxColumn = (IncludeGST && !ConsolidateGST) ? true : false;
|
|
63
63
|
// InvoicePrintData.ShowDiscountColumn = (!ForInsurance && !ConsolidateGST) ? true : false;
|
|
64
64
|
InvoicePrintData = this.GetInvoiceTypeHeading(InvoicePrintData, OriginalInvoiceData, IncludeGST, ConsolidateGST, IsProforma, IsBillTo);
|
|
65
|
-
InvoicePrintData.PrDate =
|
|
65
|
+
InvoicePrintData.PrDate = utils_1.TrUtils.IsNull(OriginalInvoiceData.PrDate) ? '' : my_date_1.MyDate.ConvertUTCDateToReadable(OriginalInvoiceData.PrDate);
|
|
66
66
|
return InvoicePrintData;
|
|
67
67
|
}
|
|
68
68
|
static GetInvoiceTypeHeading(InvoicePrintData, OriginalInvoiceData, IncludeGST, ConsolidateGST, IsProforma, IsBillTo) {
|
|
@@ -99,24 +99,24 @@ class DebitNotePrintService {
|
|
|
99
99
|
let CTaxAmtPerItem = (0, aggregation_1.division)(Item.CGST, Item.Qty);
|
|
100
100
|
let STaxAmtPerItem = (0, aggregation_1.division)(Item.SGST, Item.Qty);
|
|
101
101
|
let ITaxAmtPerItem = (0, aggregation_1.division)(Item.IGST, Item.Qty);
|
|
102
|
-
Item.UnPr =
|
|
102
|
+
Item.UnPr = utils_1.TrUtils.FixedTo((0, aggregation_1.addition)(AfterDiscForEach, CTaxAmtPerItem, STaxAmtPerItem, ITaxAmtPerItem));
|
|
103
103
|
}
|
|
104
104
|
else {
|
|
105
|
-
Item.UnPr =
|
|
105
|
+
Item.UnPr = utils_1.TrUtils.FixPriceValue(Item.UnPr);
|
|
106
106
|
}
|
|
107
|
-
Item.CGSTAmt =
|
|
108
|
-
Item.SGSTAmt =
|
|
109
|
-
Item.IGSTAmt =
|
|
107
|
+
Item.CGSTAmt = utils_1.TrUtils.FixPriceValue(Item.CGST);
|
|
108
|
+
Item.SGSTAmt = utils_1.TrUtils.FixPriceValue(Item.SGST);
|
|
109
|
+
Item.IGSTAmt = utils_1.TrUtils.FixPriceValue(Item.IGST);
|
|
110
110
|
Item.CGSTPerc = shared_print_service_1.PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
111
111
|
Item.SGSTPerc = shared_print_service_1.PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
112
112
|
Item.IGSTPerc = shared_print_service_1.PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
113
113
|
if (LineTotal === 'AT') {
|
|
114
|
-
Item.LineTotal =
|
|
114
|
+
Item.LineTotal = utils_1.TrUtils.FixPriceValue(Item.AfterPartTax);
|
|
115
115
|
}
|
|
116
116
|
else {
|
|
117
|
-
Item.LineTotal =
|
|
117
|
+
Item.LineTotal = utils_1.TrUtils.FixPriceValue((0, aggregation_1.subtraction)(Item.UnAmt, Item.Disc));
|
|
118
118
|
}
|
|
119
|
-
if (!
|
|
119
|
+
if (!utils_1.TrUtils.IsZero(Item.Qty) && !utils_1.TrUtils.CheckInvalidSelect(Item.UoM)) {
|
|
120
120
|
Item.QtyAndUoM = Item.Qty + ' ' + Item.UoM;
|
|
121
121
|
}
|
|
122
122
|
});
|
|
@@ -136,15 +136,15 @@ class DebitNotePrintService {
|
|
|
136
136
|
return PrintInfo;
|
|
137
137
|
}
|
|
138
138
|
static GetFormattedProductDataForPrint(OriginalInvoiceData, InvoicePrintData) {
|
|
139
|
-
if (!
|
|
139
|
+
if (!utils_1.TrUtils.IsNull(OriginalInvoiceData.Prod)) {
|
|
140
140
|
InvoicePrintData.Product = OriginalInvoiceData.Prod;
|
|
141
|
-
if (
|
|
141
|
+
if (utils_1.TrUtils.IsNull(InvoicePrintData.Product.VIN)) {
|
|
142
142
|
InvoicePrintData.Product.VIN = '';
|
|
143
143
|
}
|
|
144
|
-
if (
|
|
144
|
+
if (utils_1.TrUtils.IsNull(InvoicePrintData.Product.RegNo)) {
|
|
145
145
|
InvoicePrintData.Product.RegNo = '';
|
|
146
146
|
}
|
|
147
|
-
if (
|
|
147
|
+
if (utils_1.TrUtils.IsNull(InvoicePrintData.Product.EngNo)) {
|
|
148
148
|
InvoicePrintData.Product.EngNo = '';
|
|
149
149
|
}
|
|
150
150
|
InvoicePrintData.MIn = OriginalInvoiceData.Prod.MIn;
|
|
@@ -158,17 +158,17 @@ class DebitNotePrintService {
|
|
|
158
158
|
Customer.Name = OriginalInvoiceData.BillTo.Name;
|
|
159
159
|
Customer.Adrs = [];
|
|
160
160
|
Customer.Cons = [];
|
|
161
|
-
if (!
|
|
161
|
+
if (!utils_1.TrUtils.IsNull(OriginalInvoiceData.BillTo.Adrs)) {
|
|
162
162
|
Customer.Adrs.push(OriginalInvoiceData.BillTo.Adrs.A1);
|
|
163
|
-
if (!
|
|
163
|
+
if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.BillTo.Adrs.A2)) {
|
|
164
164
|
Customer.Adrs.push(OriginalInvoiceData.BillTo.Adrs.A2);
|
|
165
165
|
}
|
|
166
|
-
if (!
|
|
166
|
+
if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.BillTo.Adrs.Ct)) {
|
|
167
167
|
Customer.Adrs.push(OriginalInvoiceData.BillTo.Adrs.Ct);
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
Customer.GSTIN = OriginalInvoiceData.BillTo.GSTIN;
|
|
171
|
-
if (!
|
|
171
|
+
if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.BillTo.Ph)) {
|
|
172
172
|
Customer.Cons = [
|
|
173
173
|
{
|
|
174
174
|
Type: 'M',
|
|
@@ -187,7 +187,7 @@ class DebitNotePrintService {
|
|
|
187
187
|
let Customer = {};
|
|
188
188
|
Customer.Name = this.GetBillToName(OriginalInvoiceData.Cust.Title, OriginalInvoiceData.Cust.Name);
|
|
189
189
|
Customer.Cons = [];
|
|
190
|
-
if (!
|
|
190
|
+
if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.Cust.Ph)) {
|
|
191
191
|
Customer.Cons = [
|
|
192
192
|
{
|
|
193
193
|
Type: 'M',
|
|
@@ -197,9 +197,9 @@ class DebitNotePrintService {
|
|
|
197
197
|
}
|
|
198
198
|
Customer.GSTIN = OriginalInvoiceData.Cust.GSTIN;
|
|
199
199
|
Customer.Adrs = [];
|
|
200
|
-
if (!
|
|
200
|
+
if (!utils_1.TrUtils.IsNull(OriginalInvoiceData.Cust.Adrs)) {
|
|
201
201
|
Customer.Adrs.push(OriginalInvoiceData.Cust.Adrs.A1);
|
|
202
|
-
if (!
|
|
202
|
+
if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.Cust.Adrs.A2)) {
|
|
203
203
|
Customer.Adrs.push(OriginalInvoiceData.Cust.Adrs.A2);
|
|
204
204
|
}
|
|
205
205
|
Customer.Adrs.push(OriginalInvoiceData.Cust.Adrs.Ct);
|
|
@@ -209,7 +209,7 @@ class DebitNotePrintService {
|
|
|
209
209
|
return Customer;
|
|
210
210
|
}
|
|
211
211
|
static GetBillToName(Title, Name) {
|
|
212
|
-
return
|
|
212
|
+
return utils_1.TrUtils.IsEmpty(Title) ? Name : Title + ' ' + Name;
|
|
213
213
|
}
|
|
214
214
|
static GetPaymentsTotal(InvoicePayments, Total, InvoiceStatus) {
|
|
215
215
|
var i = 0;
|
|
@@ -222,7 +222,7 @@ class DebitNotePrintService {
|
|
|
222
222
|
Data.Due = 0;
|
|
223
223
|
}
|
|
224
224
|
else {
|
|
225
|
-
Data.Due =
|
|
225
|
+
Data.Due = utils_1.TrUtils.FixedTo(Total - PaidTotal);
|
|
226
226
|
}
|
|
227
227
|
if (Data.Due < 0) {
|
|
228
228
|
Data.Due = 0;
|
|
@@ -230,7 +230,7 @@ class DebitNotePrintService {
|
|
|
230
230
|
if (Data.Due === 0) {
|
|
231
231
|
Data.Sts = enums_1.InvoiceStatusEnum.Closed;
|
|
232
232
|
}
|
|
233
|
-
Data.Paid =
|
|
233
|
+
Data.Paid = utils_1.TrUtils.FixedTo(PaidTotal);
|
|
234
234
|
return Data;
|
|
235
235
|
}
|
|
236
236
|
}
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DebitNoteTotalsService = void 0;
|
|
4
4
|
const aggregation_1 = require("../aggregation/aggregation");
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("../shared/utils");
|
|
6
6
|
class DebitNoteTotalsService {
|
|
7
7
|
static GetTotalsValue(PartsList, IsIndependentTax, DetailedInfo, Disc, Perc, TaxCodes, WithItems, Settings) {
|
|
8
8
|
// LPerc = TrUtils.SetPercToStringIfNull(LPerc);
|
|
9
9
|
// PPerc = TrUtils.SetPercToStringIfNull(PPerc);
|
|
10
|
-
Perc =
|
|
10
|
+
Perc = utils_1.TrUtils.SetPercToStringIfNull(Perc);
|
|
11
11
|
// LDisc = TrUtils.SetValueToZeroIfNull(LDisc);
|
|
12
12
|
// PDisc = TrUtils.SetValueToZeroIfNull(PDisc);
|
|
13
|
-
Disc =
|
|
13
|
+
Disc = utils_1.TrUtils.SetValueToZeroIfNull(Disc);
|
|
14
14
|
// opCodesList = this.CalculateLaborValues(opCodesList, IsIndependentTax);
|
|
15
15
|
PartsList = this.CalculateLaborPartValues(PartsList, IsIndependentTax);
|
|
16
16
|
let finalTotalsData = this.GetFinalRODataForSave(PartsList, IsIndependentTax, Disc, Perc, DetailedInfo, Settings);
|
|
@@ -46,12 +46,12 @@ class DebitNoteTotalsService {
|
|
|
46
46
|
return PartsList;
|
|
47
47
|
}
|
|
48
48
|
static ResetLaborPartValueIfInvalid(Part) {
|
|
49
|
-
Part.UnPr =
|
|
50
|
-
Part.Disc =
|
|
51
|
-
Part.RecDisc =
|
|
52
|
-
Part.CGST =
|
|
53
|
-
Part.SGST =
|
|
54
|
-
Part.IGST =
|
|
49
|
+
Part.UnPr = utils_1.TrUtils.SetValueToZeroIfNull(Part.UnPr);
|
|
50
|
+
Part.Disc = utils_1.TrUtils.SetValueToZeroIfNull(Part.Disc);
|
|
51
|
+
Part.RecDisc = utils_1.TrUtils.SetValueToZeroIfNull(Part.RecDisc);
|
|
52
|
+
Part.CGST = utils_1.TrUtils.SetValueToZeroIfNull(Part.CGST);
|
|
53
|
+
Part.SGST = utils_1.TrUtils.SetValueToZeroIfNull(Part.SGST);
|
|
54
|
+
Part.IGST = utils_1.TrUtils.SetValueToZeroIfNull(Part.IGST);
|
|
55
55
|
return Part;
|
|
56
56
|
}
|
|
57
57
|
static GetFinalRODataForSave(PartsList, IsIndependentTax, Disc, Perc, DetailedInfo, Settings) {
|
|
@@ -89,8 +89,8 @@ class DebitNoteTotalsService {
|
|
|
89
89
|
finalTotalsData.Round = (0, aggregation_1.subtraction)(Math.round(CustTotal), CustTotal);
|
|
90
90
|
finalTotalsData.Total = Math.round(CustTotal);
|
|
91
91
|
if (DetailedInfo) {
|
|
92
|
-
finalTotalsData.FixedSubTotal =
|
|
93
|
-
finalTotalsData.FixedTotal =
|
|
92
|
+
finalTotalsData.FixedSubTotal = utils_1.TrUtils.FixedTo(CustomerAfterDiscTotals);
|
|
93
|
+
finalTotalsData.FixedTotal = utils_1.TrUtils.FixedTo(CustTotal);
|
|
94
94
|
}
|
|
95
95
|
return finalTotalsData;
|
|
96
96
|
}
|
|
@@ -119,21 +119,21 @@ class DebitNoteTotalsService {
|
|
|
119
119
|
// finalTotalsData.CustLaborCGST = this.GetLaborCGSTTaxTotal(opCodesList, IsIndependentTax);
|
|
120
120
|
// finalTotalsData.CustLaborIGST = this.GetLaborIGSTTaxTotal(opCodesList, IsIndependentTax);
|
|
121
121
|
let TaxInfo = this.GetPartGSTTaxTotal(PartsList, IsIndependentTax);
|
|
122
|
-
finalTotalsData.CustPartITax =
|
|
123
|
-
finalTotalsData.CustPartCGST =
|
|
124
|
-
finalTotalsData.CustPartIGST =
|
|
125
|
-
finalTotalsData.CustPartSGST =
|
|
122
|
+
finalTotalsData.CustPartITax = utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[3]);
|
|
123
|
+
finalTotalsData.CustPartCGST = utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[0]);
|
|
124
|
+
finalTotalsData.CustPartIGST = utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[2]);
|
|
125
|
+
finalTotalsData.CustPartSGST = utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[1]);
|
|
126
126
|
// finalTotalsData.CustLaborAfterTax = addition(finalTotalsData.CustLaborITax , finalTotalsData.CustLaborTotalAfterDisc);
|
|
127
127
|
finalTotalsData.CustPartAfterTax = (0, aggregation_1.addition)(finalTotalsData.CustPartITax, finalTotalsData.CustPartsTotalAfterDisc);
|
|
128
128
|
finalTotalsData.CustTaxGroupData = this.GetTaxGroupingForPartsByHSN(PartsList, TaxCodes);
|
|
129
|
-
finalTotalsData.CustTotalRoundedBy =
|
|
130
|
-
finalTotalsData.CustRoundedTotal =
|
|
129
|
+
finalTotalsData.CustTotalRoundedBy = utils_1.TrUtils.FixedTo(finalTotalsData.Round);
|
|
130
|
+
finalTotalsData.CustRoundedTotal = utils_1.TrUtils.FixedTo(finalTotalsData.Total);
|
|
131
131
|
for (var key in finalTotalsData) {
|
|
132
132
|
if (key !== 'Total' && key !== 'SubTotal' &&
|
|
133
133
|
key !== 'LDisc' && key !== 'LPerc' && key !== 'PDisc' &&
|
|
134
134
|
key !== 'PPerc' && key !== 'Disc' && key !== 'Perc' && key !== 'Tax'
|
|
135
135
|
&& typeof finalTotalsData[key] === 'number') {
|
|
136
|
-
finalTotalsData[key] =
|
|
136
|
+
finalTotalsData[key] = utils_1.TrUtils.FixPriceValue(finalTotalsData[key]);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
return finalTotalsData;
|
|
@@ -142,7 +142,7 @@ class DebitNoteTotalsService {
|
|
|
142
142
|
let PartsDiscountedTotal = 0;
|
|
143
143
|
let overallPartDisc = 0;
|
|
144
144
|
if (!isTaxable) {
|
|
145
|
-
overallPartDisc =
|
|
145
|
+
overallPartDisc = utils_1.TrUtils.SetValueToZeroIfNull(finalTotalsData.PDisc);
|
|
146
146
|
}
|
|
147
147
|
PartsList.forEach((Part) => {
|
|
148
148
|
PartsDiscountedTotal = (0, aggregation_1.addition)(PartsDiscountedTotal, Part.DiscountedPrice);
|
|
@@ -170,8 +170,8 @@ class DebitNoteTotalsService {
|
|
|
170
170
|
}
|
|
171
171
|
static ItemsTotalAfterDiscount(PartsTotalAfterDisc, PartsTaxAmount, MainPDisc, PDiscInPerc) {
|
|
172
172
|
let ItemsTotal = (0, aggregation_1.addition)(PartsTotalAfterDisc, PartsTaxAmount);
|
|
173
|
-
if (!
|
|
174
|
-
if (!
|
|
173
|
+
if (!utils_1.TrUtils.IsZero(MainPDisc)) {
|
|
174
|
+
if (!utils_1.TrUtils.IsEmpty(PDiscInPerc)) {
|
|
175
175
|
ItemsTotal = (0, aggregation_1.subtraction)(ItemsTotal, (0, aggregation_1.division)((0, aggregation_1.multiply)(ItemsTotal, Number(PDiscInPerc)), 100));
|
|
176
176
|
}
|
|
177
177
|
else {
|
|
@@ -203,13 +203,13 @@ class DebitNoteTotalsService {
|
|
|
203
203
|
}
|
|
204
204
|
static GetCombinedTaxPercentage(Parts, TaxCodes) {
|
|
205
205
|
Parts.forEach((Part) => {
|
|
206
|
-
if (
|
|
206
|
+
if (utils_1.TrUtils.IsNull(Part.HSN)) {
|
|
207
207
|
Part.HSN = '';
|
|
208
208
|
}
|
|
209
209
|
let GSTValues = this.GetGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
|
|
210
|
-
Part.CGSTAmt =
|
|
211
|
-
Part.SGSTAmt =
|
|
212
|
-
Part.IGSTAmt =
|
|
210
|
+
Part.CGSTAmt = utils_1.TrUtils.SetValueToZeroIfNull(GSTValues[0]);
|
|
211
|
+
Part.SGSTAmt = utils_1.TrUtils.SetValueToZeroIfNull(GSTValues[1]);
|
|
212
|
+
Part.IGSTAmt = utils_1.TrUtils.SetValueToZeroIfNull(GSTValues[2]);
|
|
213
213
|
Part.CombinedTaxPercentage = (0, aggregation_1.addition)(Part.CGSTAmt, Part.SGSTAmt, Part.IGSTAmt);
|
|
214
214
|
});
|
|
215
215
|
return Parts;
|
|
@@ -252,8 +252,8 @@ class DebitNoteTotalsService {
|
|
|
252
252
|
TaxAmount = (0, aggregation_1.addition)(TaxAmount, argMatchedGSTPart.SGST);
|
|
253
253
|
});
|
|
254
254
|
TaxInfo.HSN = HSN;
|
|
255
|
-
TaxInfo.TotalTaxableAmount =
|
|
256
|
-
TaxInfo.TotalTaxAmount =
|
|
255
|
+
TaxInfo.TotalTaxableAmount = utils_1.TrUtils.FixPriceValue(TaxOnAmount);
|
|
256
|
+
TaxInfo.TotalTaxAmount = utils_1.TrUtils.FixPriceValue(TaxAmount);
|
|
257
257
|
TaxInfo.ItemsCount = MatchedPart.length;
|
|
258
258
|
// let GSTValues: any[] = this.GetGSTValueBasedOnTaxCode(MatchedPart[0].TCode, TaxCodes);
|
|
259
259
|
// TaxInfo.CGST = GSTValues[0];
|
|
@@ -272,7 +272,7 @@ class DebitNoteTotalsService {
|
|
|
272
272
|
let CGST = 0;
|
|
273
273
|
let SGST = 0;
|
|
274
274
|
let IGST = 0;
|
|
275
|
-
if (
|
|
275
|
+
if (utils_1.TrUtils.IsNull(TCode)) {
|
|
276
276
|
return [CGST, SGST, IGST];
|
|
277
277
|
}
|
|
278
278
|
let TCodeIndex = TaxCodes.findIndex((TaxCode) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DeliveryChallanPdfService = void 0;
|
|
4
|
-
const
|
|
4
|
+
const utils_1 = require("../shared/utils");
|
|
5
5
|
const shared_pdf_service_1 = require("./shared-pdf.service");
|
|
6
6
|
const shared_print_service_1 = require("./shared-print.service");
|
|
7
7
|
class DeliveryChallanPdfService {
|
|
@@ -10,7 +10,7 @@ class DeliveryChallanPdfService {
|
|
|
10
10
|
}
|
|
11
11
|
static GetDeliveryChallanPrint(ROPrintData, numberofCopies, moreDiscDetails) {
|
|
12
12
|
var contents = [];
|
|
13
|
-
if (
|
|
13
|
+
if (utils_1.TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
|
|
14
14
|
contents.push(this.CommonHeaderDetails(ROPrintData, null), this.PreparesparePartsTable(ROPrintData), this.CommonTotalDetails(ROPrintData, null, numberofCopies, moreDiscDetails));
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
@@ -36,7 +36,7 @@ class DeliveryChallanPdfService {
|
|
|
36
36
|
}
|
|
37
37
|
static GetFileName(ROPrintData) {
|
|
38
38
|
let fileName = ROPrintData.HeaderName;
|
|
39
|
-
if (!
|
|
39
|
+
if (!utils_1.TrUtils.IsNull(ROPrintData.Product) && !utils_1.TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
|
|
40
40
|
fileName = fileName + '-' + ROPrintData.Product.RegNo;
|
|
41
41
|
}
|
|
42
42
|
return fileName;
|
|
@@ -62,7 +62,7 @@ class DeliveryChallanPdfService {
|
|
|
62
62
|
let List = [];
|
|
63
63
|
if (ROPrintData.Entity.Body === 1) {
|
|
64
64
|
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
65
|
-
if (
|
|
65
|
+
if (utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
66
66
|
ROPrintData.PrintInfo[i].Text = '';
|
|
67
67
|
}
|
|
68
68
|
// List.push(ROPrintData.PrintInfo[i].Text,
|
|
@@ -73,10 +73,10 @@ class DeliveryChallanPdfService {
|
|
|
73
73
|
else {
|
|
74
74
|
if (ROPrintData.Entity.Body === 2) {
|
|
75
75
|
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
76
|
-
if (
|
|
76
|
+
if (utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
77
77
|
ROPrintData.PrintInfo[i].Text = '';
|
|
78
78
|
}
|
|
79
|
-
List.push(ROPrintData.PrintInfo[i].Text, this.WithOutDiscountFieldTable(
|
|
79
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.WithOutDiscountFieldTable(utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn));
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
@@ -87,10 +87,10 @@ class DeliveryChallanPdfService {
|
|
|
87
87
|
}
|
|
88
88
|
else {
|
|
89
89
|
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
90
|
-
if (
|
|
90
|
+
if (utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
91
91
|
ROPrintData.PrintInfo[i].Text = '';
|
|
92
92
|
}
|
|
93
|
-
List.push(ROPrintData.PrintInfo[i].Text, this.GetWithOutDiscAndTaxFieldHeader(
|
|
93
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.GetWithOutDiscAndTaxFieldHeader(utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn));
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -154,14 +154,14 @@ class DeliveryChallanPdfService {
|
|
|
154
154
|
Parts.forEach((part) => {
|
|
155
155
|
var dataRow = [];
|
|
156
156
|
columns.forEach((column) => {
|
|
157
|
-
if ((!
|
|
157
|
+
if ((!utils_1.TrUtils.IsFixedZero(part[column.Field]) && !utils_1.TrUtils.IsNull(part[column.Field]))
|
|
158
158
|
|| (column.text === 'Line Total')) {
|
|
159
159
|
if (part[column.Field] === 'Spare Parts') {
|
|
160
160
|
dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
|
|
161
161
|
}
|
|
162
162
|
else {
|
|
163
163
|
if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
|
|
164
|
-
&&
|
|
164
|
+
&& utils_1.TrUtils.CheckInvalidSelect(part.TCode))) {
|
|
165
165
|
part[column.Field] = '';
|
|
166
166
|
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
167
167
|
}
|
|
@@ -171,7 +171,7 @@ class DeliveryChallanPdfService {
|
|
|
171
171
|
|| column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
|
|
172
172
|
if (column.Field === 'Disc') {
|
|
173
173
|
if (column.type === 'percentage') {
|
|
174
|
-
if (!
|
|
174
|
+
if (!utils_1.TrUtils.IsEmpty(part[column.Field])) {
|
|
175
175
|
dataRow.push({ text: part[column.Field].toString(), noWrap: true });
|
|
176
176
|
}
|
|
177
177
|
else {
|
|
@@ -179,7 +179,7 @@ class DeliveryChallanPdfService {
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
else {
|
|
182
|
-
if (!
|
|
182
|
+
if (!utils_1.TrUtils.IsZero(part[column.Field])) {
|
|
183
183
|
dataRow.push({ text: part[column.Field].toString(), noWrap: true });
|
|
184
184
|
}
|
|
185
185
|
else {
|
|
@@ -188,7 +188,7 @@ class DeliveryChallanPdfService {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
else {
|
|
191
|
-
if (!
|
|
191
|
+
if (!utils_1.TrUtils.IsZero(part[column.Field])) {
|
|
192
192
|
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
193
193
|
}
|
|
194
194
|
else {
|
|
@@ -201,7 +201,7 @@ class DeliveryChallanPdfService {
|
|
|
201
201
|
if (column.Field === 'Desc') {
|
|
202
202
|
let DescData = [];
|
|
203
203
|
DescData.push(part[column.Field].toString());
|
|
204
|
-
if (!
|
|
204
|
+
if (!utils_1.TrUtils.IsEmpty(part['EDesc'])) {
|
|
205
205
|
DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
|
|
206
206
|
}
|
|
207
207
|
dataRow.push({ stack: DescData });
|
|
@@ -416,7 +416,7 @@ class DeliveryChallanPdfService {
|
|
|
416
416
|
}
|
|
417
417
|
static CommonTotalDetails(ROPrintData, index, numberofCopies, moreDiscDetails) {
|
|
418
418
|
let CommonDetails = [
|
|
419
|
-
shared_pdf_service_1.SharedPDFService.GetFinalTotalDetails(ROPrintData, '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn, ROPrintData.CustPartsTotalBeforeDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST, ROPrintData.CustPartSGST, ROPrintData.CustTaxGroupData, ROPrintData.ShowAccParts, '0.00', ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.For, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn,
|
|
419
|
+
shared_pdf_service_1.SharedPDFService.GetFinalTotalDetails(ROPrintData, '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn, ROPrintData.CustPartsTotalBeforeDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST, ROPrintData.CustPartSGST, ROPrintData.CustTaxGroupData, ROPrintData.ShowAccParts, '0.00', ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.For, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn, utils_1.TrUtils.isTaxable(ROPrintData.Settings.Tax), '0.00', ROPrintData.CustPartITax, ROPrintData.Consolidate, ROPrintData.From, null, null, moreDiscDetails),
|
|
420
420
|
// SharedPDFService.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts),
|
|
421
421
|
shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
|
|
422
422
|
shared_pdf_service_1.SharedPDFService.GetUnderLine(),
|
|
@@ -425,7 +425,7 @@ class DeliveryChallanPdfService {
|
|
|
425
425
|
if (ROPrintData.Type !== 'Invoice') {
|
|
426
426
|
CommonDetails.splice(2, 0, shared_pdf_service_1.SharedPDFService.GetUnderLine());
|
|
427
427
|
}
|
|
428
|
-
if (!
|
|
428
|
+
if (!utils_1.TrUtils.IsNull(numberofCopies) && numberofCopies.length !== 0 && (index !== (numberofCopies.length - 1))) {
|
|
429
429
|
CommonDetails.push({ text: '', pageBreak: 'after' });
|
|
430
430
|
}
|
|
431
431
|
return CommonDetails;
|
|
@@ -3,36 +3,36 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DeliveryChallanPrintService = void 0;
|
|
4
4
|
const shared_print_service_1 = require("./shared-print.service");
|
|
5
5
|
const delivery_challan_totals_1 = require("./delivery-challan-totals");
|
|
6
|
-
const
|
|
6
|
+
const utils_1 = require("../shared/utils");
|
|
7
7
|
const code_enums_1 = require("../enums/code-enums");
|
|
8
8
|
const enums_1 = require("../enums/enums");
|
|
9
|
-
const my_date_1 = require("../
|
|
9
|
+
const my_date_1 = require("../shared/my-date");
|
|
10
10
|
const aggregation_1 = require("../aggregation/aggregation");
|
|
11
11
|
class DeliveryChallanPrintService {
|
|
12
12
|
static GetChallanDataPrintInfo(OriginalInvoiceData, OriginalEntityData, image, IncludeGST, ConsolidateGST, TaxCodes, IsProforma) {
|
|
13
13
|
var _a, _b;
|
|
14
14
|
let InvoicePrintData = {};
|
|
15
|
-
let argInvoiceData =
|
|
15
|
+
let argInvoiceData = utils_1.TrUtils.Stringify(OriginalInvoiceData);
|
|
16
16
|
if (!IncludeGST) {
|
|
17
17
|
argInvoiceData.Settings.Tax = 'NO';
|
|
18
18
|
}
|
|
19
19
|
InvoicePrintData.IsProforma = IsProforma;
|
|
20
|
-
InvoicePrintData.Settings =
|
|
20
|
+
InvoicePrintData.Settings = utils_1.TrUtils.Stringify(argInvoiceData.Settings);
|
|
21
21
|
let SType;
|
|
22
|
-
if (!
|
|
22
|
+
if (!utils_1.TrUtils.IsNull(argInvoiceData.SType)) {
|
|
23
23
|
SType = argInvoiceData.SType;
|
|
24
24
|
}
|
|
25
25
|
InvoicePrintData = this.GetPrintConditionsBasedOnInput(InvoicePrintData, IncludeGST, ConsolidateGST, SType, argInvoiceData, IsProforma);
|
|
26
26
|
InvoicePrintData.Entity = shared_print_service_1.PrintSharedService.GetFormattedEntityDataForPrint(OriginalEntityData, "Delivery Challan", OriginalInvoiceData);
|
|
27
27
|
InvoicePrintData = shared_print_service_1.PrintSharedService.GetEntityHeaderStyles(InvoicePrintData, OriginalEntityData, image);
|
|
28
28
|
InvoicePrintData = this.GetInvoiceOtherDetailsForPrint(InvoicePrintData, argInvoiceData);
|
|
29
|
-
let IsTaxable = (IncludeGST &&
|
|
29
|
+
let IsTaxable = (IncludeGST && utils_1.TrUtils.isTaxable(argInvoiceData.Settings.Tax)) ? true : false;
|
|
30
30
|
let finalTotalsData = delivery_challan_totals_1.DeliveryChallanTotalsService.GetTotalsValue(argInvoiceData.Items, IsTaxable, true, argInvoiceData.Disc, argInvoiceData.Perc, TaxCodes, true, argInvoiceData.Settings, InvoicePrintData.Entity.Round);
|
|
31
31
|
if (ConsolidateGST) {
|
|
32
32
|
finalTotalsData.CustLaborTotalBeforeDisc = finalTotalsData.CustLaborAfterTax;
|
|
33
33
|
finalTotalsData.CustPartsTotalBeforeDisc = finalTotalsData.CustPartAfterTax;
|
|
34
34
|
}
|
|
35
|
-
InvoicePrintData =
|
|
35
|
+
InvoicePrintData = utils_1.TrUtils.ConcatObjects(InvoicePrintData, finalTotalsData);
|
|
36
36
|
InvoicePrintData.Items = this.GetItemsPrintInfo(InvoicePrintData.Items, ConsolidateGST, TaxCodes, (_b = (_a = OriginalEntityData.Entity.Settings) === null || _a === void 0 ? void 0 : _a.Acc) === null || _b === void 0 ? void 0 : _b.LTot);
|
|
37
37
|
argInvoiceData = this.ReverseItemsForInvoicePrint(argInvoiceData);
|
|
38
38
|
InvoicePrintData.PrintInfo = this.PrepareFormatForInvoicePrint(InvoicePrintData, code_enums_1.ROTypeEnum.Invoice, argInvoiceData.Sts);
|
|
@@ -52,12 +52,12 @@ class DeliveryChallanPrintService {
|
|
|
52
52
|
InvoicePrintData.IncludeGST = IncludeGST;
|
|
53
53
|
InvoicePrintData.ConsolidateGST = ConsolidateGST;
|
|
54
54
|
InvoicePrintData.ShowAccParts = false;
|
|
55
|
-
InvoicePrintData.ShowIGST = (
|
|
55
|
+
InvoicePrintData.ShowIGST = (utils_1.TrUtils.IsNull(SType) || (SType === 'Intra')) ? false : true;
|
|
56
56
|
InvoicePrintData.ShowTaxColumn = (IncludeGST && !ConsolidateGST) ? true : false;
|
|
57
57
|
// InvoicePrintData.ShowDiscountColumn = (!ForInsurance && !ConsolidateGST) ? true : false;
|
|
58
58
|
InvoicePrintData = this.GetInvoiceTypeHeading(InvoicePrintData, OriginalInvoiceData, IncludeGST, ConsolidateGST, IsProforma);
|
|
59
|
-
InvoicePrintData.PrDate =
|
|
60
|
-
InvoicePrintData.BL =
|
|
59
|
+
InvoicePrintData.PrDate = utils_1.TrUtils.IsNull(OriginalInvoiceData.PrDate) ? '' : my_date_1.MyDate.ConvertUTCDateToReadable(OriginalInvoiceData.PrDate);
|
|
60
|
+
InvoicePrintData.BL = utils_1.TrUtils.Stringify(OriginalInvoiceData.BL);
|
|
61
61
|
return InvoicePrintData;
|
|
62
62
|
}
|
|
63
63
|
static GetInvoiceTypeHeading(InvoicePrintData, OriginalInvoiceData, IncludeGST, ConsolidateGST, IsProforma) {
|
|
@@ -83,24 +83,24 @@ class DeliveryChallanPrintService {
|
|
|
83
83
|
let CTaxAmtPerItem = Item.CGST / Item.Qty;
|
|
84
84
|
let STaxAmtPerItem = Item.SGST / Item.Qty;
|
|
85
85
|
let ITaxAmtPerItem = Item.IGST / Item.Qty;
|
|
86
|
-
Item.UnPr =
|
|
86
|
+
Item.UnPr = utils_1.TrUtils.FixPriceValue(AfterDiscForEach + CTaxAmtPerItem + STaxAmtPerItem + ITaxAmtPerItem);
|
|
87
87
|
}
|
|
88
88
|
else {
|
|
89
|
-
Item.UnPr =
|
|
89
|
+
Item.UnPr = utils_1.TrUtils.FixPriceValue(Item.UnPr);
|
|
90
90
|
}
|
|
91
|
-
Item.CGSTAmt =
|
|
92
|
-
Item.SGSTAmt =
|
|
93
|
-
Item.IGSTAmt =
|
|
91
|
+
Item.CGSTAmt = utils_1.TrUtils.FixPriceValue(Item.CGST);
|
|
92
|
+
Item.SGSTAmt = utils_1.TrUtils.FixPriceValue(Item.SGST);
|
|
93
|
+
Item.IGSTAmt = utils_1.TrUtils.FixPriceValue(Item.IGST);
|
|
94
94
|
Item.CGSTPerc = shared_print_service_1.PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
95
95
|
Item.SGSTPerc = shared_print_service_1.PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
96
96
|
Item.IGSTPerc = shared_print_service_1.PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
97
97
|
if (LineTotal === 'AT') {
|
|
98
|
-
Item.LineTotal =
|
|
98
|
+
Item.LineTotal = utils_1.TrUtils.FixPriceValue(Item.AfterPartTax);
|
|
99
99
|
}
|
|
100
100
|
else {
|
|
101
|
-
Item.LineTotal =
|
|
101
|
+
Item.LineTotal = utils_1.TrUtils.FixPriceValue((0, aggregation_1.subtraction)(Item.UnAmt, Item.Disc));
|
|
102
102
|
}
|
|
103
|
-
if (!
|
|
103
|
+
if (!utils_1.TrUtils.IsZero(Item.Qty) && !utils_1.TrUtils.CheckInvalidSelect(Item.UoM)) {
|
|
104
104
|
Item.QtyAndUoM = Item.Qty + ' ' + Item.UoM;
|
|
105
105
|
}
|
|
106
106
|
});
|
|
@@ -124,20 +124,20 @@ class DeliveryChallanPrintService {
|
|
|
124
124
|
Customer.Name = OriginalInvoiceData.ShipTo.Name;
|
|
125
125
|
Customer.Adrs = [];
|
|
126
126
|
Customer.Cons = [];
|
|
127
|
-
if (!
|
|
127
|
+
if (!utils_1.TrUtils.IsNull(OriginalInvoiceData.ShipTo.Adrs)) {
|
|
128
128
|
Customer.Adrs.push(OriginalInvoiceData.ShipTo.Adrs.A1);
|
|
129
|
-
if (!
|
|
129
|
+
if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.ShipTo.Adrs.A2)) {
|
|
130
130
|
Customer.Adrs.push(OriginalInvoiceData.ShipTo.Adrs.A2);
|
|
131
131
|
}
|
|
132
|
-
if (!
|
|
132
|
+
if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.ShipTo.Adrs.Ct)) {
|
|
133
133
|
Customer.Adrs.push(OriginalInvoiceData.ShipTo.Adrs.Ct);
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
Customer.GSTIN = OriginalInvoiceData.ShipTo.GSTIN;
|
|
137
|
-
if (!
|
|
137
|
+
if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.ShipTo.DLNo)) {
|
|
138
138
|
Customer.DLNo = OriginalInvoiceData.ShipTo.DLNo;
|
|
139
139
|
}
|
|
140
|
-
if (!
|
|
140
|
+
if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.ShipTo.Ph)) {
|
|
141
141
|
Customer.Cons = [
|
|
142
142
|
{
|
|
143
143
|
Type: 'M',
|
|
@@ -149,7 +149,7 @@ class DeliveryChallanPrintService {
|
|
|
149
149
|
return InvoicePrintData;
|
|
150
150
|
}
|
|
151
151
|
static GetBillToName(Title, Name) {
|
|
152
|
-
return
|
|
152
|
+
return utils_1.TrUtils.IsEmpty(Title) ? Name : Title + ' ' + Name;
|
|
153
153
|
}
|
|
154
154
|
static GetPaymentsTotal(InvoicePayments, Total, InvoiceStatus) {
|
|
155
155
|
var i = 0;
|
|
@@ -162,7 +162,7 @@ class DeliveryChallanPrintService {
|
|
|
162
162
|
Data.Due = 0;
|
|
163
163
|
}
|
|
164
164
|
else {
|
|
165
|
-
Data.Due =
|
|
165
|
+
Data.Due = utils_1.TrUtils.FixedTo(Total - PaidTotal);
|
|
166
166
|
}
|
|
167
167
|
if (Data.Due < 0) {
|
|
168
168
|
Data.Due = 0;
|
|
@@ -170,7 +170,7 @@ class DeliveryChallanPrintService {
|
|
|
170
170
|
if (Data.Due === 0) {
|
|
171
171
|
Data.Sts = enums_1.InvoiceStatusEnum.Closed;
|
|
172
172
|
}
|
|
173
|
-
Data.Paid =
|
|
173
|
+
Data.Paid = utils_1.TrUtils.FixedTo(PaidTotal);
|
|
174
174
|
return Data;
|
|
175
175
|
}
|
|
176
176
|
}
|