shareneus 1.5.47 → 1.5.49

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.
@@ -1,953 +1,869 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnifiedInvoicePdfService = void 0;
3
+ exports.GetInvoicePrint = GetInvoicePrint;
4
+ exports.GetMarginsBasedOnPaperSize = GetMarginsBasedOnPaperSize;
5
+ exports.GetWatermark = GetWatermark;
6
+ exports.GetFileName = GetFileName;
7
+ exports.CommonHeaderDetails = CommonHeaderDetails;
8
+ exports.GetMainHeaderDetails = GetMainHeaderDetails;
9
+ exports.HeaderAfterLine = HeaderAfterLine;
10
+ exports.CustomerAndVehicleDetailsAfterLine = CustomerAndVehicleDetailsAfterLine;
11
+ exports.PreparesparePartsTable = PreparesparePartsTable;
12
+ exports.GetLaborPartsTableForView = GetLaborPartsTableForView;
13
+ exports.WithOutDiscountFieldTable = WithOutDiscountFieldTable;
14
+ exports.BuildTableBodyForLaborAndParts = BuildTableBodyForLaborAndParts;
15
+ exports.GetWithOutDiscAndTaxFieldHeader = GetWithOutDiscAndTaxFieldHeader;
16
+ exports.TaxDataTable = TaxDataTable;
17
+ exports.ConsolidateDataTable = ConsolidateDataTable;
18
+ exports.NoTaxDataTable = NoTaxDataTable;
19
+ exports.buildTableForCustomerLabor = buildTableForCustomerLabor;
20
+ exports.getSummaryHeaders = getSummaryHeaders;
21
+ exports.CommonTotalDetails = CommonTotalDetails;
22
+ exports.GetBanckdetailswithQRCode = GetBanckdetailswithQRCode;
23
+ exports.GetNumberInWords = GetNumberInWords;
24
+ exports.GetGatePass = GetGatePass;
25
+ exports.GetCustomerDetails = GetCustomerDetails;
26
+ exports.GetVehicleDetails = GetVehicleDetails;
27
+ exports.GetLandscapeWithOutDiscountFieldHeader = GetLandscapeWithOutDiscountFieldHeader;
28
+ exports.getLandscapeSummaryHeaders = getLandscapeSummaryHeaders;
29
+ exports.GetLandscapeTaxTableWidths = GetLandscapeTaxTableWidths;
4
30
  const math_operations_1 = require("../../shared/math-operations");
5
31
  const shared_pdf_service_1 = require("../../shared/shared-pdf.service");
6
32
  const shared_print_service_1 = require("../../shared/shared-print.service");
7
33
  const my_date_1 = require("../../utils/my-date");
8
34
  const tr_utils_1 = require("../../utils/tr-utils");
