shareneus 1.7.323 → 1.7.324
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/accounting/debit-note/debit-note-print.service.d.ts +5 -0
- package/dist/accounting/debit-note/debit-note-print.service.js +91 -9
- package/dist/shared/transactions-pdf.service.d.ts +1 -0
- package/dist/shared/transactions-pdf.service.js +28 -0
- package/package.json +1 -1
- package/src/accounting/debit-note/debit-note-print.service.ts +103 -17
- package/src/shared/transactions-pdf.service.ts +32 -0
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export declare class DebitNotePrintService {
|
|
2
2
|
static GetDebitNotePrintInfo(OriginalInvoiceData: any, OriginalEntityData: any, image: any, IncludeGST: boolean, ConsolidateGST: boolean, TaxCodes: any, IsProforma: boolean, IsCustBillTo: boolean): any;
|
|
3
|
+
static GetLaborPrintInfo(LaborList: any, Consolidate: boolean, TaxCodes: any, LineTotal: string, DecimalsNumber: number): any;
|
|
4
|
+
static getTaxName(TCode: any, TaxCodes: any): any;
|
|
5
|
+
static GetTaxAmountFromTaxes(item: any, taxCode: string): any;
|
|
6
|
+
static GetTaxRateFromTaxes(item: any, taxCode: string): any;
|
|
7
|
+
static GetTCodeFromTaxes(item: any): any;
|
|
3
8
|
static GetPrintConditionsBasedOnInput(InvoicePrintData: any, IncludeGST: boolean, ConsolidateGST: boolean, SType: any, OriginalInvoiceData: any, IsProforma: boolean, IsBillTo: boolean): any;
|
|
4
9
|
static GetInvoiceTypeHeading(InvoicePrintData: any, OriginalInvoiceData: any, IncludeGST: boolean, ConsolidateGST: boolean, IsProforma: boolean, IsBillTo: boolean): any;
|
|
5
10
|
static GetInvoiceOtherDetailsForPrint(InvoicePrintData: any, OriginalInvoiceData: any, IsCustBillTo: boolean): any;
|
|
@@ -10,7 +10,7 @@ const my_date_1 = require("../../utils/my-date");
|
|
|
10
10
|
const math_operations_1 = require("../../shared/math-operations");
|
|
11
11
|
class DebitNotePrintService {
|
|
12
12
|
static GetDebitNotePrintInfo(OriginalInvoiceData, OriginalEntityData, image, IncludeGST, ConsolidateGST, TaxCodes, IsProforma, IsCustBillTo) {
|
|
13
|
-
var _a, _b, _c, _d;
|
|
13
|
+
var _a, _b, _c, _d, _e, _f;
|
|
14
14
|
let InvoicePrintData = {};
|
|
15
15
|
let argInvoiceData = tr_utils_1.TrUtils.Stringify(OriginalInvoiceData);
|
|
16
16
|
if (!IncludeGST) {
|
|
@@ -31,7 +31,8 @@ class DebitNotePrintService {
|
|
|
31
31
|
finalTotalsData.CustPartsTotalBeforeDisc = finalTotalsData.CustPartAfterTax;
|
|
32
32
|
}
|
|
33
33
|
InvoicePrintData = tr_utils_1.TrUtils.ConcatObjects(InvoicePrintData, finalTotalsData);
|
|
34
|
-
InvoicePrintData.
|
|
34
|
+
InvoicePrintData.Ops = this.GetLaborPrintInfo(InvoicePrintData.Services, ConsolidateGST, TaxCodes, (_b = (_a = OriginalEntityData.Entity.Settings) === null || _a === void 0 ? void 0 : _a.Acc) === null || _b === void 0 ? void 0 : _b.LTot, InvoicePrintData.Entity.DecimalsNumber);
|
|
35
|
+
InvoicePrintData.Items = this.GetItemsPrintInfo(InvoicePrintData.Items, ConsolidateGST, TaxCodes, (_d = (_c = OriginalEntityData.Entity.Settings) === null || _c === void 0 ? void 0 : _c.Acc) === null || _d === void 0 ? void 0 : _d.LTot, (_e = InvoicePrintData.Entity) === null || _e === void 0 ? void 0 : _e.DecimalsNumber);
|
|
35
36
|
argInvoiceData = this.ReverseItemsForInvoicePrint(argInvoiceData);
|
|
36
37
|
InvoicePrintData.PrintInfo = this.PrepareFormatForInvoicePrint(InvoicePrintData, code_enums_1.ROTypeEnum.Invoice, argInvoiceData.Sts);
|
|
37
38
|
InvoicePrintData = this.GetFormattedProductDataForPrint(argInvoiceData, InvoicePrintData);
|
|
@@ -39,7 +40,7 @@ class DebitNotePrintService {
|
|
|
39
40
|
if (tr_utils_1.TrUtils.IsNull(argInvoiceData.Payments)) {
|
|
40
41
|
argInvoiceData.Payments = [];
|
|
41
42
|
}
|
|
42
|
-
let PaymentData = this.GetPaymentsTotal(argInvoiceData.Payments, InvoicePrintData.Total, argInvoiceData.Sts, (
|
|
43
|
+
let PaymentData = this.GetPaymentsTotal(argInvoiceData.Payments, InvoicePrintData.Total, argInvoiceData.Sts, (_f = InvoicePrintData.Entity) === null || _f === void 0 ? void 0 : _f.DecimalsNumber);
|
|
43
44
|
InvoicePrintData.Due = PaymentData.Due;
|
|
44
45
|
InvoicePrintData.Paid = PaymentData.Paid;
|
|
45
46
|
if (!tr_utils_1.TrUtils.IsNull(PaymentData.Sts)) {
|
|
@@ -51,6 +52,78 @@ class DebitNotePrintService {
|
|
|
51
52
|
}
|
|
52
53
|
return InvoicePrintData;
|
|
53
54
|
}
|
|
55
|
+
static GetLaborPrintInfo(LaborList, Consolidate, TaxCodes, LineTotal, DecimalsNumber) {
|
|
56
|
+
LaborList.forEach((Labor) => {
|
|
57
|
+
Labor.HSN = Labor.SAC;
|
|
58
|
+
if (tr_utils_1.TrUtils.IsNull(Labor.Qty)) {
|
|
59
|
+
Labor.Qty = 1;
|
|
60
|
+
}
|
|
61
|
+
if (Consolidate) {
|
|
62
|
+
Labor.UnPr = tr_utils_1.TrUtils.FixedTo(Labor.AfterLaborTax, DecimalsNumber);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
Labor.UnPr = tr_utils_1.TrUtils.FixPriceValue(Labor.Pr, DecimalsNumber);
|
|
66
|
+
}
|
|
67
|
+
if (!tr_utils_1.TrUtils.IsEmpty(Labor.Perc)) {
|
|
68
|
+
Labor.DiscPerc = Labor.Perc;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
Labor.DiscPerc = Labor.Perc;
|
|
72
|
+
if (!tr_utils_1.TrUtils.IsZero(Number(Labor.UnPr))) {
|
|
73
|
+
Labor.DiscPerc = (0, math_operations_1.Divide)((0, math_operations_1.Multiply)(100, Labor.Disc), Labor.UnPr);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
Labor.DiscPerc = 0;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
Labor.TCode = this.GetTCodeFromTaxes(Labor);
|
|
80
|
+
Labor.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromTaxes(Labor, 'CGST'), DecimalsNumber);
|
|
81
|
+
Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromTaxes(Labor, 'SGST'), DecimalsNumber);
|
|
82
|
+
Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromTaxes(Labor, 'IGST'), DecimalsNumber);
|
|
83
|
+
Labor.QtyAndUoM = Labor.Qty.toString();
|
|
84
|
+
Labor.CGSTPerc = this.GetTaxRateFromTaxes(Labor, 'CGST');
|
|
85
|
+
Labor.SGSTPerc = this.GetTaxRateFromTaxes(Labor, 'SGST');
|
|
86
|
+
Labor.IGSTPerc = this.GetTaxRateFromTaxes(Labor, 'IGST');
|
|
87
|
+
Labor.TaxName = this.getTaxName(Labor.TCode, TaxCodes);
|
|
88
|
+
if (LineTotal === 'AT') {
|
|
89
|
+
Labor.LineTotal = tr_utils_1.TrUtils.FixPriceValue(Labor.AfterLaborTax, DecimalsNumber);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
Labor.LineTotal = tr_utils_1.TrUtils.FixPriceValue((0, math_operations_1.Subtract)(Labor.Amt, Labor.Disc), DecimalsNumber);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
return LaborList;
|
|
96
|
+
}
|
|
97
|
+
static getTaxName(TCode, TaxCodes) {
|
|
98
|
+
let Index = TaxCodes.findIndex((TaxCode) => {
|
|
99
|
+
return Number(TCode) === TaxCode._id;
|
|
100
|
+
});
|
|
101
|
+
return (Index !== -1) ? TaxCodes[Index].Name : '';
|
|
102
|
+
}
|
|
103
|
+
static GetTaxAmountFromTaxes(item, taxCode) {
|
|
104
|
+
const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
|
|
105
|
+
const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
106
|
+
if (matchedTaxes.length !== 0) {
|
|
107
|
+
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Amt), 0);
|
|
108
|
+
}
|
|
109
|
+
return 0;
|
|
110
|
+
}
|
|
111
|
+
static GetTaxRateFromTaxes(item, taxCode) {
|
|
112
|
+
const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
|
|
113
|
+
const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
114
|
+
if (matchedTaxes.length !== 0) {
|
|
115
|
+
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Rate), 0);
|
|
116
|
+
}
|
|
117
|
+
return 0;
|
|
118
|
+
}
|
|
119
|
+
static GetTCodeFromTaxes(item) {
|
|
120
|
+
const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
|
|
121
|
+
const matchedTax = taxes.find((tax) => !tr_utils_1.TrUtils.IsNull(tax === null || tax === void 0 ? void 0 : tax.TaxCodeId));
|
|
122
|
+
if (!tr_utils_1.TrUtils.IsNull(matchedTax === null || matchedTax === void 0 ? void 0 : matchedTax.TaxCodeId)) {
|
|
123
|
+
return matchedTax.TaxCodeId;
|
|
124
|
+
}
|
|
125
|
+
return item === null || item === void 0 ? void 0 : item.TCode;
|
|
126
|
+
}
|
|
54
127
|
static GetPrintConditionsBasedOnInput(InvoicePrintData, IncludeGST, ConsolidateGST, SType, OriginalInvoiceData, IsProforma, IsBillTo) {
|
|
55
128
|
InvoicePrintData.For = enums_1.PayTypeEnum.Customer;
|
|
56
129
|
InvoicePrintData.IncludeGST = IncludeGST;
|
|
@@ -102,12 +175,21 @@ class DebitNotePrintService {
|
|
|
102
175
|
else {
|
|
103
176
|
Item.UnPr = tr_utils_1.TrUtils.FixPriceValue(Item.UnPr, DecimalsNumber);
|
|
104
177
|
}
|
|
105
|
-
Item.
|
|
106
|
-
Item.
|
|
107
|
-
Item.
|
|
108
|
-
Item.
|
|
109
|
-
Item.
|
|
110
|
-
Item.
|
|
178
|
+
Item.TCode = this.GetTCodeFromTaxes(Item);
|
|
179
|
+
Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromTaxes(Item, 'CGST'), DecimalsNumber);
|
|
180
|
+
Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromTaxes(Item, 'SGST'), DecimalsNumber);
|
|
181
|
+
Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromTaxes(Item, 'IGST'), DecimalsNumber);
|
|
182
|
+
Item.QtyAndUoM = Item.Qty.toString();
|
|
183
|
+
Item.CGSTPerc = this.GetTaxRateFromTaxes(Item, 'CGST');
|
|
184
|
+
Item.SGSTPerc = this.GetTaxRateFromTaxes(Item, 'SGST');
|
|
185
|
+
Item.IGSTPerc = this.GetTaxRateFromTaxes(Item, 'IGST');
|
|
186
|
+
Item.TaxName = this.getTaxName(Item.TCode, TaxCodes);
|
|
187
|
+
// Item.CGSTAmt = TrUtils.FixPriceValue(Item.CGST, DecimalsNumber);
|
|
188
|
+
// Item.SGSTAmt = TrUtils.FixPriceValue(Item.SGST, DecimalsNumber);
|
|
189
|
+
// Item.IGSTAmt = TrUtils.FixPriceValue(Item.IGST, DecimalsNumber);
|
|
190
|
+
// Item.CGSTPerc = PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
191
|
+
// Item.SGSTPerc = PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
192
|
+
// Item.IGSTPerc = PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
111
193
|
if (LineTotal === 'AT') {
|
|
112
194
|
Item.LineTotal = tr_utils_1.TrUtils.FixPriceValue(Item.AfterPartTax, DecimalsNumber);
|
|
113
195
|
}
|
|
@@ -2,5 +2,6 @@ export declare function GetInvoicePDF(invoiceData: any, entityData: any, headerC
|
|
|
2
2
|
export declare function GetSalesOrderPDF(salesOrderData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image?: any, numberofCopies?: string[], options?: any): any;
|
|
3
3
|
export declare function GetDeliveryChallanPDF(deliveryChallanData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image?: any, numberofCopies?: string[], options?: any): any;
|
|
4
4
|
export declare function GetCreditNotePDF(creditNoteData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image?: any, numberofCopies?: string[], options?: any): any;
|
|
5
|
+
export declare function GetDebitNotePDF(debitNoteData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image?: any, numberofCopies?: string[], options?: any): any;
|
|
5
6
|
export declare function GetSalesReceiptPDF(salesReceiptData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image?: any, numberofCopies?: string[], withPass?: boolean, options?: any): any;
|
|
6
7
|
export declare function GetBillPDF(billData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image?: any): any;
|
|
@@ -4,6 +4,7 @@ exports.GetInvoicePDF = GetInvoicePDF;
|
|
|
4
4
|
exports.GetSalesOrderPDF = GetSalesOrderPDF;
|
|
5
5
|
exports.GetDeliveryChallanPDF = GetDeliveryChallanPDF;
|
|
6
6
|
exports.GetCreditNotePDF = GetCreditNotePDF;
|
|
7
|
+
exports.GetDebitNotePDF = GetDebitNotePDF;
|
|
7
8
|
exports.GetSalesReceiptPDF = GetSalesReceiptPDF;
|
|
8
9
|
exports.GetBillPDF = GetBillPDF;
|
|
9
10
|
const purchase_order_print_service_1 = require("../purchases/purchase-order/purchase-order-print.service");
|
|
@@ -20,6 +21,7 @@ const credit_note_pdf_service_1 = require("../accounting/credit-note/credit-note
|
|
|
20
21
|
const inv_print_service_1 = require("../accounting/invoice/inv-print.service");
|
|
21
22
|
const invoice_pdf_service_1 = require("../accounting/invoice/invoice-pdf/invoice-pdf.service");
|
|
22
23
|
const unified_invoice_pdf_service_1 = require("../accounting/invoice/unified-invoice-pdf.service");
|
|
24
|
+
const debit_note_print_service_1 = require("../accounting/debit-note/debit-note-print.service");
|
|
23
25
|
function GetInvoicePDF(invoiceData, entityData, headerConfig, printConfig, taxCodes, image = null, numberofCopies = ['Original'], withPass = false, options = null) {
|
|
24
26
|
var _a;
|
|
25
27
|
if (!options) {
|
|
@@ -133,6 +135,32 @@ function GetCreditNotePDF(creditNoteData, entityData, headerConfig, printConfig,
|
|
|
133
135
|
}
|
|
134
136
|
return cnPrint;
|
|
135
137
|
}
|
|
138
|
+
function GetDebitNotePDF(debitNoteData, entityData, headerConfig, printConfig, taxCodes, image = null, numberofCopies = ['Original'], options = null) {
|
|
139
|
+
var _a;
|
|
140
|
+
if (!options) {
|
|
141
|
+
options = {
|
|
142
|
+
ShowGST: (((_a = debitNoteData === null || debitNoteData === void 0 ? void 0 : debitNoteData.Settings) === null || _a === void 0 ? void 0 : _a.Tax) === 'TI') ? true : false,
|
|
143
|
+
ConsolidateGST: false,
|
|
144
|
+
Size: 'full',
|
|
145
|
+
MoreDiscDetails: false,
|
|
146
|
+
Orientation: 'portrait'
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const printConfigData = tr_utils_1.TrUtils.ConcatObjects(tr_utils_1.TrUtils.Stringify(headerConfig), tr_utils_1.TrUtils.Stringify(printConfig));
|
|
150
|
+
const debitNotePrintData = debit_note_print_service_1.DebitNotePrintService.GetDebitNotePrintInfo(debitNoteData, entityData, image, true, false, taxCodes, false, true);
|
|
151
|
+
let dnPrint;
|
|
152
|
+
if (options.ConsolidateGST) {
|
|
153
|
+
dnPrint = debit_note_print_service_1.DebitNotePrintService.GetDebitNotePrintInfo(debitNotePrintData, entityData, image, true, true, taxCodes, false, true);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
debitNotePrintData.Round = tr_utils_1.TrUtils.FixedTo(debitNoteData.Round);
|
|
157
|
+
debitNotePrintData.Total = tr_utils_1.TrUtils.FixedTo(debitNoteData.Total);
|
|
158
|
+
debitNotePrintData.SubToal = tr_utils_1.TrUtils.FixedTo(debitNoteData.SubToal);
|
|
159
|
+
debitNotePrintData.TaxTotal = tr_utils_1.TrUtils.FixedTo(debitNoteData.TaxTotal);
|
|
160
|
+
dnPrint = (0, invoice_pdf_service_1.CreateInvoicePDFService)(debitNotePrintData, printConfigData, numberofCopies);
|
|
161
|
+
}
|
|
162
|
+
return dnPrint;
|
|
163
|
+
}
|
|
136
164
|
function GetSalesReceiptPDF(salesReceiptData, entityData, headerConfig, printConfig, taxCodes, image = null, numberofCopies = ['Original'], withPass = false, options = null) {
|
|
137
165
|
var _a;
|
|
138
166
|
if (!options) {
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import { ROTypeEnum } from '../../enums/code-enums';
|
|
|
6
6
|
import { TrUtils } from '../../utils/tr-utils';
|
|
7
7
|
import { InvoiceStatusEnum, PayTypeEnum } from '../../enums/enums';
|
|
8
8
|
import { MyDate } from '../../utils/my-date';
|
|
9
|
-
import { Add, Divide, Subtract } from '../../shared/math-operations';
|
|
9
|
+
import { Add, Divide, Multiply, Subtract } from '../../shared/math-operations';
|
|
10
10
|
|
|
11
11
|
export class DebitNotePrintService {
|
|
12
12
|
|
|
@@ -47,8 +47,8 @@ export class DebitNotePrintService {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
InvoicePrintData = TrUtils.ConcatObjects(InvoicePrintData, finalTotalsData);
|
|
50
|
-
|
|
51
|
-
InvoicePrintData.Items = this.GetItemsPrintInfo(InvoicePrintData.Items, ConsolidateGST, TaxCodes,OriginalEntityData.Entity.Settings?.Acc?.LTot, InvoicePrintData.Entity?.DecimalsNumber);
|
|
50
|
+
InvoicePrintData.Ops = this.GetLaborPrintInfo(InvoicePrintData.Services, ConsolidateGST, TaxCodes, OriginalEntityData.Entity.Settings?.Acc?.LTot, InvoicePrintData.Entity.DecimalsNumber);
|
|
51
|
+
InvoicePrintData.Items = this.GetItemsPrintInfo(InvoicePrintData.Items, ConsolidateGST, TaxCodes, OriginalEntityData.Entity.Settings?.Acc?.LTot, InvoicePrintData.Entity?.DecimalsNumber);
|
|
52
52
|
|
|
53
53
|
argInvoiceData = this.ReverseItemsForInvoicePrint(argInvoiceData);
|
|
54
54
|
|
|
@@ -57,8 +57,8 @@ export class DebitNotePrintService {
|
|
|
57
57
|
InvoicePrintData = this.GetFormattedProductDataForPrint(argInvoiceData, InvoicePrintData);
|
|
58
58
|
|
|
59
59
|
InvoicePrintData = this.GetBillNameForInvoicePrint(argInvoiceData, InvoicePrintData, IsCustBillTo);
|
|
60
|
-
if(TrUtils.IsNull(argInvoiceData.Payments)){
|
|
61
|
-
argInvoiceData.Payments=[];
|
|
60
|
+
if (TrUtils.IsNull(argInvoiceData.Payments)) {
|
|
61
|
+
argInvoiceData.Payments = [];
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
let PaymentData = this.GetPaymentsTotal(argInvoiceData.Payments, InvoicePrintData.Total, argInvoiceData.Sts, InvoicePrintData.Entity?.DecimalsNumber);
|
|
@@ -74,6 +74,83 @@ export class DebitNotePrintService {
|
|
|
74
74
|
return InvoicePrintData;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
static GetLaborPrintInfo(LaborList: any, Consolidate: boolean, TaxCodes: any, LineTotal: string, DecimalsNumber: number) {
|
|
81
|
+
LaborList.forEach((Labor: any) => {
|
|
82
|
+
Labor.HSN = Labor.SAC;
|
|
83
|
+
if (TrUtils.IsNull(Labor.Qty)) {
|
|
84
|
+
Labor.Qty = 1;
|
|
85
|
+
}
|
|
86
|
+
if (Consolidate) {
|
|
87
|
+
Labor.UnPr = TrUtils.FixedTo(Labor.AfterLaborTax, DecimalsNumber);
|
|
88
|
+
} else {
|
|
89
|
+
Labor.UnPr = TrUtils.FixPriceValue(Labor.Pr, DecimalsNumber);
|
|
90
|
+
}
|
|
91
|
+
if (!TrUtils.IsEmpty(Labor.Perc)) {
|
|
92
|
+
Labor.DiscPerc = Labor.Perc;
|
|
93
|
+
} else {
|
|
94
|
+
Labor.DiscPerc = Labor.Perc;
|
|
95
|
+
if (!TrUtils.IsZero(Number(Labor.UnPr))) {
|
|
96
|
+
Labor.DiscPerc = Divide(Multiply(100, Labor.Disc), Labor.UnPr);
|
|
97
|
+
} else {
|
|
98
|
+
Labor.DiscPerc = 0;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
Labor.TCode = this.GetTCodeFromTaxes(Labor);
|
|
102
|
+
Labor.CGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromTaxes(Labor, 'CGST'), DecimalsNumber);
|
|
103
|
+
Labor.SGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromTaxes(Labor, 'SGST'), DecimalsNumber);
|
|
104
|
+
Labor.IGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromTaxes(Labor, 'IGST'), DecimalsNumber);
|
|
105
|
+
Labor.QtyAndUoM = Labor.Qty.toString();
|
|
106
|
+
Labor.CGSTPerc = this.GetTaxRateFromTaxes(Labor, 'CGST');
|
|
107
|
+
Labor.SGSTPerc = this.GetTaxRateFromTaxes(Labor, 'SGST');
|
|
108
|
+
Labor.IGSTPerc = this.GetTaxRateFromTaxes(Labor, 'IGST');
|
|
109
|
+
Labor.TaxName = this.getTaxName(Labor.TCode, TaxCodes);
|
|
110
|
+
if (LineTotal === 'AT') {
|
|
111
|
+
Labor.LineTotal = TrUtils.FixPriceValue(Labor.AfterLaborTax, DecimalsNumber);
|
|
112
|
+
} else {
|
|
113
|
+
Labor.LineTotal = TrUtils.FixPriceValue(Subtract(Labor.Amt, Labor.Disc), DecimalsNumber);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return LaborList;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
static getTaxName(TCode: any, TaxCodes: any) {
|
|
120
|
+
let Index: any = TaxCodes.findIndex((TaxCode: any) => {
|
|
121
|
+
return Number(TCode) === TaxCode._id;
|
|
122
|
+
});
|
|
123
|
+
return (Index !== -1) ? TaxCodes[Index].Name : '';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
static GetTaxAmountFromTaxes(item: any, taxCode: string) {
|
|
127
|
+
const taxes = Array.isArray(item?.Taxes) ? item.Taxes : [];
|
|
128
|
+
const matchedTaxes = taxes.filter((tax: any) => tax?.Code === taxCode);
|
|
129
|
+
if (matchedTaxes.length !== 0) {
|
|
130
|
+
return matchedTaxes.reduce((total: number, tax: any) => Add(total, tax?.Amt), 0);
|
|
131
|
+
}
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
static GetTaxRateFromTaxes(item: any, taxCode: string) {
|
|
137
|
+
const taxes = Array.isArray(item?.Taxes) ? item.Taxes : [];
|
|
138
|
+
const matchedTaxes = taxes.filter((tax: any) => tax?.Code === taxCode);
|
|
139
|
+
if (matchedTaxes.length !== 0) {
|
|
140
|
+
return matchedTaxes.reduce((total: number, tax: any) => Add(total, tax?.Rate), 0);
|
|
141
|
+
}
|
|
142
|
+
return 0;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
static GetTCodeFromTaxes(item: any) {
|
|
146
|
+
const taxes = Array.isArray(item?.Taxes) ? item.Taxes : [];
|
|
147
|
+
const matchedTax = taxes.find((tax: any) => !TrUtils.IsNull(tax?.TaxCodeId));
|
|
148
|
+
if (!TrUtils.IsNull(matchedTax?.TaxCodeId)) {
|
|
149
|
+
return matchedTax.TaxCodeId;
|
|
150
|
+
}
|
|
151
|
+
return item?.TCode;
|
|
152
|
+
}
|
|
153
|
+
|
|
77
154
|
static GetPrintConditionsBasedOnInput(InvoicePrintData: any, IncludeGST: boolean, ConsolidateGST: boolean,
|
|
78
155
|
SType: any, OriginalInvoiceData: any, IsProforma: boolean, IsBillTo: boolean) {
|
|
79
156
|
InvoicePrintData.For = PayTypeEnum.Customer;
|
|
@@ -122,23 +199,32 @@ export class DebitNotePrintService {
|
|
|
122
199
|
return InvoicePrintData;
|
|
123
200
|
}
|
|
124
201
|
|
|
125
|
-
static GetItemsPrintInfo(Items: any, Consolidate: boolean, TaxCodes: any, LineTotal:string, DecimalsNumber: number) {
|
|
202
|
+
static GetItemsPrintInfo(Items: any, Consolidate: boolean, TaxCodes: any, LineTotal: string, DecimalsNumber: number) {
|
|
126
203
|
Items.forEach((Item: any) => {
|
|
127
204
|
if (Consolidate) {
|
|
128
205
|
let AfterDiscForEach = Divide(Item.AfterPartDisc, Item.Qty);
|
|
129
|
-
let CTaxAmtPerItem = Divide(Item.CGST
|
|
130
|
-
let STaxAmtPerItem = Divide(Item.SGST
|
|
131
|
-
let ITaxAmtPerItem = Divide(Item.IGST
|
|
132
|
-
Item.UnPr = TrUtils.FixedTo(Add(AfterDiscForEach
|
|
133
|
-
}else{
|
|
206
|
+
let CTaxAmtPerItem = Divide(Item.CGST, Item.Qty);
|
|
207
|
+
let STaxAmtPerItem = Divide(Item.SGST, Item.Qty);
|
|
208
|
+
let ITaxAmtPerItem = Divide(Item.IGST, Item.Qty);
|
|
209
|
+
Item.UnPr = TrUtils.FixedTo(Add(AfterDiscForEach, CTaxAmtPerItem, STaxAmtPerItem, ITaxAmtPerItem), DecimalsNumber);
|
|
210
|
+
} else {
|
|
134
211
|
Item.UnPr = TrUtils.FixPriceValue(Item.UnPr, DecimalsNumber);
|
|
135
212
|
}
|
|
136
|
-
Item.
|
|
137
|
-
Item.
|
|
138
|
-
Item.
|
|
139
|
-
Item.
|
|
140
|
-
Item.
|
|
141
|
-
Item.
|
|
213
|
+
Item.TCode = this.GetTCodeFromTaxes(Item);
|
|
214
|
+
Item.CGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromTaxes(Item, 'CGST'), DecimalsNumber);
|
|
215
|
+
Item.SGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromTaxes(Item, 'SGST'), DecimalsNumber);
|
|
216
|
+
Item.IGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromTaxes(Item, 'IGST'), DecimalsNumber);
|
|
217
|
+
Item.QtyAndUoM = Item.Qty.toString();
|
|
218
|
+
Item.CGSTPerc = this.GetTaxRateFromTaxes(Item, 'CGST');
|
|
219
|
+
Item.SGSTPerc = this.GetTaxRateFromTaxes(Item, 'SGST');
|
|
220
|
+
Item.IGSTPerc = this.GetTaxRateFromTaxes(Item, 'IGST');
|
|
221
|
+
Item.TaxName = this.getTaxName(Item.TCode, TaxCodes);
|
|
222
|
+
// Item.CGSTAmt = TrUtils.FixPriceValue(Item.CGST, DecimalsNumber);
|
|
223
|
+
// Item.SGSTAmt = TrUtils.FixPriceValue(Item.SGST, DecimalsNumber);
|
|
224
|
+
// Item.IGSTAmt = TrUtils.FixPriceValue(Item.IGST, DecimalsNumber);
|
|
225
|
+
// Item.CGSTPerc = PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
226
|
+
// Item.SGSTPerc = PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
227
|
+
// Item.IGSTPerc = PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
142
228
|
if (LineTotal === 'AT') {
|
|
143
229
|
Item.LineTotal = TrUtils.FixPriceValue(Item.AfterPartTax, DecimalsNumber);
|
|
144
230
|
} else {
|
|
@@ -14,6 +14,7 @@ import { CreditNotePdfService } from "../accounting/credit-note/credit-note-pdf.
|
|
|
14
14
|
import { GetInvoicePrintInfo } from "../accounting/invoice/inv-print.service";
|
|
15
15
|
import { CreateInvoicePDFService } from "../accounting/invoice/invoice-pdf/invoice-pdf.service";
|
|
16
16
|
import { GetInvoicePrint } from "../accounting/invoice/unified-invoice-pdf.service";
|
|
17
|
+
import { DebitNotePrintService } from "../accounting/debit-note/debit-note-print.service";
|
|
17
18
|
|
|
18
19
|
export function GetInvoicePDF(invoiceData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image: any = null, numberofCopies: string[] = ['Original'], withPass: boolean = false, options: any = null) {
|
|
19
20
|
if (!options) {
|
|
@@ -146,6 +147,37 @@ export function GetCreditNotePDF(creditNoteData: any, entityData: any, headerCon
|
|
|
146
147
|
return cnPrint;
|
|
147
148
|
}
|
|
148
149
|
|
|
150
|
+
export function GetDebitNotePDF(debitNoteData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image: any = null, numberofCopies: string[] = ['Original'], options: any = null) {
|
|
151
|
+
if (!options) {
|
|
152
|
+
options = {
|
|
153
|
+
ShowGST: (debitNoteData?.Settings?.Tax === 'TI') ? true : false,
|
|
154
|
+
ConsolidateGST: false,
|
|
155
|
+
Size: 'full',
|
|
156
|
+
MoreDiscDetails: false,
|
|
157
|
+
Orientation: 'portrait'
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
const printConfigData: any = TrUtils.ConcatObjects(
|
|
161
|
+
TrUtils.Stringify(headerConfig),
|
|
162
|
+
TrUtils.Stringify(printConfig)
|
|
163
|
+
);
|
|
164
|
+
const debitNotePrintData: any = DebitNotePrintService.GetDebitNotePrintInfo(debitNoteData, entityData, image,
|
|
165
|
+
true, false, taxCodes, false, true);
|
|
166
|
+
let dnPrint: any;
|
|
167
|
+
if (options.ConsolidateGST) {
|
|
168
|
+
dnPrint = DebitNotePrintService.GetDebitNotePrintInfo(debitNotePrintData,entityData, image,true, true, taxCodes, false, true);
|
|
169
|
+
} else {
|
|
170
|
+
debitNotePrintData.Round = TrUtils.FixedTo(debitNoteData.Round);
|
|
171
|
+
debitNotePrintData.Total = TrUtils.FixedTo(debitNoteData.Total);
|
|
172
|
+
debitNotePrintData.SubToal = TrUtils.FixedTo(debitNoteData.SubToal);
|
|
173
|
+
debitNotePrintData.TaxTotal = TrUtils.FixedTo(debitNoteData.TaxTotal);
|
|
174
|
+
dnPrint = CreateInvoicePDFService(debitNotePrintData, printConfigData, numberofCopies);
|
|
175
|
+
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return dnPrint;
|
|
179
|
+
}
|
|
180
|
+
|
|
149
181
|
|
|
150
182
|
export function GetSalesReceiptPDF(salesReceiptData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image: any = null, numberofCopies: string[] = ['Original'], withPass: boolean = false, options: any = null) {
|
|
151
183
|
if (!options) {
|