9
- class UnifiedInvoicePdfService {
10
- constructor() {
11
- this.FontSize = 8;
12
- }
13
- static GetInvoicePrint(ROPrintData, numberofCopies, withPass, size = null, moreDiscDetails, orientation = 'portrait') {
14
- const isotherIndustry = false;
15
- var contents = [];
16
- if (tr_utils_1.TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
17
- contents.push(this.CommonHeaderDetails(ROPrintData, null, isotherIndustry, orientation), this.PreparesparePartsTable(ROPrintData, orientation), this.CommonTotalDetails(ROPrintData, null, numberofCopies, withPass, moreDiscDetails, orientation));
18
- }
19
- else {
20
- numberofCopies.forEach((text, index) => {
21
- contents.push(this.CommonHeaderDetails(ROPrintData, text, isotherIndustry, orientation), this.PreparesparePartsTable(ROPrintData, orientation), this.CommonTotalDetails(ROPrintData, index, numberofCopies, withPass, moreDiscDetails, orientation));
22
- });
23
- }
24
- var dd = {
25
- watermark: this.GetWatermark(ROPrintData),
26
- info: {
27
- title: this.GetFileName(ROPrintData),
28
- },
29
- background: function (currentPage, pageSize) {
30
- if (size !== 'full') {
31
- pageSize.height = pageSize.height - 435.945;
32
- }
33
- return shared_pdf_service_1.SharedPDFService.GetWatermarkImage(ROPrintData.Image, pageSize, ROPrintData.Entity.Wmark);
34
- },
35
- header: function (currentPage, pageCount) {
36
- return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
37
- },
38
- pageBreakBefore: function (currentNode, followingNodesOnPage, nodesOnNextPage, previousNodesOnPage) {
39
- return currentNode.startPosition.top >= 700 && !tr_utils_1.TrUtils.IsNull(currentNode === null || currentNode === void 0 ? void 0 : currentNode.id) && (currentNode === null || currentNode === void 0 ? void 0 : currentNode.id) === '567';
40
- },
41
- pageMargins: this.GetMarginsBasedOnPaperSize(size, orientation),
42
- pageOrientation: orientation,
43
- pageSize: 'A4',
44
- content: contents,
45
- styles: shared_pdf_service_1.SharedPDFService.GetStyles()
46
- };
47
- return dd;
35
+ function GetInvoicePrint(invoicePdfData, numberofCopies, withPass, size = null, moreDiscDetails, orientation = 'portrait') {
36
+ const isotherIndustry = false;
37
+ var contents = [];
38
+ if (tr_utils_1.TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
39
+ contents.push(CommonHeaderDetails(invoicePdfData, null, isotherIndustry, orientation), PreparesparePartsTable(invoicePdfData, orientation), CommonTotalDetails(invoicePdfData, null, numberofCopies, withPass, moreDiscDetails, orientation));
48
40
  }
49
- static GetMarginsBasedOnPaperSize(size, orientation = 'portrait') {
50
- if (orientation === 'landscape') {
51
- return [10, 15, 10, 15];
52
- }
53
- if (size === 'full') {
54
- return [10, 15, 10, 15];
55
- }
56
- else {
57
- return [10, 15, 10, 15];
58
- }
41
+ else {
42
+ numberofCopies.forEach((text, index) => {
43
+ contents.push(CommonHeaderDetails(invoicePdfData, text, isotherIndustry, orientation), PreparesparePartsTable(invoicePdfData, orientation), CommonTotalDetails(invoicePdfData, index, numberofCopies, withPass, moreDiscDetails, orientation));
44
+ });
59
45
  }
60
- static GetWatermark(ROPrintData) {
61
- if (ROPrintData.IsProforma && ROPrintData.Entity.Wmark) {
62
- return { text: 'Not a final invoice', opacity: 0.2 };
63
- }
64
- else {
65
- return '';
66
- }
46
+ var dd = {
47
+ watermark: GetWatermark(invoicePdfData),
48
+ info: {
49
+ title: GetFileName(invoicePdfData),
50
+ },
51
+ background: function (currentPage, pageSize) {
52
+ if (size !== 'full') {
53
+ pageSize.height = pageSize.height - 435.945;
54
+ }
55
+ return shared_pdf_service_1.SharedPDFService.GetWatermarkImage(invoicePdfData.Image, pageSize, invoicePdfData.Entity.Wmark);
56
+ },
57
+ header: function (currentPage, pageCount) {
58
+ return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
59
+ },
60
+ pageBreakBefore: function (currentNode, followingNodesOnPage, nodesOnNextPage, previousNodesOnPage) {
61
+ return currentNode.startPosition.top >= 700 && !tr_utils_1.TrUtils.IsNull(currentNode === null || currentNode === void 0 ? void 0 : currentNode.id) && (currentNode === null || currentNode === void 0 ? void 0 : currentNode.id) === '567';
62
+ },
63
+ pageMargins: GetMarginsBasedOnPaperSize(size, orientation),
64
+ pageOrientation: orientation,
65
+ pageSize: 'A4',
66
+ content: contents,
67
+ styles: shared_pdf_service_1.SharedPDFService.GetStyles()
68
+ };
69
+ return dd;
70
+ }
71
+ function GetMarginsBasedOnPaperSize(size, orientation = 'portrait') {
72
+ if (orientation === 'landscape') {
73
+ return [10, 15, 10, 15];
67
74
  }
68
- static GetFileName(ROPrintData) {
69
- let fileName = ROPrintData.HeaderName;
70
- if (!tr_utils_1.TrUtils.IsNull(ROPrintData.Product) && !tr_utils_1.TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
71
- fileName = fileName + '-' + ROPrintData.Product.RegNo;
72
- }
73
- return fileName;
74
- }
75
- static CommonHeaderDetails(ROPrintData, text, isotherIndustry, orientation = 'portrait') {
76
- const headerDetails = [
77
- this.GetMainHeaderDetails(ROPrintData.Entity, ROPrintData.HeaderName, ROPrintData.Image, ROPrintData.HColor, ROPrintData.AColor, text, orientation),
78
- shared_pdf_service_1.SharedPDFService.GetCustomerAndVehicleDetails(ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate, ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.For, ROPrintData.SurName, ROPrintData.SurPhone, ROPrintData.Type, ROPrintData.SurEmail, ROPrintData.InsComp, ROPrintData.PolNo, ROPrintData.PolType, ROPrintData.Customer, ROPrintData.IsProforma, ROPrintData.Settings, ROPrintData.Location, isotherIndustry, ROPrintData.BL, ROPrintData.ROCode, ROPrintData.TypeName, ROPrintData.AdmNo, ROPrintData.DoS, ROPrintData.Entity.PrCustBar, orientation),
79
- shared_pdf_service_1.SharedPDFService.GetOwnerDetails(ROPrintData.Cust, ROPrintData.Type, ROPrintData.For),
80
- this.CustomerAndVehicleDetailsAfterLine(orientation),
81
- shared_pdf_service_1.SharedPDFService.GetDisplayTable(),
82
- ];
83
- return headerDetails;
84
- }
85
- static GetMainHeaderDetails(Entity, HeaderName, Image, HColor, AColor, text, orientation = 'portrait') {
86
- return [
87
- shared_pdf_service_1.SharedPDFService.GetMainHeader(Entity, Image, AColor, HColor, text, orientation),
88
- shared_pdf_service_1.SharedPDFService.GetPrintType(HeaderName),
89
- this.HeaderAfterLine(orientation)
90
- ];
91
- }
92
- static HeaderAfterLine(orientation = 'portrait') {
93
- const lineWidth = orientation === 'landscape' ? 800 : 555;
94
- return {
95
- canvas: [
96
- {
97
- type: 'line',
98
- x1: 0, y1: 0,
99
- x2: lineWidth, y2: 0,
100
- lineWidth: 0.5
101
- }
102
- ], margin: [0, 2, 0, 2]
103
- };
75
+ if (size === 'full') {
76
+ return [10, 15, 10, 15];
104
77
  }
105
- static CustomerAndVehicleDetailsAfterLine(orientation = 'portrait') {
106
- const lineWidth = orientation === 'landscape' ? 800 : 555;
107
- return {
108
- canvas: [
109
- {
110
- type: 'line',
111
- x1: 0, y1: 0,
112
- x2: lineWidth, y2: 0,
113
- lineWidth: 0.5
114
- }
115
- ], margin: [0, 2, 0, 2]
116
- };
78
+ else {
79
+ return [10, 15, 10, 15];
80
+ }
81
+ }
82
+ function GetWatermark(invoicePdfData) {
83
+ if (invoicePdfData.IsProforma && invoicePdfData.Entity.Wmark) {
84
+ return { text: 'Not a final invoice', opacity: 0.2 };
117
85
  }
118
- static PreparesparePartsTable(ROPrintData, orientation = 'portrait') {
119
- let List = [];
120
- const printPartNo = ROPrintData.Entity.MPN;
121
- if (ROPrintData.Entity.Body === 1) {
122
- for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
123
- if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
124
- ROPrintData.PrintInfo[i].Text = '';
86
+ else {
87
+ return '';
88
+ }
89
+ }
90
+ function GetFileName(invoicePdfData) {
91
+ let fileName = invoicePdfData.HeaderName;
92
+ if (!tr_utils_1.TrUtils.IsNull(invoicePdfData.Product) && !tr_utils_1.TrUtils.IsEmpty(invoicePdfData.Product.RegNo)) {
93
+ fileName = fileName + '-' + invoicePdfData.Product.RegNo;
94
+ }
95
+ return fileName;
96
+ }
97
+ function CommonHeaderDetails(invoicePdfData, text, isotherIndustry, orientation = 'portrait') {
98
+ const headerDetails = [
99
+ GetMainHeaderDetails(invoicePdfData.Entity, invoicePdfData.HeaderName, invoicePdfData.Image, invoicePdfData.HColor, invoicePdfData.AColor, text, orientation),
100
+ shared_pdf_service_1.SharedPDFService.GetCustomerAndVehicleDetails(invoicePdfData._id, invoicePdfData.CrDate, invoicePdfData.PrDate, invoicePdfData.MOut, invoicePdfData.MIn, invoicePdfData.Product, invoicePdfData.PrintType, invoicePdfData.For, invoicePdfData.SurName, invoicePdfData.SurPhone, invoicePdfData.Type, invoicePdfData.SurEmail, invoicePdfData.InsComp, invoicePdfData.PolNo, invoicePdfData.PolType, invoicePdfData.Customer, invoicePdfData.IsProforma, invoicePdfData.Settings, invoicePdfData.Location, isotherIndustry, invoicePdfData.BL, invoicePdfData.ROCode, invoicePdfData.TypeName, invoicePdfData.AdmNo, invoicePdfData.DoS, invoicePdfData.Entity.PrCustBar, orientation),
101
+ shared_pdf_service_1.SharedPDFService.GetOwnerDetails(invoicePdfData.Cust, invoicePdfData.Type, invoicePdfData.For),
102
+ CustomerAndVehicleDetailsAfterLine(orientation),
103
+ shared_pdf_service_1.SharedPDFService.GetDisplayTable(),
104
+ ];
105
+ return headerDetails;
106
+ }
107
+ function GetMainHeaderDetails(Entity, HeaderName, Image, HColor, AColor, text, orientation = 'portrait') {
108
+ return [
109
+ shared_pdf_service_1.SharedPDFService.GetMainHeader(Entity, Image, AColor, HColor, text, orientation),
110
+ shared_pdf_service_1.SharedPDFService.GetPrintType(HeaderName),
111
+ HeaderAfterLine(orientation)
112
+ ];
113
+ }
114
+ function HeaderAfterLine(orientation = 'portrait') {
115
+ const lineWidth = orientation === 'landscape' ? 820 : 575;
116
+ return {
117
+ canvas: [
118
+ {
119
+ type: 'line',
120
+ x1: 0, y1: 0,
121
+ x2: lineWidth, y2: 0,
122
+ lineWidth: 0.5
123
+ }
124
+ ], margin: [0, 2, 0, 2]
125
+ };
126
+ }
127
+ function CustomerAndVehicleDetailsAfterLine(orientation = 'portrait') {
128
+ const lineWidth = orientation === 'landscape' ? 820 : 575;
129
+ return {
130
+ canvas: [
131
+ {
132
+ type: 'line',
133
+ x1: 0, y1: 0,
134
+ x2: lineWidth, y2: 0,
135
+ lineWidth: 0.5
136
+ }
137
+ ], margin: [0, 2, 0, 2]
138
+ };
139
+ }
140
+ function PreparesparePartsTable(invoicePdfData, orientation = 'portrait') {
141
+ let List = [];
142
+ const printPartNo = invoicePdfData.Entity.MPN;
143
+ if (invoicePdfData.Entity.Body === 1) {
144
+ for (let i = 0; i < invoicePdfData.PrintInfo.length; i++) {
145
+ if (tr_utils_1.TrUtils.IsNull(invoicePdfData.PrintInfo[i].Text)) {
146
+ invoicePdfData.PrintInfo[i].Text = '';
147
+ }
148
+ List.push(invoicePdfData.PrintInfo[i].Text, GetLaborPartsTableForView(tr_utils_1.TrUtils.Stringify(invoicePdfData.PrintInfo[i].Items), tr_utils_1.TrUtils.Stringify(invoicePdfData.PrintInfo[i].Ops), printPartNo, orientation));
149
+ }
150
+ }
151
+ else {
152
+ if (invoicePdfData.Entity.Body === 2) {
153
+ for (let i = 0; i < invoicePdfData.PrintInfo.length; i++) {
154
+ if (tr_utils_1.TrUtils.IsNull(invoicePdfData.PrintInfo[i].Text)) {
155
+ invoicePdfData.PrintInfo[i].Text = '';
125
156
  }
126
- List.push(ROPrintData.PrintInfo[i].Text, this.GetLaborPartsTableForView(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), printPartNo, orientation));
157
+ List.push(invoicePdfData.PrintInfo[i].Text, WithOutDiscountFieldTable(tr_utils_1.TrUtils.Stringify(invoicePdfData.PrintInfo[i].Items), tr_utils_1.TrUtils.Stringify(invoicePdfData.PrintInfo[i].Ops), invoicePdfData.ShowTaxColumn, printPartNo, invoicePdfData.Entity.Body, invoicePdfData.ShowIGST, invoicePdfData.ConsolidateGST, invoicePdfData.ShowDiscountColumn, invoicePdfData.Entity.DecimalsNumber, invoicePdfData, orientation));
127
158
  }
128
159
  }
129
160
  else {
130
- if (ROPrintData.Entity.Body === 2) {
131
- for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
132
- if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
133
- ROPrintData.PrintInfo[i].Text = '';
134
- }
135
- List.push(ROPrintData.PrintInfo[i].Text, this.WithOutDiscountFieldTable(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.ShowTaxColumn, printPartNo, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn, ROPrintData.Entity.DecimalsNumber, ROPrintData, orientation));
136
- }
161
+ if (invoicePdfData.Summary) {
162
+ List.push('', GetLaborPartsTableForView(invoicePdfData.Items, invoicePdfData.Ops, printPartNo, orientation));
137
163
  }
138
164
  else {
139
- if (ROPrintData.Summary) {
140
- List.push('', this.GetLaborPartsTableForView(ROPrintData.Items, ROPrintData.Ops, printPartNo, orientation));
141
- }
142
- else {
143
- for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
144
- if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
145
- ROPrintData.PrintInfo[i].Text = '';
146
- }
147
- List.push(ROPrintData.PrintInfo[i].Text, this.GetWithOutDiscAndTaxFieldHeader(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.ShowTaxColumn, printPartNo, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn, ROPrintData.Entity.DecimalsNumber, ROPrintData, orientation));
165
+ for (let i = 0; i < invoicePdfData.PrintInfo.length; i++) {
166
+ if (tr_utils_1.TrUtils.IsNull(invoicePdfData.PrintInfo[i].Text)) {
167
+ invoicePdfData.PrintInfo[i].Text = '';
148
168
  }
169
+ List.push(invoicePdfData.PrintInfo[i].Text, GetWithOutDiscAndTaxFieldHeader(tr_utils_1.TrUtils.Stringify(invoicePdfData.PrintInfo[i].Items), tr_utils_1.TrUtils.Stringify(invoicePdfData.PrintInfo[i].Ops), invoicePdfData.ShowTaxColumn, printPartNo, invoicePdfData.Entity.Body, invoicePdfData.ShowIGST, invoicePdfData.ConsolidateGST, invoicePdfData.ShowDiscountColumn, invoicePdfData.Entity.DecimalsNumber, invoicePdfData, orientation));
149
170
  }
150
171
  }
151
172
  }
152
- return List;
153
- }
154
- static GetLaborPartsTableForView(Parts, Ops, PrintPartNo, orientation = 'portrait') {
155
- if (Parts.length !== 0 || Ops.length !== 0) {
156
- if (PrintPartNo) {
157
- const widths = orientation === 'landscape' ? [15, 30, 140, 40, 35, 35, 25, 25, 35, 30, 50] : [25, 30, 170, 85, 15, 20, 50, 30, 30, 50];
158
- return {
159
- style: 'tableExample',
160
- table: {
161
- widths: widths,
162
- body: this.buildTableForCustomerLabor(Parts, Ops, PrintPartNo, false, orientation)
163
- },
164
- layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
165
- };
166
- }
167
- else {
168
- const widths = orientation === 'landscape' ? [15, 180, 40, 35, 35, 25, 25, 35, 30, 50] : [25, 200, 55, 25, 55, 55, 40, 15, 50];
169
- return {
170
- style: 'tableExample',
171
- table: {
172
- widths: widths,
173
- body: this.buildTableForCustomerLabor(Parts, Ops, PrintPartNo, false, orientation)
174
- },
175
- layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
176
- };
177
- }
173
+ }
174
+ return List;
175
+ }
176
+ function GetLaborPartsTableForView(Parts, Ops, PrintPartNo, orientation = 'portrait') {
177
+ if (Parts.length !== 0 || Ops.length !== 0) {
178
+ if (PrintPartNo) {
179
+ const widths = orientation === 'landscape' ? [15, 30, 140, 40, 35, 35, 25, 25, 35, 30, 50] : [25, 30, 170, 85, 15, 20, 50, 30, 30, 50];
180
+ return {
181
+ style: 'tableExample',
182
+ table: {
183
+ widths: widths,
184
+ body: buildTableForCustomerLabor(Parts, Ops, PrintPartNo, false, orientation)
185
+ },
186
+ layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
187
+ };
178
188
  }
179
189
  else {
180
- let a = '';
181
- return a;
190
+ const widths = orientation === 'landscape' ? [15, 180, 40, 35, 35, 25, 25, 35, 30, 50] : [25, 200, 55, 25, 55, 55, 40, 15, 50];
191
+ return {
192
+ style: 'tableExample',
193
+ table: {
194
+ widths: widths,
195
+ body: buildTableForCustomerLabor(Parts, Ops, PrintPartNo, false, orientation)
196
+ },
197
+ layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
198
+ };
182
199
  }
183
200
  }
184
- static WithOutDiscountFieldTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, ROPrintData, orientation = 'portrait') {
185
- if (Parts.length !== 0 || Ops.length !== 0) {
186
- if (PrintPartNo) {
187
- const widths = orientation === 'landscape' ? this.GetLandscapeTaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn) : [25, 60, 155, 30, 50, 60, 30, 50];
188
- return {
189
- style: 'tableExample',
190
- marginLeft: 20,
191
- table: {
192
- widths: widths,
193
- headerRows: orientation === 'landscape' ? 2 : 1,
194
- body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation)
195
- },
196
- layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
197
- };
198
- }
199
- else {
200
- const widths = orientation === 'landscape' ? this.GetLandscapeTaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn) : [25, 215, 25, 50, 60, 45, 50];
201
- return {
202
- style: 'tableExample',
203
- marginLeft: 20,
204
- table: {
205
- widths: widths,
206
- headerRows: orientation === 'landscape' ? 2 : 1,
207
- body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation)
208
- },
209
- layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
210
- };
211
- }
201
+ else {
202
+ let a = '';
203
+ return a;
204
+ }
205
+ }
206
+ function WithOutDiscountFieldTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, invoicePdfData, orientation = 'portrait') {
207
+ if (Parts.length !== 0 || Ops.length !== 0) {
208
+ if (PrintPartNo) {
209
+ const widths = orientation === 'landscape' ? GetLandscapeTaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn) : [25, 60, 155, 30, 50, 60, 30, 50];
210
+ return {
211
+ style: 'tableExample',
212
+ marginLeft: 20,
213
+ table: {
214
+ widths: widths,
215
+ headerRows: orientation === 'landscape' ? 2 : 1,
216
+ body: BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation)
217
+ },
218
+ layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
219
+ };
212
220
  }
213
221
  else {
214
- let a = '';
215
- return a;
222
+ const widths = orientation === 'landscape' ? GetLandscapeTaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn) : [25, 215, 25, 50, 60, 45, 50];
223
+ return {
224
+ style: 'tableExample',
225
+ marginLeft: 20,
226
+ table: {
227
+ widths: widths,
228
+ headerRows: orientation === 'landscape' ? 2 : 1,
229
+ body: BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation)
230
+ },
231
+ layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
232
+ };
216
233
  }
217
234
  }
218
- static BuildTableBodyForLaborAndParts(Parts, Labor, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation = 'portrait') {
219
- var body = [];
220
- let columns = orientation === 'landscape' ? this.GetLandscapeWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn) : shared_print_service_1.PrintSharedService.GetWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
221
- for (let i = 0; i < columns.length; i++) {
222
- body.push(columns[i]);
223
- }
224
- columns = columns[1];
225
- const partsLabel = 'Items';
226
- const partsTotalLabel = 'Items Total';
227
- const laborLabel = 'Service';
228
- const laborTotalLabel = 'Service Total';
229
- if (Parts.length !== 0) {
230
- let Qty = 0;
231
- let CGSTAMT = 0;
232
- let SGSTAMT = 0;
233
- let IGSTAMT = 0;
234
- let Taxable = 0;
235
- let FinalTotal = 0;
236
- Parts.forEach((part) => {
237
- Qty = (0, math_operations_1.Add)(Qty, tr_utils_1.TrUtils.FixedTo(part.Qty, DecimalsNumber));
238
- CGSTAMT = (0, math_operations_1.Add)(CGSTAMT, tr_utils_1.TrUtils.FixedTo(part.CGSTAmt, DecimalsNumber));
239
- SGSTAMT = (0, math_operations_1.Add)(SGSTAMT, tr_utils_1.TrUtils.FixedTo(part.SGSTAmt, DecimalsNumber));
240
- IGSTAMT = (0, math_operations_1.Add)(IGSTAMT, tr_utils_1.TrUtils.FixedTo(part.IGSTAmt, DecimalsNumber));
241
- Taxable = (0, math_operations_1.Add)(Taxable, tr_utils_1.TrUtils.FixedTo(part.AfterPartDisc, DecimalsNumber));
242
- FinalTotal = (0, math_operations_1.Add)(FinalTotal, tr_utils_1.TrUtils.FixedTo(part.AfterPartTax, DecimalsNumber));
243
- });
244
- let dpartadding1 = {};
245
- dpartadding1.SNo = '';
246
- dpartadding1.Desc = partsTotalLabel;
247
- dpartadding1.QtyAndUoM = tr_utils_1.TrUtils.FixedTo(Qty, DecimalsNumber);
248
- dpartadding1.bold = true;
249
- dpartadding1.UnPr = tr_utils_1.TrUtils.FixedTo(Taxable, DecimalsNumber);
250
- dpartadding1.SGSTAmt = tr_utils_1.TrUtils.FixedTo(SGSTAMT, DecimalsNumber);
251
- dpartadding1.IGSTAmt = tr_utils_1.TrUtils.FixedTo(IGSTAMT, DecimalsNumber);
252
- dpartadding1.CGSTAmt = tr_utils_1.TrUtils.FixedTo(CGSTAMT, DecimalsNumber);
253
- dpartadding1.TCode = ShowTaxColumn ? 114 : undefined;
254
- dpartadding1.LineTotal = tr_utils_1.TrUtils.FixPriceValue(FinalTotal, DecimalsNumber);
255
- Parts.push({ SNo: '' });
256
- Parts.push(dpartadding1);
257
- let dummypartadding1 = {};
258
- dummypartadding1.SNo = '';
259
- dummypartadding1.Desc = partsLabel;
260
- dummypartadding1.Qty = '';
261
- dummypartadding1.UnPr = '';
262
- dummypartadding1.LineTotal = '';
263
- Parts.unshift(dummypartadding1);
235
+ else {
236
+ let a = '';
237
+ return a;
238
+ }
239
+ }
240
+ function calculatePartsTotals(Parts, DecimalsNumber) {
241
+ let Qty = 0;
242
+ let CGSTAMT = 0;
243
+ let SGSTAMT = 0;
244
+ let IGSTAMT = 0;
245
+ let Taxable = 0;
246
+ let FinalTotal = 0;
247
+ Parts.forEach((part) => {
248
+ Qty = (0, math_operations_1.Add)(Qty, tr_utils_1.TrUtils.FixedTo(part.Qty, DecimalsNumber));
249
+ CGSTAMT = (0, math_operations_1.Add)(CGSTAMT, tr_utils_1.TrUtils.FixedTo(part.CGSTAmt, DecimalsNumber));
250
+ SGSTAMT = (0, math_operations_1.Add)(SGSTAMT, tr_utils_1.TrUtils.FixedTo(part.SGSTAmt, DecimalsNumber));
251
+ IGSTAMT = (0, math_operations_1.Add)(IGSTAMT, tr_utils_1.TrUtils.FixedTo(part.IGSTAmt, DecimalsNumber));
252
+ Taxable = (0, math_operations_1.Add)(Taxable, tr_utils_1.TrUtils.FixedTo(part.AfterPartDisc, DecimalsNumber));
253
+ FinalTotal = (0, math_operations_1.Add)(FinalTotal, tr_utils_1.TrUtils.FixedTo(part.AfterPartTax, DecimalsNumber));
254
+ });
255
+ return { Qty, CGSTAMT, SGSTAMT, IGSTAMT, Taxable, FinalTotal };
256
+ }
257
+ function calculateLaborTotals(Labor, DecimalsNumber) {
258
+ let CGSTAMT = 0;
259
+ let SGSTAMT = 0;
260
+ let IGSTAMT = 0;
261
+ let Taxable = 0;
262
+ let FinalTotal = 0;
263
+ Labor.forEach((operation) => {
264
+ CGSTAMT = (0, math_operations_1.Add)(CGSTAMT, tr_utils_1.TrUtils.FixedTo(operation.CGSTAmt, DecimalsNumber));
265
+ SGSTAMT = (0, math_operations_1.Add)(SGSTAMT, tr_utils_1.TrUtils.FixedTo(operation.SGSTAmt, DecimalsNumber));
266
+ IGSTAMT = (0, math_operations_1.Add)(IGSTAMT, tr_utils_1.TrUtils.FixedTo(operation.IGSTAmt, DecimalsNumber));
267
+ Taxable = (0, math_operations_1.Add)(Taxable, tr_utils_1.TrUtils.FixedTo(operation.AfterLaborDisc, DecimalsNumber));
268
+ FinalTotal = (0, math_operations_1.Add)(FinalTotal, tr_utils_1.TrUtils.FixedTo(operation.AfterLaborTax, DecimalsNumber));
269
+ });
270
+ return { CGSTAMT, SGSTAMT, IGSTAMT, Taxable, FinalTotal };
271
+ }
272
+ function addPartsHeaderAndTotalRows(Parts, partsLabel, partsTotalLabel, ShowTaxColumn, DecimalsNumber) {
273
+ const totals = calculatePartsTotals(Parts, DecimalsNumber);
274
+ let dpartadding1 = {};
275
+ dpartadding1.SNo = '';
276
+ dpartadding1.Desc = partsTotalLabel;
277
+ dpartadding1.QtyAndUoM = tr_utils_1.TrUtils.FixedTo(totals.Qty, DecimalsNumber);
278
+ dpartadding1.bold = true;
279
+ dpartadding1.UnPr = tr_utils_1.TrUtils.FixedTo(totals.Taxable, DecimalsNumber);
280
+ dpartadding1.SGSTAmt = tr_utils_1.TrUtils.FixedTo(totals.SGSTAMT, DecimalsNumber);
281
+ dpartadding1.IGSTAmt = tr_utils_1.TrUtils.FixedTo(totals.IGSTAMT, DecimalsNumber);
282
+ dpartadding1.CGSTAmt = tr_utils_1.TrUtils.FixedTo(totals.CGSTAMT, DecimalsNumber);
283
+ dpartadding1.TCode = ShowTaxColumn ? 114 : undefined;
284
+ dpartadding1.LineTotal = tr_utils_1.TrUtils.FixPriceValue(totals.FinalTotal, DecimalsNumber);
285
+ Parts.push({ SNo: '' });
286
+ Parts.push(dpartadding1);
287
+ let dummypartadding1 = {};
288
+ dummypartadding1.SNo = '';
289
+ dummypartadding1.Desc = partsLabel;
290
+ dummypartadding1.Qty = '';
291
+ dummypartadding1.UnPr = '';
292
+ dummypartadding1.LineTotal = '';
293
+ Parts.unshift(dummypartadding1);
294
+ }
295
+ function addLaborHeaderAndTotalRows(Labor, laborLabel, laborTotalLabel, ShowTaxColumn, DecimalsNumber) {
296
+ const totals = calculateLaborTotals(Labor, DecimalsNumber);
297
+ let dpartadding1 = {};
298
+ dpartadding1.SNo = '';
299
+ dpartadding1.Desc = laborTotalLabel;
300
+ dpartadding1.UnPr = tr_utils_1.TrUtils.FixedTo(totals.Taxable, DecimalsNumber);
301
+ dpartadding1.SGSTAmt = tr_utils_1.TrUtils.FixedTo(totals.SGSTAMT, DecimalsNumber);
302
+ dpartadding1.IGSTAmt = tr_utils_1.TrUtils.FixedTo(totals.IGSTAMT, DecimalsNumber);
303
+ dpartadding1.CGSTAmt = tr_utils_1.TrUtils.FixedTo(totals.CGSTAMT, DecimalsNumber);
304
+ dpartadding1.TCode = ShowTaxColumn ? 114 : undefined;
305
+ dpartadding1.bold = true;
306
+ dpartadding1.LineTotal = tr_utils_1.TrUtils.FixPriceValue(totals.FinalTotal, DecimalsNumber);
307
+ Labor.push({ SNo: '' });
308
+ Labor.push(dpartadding1);
309
+ let dummypartadding1 = {};
310
+ dummypartadding1.SNo = '';
311
+ dummypartadding1.Desc = laborLabel;
312
+ dummypartadding1.Qty = '';
313
+ dummypartadding1.UnPr = '';
314
+ dummypartadding1.LineTotal = '';
315
+ Labor.unshift(dummypartadding1);
316
+ }
317
+ function buildItemRow(item, columns, column, itemLabel) {
318
+ const hasValue = !tr_utils_1.TrUtils.IsFixedZero(item[column.Field]) && !tr_utils_1.TrUtils.IsNull(item[column.Field]) || (column.text === 'Line Total');
319
+ if (hasValue) {
320
+ if (item[column.Field] === itemLabel) {
321
+ return { text: item[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' };
264
322
  }
265
- let SNo = 1;
266
- Parts.forEach((part) => {
267
- var dataRow = [];
268
- columns.forEach((column) => {
269
- const hasValue = !tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field]) || (column.text === 'Line Total');
270
- if (hasValue) {
271
- if (part[column.Field] === partsLabel) {
272
- dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
273
- }
274
- else {
275
- if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
276
- && tr_utils_1.TrUtils.CheckInvalidSelect(part.TCode))) {
277
- part[column.Field] = '';
278
- dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
323
+ else {
324
+ if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
325
+ && tr_utils_1.TrUtils.CheckInvalidSelect(item.TCode))) {
326
+ item[column.Field] = '';
327
+ return { text: item[column.Field].toString(), alignment: 'center' };
328
+ }
329
+ else {
330
+ if (column.text === 'Line Total' || column.Field === 'UnPr' || column.Field === 'MRP' || column.Field === 'Batch' || column.Field === 'ExDate' || column.Field === 'QtyAndUoM'
331
+ || column.text === 'Tax' || column.Field === 'Disc' || column.Field === 'Perc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
332
+ || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc' || column.Field === 'Price') {
333
+ if (column.Field === 'Disc') {
334
+ if (column.type === 'percentage') {
335
+ if (!tr_utils_1.TrUtils.IsEmpty(item[column.Field])) {
336
+ return { text: item[column.Field].toString(), noWrap: true, alignment: 'center' };
337
+ }
338
+ else {
339
+ return { text: '', noWrap: true };
340
+ }
279
341
  }
280
342
  else {
281
- if (column.text === 'Line Total' || column.Field === 'UnPr' || column.Field === 'MRP' || column.Field === 'Batch' || column.Field === 'ExDate' || column.Field === 'QtyAndUoM'
282
- || column.text === 'Tax' || column.Field === 'Disc' || column.Field === 'Perc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
283
- || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
284
- if (column.Field === 'Disc') {
285
- if (column.type === 'percentage') {
286
- if (!tr_utils_1.TrUtils.IsEmpty(part[column.Field])) {
287
- dataRow.push({ text: part[column.Field].toString(), noWrap: true, alignment: 'center' });
288
- }
289
- else {
290
- dataRow.push({ text: '', noWrap: true });
291
- }
292
- }
293
- else {
294
- if (!tr_utils_1.TrUtils.IsNull(part[column.Field])) {
295
- dataRow.push({ text: part[column.Field].toString(), alignment: 'right', noWrap: true });
296
- }
297
- else {
298
- dataRow.push({ text: '', noWrap: true });
299
- }
300
- }
301
- }
302
- else {
303
- if (column.Field === 'Batch') {
304
- if (!tr_utils_1.TrUtils.IsNull(part[column.Field])) {
305
- dataRow.push({ text: part[column.Field].BN, nowrap: true });
306
- }
307
- else {
308
- dataRow.push({ text: '', noWrap: true });
309
- }
310
- }
311
- else if (column.Field === 'ExDate') {
312
- if (!tr_utils_1.TrUtils.IsNull(part['Batch'])) {
313
- dataRow.push({ text: my_date_1.MyDate.ConvertUTCDateToReadableExDate(part['Batch'].ExDt), nowrap: true });
314
- }
315
- else {
316
- dataRow.push({ text: '', noWrap: true });
317
- }
318
- }
319
- else {
320
- if (!tr_utils_1.TrUtils.IsNull(part[column.Field])) {
321
- dataRow.push({ text: part[column.Field].toString(), bold: part.bold, alignment: 'right', nowrap: true });
322
- }
323
- else {
324
- dataRow.push({ text: '', noWrap: true });
325
- }
326
- }
327
- }
343
+ if (!tr_utils_1.TrUtils.IsNull(item[column.Field])) {
344
+ return { text: item[column.Field].toString(), alignment: 'right', noWrap: true };
328
345
  }
329
346
  else {
330
- if (column.Field === 'Desc') {
331
- let DescData = [];
332
- DescData.push({ text: part[column.Field].toString(), bold: part.bold });
333
- if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
334
- DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
335
- }
336
- dataRow.push({ stack: DescData });
337
- }
338
- else {
339
- dataRow.push({ text: part[column.Field].toString() });
340
- }
347
+ return { text: '', noWrap: true };
341
348
  }
342
349
  }
343
350
  }
344
- }
345
- else {
346
- if (column.Field === 'SNo') {
347
- part[column.Field] = SNo;
348
- SNo = SNo + 1;
349
- }
350
351
  else {
351
- if (tr_utils_1.TrUtils.IsNull(part[column.Field])) {
352
- part[column.Field] = '';
352
+ if (column.Field === 'Batch') {
353
+ if (!tr_utils_1.TrUtils.IsNull(item[column.Field])) {
354
+ return { text: item[column.Field].BN, nowrap: true };
355
+ }
356
+ else {
357
+ return { text: '', noWrap: true };
358
+ }
353
359
  }
354
- }
355
- dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
356
- }
357
- });
358
- body.push(dataRow);
359
- });
360
- SNo = 1;
361
- if (Labor.length !== 0) {
362
- let CGSTAMT = 0;
363
- let SGSTAMT = 0;
364
- let IGSTAMT = 0;
365
- let Taxable = 0;
366
- let FinalTotal = 0;
367
- Labor.forEach((operation) => {
368
- CGSTAMT = (0, math_operations_1.Add)(CGSTAMT, tr_utils_1.TrUtils.FixedTo(operation.CGSTAmt, DecimalsNumber));
369
- SGSTAMT = (0, math_operations_1.Add)(SGSTAMT, tr_utils_1.TrUtils.FixedTo(operation.SGSTAmt, DecimalsNumber));
370
- IGSTAMT = (0, math_operations_1.Add)(IGSTAMT, tr_utils_1.TrUtils.FixedTo(operation.IGSTAmt, DecimalsNumber));
371
- Taxable = (0, math_operations_1.Add)(Taxable, tr_utils_1.TrUtils.FixedTo(operation.AfterLaborDisc, DecimalsNumber));
372
- FinalTotal = (0, math_operations_1.Add)(FinalTotal, tr_utils_1.TrUtils.FixedTo(operation.AfterLaborTax, DecimalsNumber));
373
- });
374
- let dpartadding1 = {};
375
- dpartadding1.SNo = '';
376
- dpartadding1.Desc = laborTotalLabel;
377
- dpartadding1.UnPr = tr_utils_1.TrUtils.FixedTo(Taxable, DecimalsNumber);
378
- dpartadding1.SGSTAmt = tr_utils_1.TrUtils.FixedTo(SGSTAMT, DecimalsNumber);
379
- dpartadding1.IGSTAmt = tr_utils_1.TrUtils.FixedTo(IGSTAMT, DecimalsNumber);
380
- dpartadding1.CGSTAmt = tr_utils_1.TrUtils.FixedTo(CGSTAMT, DecimalsNumber);
381
- dpartadding1.TCode = ShowTaxColumn ? 114 : undefined;
382
- dpartadding1.bold = true;
383
- dpartadding1.LineTotal = tr_utils_1.TrUtils.FixPriceValue(FinalTotal, DecimalsNumber);
384
- Labor.push({ SNo: '' });
385
- Labor.push(dpartadding1);
386
- let dummypartadding1 = {};
387
- dummypartadding1.SNo = '';
388
- dummypartadding1.Desc = laborLabel;
389
- dummypartadding1.Qty = '';
390
- dummypartadding1.UnPr = '';
391
- dummypartadding1.LineTotal = '';
392
- Labor.unshift(dummypartadding1);
393
- }
394
- if (Body === 2) {
395
- for (let i = 0; i < Labor.length; i++) {
396
- Labor[i].UnPr = '';
397
- }
398
- }
399
- Labor.forEach((Ops) => {
400
- var dataRow = [];
401
- columns.forEach((column) => {
402
- const hasValue = !tr_utils_1.TrUtils.IsFixedZero(Ops[column.Field]) && !tr_utils_1.TrUtils.IsNull(Ops[column.Field]) || (column.text === 'Line Total');
403
- if (hasValue) {
404
- if (Ops[column.Field] === laborLabel) {
405
- dataRow.push({ text: Ops[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
406
- }
407
- else {
408
- if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
409
- && tr_utils_1.TrUtils.CheckInvalidSelect(Ops.TCode))) {
410
- Ops[column.Field] = '';
411
- dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
360
+ else if (column.Field === 'ExDate') {
361
+ if (!tr_utils_1.TrUtils.IsNull(item['Batch'])) {
362
+ return { text: my_date_1.MyDate.ConvertUTCDateToReadableExDate(item['Batch'].ExDt), nowrap: true };
363
+ }
364
+ else {
365
+ return { text: '', noWrap: true };
366
+ }
412
367
  }
413
368
  else {
414
- if (column.text === 'Line Total' || column.Field === 'Price' || column.Field === 'MRP' || column.Field === 'Batch' || column.Field === 'ExDate' || column.text === 'Tax' || column.Field === 'UnPr'
415
- || column.Field === 'QtyAndUoM' || column.Field === 'Disc' || column.Field === 'Perc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
416
- || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
417
- if (column.Field === 'Disc') {
418
- if (column.type === 'percentage') {
419
- if (!tr_utils_1.TrUtils.IsEmpty(Ops[column.Field])) {
420
- dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center', noWrap: true });
421
- }
422
- else {
423
- dataRow.push({ text: '', noWrap: true });
424
- }
425
- }
426
- else {
427
- if (!tr_utils_1.TrUtils.IsNull(Ops[column.Field])) {
428
- dataRow.push({ text: Ops[column.Field].toString(), alignment: 'right', noWrap: true });
429
- }
430
- else {
431
- dataRow.push({ text: '', noWrap: true });
432
- }
433
- }
434
- }
435
- else {
436
- if (column.Field === 'Batch') {
437
- if (!tr_utils_1.TrUtils.IsNull(Ops[column.Field])) {
438
- dataRow.push({ text: Ops[column.Field].BN, nowrap: true });
439
- }
440
- else {
441
- dataRow.push({ text: '', noWrap: true });
442
- }
443
- }
444
- else if (column.Field === 'ExDate') {
445
- if (!tr_utils_1.TrUtils.IsNull(Ops['Batch'])) {
446
- dataRow.push({ text: my_date_1.MyDate.ConvertUTCDateToReadableExDate(Ops['Batch'].ExDt), nowrap: true });
447
- }
448
- else {
449
- dataRow.push({ text: '', noWrap: true });
450
- }
451
- }
452
- else {
453
- if (!tr_utils_1.TrUtils.IsNull(Ops[column.Field])) {
454
- dataRow.push({ text: Ops[column.Field].toString(), alignment: 'right', nowrap: true, bold: Ops.bold });
455
- }
456
- else {
457
- dataRow.push({ text: '', noWrap: true });
458
- }
459
- }
460
- }
369
+ if (!tr_utils_1.TrUtils.IsNull(item[column.Field])) {
370
+ return { text: item[column.Field].toString(), bold: item.bold, alignment: 'right', nowrap: true };
461
371
  }
462
372
  else {
463
- dataRow.push({ text: Ops[column.Field].toString(), bold: Ops.bold });
373
+ return { text: '', noWrap: true };
464
374
  }
465
375
  }
466
376
  }
467
377
  }
468
378
  else {
469
- if (column.Field === 'SNo') {
470
- Ops[column.Field] = SNo;
471
- SNo = SNo + 1;
379
+ if (column.Field === 'Desc') {
380
+ let DescData = [];
381
+ DescData.push({ text: item[column.Field].toString(), bold: item.bold });
382
+ if (!tr_utils_1.TrUtils.IsEmpty(item['EDesc'])) {
383
+ DescData.push({ text: item['EDesc'].toString(), color: 'grey' });
384
+ }
385
+ return { stack: DescData };
472
386
  }
473
387
  else {
474
- if (tr_utils_1.TrUtils.IsNull(Ops[column.Field])) {
475
- Ops[column.Field] = '';
476
- }
388
+ return { text: item[column.Field].toString(), bold: item.bold };
477
389
  }
478
- dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
479
390
  }
480
- });
481
- body.push(dataRow);
391
+ }
392
+ }
393
+ }
394
+ else {
395
+ if (tr_utils_1.TrUtils.IsNull(item[column.Field])) {
396
+ item[column.Field] = '';
397
+ }
398
+ return { text: item[column.Field].toString(), alignment: 'center' };
399
+ }
400
+ }
401
+ function buildTableRows(items, columns, itemLabel, body) {
402
+ let SNo = 1;
403
+ items.forEach((item) => {
404
+ var dataRow = [];
405
+ columns.forEach((column) => {
406
+ if (column.Field === 'SNo' && (tr_utils_1.TrUtils.IsFixedZero(item[column.Field]) || tr_utils_1.TrUtils.IsNull(item[column.Field])) && item[column.Field] !== itemLabel) {
407
+ item[column.Field] = SNo;
408
+ SNo = SNo + 1;
409
+ }
410
+ dataRow.push(buildItemRow(item, columns, column, itemLabel));
482
411
  });
483
- return body;
412
+ body.push(dataRow);
413
+ });
414
+ }
415
+ function BuildTableBodyForLaborAndParts(Parts, Labor, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation = 'portrait') {
416
+ var body = [];
417
+ let columns = orientation === 'landscape' ? GetLandscapeWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn) : shared_print_service_1.PrintSharedService.GetWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
418
+ for (let i = 0; i < columns.length; i++) {
419
+ body.push(columns[i]);
420
+ }
421
+ columns = columns[1];
422
+ const partsLabel = 'Items';
423
+ const partsTotalLabel = 'Items Total';
424
+ const laborLabel = 'Service';
425
+ const laborTotalLabel = 'Service Total';
426
+ if (Parts.length !== 0) {
427
+ addPartsHeaderAndTotalRows(Parts, partsLabel, partsTotalLabel, ShowTaxColumn, DecimalsNumber);
484
428
  }
485
- static GetWithOutDiscAndTaxFieldHeader(Parts, Ops, ShowTaxColumn, PrintPartNo, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, ROPrintData, orientation = 'portrait') {
486
- if (Parts.length !== 0 || Ops.length !== 0) {
487
- if (ShowTaxColumn) {
488
- return this.TaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation);
429
+ buildTableRows(Parts, columns, partsLabel, body);
430
+ if (Labor.length !== 0) {
431
+ addLaborHeaderAndTotalRows(Labor, laborLabel, laborTotalLabel, ShowTaxColumn, DecimalsNumber);
432
+ }
433
+ if (Body === 2) {
434
+ for (let i = 0; i < Labor.length; i++) {
435
+ Labor[i].UnPr = '';
436
+ }
437
+ }
438
+ buildTableRows(Labor, columns, laborLabel, body);
439
+ return body;
440
+ }
441
+ function GetWithOutDiscAndTaxFieldHeader(Parts, Ops, ShowTaxColumn, PrintPartNo, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, invoicePdfData, orientation = 'portrait') {
442
+ if (Parts.length !== 0 || Ops.length !== 0) {
443
+ if (ShowTaxColumn) {
444
+ return TaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation);
445
+ }
446
+ else {
447
+ if (ConsolidateGST) {
448
+ return ConsolidateDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation);
489
449
  }
490
450
  else {
491
- if (ConsolidateGST) {
492
- return this.ConsolidateDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation);
493
- }
494
- else {
495
- return this.NoTaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation);
496
- }
451
+ return NoTaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation);
497
452
  }
498
453
  }
499
- else {
500
- let a = '';
501
- return a;
502
- }
503
454
  }
504
- static TaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation = 'portrait') {
505
- const layoutStyle = shared_print_service_1.PrintSharedService.LayOutStyle();
506
- const widths = orientation === 'landscape' ? this.GetLandscapeTaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn) : shared_print_service_1.PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn);
455
+ else {
456
+ let a = '';
457
+ return a;
458
+ }
459
+ }
460
+ function TaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation = 'portrait') {
461
+ const layoutStyle = shared_print_service_1.PrintSharedService.LayOutStyle();
462
+ const widths = orientation === 'landscape' ? GetLandscapeTaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn) : shared_print_service_1.PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn);
463
+ return {
464
+ style: 'tableExample',
465
+ marginTop: orientation === 'landscape' ? -6 : 0,
466
+ table: {
467
+ widths: widths,
468
+ body: BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation)
469
+ },
470
+ layout: layoutStyle
471
+ };
472
+ }
473
+ function ConsolidateDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation = 'portrait') {
474
+ const layoutStyle = shared_print_service_1.PrintSharedService.LayOutStyle();
475
+ if (PrintPartNo) {
476
+ const widths = orientation === 'landscape' ? [15, 50, 180, 40, 35, 35, 25, 25, 35, 30, 50] : [25, 70, 263, 25, 60, 80, 10, 40];
507
477
  return {
508
478
  style: 'tableExample',
509
- marginTop: orientation === 'landscape' ? -6 : 0,
510
479
  table: {
511
480
  widths: widths,
512
- body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation)
481
+ body: BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation)
513
482
  },
514
483
  layout: layoutStyle
515
484
  };
516
485
  }
517
- static ConsolidateDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation = 'portrait') {
518
- const layoutStyle = shared_print_service_1.PrintSharedService.LayOutStyle();
519
- if (PrintPartNo) {
520
- const widths = orientation === 'landscape' ? [15, 50, 180, 40, 35, 35, 25, 25, 35, 30, 50] : [25, 70, 263, 25, 60, 80, 10, 40];
521
- return {
522
- style: 'tableExample',
523
- table: {
524
- widths: widths,
525
- body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation)
526
- },
527
- layout: layoutStyle
528
- };
529
- }
530
- else {
531
- const widths = orientation === 'landscape' ? [15, 220, 40, 35, 35, 25, 25, 35, 30, 50] : [25, 295, 50, 80, 80, 10, 40];
532
- return {
533
- style: 'tableExample',
534
- table: {
535
- widths: widths,
536
- body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation)
537
- },
538
- layout: layoutStyle
539
- };
540
- }
541
- }
542
- static NoTaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation = 'portrait') {
543
- const layoutStyle = shared_print_service_1.PrintSharedService.LayOutStyle();
544
- const widths = orientation === 'landscape'
545
- ? (PrintPartNo ? [15, 50, 180, 40, 35, 35, 25, 25, 35, 30, 50] : [15, 220, 40, 35, 35, 25, 25, 35, 30, 50])
546
- : shared_print_service_1.PrintSharedService.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo);
486
+ else {
487
+ const widths = orientation === 'landscape' ? [15, 220, 40, 35, 35, 25, 25, 35, 30, 50] : [25, 295, 50, 80, 80, 10, 40];
547
488
  return {
548
489
  style: 'tableExample',
549
490
  table: {
550
491
  widths: widths,
551
- body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation)
492
+ body: BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation)
552
493
  },
553
494
  layout: layoutStyle
554
495
  };
555
496
  }
556
- static buildTableForCustomerLabor(Parts, Ops, PrintPartNo, customerorInsurance, orientation = 'portrait') {
557
- var body = [];
558
- let columns;
559
- columns = orientation === 'landscape' ? this.getLandscapeSummaryHeaders(PrintPartNo) : this.getSummaryHeaders(PrintPartNo);
560
- body.push(columns);
561
- const partsLabel = 'Items';
562
- if (Parts.length !== 0) {
563
- let dummypartadding1 = {};
564
- dummypartadding1.SNo = '';
565
- dummypartadding1.Desc = partsLabel;
566
- dummypartadding1.Qty = '';
567
- dummypartadding1.UnPr = '';
568
- dummypartadding1.Price = '';
569
- dummypartadding1.DiscountedPrice = '';
570
- dummypartadding1.LineTotal = '';
571
- dummypartadding1.QtyAndUoM = '';
572
- dummypartadding1.HSN = '';
573
- dummypartadding1.MPN = '';
574
- Parts.unshift(dummypartadding1);
497
+ }
498
+ function NoTaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation = 'portrait') {
499
+ const layoutStyle = shared_print_service_1.PrintSharedService.LayOutStyle();
500
+ const widths = orientation === 'landscape'
501
+ ? (PrintPartNo ? [15, 50, 180, 40, 35, 35, 25, 25, 35, 30, 50] : [15, 220, 40, 35, 35, 25, 25, 35, 30, 50])
502
+ : shared_print_service_1.PrintSharedService.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo);
503
+ return {
504
+ style: 'tableExample',
505
+ table: {
506
+ widths: widths,
507
+ body: BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, DecimalsNumber, orientation)
508
+ },
509
+ layout: layoutStyle
510
+ };
511
+ }
512
+ function buildTableForCustomerLabor(Parts, Ops, PrintPartNo, customerorInsurance, orientation = 'portrait') {
513
+ var body = [];
514
+ let columns;
515
+ columns = orientation === 'landscape' ? getLandscapeSummaryHeaders(PrintPartNo) : getSummaryHeaders(PrintPartNo);
516
+ body.push(columns);
517
+ const partsLabel = 'Items';
518
+ const laborLabel = 'Service';
519
+ let snoRef = { value: 1 };
520
+ if (Parts.length !== 0) {
521
+ addSummaryHeaderRow(Parts, partsLabel, PrintPartNo);
522
+ }
523
+ buildSummaryRows(Parts, columns, partsLabel, body, snoRef);
524
+ snoRef.value = 1;
525
+ if (Ops.length !== 0) {
526
+ addSummaryHeaderRow(Ops, laborLabel, PrintPartNo);
527
+ }
528
+ buildSummaryRows(Ops, columns, laborLabel, body, snoRef);
529
+ return body;
530
+ }
531
+ function addSummaryHeaderRow(items, label, PrintPartNo) {
532
+ let headerRow = {};
533
+ headerRow.SNo = '';
534
+ headerRow.Desc = label;
535
+ headerRow.Qty = '';
536
+ headerRow.UnPr = '';
537
+ headerRow.Price = '';
538
+ headerRow.DiscountedPrice = '';
539
+ headerRow.LineTotal = '';
540
+ headerRow.QtyAndUoM = '';
541
+ headerRow.HSN = '';
542
+ if (PrintPartNo) {
543
+ headerRow.MPN = '';
544
+ }
545
+ items.unshift(headerRow);
546
+ }
547
+ function buildSummaryItemCell(item, column, itemLabel) {
548
+ const hasValue = !tr_utils_1.TrUtils.IsFixedZero(item[column.Field]) && !tr_utils_1.TrUtils.IsNull(item[column.Field]) || column.text === 'Line Total';
549
+ if (hasValue) {
550
+ if (item[column.Field] === itemLabel) {
551
+ return { text: item[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' };
575
552
  }
576
- let SNo = 1;
577
- Parts.forEach((part) => {
578
- var dataRow = [];
579
- columns.forEach((column) => {
580
- const hasValue = !tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field]) || column.text === 'Line Total';
581
- if (hasValue) {
582
- if (part[column.Field] === partsLabel) {
583
- dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
584
- }
585
- else {
586
- if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'CustPrice' || column.Field === 'InsPrice' ||
587
- column.Field === 'DiscountedPrice' || column.Field === 'TaxAmount' || column.Field === 'UnPr') {
588
- if (column.Field === 'Disc Amt') {
589
- dataRow.push({ text: part[column.Field].toString(), alignment: 'right', noWrap: true });
590
- }
591
- else {
592
- dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
593
- }
594
- }
595
- else {
596
- if (column.Field === 'Desc') {
597
- let DescData = [];
598
- DescData.push(part[column.Field].toString());
599
- if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
600
- DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
601
- }
602
- dataRow.push({ stack: DescData });
603
- }
604
- else {
605
- dataRow.push({ text: part[column.Field].toString() });
606
- }
607
- }
608
- }
553
+ else {
554
+ if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'CustPrice' || column.Field === 'InsPrice' ||
555
+ column.Field === 'DiscountedPrice' || column.Field === 'TaxAmount' || column.Field === 'UnPr') {
556
+ if (column.Field === 'Disc Amt') {
557
+ return { text: item[column.Field].toString(), alignment: 'right', noWrap: true };
609
558
  }
610
559
  else {
611
- if (column.Field === 'SNo') {
612
- part[column.Field] = SNo;
613
- SNo = SNo + 1;
614
- }
615
- else {
616
- if (tr_utils_1.TrUtils.IsNull(part[column.Field])) {
617
- part[column.Field] = '';
618
- }
619
- }
620
- dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
560
+ return { text: item[column.Field].toString(), alignment: 'right', nowrap: true };
621
561
  }
622
- });
623
- body.push(dataRow);
624
- });
625
- SNo = 1;
626
- const laborLabel = 'Service';
627
- if (Ops.length !== 0) {
628
- let dummypartadding1 = {};
629
- dummypartadding1.SNo = '';
630
- dummypartadding1.Desc = laborLabel;
631
- dummypartadding1.Qty = '';
632
- dummypartadding1.UnPr = '';
633
- dummypartadding1.Price = '';
634
- dummypartadding1.DiscountedPrice = '';
635
- dummypartadding1.LineTotal = '';
636
- dummypartadding1.QtyAndUoM = '';
637
- dummypartadding1.HSN = '';
638
- Ops.unshift(dummypartadding1);
639
- }
640
- Ops.forEach((labor) => {
641
- var dataRow = [];
642
- columns.forEach((column) => {
643
- const hasValue = !tr_utils_1.TrUtils.IsFixedZero(labor[column.Field]) && !tr_utils_1.TrUtils.IsNull(labor[column.Field]) || column.text === 'Line Total';
644
- if (hasValue) {
645
- if (labor[column.Field] === laborLabel) {
646
- dataRow.push({ text: labor[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
647
- }
648
- else {
649
- if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'DiscountedPrice' || column.Field === 'TaxAmount'
650
- || column.Field === 'UnPr' || column.Field === 'CustPrice' || column.Field === 'InsPrice') {
651
- if (column.Field === 'Disc Amt') {
652
- dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', noWrap: true });
653
- }
654
- else {
655
- dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', nowrap: true });
656
- }
657
- }
658
- else {
659
- dataRow.push({ text: labor[column.Field].toString() });
660
- }
562
+ }
563
+ else {
564
+ if (column.Field === 'Desc') {
565
+ let DescData = [];
566
+ DescData.push(item[column.Field].toString());
567
+ if (!tr_utils_1.TrUtils.IsEmpty(item['EDesc'])) {
568
+ DescData.push({ text: item['EDesc'].toString(), color: 'grey' });
661
569
  }
570
+ return { stack: DescData };
662
571
  }
663
572
  else {
664
- if (column.Field === 'SNo') {
665
- labor[column.Field] = SNo;
666
- SNo = SNo + 1;
667
- }
668
- else {
669
- if (tr_utils_1.TrUtils.IsNull(labor[column.Field])) {
670
- labor[column.Field] = '';
671
- }
672
- }
673
- dataRow.push({ text: labor[column.Field].toString(), alignment: 'center' });
573
+ return { text: item[column.Field].toString() };
674
574
  }
675
- });
676
- body.push(dataRow);
677
- });
678
- return body;
679
- }
680
- static getSummaryHeaders(permission) {
681
- let headersNames = [
682
- { text: 'Description', style: 'tableheader', Field: 'Desc' },
683
- { text: 'HSN / SAC', style: 'tableheader', Field: 'SAC' },
684
- { text: 'Qty', style: 'tableheader', Field: 'QtyAndUoM' },
685
- { text: 'Ins. Amt', style: 'tableheader', Field: 'AssPr' },
686
- { text: 'Cust. Amt', style: 'tableheader', Field: 'Pr' },
687
- { text: 'Disc.(Rs)', style: 'tableheader', Field: 'DiscountedPrice' },
688
- { text: 'Tax %', style: 'tableheader', Field: 'TaxAmount' },
689
- { text: 'Line Total', style: 'tableheader', Field: 'LineTotal' }
690
- ];
691
- if (permission) {
692
- let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
693
- let MPN = { text: 'Part No', style: 'tableheader', Field: 'MPN' };
694
- headersNames.unshift(sno, MPN);
695
- }
696
- else {
697
- let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
698
- headersNames.unshift(sno);
699
- }
700
- return headersNames;
701
- }
702
- static CommonTotalDetails(ROPrintData, index, numberofCopies, withPass, moreDiscDetails, orientation = 'portrait') {
703
- var _a;
704
- const taxSummaryData = ROPrintData.TaxSummary || ROPrintData.CustTaxGroupDataByPerc;
705
- let CommonDetails = [
706
- shared_pdf_service_1.SharedPDFService.GetFinalTotalDetails1(ROPrintData, ROPrintData.CustLaborTotalAfterDisc, ROPrintData.CustLaborDiscTotal, ROPrintData.CustLaborCGST, ROPrintData.CustLaborSGST, ROPrintData.CustLaborIGST, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn, ROPrintData.CustPartsTotalAfterDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST, ROPrintData.CustPartSGST, taxSummaryData, ROPrintData.ShowAccParts, ROPrintData.CustLaborAfterTax, ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.For, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn, tr_utils_1.TrUtils.isTaxable((_a = ROPrintData.Settings) === null || _a === void 0 ? void 0 : _a.Tax), ROPrintData.CustLaborITax, ROPrintData.CustPartITax, ROPrintData.Consolidate, ROPrintData.From, ROPrintData.Adj, taxSummaryData, ROPrintData.STotal, false, moreDiscDetails),
707
- this.GetNumberInWords(ROPrintData.CustRoundedTotal),
708
- shared_pdf_service_1.SharedPDFService.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts, ROPrintData.isCountersale, ROPrintData.Entity.DecimalsNumber),
709
- shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
710
- this.GetBanckdetailswithQRCode(ROPrintData),
711
- shared_pdf_service_1.SharedPDFService.GetUnderLine(orientation),
712
- shared_pdf_service_1.SharedPDFService.GetInvSignatures(ROPrintData.Entity.CName, ROPrintData.isCountersale),
713
- shared_pdf_service_1.SharedPDFService.GetUnderLine1(withPass, orientation),
714
- this.GetGatePass(withPass, ROPrintData)
715
- ];
716
- if (ROPrintData.Type !== 'Invoice') {
717
- CommonDetails.splice(2, 0, shared_pdf_service_1.SharedPDFService.GetUnderLine(orientation));
575
+ }
718
576
  }
719
- if (!tr_utils_1.TrUtils.IsNull(numberofCopies) && numberofCopies.length !== 0 && (index !== (numberofCopies.length - 1))) {
720
- CommonDetails.push({ text: '', pageBreak: 'after' });
577
+ }
578
+ else {
579
+ if (tr_utils_1.TrUtils.IsNull(item[column.Field])) {
580
+ item[column.Field] = '';
721
581
  }
722
- return CommonDetails;
582
+ return { text: item[column.Field].toString(), alignment: 'center' };
723
583
  }
724
- static GetBanckdetailswithQRCode(ROPrintData) {
584
+ }
585
+ function buildSummaryRows(items, columns, itemLabel, body, snoRef) {
586
+ items.forEach((item) => {
587
+ var dataRow = [];
588
+ columns.forEach((column) => {
589
+ if (column.Field === 'SNo' && (tr_utils_1.TrUtils.IsFixedZero(item[column.Field]) || tr_utils_1.TrUtils.IsNull(item[column.Field])) && item[column.Field] !== itemLabel) {
590
+ item[column.Field] = snoRef.value;
591
+ snoRef.value = snoRef.value + 1;
592
+ }
593
+ dataRow.push(buildSummaryItemCell(item, column, itemLabel));
594
+ });
595
+ body.push(dataRow);
596
+ });
597
+ }
598
+ function getSummaryHeaders(permission) {
599
+ let headersNames = [
600
+ { text: 'Description', style: 'tableheader', Field: 'Desc' },
601
+ { text: 'HSN / SAC', style: 'tableheader', Field: 'SAC' },
602
+ { text: 'Qty', style: 'tableheader', Field: 'QtyAndUoM' },
603
+ { text: 'Ins. Amt', style: 'tableheader', Field: 'AssPr' },
604
+ { text: 'Cust. Amt', style: 'tableheader', Field: 'Pr' },
605
+ { text: 'Disc.(Rs)', style: 'tableheader', Field: 'DiscountedPrice' },
606
+ { text: 'Tax %', style: 'tableheader', Field: 'TaxAmount' },
607
+ { text: 'Line Total', style: 'tableheader', Field: 'LineTotal' }
608
+ ];
609
+ if (permission) {
610
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
611
+ let MPN = { text: 'Part No', style: 'tableheader', Field: 'MPN' };
612
+ headersNames.unshift(sno, MPN);
613
+ }
614
+ else {
615
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
616
+ headersNames.unshift(sno);
617
+ }
618
+ return headersNames;
619
+ }
620
+ function CommonTotalDetails(invoicePdfData, index, numberofCopies, withPass, moreDiscDetails, orientation = 'portrait') {
621
+ var _a;
622
+ const taxSummaryData = invoicePdfData.TaxSummary || invoicePdfData.CustTaxGroupDataByPerc;
623
+ let CommonDetails = [
624
+ shared_pdf_service_1.SharedPDFService.GetFinalTotalDetails1(invoicePdfData, invoicePdfData.CustLaborTotalAfterDisc, invoicePdfData.CustLaborDiscTotal, invoicePdfData.CustLaborCGST, invoicePdfData.CustLaborSGST, invoicePdfData.CustLaborIGST, invoicePdfData.CustPartIGST, invoicePdfData.ShowIGST, invoicePdfData.ShowTaxColumn, invoicePdfData.CustPartsTotalAfterDisc, invoicePdfData.CustPartsDiscTotal, invoicePdfData.CustPartCGST, invoicePdfData.CustPartSGST, taxSummaryData, invoicePdfData.ShowAccParts, invoicePdfData.CustLaborAfterTax, invoicePdfData.CustPartAfterTax, invoicePdfData.FixedDisc, invoicePdfData.For, invoicePdfData.FixedTotal, invoicePdfData.CustTotalRoundedBy, invoicePdfData.CustRoundedTotal, invoicePdfData.ShowTaxColumn, invoicePdfData.ShowTaxColumn, tr_utils_1.TrUtils.isTaxable((_a = invoicePdfData.Settings) === null || _a === void 0 ? void 0 : _a.Tax), invoicePdfData.CustLaborITax, invoicePdfData.CustPartITax, invoicePdfData.Consolidate, invoicePdfData.From, invoicePdfData.Adj, taxSummaryData, invoicePdfData.STotal, false, moreDiscDetails),
625
+ GetNumberInWords(invoicePdfData.CustRoundedTotal),
626
+ shared_pdf_service_1.SharedPDFService.InvoiceDueStatus(invoicePdfData.Type, invoicePdfData.Paid, invoicePdfData.Due, invoicePdfData.Sts, invoicePdfData.isCountersale, invoicePdfData.Entity.DecimalsNumber),
627
+ shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(invoicePdfData.Entity.Terms),
628
+ GetBanckdetailswithQRCode(invoicePdfData),
629
+ shared_pdf_service_1.SharedPDFService.GetUnderLine(orientation),
630
+ shared_pdf_service_1.SharedPDFService.GetInvSignatures(invoicePdfData.Entity.CName, invoicePdfData.isCountersale),
631
+ shared_pdf_service_1.SharedPDFService.GetUnderLine1(withPass, orientation),
632
+ GetGatePass(withPass, invoicePdfData)
633
+ ];
634
+ if (invoicePdfData.Type !== 'Invoice') {
635
+ CommonDetails.splice(2, 0, shared_pdf_service_1.SharedPDFService.GetUnderLine(orientation));
636
+ }
637
+ if (!tr_utils_1.TrUtils.IsNull(numberofCopies) && numberofCopies.length !== 0 && (index !== (numberofCopies.length - 1))) {
638
+ CommonDetails.push({ text: '', pageBreak: 'after' });
639
+ }
640
+ return CommonDetails;
641
+ }
642
+ function GetBanckdetailswithQRCode(invoicePdfData) {
643
+ return {
644
+ columns: [
645
+ shared_pdf_service_1.SharedPDFService.GetBankDetials(invoicePdfData.Entity.Bank, invoicePdfData.Entity.PrBank, invoicePdfData.Entity.UPIPhone),
646
+ shared_pdf_service_1.SharedPDFService.GetEntityDetails(invoicePdfData.Entity)
647
+ ]
648
+ };
649
+ }
650
+ function GetNumberInWords(TotalAmount) {
651
+ var rupee = shared_pdf_service_1.SharedPDFService.convertNumberToWords(TotalAmount);
652
+ return { columns: [{ text: 'In Words :', fontSize: 9, width: 45 }, { text: rupee, bold: true, fontSize: 9, width: '*' }] };
653
+ }
654
+ function GetGatePass(isGatepass, invoicePdfData) {
655
+ if (isGatepass) {
725
656
  return {
726
- columns: [
727
- shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank, ROPrintData.Entity.UPIPhone),
728
- shared_pdf_service_1.SharedPDFService.GetEntityDetails(ROPrintData.Entity)
729
- ]
657
+ columns: [{
658
+ id: '567',
659
+ text: [{ text: '', id: '1234' }],
660
+ stack: [
661
+ {
662
+ columns: [{ text: '' }, { text: 'Gate Pass', bold: true, fontSize: 9, alignment: 'center', marginTop: 5 },
663
+ { text: 'Date: ' + my_date_1.MyDate.ConvertUTCDateToReadable(my_date_1.MyDate.GetDateTimeNowInUTC(invoicePdfData.Entity.User.TZ)), marginTop: 5, fontSize: 9, alignment: 'right' }]
664
+ },
665
+ { text: invoicePdfData.Entity.CName, alignment: 'center', bold: true, fontSize: 12, marginTop: 5, marginBottom: 5 },
666
+ {
667
+ marginTop: 5,
668
+ columns: [
669
+ { text: '', width: 60 },
670
+ GetCustomerDetails(invoicePdfData, false),
671
+ GetVehicleDetails(invoicePdfData.Product, false)
672
+ ]
673
+ },
674
+ { text: 'Vehicle has been received from workshop and work done as per my satisfaction.', fontSize: 7, marginTop: 10, marginLeft: 60 },
675
+ { columns: [shared_pdf_service_1.SharedPDFService.CustomerSignature(), { text: '' }, shared_pdf_service_1.SharedPDFService.Accountantsignature()] }
676
+ ]
677
+ }],
730
678
  };
731
679
  }
732
- static GetNumberInWords(TotalAmount) {
733
- var rupee = shared_pdf_service_1.SharedPDFService.convertNumberToWords(TotalAmount);
734
- return { columns: [{ text: 'In Words :', fontSize: 9, width: 45 }, { text: rupee, bold: true, fontSize: 9, width: '*' }] };
680
+ else {
681
+ return shared_pdf_service_1.SharedPDFService.emptyObject();
735
682
  }
736
- static GetGatePass(isGatepass, ROPrintData) {
737
- if (isGatepass) {
738
- return {
739
- columns: [{
740
- id: '567',
741
- text: [{ text: '', id: '1234' }],
742
- stack: [
743
- {
744
- columns: [{ text: '' }, { text: 'Gate Pass', bold: true, fontSize: 9, alignment: 'center', marginTop: 5 },
745
- { text: 'Date: ' + my_date_1.MyDate.ConvertUTCDateToReadable(my_date_1.MyDate.GetDateTimeNowInUTC(ROPrintData.Entity.User.TZ)), marginTop: 5, fontSize: 9, alignment: 'right' }]
746
- },
747
- { text: ROPrintData.Entity.CName, alignment: 'center', bold: true, fontSize: 12, marginTop: 5, marginBottom: 5 },
748
- {
749
- marginTop: 5,
750
- columns: [
751
- { text: '', width: 60 },
752
- this.GetCustomerDetails(ROPrintData, false),
753
- this.GetVehicleDetails(ROPrintData.Product, false)
754
- ]
755
- },
756
- { text: 'Vehicle has been received from workshop and work done as per my satisfaction.', fontSize: 7, marginTop: 10, marginLeft: 60 },
757
- { columns: [shared_pdf_service_1.SharedPDFService.CustomerSignature(), { text: '' }, shared_pdf_service_1.SharedPDFService.Accountantsignature()] }
758
- ]
759
- }],
760
- };
683
+ }
684
+ function GetCustomerDetails(invoicePdfData, isOtherIndustry) {
685
+ let CustomerData = [
686
+ { name: 'Customer Name', value: invoicePdfData.Customer.Name },
687
+ { name: 'Service Advisor', value: invoicePdfData.Name },
688
+ ];
689
+ return shared_pdf_service_1.SharedPDFService.GetVehicleDataTable(CustomerData);
690
+ }
691
+ function GetVehicleDetails(Vehicle, isOtherIndustry) {
692
+ let vehicleData;
693
+ vehicleData = [];
694
+ if (isOtherIndustry) {
695
+ vehicleData.push({ name: 'Serial No', value: shared_pdf_service_1.SharedPDFService.CheckAndSetString(Vehicle.SNo) });
696
+ }
697
+ let a = [
698
+ { name: 'Vehicle Model', value: shared_pdf_service_1.SharedPDFService.CheckAndSetString(Vehicle.Model) },
699
+ ];
700
+ if (!isOtherIndustry) {
701
+ a.unshift({ name: 'Regn. No', value: shared_pdf_service_1.SharedPDFService.CheckAndSetString(Vehicle.RegNo) });
702
+ if (!tr_utils_1.TrUtils.IsEmpty(Vehicle.VIN)) {
703
+ a.unshift({ name: 'Chassis No', value: shared_pdf_service_1.SharedPDFService.CheckAndSetString(Vehicle.VIN) });
704
+ }
705
+ }
706
+ for (let i = 0; i < a.length; i++) {
707
+ vehicleData.push(a[i]);
708
+ }
709
+ return shared_pdf_service_1.SharedPDFService.GetVehicleDataTable(vehicleData);
710
+ }
711
+ function GetLandscapeWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn) {
712
+ let headersNames;
713
+ if (PrintPartNo) {
714
+ headersNames = [[
715
+ { text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
716
+ { text: 'Part No', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
717
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.5 },
718
+ { text: 'HSN/SAC', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
719
+ { text: 'Batch No', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
720
+ { text: 'Expiry', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
721
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.5 },
722
+ { text: 'Off Qty', style: 'tableheader', rowSpan: 2, lineHeight: 1 },
723
+ { text: 'MRP', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'center' },
724
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'center' },
725
+ { text: 'Line Total', rowSpan: 2, lineHeight: 0.5, style: 'tableheader' }
726
+ ], [
727
+ { text: '', Field: 'SNo', lineHeight: 0.5 },
728
+ { text: '', Field: 'MPN', lineHeight: 0.5 },
729
+ { text: '', Field: 'Desc', lineHeight: 0.5 },
730
+ { text: 'HSN/SAC', Field: 'HSN', lineHeight: 0.5 },
731
+ { text: '', Field: 'Batch', lineHeight: 0.5 },
732
+ { text: 'Expiry', Field: 'ExDate', lineHeight: 0.5 },
733
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 },
734
+ { text: '', Field: 'OfQty', lineHeight: 0.5 },
735
+ { text: '', Field: 'MRP', lineHeight: 0.5 },
736
+ { text: '', Field: 'UnPr', lineHeight: 0.5 },
737
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
738
+ ]];
739
+ let Count = 10;
740
+ if (ShowDiscountColumn) {
741
+ headersNames[0].splice(Count, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
742
+ headersNames[0].splice(Count + 1, 0, {});
743
+ headersNames[1].splice(Count, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
744
+ headersNames[1].splice(Count + 1, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
745
+ Count = 12;
746
+ }
747
+ if (ShowIGST) {
748
+ headersNames[0].splice(Count, 0, { text: 'IGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
749
+ headersNames[0].splice(Count + 1, 0, {});
750
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'IGSTPerc', type: 'percentage', lineHeight: 0.8 });
751
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'IGSTAmt', type: 'amount', lineHeight: 0.5 });
761
752
  }
762
753
  else {
763
- return shared_pdf_service_1.SharedPDFService.emptyObject();
754
+ headersNames[0].splice(Count, 0, { text: 'CGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
755
+ headersNames[0].splice(Count + 1, 0, {});
756
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'CGSTPerc', type: 'percentage', lineHeight: 0.8 });
757
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'CGSTAmt', type: 'amount', lineHeight: 0.7 });
758
+ headersNames[0].splice(Count + 2, 0, { text: 'SGST/UTGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
759
+ headersNames[0].splice(Count + 3, 0, {});
760
+ headersNames[1].splice(Count + 2, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'SGSTPerc', type: 'percentage', lineHeight: 0.8 });
761
+ headersNames[1].splice(Count + 3, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'SGSTAmt', type: 'amount', lineHeight: 0.5 });
764
762
  }
765
763
  }
766
- static GetCustomerDetails(ROPrintData, isOtherIndustry) {
767
- let CustomerData = [
768
- { name: 'Customer Name', value: ROPrintData.Customer.Name },
769
- { name: 'Service Advisor', value: ROPrintData.Name },
770
- ];
771
- return shared_pdf_service_1.SharedPDFService.GetVehicleDataTable(CustomerData);
772
- }
773
- static GetVehicleDetails(Vehicle, isOtherIndustry) {
774
- let vehicleData;
775
- vehicleData = [];
776
- if (isOtherIndustry) {
777
- vehicleData.push({ name: 'Serial No', value: shared_pdf_service_1.SharedPDFService.CheckAndSetString(Vehicle.SNo) });
778
- }
779
- let a = [
780
- { name: 'Vehicle Model', value: shared_pdf_service_1.SharedPDFService.CheckAndSetString(Vehicle.Model) },
781
- ];
782
- if (!isOtherIndustry) {
783
- a.unshift({ name: 'Regn. No', value: shared_pdf_service_1.SharedPDFService.CheckAndSetString(Vehicle.RegNo) });
784
- if (!tr_utils_1.TrUtils.IsEmpty(Vehicle.VIN)) {
785
- a.unshift({ name: 'Chassis No', value: shared_pdf_service_1.SharedPDFService.CheckAndSetString(Vehicle.VIN) });
786
- }
764
+ else {
765
+ headersNames = [[
766
+ { text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 },
767
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.6 },
768
+ { text: 'HSN/SAC', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
769
+ { text: 'Batch No', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
770
+ { text: 'Expiry', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
771
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.6 },
772
+ { text: 'Off Qty', style: 'tableheader', rowSpan: 2, lineHeight: 1 },
773
+ { text: 'MRP', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'center' },
774
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, alignment: 'center', lineHeight: 0.6 },
775
+ { text: 'Line Total', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 }
776
+ ], [
777
+ { text: '', Field: 'SNo', lineHeight: 0.5 },
778
+ { text: '', Field: 'Desc', lineHeight: 0.5 },
779
+ { text: 'HSN/SAC', Field: 'HSN', lineHeight: 0.5 },
780
+ { text: '', Field: 'Batch', lineHeight: 0.5 },
781
+ { text: 'Expiry', Field: 'ExDate', lineHeight: 0.5 },
782
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 },
783
+ { text: '', Field: 'OfQty', lineHeight: 0.5 },
784
+ { text: '', Field: 'MRP', lineHeight: 0.5 },
785
+ { text: '', Field: 'UnPr', lineHeight: 0.5 },
786
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
787
+ ]];
788
+ let Count = 9;
789
+ if (ShowDiscountColumn) {
790
+ headersNames[0].splice(Count, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
791
+ headersNames[0].splice(Count + 1, 0, {});
792
+ headersNames[1].splice(Count, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
793
+ headersNames[1].splice(Count + 1, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
794
+ Count = 11;
795
+ }
796
+ if (ShowIGST) {
797
+ headersNames[0].splice(Count, 0, { text: 'IGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
798
+ headersNames[0].splice(Count + 1, 0, {});
799
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'IGSTPerc', type: 'percentage', lineHeight: 0.8 });
800
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'IGSTAmt', type: 'amount', lineHeight: 0.5 });
787
801
  }
788
- for (let i = 0; i < a.length; i++) {
789
- vehicleData.push(a[i]);
802
+ else {
803
+ headersNames[0].splice(Count, 0, { text: 'CGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
804
+ headersNames[0].splice(Count + 1, 0, {});
805
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'CGSTPerc', type: 'percentage', lineHeight: 0.8 });
806
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'CGSTAmt', type: 'amount', lineHeight: 0.5 });
807
+ headersNames[0].splice(Count + 2, 0, { text: 'SGST/UTGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
808
+ headersNames[0].splice(Count + 3, 0, {});
809
+ headersNames[1].splice(Count + 2, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'SGSTPerc', type: 'percentage', lineHeight: 0.8 });
810
+ headersNames[1].splice(Count + 3, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'SGSTAmt', type: 'amount', lineHeight: 0.5 });
790
811
  }
791
- return shared_pdf_service_1.SharedPDFService.GetVehicleDataTable(vehicleData);
792
812
  }
793
- static GetLandscapeWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn) {
794
- let headersNames;
795
- if (PrintPartNo) {
796
- headersNames = [[
797
- { text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
798
- { text: 'Part No', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
799
- { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.5 },
800
- { text: 'HSN/SAC', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
801
- { text: 'Batch No', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
802
- { text: 'Expiry', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
803
- { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.5 },
804
- { text: 'Off Qty', style: 'tableheader', rowSpan: 2, lineHeight: 1 },
805
- { text: 'MRP', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'center' },
806
- { text: 'Unit Price', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'center' },
807
- { text: 'Line Total', rowSpan: 2, lineHeight: 0.5, style: 'tableheader' }
808
- ], [
809
- { text: '', Field: 'SNo', lineHeight: 0.5 },
810
- { text: '', Field: 'MPN', lineHeight: 0.5 },
811
- { text: '', Field: 'Desc', lineHeight: 0.5 },
812
- { text: 'HSN/SAC', Field: 'HSN', lineHeight: 0.5 },
813
- { text: '', Field: 'Batch', lineHeight: 0.5 },
814
- { text: 'Expiry', Field: 'ExDate', lineHeight: 0.5 },
815
- { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 },
816
- { text: '', Field: 'OfQty', lineHeight: 0.5 },
817
- { text: '', Field: 'MRP', lineHeight: 0.5 },
818
- { text: '', Field: 'UnPr', lineHeight: 0.5 },
819
- { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
820
- ]];
821
- let Count = 10;
813
+ return headersNames;
814
+ }
815
+ function getLandscapeSummaryHeaders(PrintPartNo) {
816
+ var columns = [];
817
+ columns.push({ text: 'S.No', fontSize: 7, alignment: 'center', bold: true });
818
+ if (PrintPartNo) {
819
+ columns.push({ text: 'Part No', fontSize: 7, alignment: 'left', bold: true });
820
+ }
821
+ columns.push({ text: 'Description', fontSize: 7, alignment: 'left', bold: true });
822
+ columns.push({ text: 'HSN/SAC', fontSize: 7, alignment: 'center', bold: true });
823
+ columns.push({ text: 'Batch No', fontSize: 7, alignment: 'center', bold: true });
824
+ columns.push({ text: 'Expiry', fontSize: 7, alignment: 'center', bold: true });
825
+ columns.push({ text: 'Qty', fontSize: 7, alignment: 'center', bold: true });
826
+ columns.push({ text: 'Off Qty', fontSize: 7, alignment: 'center', bold: true });
827
+ columns.push({ text: 'MRP', fontSize: 7, alignment: 'right', bold: true });
828
+ columns.push({ text: 'Unit Price', fontSize: 7, alignment: 'right', bold: true });
829
+ columns.push({ text: 'Line Total', fontSize: 7, alignment: 'right', bold: true });
830
+ return columns;
831
+ }
832
+ function GetLandscapeTaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn) {
833
+ if (PrintPartNo) {
834
+ if (ShowIGST) {
822
835
  if (ShowDiscountColumn) {
823
- headersNames[0].splice(Count, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
824
- headersNames[0].splice(Count + 1, 0, {});
825
- headersNames[1].splice(Count, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
826
- headersNames[1].splice(Count + 1, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
827
- Count = 12;
828
- }
829
- if (ShowIGST) {
830
- headersNames[0].splice(Count, 0, { text: 'IGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
831
- headersNames[0].splice(Count + 1, 0, {});
832
- headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'IGSTPerc', type: 'percentage', lineHeight: 0.8 });
833
- headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'IGSTAmt', type: 'amount', lineHeight: 0.5 });
836
+ return [24, 50, '*', 50, 35, 35, 30, 25, 40, 40, 20, 35, 20, 35, 51];
834
837
  }
835
838
  else {
836
- headersNames[0].splice(Count, 0, { text: 'CGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
837
- headersNames[0].splice(Count + 1, 0, {});
838
- headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'CGSTPerc', type: 'percentage', lineHeight: 0.8 });
839
- headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'CGSTAmt', type: 'amount', lineHeight: 0.7 });
840
- headersNames[0].splice(Count + 2, 0, { text: 'SGST/UTGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
841
- headersNames[0].splice(Count + 3, 0, {});
842
- headersNames[1].splice(Count + 2, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'SGSTPerc', type: 'percentage', lineHeight: 0.8 });
843
- headersNames[1].splice(Count + 3, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'SGSTAmt', type: 'amount', lineHeight: 0.5 });
839
+ return [24, 50, '*', 50, 35, 35, 30, 25, 40, 40, 20, 35, 51];
844
840
  }
845
841
  }
846
842
  else {
847
- headersNames = [[
848
- { text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 },
849
- { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.6 },
850
- { text: 'HSN/SAC', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
851
- { text: 'Batch No', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
852
- { text: 'Expiry', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
853
- { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.6 },
854
- { text: 'Off Qty', style: 'tableheader', rowSpan: 2, lineHeight: 1 },
855
- { text: 'MRP', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'center' },
856
- { text: 'Unit Price', style: 'tableheader', rowSpan: 2, alignment: 'center', lineHeight: 0.6 },
857
- { text: 'Line Total', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 }
858
- ], [
859
- { text: '', Field: 'SNo', lineHeight: 0.5 },
860
- { text: '', Field: 'Desc', lineHeight: 0.5 },
861
- { text: 'HSN/SAC', Field: 'HSN', lineHeight: 0.5 },
862
- { text: '', Field: 'Batch', lineHeight: 0.5 },
863
- { text: 'Expiry', Field: 'ExDate', lineHeight: 0.5 },
864
- { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 },
865
- { text: '', Field: 'OfQty', lineHeight: 0.5 },
866
- { text: '', Field: 'MRP', lineHeight: 0.5 },
867
- { text: '', Field: 'UnPr', lineHeight: 0.5 },
868
- { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
869
- ]];
870
- let Count = 9;
871
843
  if (ShowDiscountColumn) {
872
- headersNames[0].splice(Count, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
873
- headersNames[0].splice(Count + 1, 0, {});
874
- headersNames[1].splice(Count, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
875
- headersNames[1].splice(Count + 1, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
876
- Count = 11;
877
- }
878
- if (ShowIGST) {
879
- headersNames[0].splice(Count, 0, { text: 'IGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
880
- headersNames[0].splice(Count + 1, 0, {});
881
- headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'IGSTPerc', type: 'percentage', lineHeight: 0.8 });
882
- headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'IGSTAmt', type: 'amount', lineHeight: 0.5 });
844
+ return [24, 45, '*', 50, 35, 35, 30, 22, 40, 40, 20, 34, 20, 32, 20, 32, 48];
883
845
  }
884
846
  else {
885
- headersNames[0].splice(Count, 0, { text: 'CGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
886
- headersNames[0].splice(Count + 1, 0, {});
887
- headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'CGSTPerc', type: 'percentage', lineHeight: 0.8 });
888
- headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'CGSTAmt', type: 'amount', lineHeight: 0.5 });
889
- headersNames[0].splice(Count + 2, 0, { text: 'SGST/UTGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
890
- headersNames[0].splice(Count + 3, 0, {});
891
- headersNames[1].splice(Count + 2, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'SGSTPerc', type: 'percentage', lineHeight: 0.8 });
892
- headersNames[1].splice(Count + 3, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'SGSTAmt', type: 'amount', lineHeight: 0.5 });
847
+ return [24, 45, '*', 50, 35, 35, 30, 22, 40, 40, 20, 32, 20, 32, 54];
893
848
  }
894
849
  }
895
- return headersNames;
896
850
  }
897
- static getLandscapeSummaryHeaders(PrintPartNo) {
898
- var columns = [];
899
- columns.push({ text: 'S.No', fontSize: 7, alignment: 'center', bold: true });
900
- if (PrintPartNo) {
901
- columns.push({ text: 'Part No', fontSize: 7, alignment: 'left', bold: true });
902
- }
903
- columns.push({ text: 'Description', fontSize: 7, alignment: 'left', bold: true });
904
- columns.push({ text: 'HSN/SAC', fontSize: 7, alignment: 'center', bold: true });
905
- columns.push({ text: 'Batch No', fontSize: 7, alignment: 'center', bold: true });
906
- columns.push({ text: 'Expiry', fontSize: 7, alignment: 'center', bold: true });
907
- columns.push({ text: 'Qty', fontSize: 7, alignment: 'center', bold: true });
908
- columns.push({ text: 'Off Qty', fontSize: 7, alignment: 'center', bold: true });
909
- columns.push({ text: 'MRP', fontSize: 7, alignment: 'right', bold: true });
910
- columns.push({ text: 'Unit Price', fontSize: 7, alignment: 'right', bold: true });
911
- columns.push({ text: 'Line Total', fontSize: 7, alignment: 'right', bold: true });
912
- return columns;
913
- }
914
- static GetLandscapeTaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn) {
915
- if (PrintPartNo) {
916
- if (ShowIGST) {
917
- if (ShowDiscountColumn) {
918
- return [24, 50, '*', 50, 35, 35, 30, 25, 40, 40, 20, 35, 20, 35, 51];
919
- }
920
- else {
921
- return [24, 50, '*', 50, 35, 35, 30, 25, 40, 40, 20, 35, 51];
922
- }
851
+ else {
852
+ if (ShowIGST) {
853
+ if (ShowDiscountColumn) {
854
+ return [24, '*', 50, 41, 35, 30, 25, 40, 40, 20, 35, 20, 35, 41];
923
855
  }
924
856
  else {
925
- if (ShowDiscountColumn) {
926
- return [24, 45, '*', 50, 35, 35, 30, 22, 40, 40, 20, 34, 20, 32, 20, 32, 48];
927
- }
928
- else {
929
- return [24, 45, '*', 50, 35, 35, 30, 22, 40, 40, 20, 32, 20, 32, 54];
930
- }
857
+ return [24, '*', 50, 50, 35, 30, 25, 40, 40, 20, 40, 50];
931
858
  }
932
859
  }
933
860
  else {
934
- if (ShowIGST) {
935
- if (ShowDiscountColumn) {
936
- return [24, '*', 50, 41, 35, 30, 25, 40, 40, 20, 35, 20, 35, 41];
937
- }
938
- else {
939
- return [24, '*', 50, 50, 35, 30, 25, 40, 40, 20, 40, 50];
940
- }
861
+ if (ShowDiscountColumn) {
862
+ return [24, '*', 50, 45, 35, 30, 22, 40, 40, 20, 34, 20, 35, 20, 35, 45];
941
863
  }
942
864
  else {
943
- if (ShowDiscountColumn) {
944
- return [24, '*', 50, 45, 35, 30, 22, 40, 40, 20, 34, 20, 35, 20, 35, 45];
945
- }
946
- else {
947
- return [24, '*', 50, 50, 35, 30, 22, 40, 40, 20, 35, 20, 35, 50];
948
- }
865
+ return [24, '*', 50, 50, 35, 30, 22, 40, 40, 20, 35, 20, 35, 50];
949
866
  }
950
867
  }
951
868
  }
952
869
  }
953
- exports.UnifiedInvoicePdfService = UnifiedInvoicePdfService;