shareneus 1.3.5 → 1.3.7
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.
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.NextServiceDateXlsxFileService = void 0;
|
|
27
|
+
const XLSX = __importStar(require("xlsx"));
|
|
28
|
+
const my_date_1 = require("../utils/my-date");
|
|
29
|
+
const tr_utils_1 = require("../utils/tr-utils");
|
|
30
|
+
class NextServiceDateXlsxFileService {
|
|
31
|
+
static GetNextServiceDateExcelData(MainData, searchValue, HeaderName, isDetails) {
|
|
32
|
+
this.wb = {};
|
|
33
|
+
this.ws = {};
|
|
34
|
+
this.Row = 0;
|
|
35
|
+
this.range = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
|
|
36
|
+
this.MergeArray = [];
|
|
37
|
+
let ws_name = HeaderName;
|
|
38
|
+
this.wb.Sheets = {};
|
|
39
|
+
this.wb.Props = {};
|
|
40
|
+
this.wb.SSF = {};
|
|
41
|
+
this.wb.SheetNames = [];
|
|
42
|
+
let showSearch = [];
|
|
43
|
+
for (const key in searchValue) {
|
|
44
|
+
if (!tr_utils_1.TrUtils.IsNull(searchValue[key]) && key !== 'Date' && key !== 'ManfCntrlId' && key !== 'VenCntrlId') {
|
|
45
|
+
showSearch.push([{
|
|
46
|
+
text: (key === 'StDate') ? 'Start Date' : (key === 'EnDate') ? 'End Date' : (key === 'ManfCntrl') ? 'Manufacturer' : (key === 'VenCntrl') ? 'Vendor' : key,
|
|
47
|
+
ColRange: 1,
|
|
48
|
+
bold: true,
|
|
49
|
+
ChildHeadings: [
|
|
50
|
+
// { text: 'Central Tax', ColRange: 1 },
|
|
51
|
+
// { text: 'State Tax', ColRange: 1 },
|
|
52
|
+
// { text: 'IGST Tax', ColRange: 1 },
|
|
53
|
+
],
|
|
54
|
+
}, {
|
|
55
|
+
text: (key === 'StDate') ? my_date_1.MyDate.ConvertUTCDateToReadable(searchValue[key]) : (key === 'EnDate') ? my_date_1.MyDate.ConvertUTCDateToReadable(searchValue[key]) : searchValue[key],
|
|
56
|
+
ColRange: 7,
|
|
57
|
+
bold: true,
|
|
58
|
+
ChildHeadings: [
|
|
59
|
+
// { text: 'Central Tax', ColRange: 1 },
|
|
60
|
+
// { text: 'State Tax', ColRange: 1 },
|
|
61
|
+
// { text: 'IGST Tax', ColRange: 1 },
|
|
62
|
+
],
|
|
63
|
+
}]);
|
|
64
|
+
}
|
|
65
|
+
// console.log(`${key}: ${searchValue[key]}`);
|
|
66
|
+
}
|
|
67
|
+
MainData = this.GetTotals(MainData);
|
|
68
|
+
this.setHeadingInCell(HeaderName, showSearch, isDetails);
|
|
69
|
+
this.setInvoiceDetailsInCell(MainData, isDetails);
|
|
70
|
+
this.ws['!ref'] = XLSX.utils.encode_range(this.range);
|
|
71
|
+
this.ws['!merges'] = this.MergeArray;
|
|
72
|
+
this.ws["!cols"] = [{ wch: 50 }, { wch: 10 }, { wch: 10 }, { wch: 10 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 20 }];
|
|
73
|
+
this.wb.SheetNames.push(ws_name);
|
|
74
|
+
this.wb.Sheets[ws_name] = this.ws;
|
|
75
|
+
return this.wb;
|
|
76
|
+
}
|
|
77
|
+
static GetTotals(MainData) {
|
|
78
|
+
MainData.forEach((InvoiceInfo) => {
|
|
79
|
+
// InvoiceInfo.Tax =
|
|
80
|
+
// InvoiceInfo.ItemsCGST + InvoiceInfo.ItemsSGST + InvoiceInfo.ItemsIGST;
|
|
81
|
+
InvoiceInfo.TotalAmount = InvoiceInfo.Tax + InvoiceInfo.NetAmt;
|
|
82
|
+
});
|
|
83
|
+
return MainData;
|
|
84
|
+
}
|
|
85
|
+
static setHeadingInCell(HeaderName, showSearch, isDetails) {
|
|
86
|
+
let MainHeadings = [
|
|
87
|
+
// {
|
|
88
|
+
// text: 'SNo',
|
|
89
|
+
// ColRange: 1,
|
|
90
|
+
// bold: true,
|
|
91
|
+
// ChildHeadings: []
|
|
92
|
+
// },
|
|
93
|
+
{
|
|
94
|
+
text: 'Customer Name',
|
|
95
|
+
ColRange: 1,
|
|
96
|
+
bold: true,
|
|
97
|
+
ChildHeadings: [],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
text: 'Reg. No',
|
|
101
|
+
ColRange: 1,
|
|
102
|
+
bold: true,
|
|
103
|
+
ChildHeadings: [
|
|
104
|
+
// { text: 'Central Tax', ColRange: 1 },
|
|
105
|
+
// { text: 'State Tax', ColRange: 1 },
|
|
106
|
+
// { text: 'IGST Tax', ColRange: 1 },
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
text: 'Vehicle',
|
|
111
|
+
ColRange: 1,
|
|
112
|
+
bold: true,
|
|
113
|
+
ChildHeadings: [
|
|
114
|
+
// { text: 'No', ColRange: 1 },
|
|
115
|
+
// { text: 'Date', ColRange: 1 },
|
|
116
|
+
// { text: 'Invoice Total', ColRange: 1 }
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
text: 'Sale Date',
|
|
121
|
+
ColRange: 1,
|
|
122
|
+
bold: true,
|
|
123
|
+
ChildHeadings: [
|
|
124
|
+
// { text: 'Central Tax', ColRange: 1 },
|
|
125
|
+
// { text: 'State Tax', ColRange: 1 },
|
|
126
|
+
// { text: 'IGST Tax', ColRange: 1 },
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
text: 'Last Service Date',
|
|
131
|
+
ColRange: 1,
|
|
132
|
+
bold: true,
|
|
133
|
+
ChildHeadings: [
|
|
134
|
+
// { text: 'Central Tax', ColRange: 1 },
|
|
135
|
+
// { text: 'State Tax', ColRange: 1 },
|
|
136
|
+
// { text: 'IGST Tax', ColRange: 1 },
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
text: 'Last Mileage',
|
|
141
|
+
ColRange: 1,
|
|
142
|
+
bold: true,
|
|
143
|
+
ChildHeadings: [
|
|
144
|
+
// { text: 'Central Tax', ColRange: 1 },
|
|
145
|
+
// { text: 'State Tax', ColRange: 1 },
|
|
146
|
+
// { text: 'IGST Tax', ColRange: 1 },
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
text: 'Next Service Date',
|
|
151
|
+
ColRange: 1,
|
|
152
|
+
bold: true,
|
|
153
|
+
ChildHeadings: [
|
|
154
|
+
// { text: 'Central Tax', ColRange: 1 },
|
|
155
|
+
// { text: 'State Tax', ColRange: 1 },
|
|
156
|
+
// { text: 'IGST Tax', ColRange: 1 },
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
];
|
|
160
|
+
this.SetDataInCell(HeaderName, 0, this.Row);
|
|
161
|
+
this.MergeArray.push({
|
|
162
|
+
s: { r: this.Row, c: 0 },
|
|
163
|
+
e: { r: this.Row, c: 0 + 8 - 1 },
|
|
164
|
+
});
|
|
165
|
+
this.Row += 2;
|
|
166
|
+
showSearch.forEach((search) => {
|
|
167
|
+
let ColStart = 0;
|
|
168
|
+
// console.log('search', search, ColStart);
|
|
169
|
+
search.forEach((item) => {
|
|
170
|
+
// console.log('text', oyo.text, ColStart);
|
|
171
|
+
this.SetDataInCell(item.text, ColStart, this.Row);
|
|
172
|
+
this.MergeArray.push({
|
|
173
|
+
s: { r: this.Row, c: ColStart },
|
|
174
|
+
e: { r: this.Row, c: ColStart + item.ColRange - 1 },
|
|
175
|
+
});
|
|
176
|
+
ColStart += item.ColRange;
|
|
177
|
+
});
|
|
178
|
+
this.Row += 1;
|
|
179
|
+
});
|
|
180
|
+
this.Row += 1;
|
|
181
|
+
let MainColStart = 0;
|
|
182
|
+
MainHeadings.forEach((MainHeader) => {
|
|
183
|
+
this.SetDataInCell(MainHeader.text, MainColStart, this.Row);
|
|
184
|
+
this.MergeArray.push({
|
|
185
|
+
s: { r: this.Row, c: MainColStart },
|
|
186
|
+
e: { r: this.Row, c: MainColStart + MainHeader.ColRange - 1 },
|
|
187
|
+
});
|
|
188
|
+
MainColStart += MainHeader.ColRange;
|
|
189
|
+
});
|
|
190
|
+
this.Row += 2;
|
|
191
|
+
}
|
|
192
|
+
static setInvoiceDetailsInCell(MainData, isDetails) {
|
|
193
|
+
MainData.forEach((InvoiceList) => {
|
|
194
|
+
this.SetInvoiceDataInExcel(InvoiceList, isDetails);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
static SetInvoiceDataInExcel(InvoiceInfo, isDetails) {
|
|
198
|
+
var _a;
|
|
199
|
+
InvoiceInfo.LSDate = this.ConvertDateToReadableFormat(InvoiceInfo.LSDate);
|
|
200
|
+
InvoiceInfo.NSDate = this.ConvertDateToReadableFormat(InvoiceInfo.NSDate);
|
|
201
|
+
InvoiceInfo.DDate = this.ConvertDateToReadableFormat(InvoiceInfo.DDate);
|
|
202
|
+
let InvoiceData = [
|
|
203
|
+
{ text: (_a = InvoiceInfo.Customer) === null || _a === void 0 ? void 0 : _a.DName, ColRange: 1, IsString: true },
|
|
204
|
+
{ text: InvoiceInfo.RegNo, ColRange: 1, IsString: true },
|
|
205
|
+
{ text: InvoiceInfo.Make + '' + InvoiceInfo.Model + '' + InvoiceInfo.Var, ColRange: 1, IsString: false },
|
|
206
|
+
{ text: InvoiceInfo.DDate, ColRange: 1, IsString: false },
|
|
207
|
+
{ text: InvoiceInfo.LSDate, ColRange: 1, IsString: false },
|
|
208
|
+
{ text: InvoiceInfo.LMileage, ColRange: 1, IsString: false },
|
|
209
|
+
{ text: InvoiceInfo.NSDate, ColRange: 1, IsString: false }
|
|
210
|
+
];
|
|
211
|
+
let ColStart = 0;
|
|
212
|
+
InvoiceData.forEach((InvData) => {
|
|
213
|
+
InvData.text = this.ConvertToString(InvData.text, InvData.IsString);
|
|
214
|
+
this.SetDataInCell(InvData.text, ColStart, this.Row);
|
|
215
|
+
this.MergeArray.push({
|
|
216
|
+
s: { r: this.Row, c: ColStart },
|
|
217
|
+
e: { r: this.Row, c: ColStart + InvData.ColRange - 1 },
|
|
218
|
+
});
|
|
219
|
+
ColStart += InvData.ColRange;
|
|
220
|
+
});
|
|
221
|
+
this.Row += 1;
|
|
222
|
+
}
|
|
223
|
+
static ConvertDateToReadableFormat(DateObject) {
|
|
224
|
+
if (!tr_utils_1.TrUtils.IsEmpty(DateObject)) {
|
|
225
|
+
let date = new Date(DateObject);
|
|
226
|
+
let Month;
|
|
227
|
+
let Day;
|
|
228
|
+
let MonthName = new Array();
|
|
229
|
+
MonthName[0] = 'Jan';
|
|
230
|
+
MonthName[1] = 'Feb';
|
|
231
|
+
MonthName[2] = 'Mar';
|
|
232
|
+
MonthName[3] = 'Apr';
|
|
233
|
+
MonthName[4] = 'May';
|
|
234
|
+
MonthName[5] = 'Jun';
|
|
235
|
+
MonthName[6] = 'Jul';
|
|
236
|
+
MonthName[7] = 'Aug';
|
|
237
|
+
MonthName[8] = 'Sept';
|
|
238
|
+
MonthName[9] = 'Oct';
|
|
239
|
+
MonthName[10] = 'Nov';
|
|
240
|
+
MonthName[11] = 'Dec';
|
|
241
|
+
Month = MonthName[date.getMonth()];
|
|
242
|
+
if (date.getDate() < 10) {
|
|
243
|
+
Day = '0' + date.getDate();
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
Day = date.getDate();
|
|
247
|
+
}
|
|
248
|
+
date = Day + '-' + Month + '-' + date.getFullYear();
|
|
249
|
+
return date;
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
static ConvertToString(Text, IsString) {
|
|
256
|
+
if (IsString) {
|
|
257
|
+
if (Text == null) {
|
|
258
|
+
Text = '';
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
if (Text == null) {
|
|
263
|
+
Text = 0;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (typeof Text === 'number') {
|
|
267
|
+
return Number(tr_utils_1.TrUtils.FixedTo(Text));
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
return Text;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
static SetDataInCell(Data, ColRange, RowNum) {
|
|
274
|
+
var cell = { v: Data };
|
|
275
|
+
var cell_ref = XLSX.utils.encode_cell({ c: ColRange, r: RowNum });
|
|
276
|
+
if (this.range.e.c < ColRange) {
|
|
277
|
+
this.range.e.c = ColRange;
|
|
278
|
+
}
|
|
279
|
+
if (this.range.e.r < RowNum) {
|
|
280
|
+
this.range.e.r = RowNum;
|
|
281
|
+
}
|
|
282
|
+
cell = this.getcelltype(cell);
|
|
283
|
+
this.ws[cell_ref] = cell;
|
|
284
|
+
}
|
|
285
|
+
static getcelltype(cell) {
|
|
286
|
+
if (typeof cell.v === 'number')
|
|
287
|
+
cell.t = 'n';
|
|
288
|
+
else if (typeof cell.v === 'boolean')
|
|
289
|
+
cell.t = 'b';
|
|
290
|
+
else
|
|
291
|
+
cell.t = 's';
|
|
292
|
+
return cell;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
exports.NextServiceDateXlsxFileService = NextServiceDateXlsxFileService;
|
|
296
|
+
NextServiceDateXlsxFileService.wb = {};
|
|
297
|
+
NextServiceDateXlsxFileService.Row = 2;
|
|
298
|
+
NextServiceDateXlsxFileService.MergeArray = [];
|
|
299
|
+
NextServiceDateXlsxFileService.range = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
|
|
300
|
+
NextServiceDateXlsxFileService.ws = {};
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DebitNotePdfService = exports.DCWithoutPricePdfService = exports.DCLandscapeWithoutPricePdfService = exports.DCLandscapePdfService = exports.CustomerBalancesService = exports.SalesByCustomerPDFService = exports.CustWiseSalesDetailsService = exports.CreditNoteTotalsService = exports.CreditNotePdfService = exports.ConsultationPDFService = exports.ConsultationFullPrintService = exports.ConsultationFeeReceiptPrintService = exports.CNPrintService = exports.ChecklistsPDFService = exports.CheckListPrintService = exports.CategoryWiseItemPDFService = exports.SalesReceiptprintService = exports.AppointmentTotalsService = exports.AnalysisPDFService = exports.VenBalanceXlsxFileService = exports.TallySalesImportXlsxFileService = exports.StockXlsxFileService = exports.IssueSparesXlsxFileService = exports.ScheduledDrugXlsxFileService = exports.ScheduledDrugSummaryXlsxFileService = exports.SalesByServiceSummaryXlsxFileService = exports.SummaryXlsxFileService = exports.ServiceAdvisorWisePartXlsxFileService = exports.ServiceAdvisorWiseLaborXlsxFileService = exports.RepairOrdersXlsxFileService = exports.PaymentsMadeXlsxFileService = exports.PaymentReceiveXlsxFileService = exports.OperatorWiseSummaryXlsxFileService = exports.OperatorWiseDetailsXlsxFileService = exports.ManfWiseSalesXlsxFileService = exports.ItemsWiseSalesXlsxFileService = exports.ItemWiseMOSummaryXlsxFileService = exports.ItemWiseMODetailsXlsxFileService = exports.ItemWiseDoctorSaleXlsxFileService = exports.InvoicesWiseXlsxFileService = exports.InsuranceExpireXlsxFileService = exports.GSTR2ExcelService = exports.GSTR1ExcelService = exports.GSTROXlsxFileService = exports.ExpiringDrugsXlsxFileService = exports.SalesByCustomerXlsxFileService = exports.CustWiseSalesXlsxFileService = exports.CustBalanceXlsxFileService = exports.CategoryWiseItemXlsxFileService = exports.AnalysisXlsxFileService = void 0;
|
|
4
4
|
exports.SharedPDFService = exports.SharedInvoiceprintService = exports.WOPrintService = exports.ScheduledDrugSummaryPDFService = exports.ScheduledDrugPDFService = exports.SalesTotalsService = exports.SaleReceiptPrintService = exports.SalesReceiptpdfService = exports.SalesPrintService = exports.SalesPdfService = exports.SalesByServiceSummaryPDF = exports.ROTotalsService = exports.ROPrintService = exports.RoprintService = exports.RepairOrdersReportsPDFService = exports.ReorderPointPDFService = exports.ReceiptPrintService = exports.PurchaseOrderPDFService = exports.PurchaseOrderTotalsService = exports.PurchaseOrderPrintService = exports.PosReceiptPrintService = exports.POTotalsService = exports.PaymentsReportPDFService = exports.ReceiptPDFService = exports.PackShipPrintService = exports.PackShipPDFService = exports.OperatorWiseSalesSummaryPDF = exports.OperatorWiseSalesDetailsPDF = exports.MaterialOutprintService = exports.MeetingPdfService = exports.ManfWiseSalesService = exports.ItemWiseSalesPDFService = exports.ItemWiseMOSummaryPDF = exports.ItemWiseMODetailsPDF = exports.ItemWiseDoctorSalePDFService = exports.ItemDetaisPdf = exports.IssuePartsprintService = exports.InvoiceTotalsService = exports.InvoiceLandscapePdfService = exports.InvPrintService = exports.InvoiceprintService = exports.InsuranceExpirePDF = exports.ExpiringDrugPDFService = exports.EstPrintService = exports.EquipmentDesignPdf = exports.DeliveryChallanTotalsService = exports.DeliveryChallanPrintService = exports.DeliveryChallanPdfService = exports.DebitNoteTotalsService = exports.DebitNotePrintService = void 0;
|
|
5
|
-
exports.ConsultationLetterHeadPDFService = exports.InvoiceLetterheadPdfService = exports.HCInvoiceprintService = exports.InvoicePortraitPrintService = exports.MyDate = exports.TrUtils = exports.VendorDebitNoteTotalsService = exports.VendorDebitNotePrintService = exports.VendorDebitNotePdfService = exports.VendorCreditNoteTotalsService = exports.VendorCreditNotePrintService = exports.VendorCreditNotePDFService = exports.VendorBalancesService = exports.TransferOrderPrintService = exports.TechnicianPrintService = exports.TechnicianpdfService = exports.TaskReportsPDfService = exports.TaskPDfService = exports.PrintSharedService = void 0;
|
|
5
|
+
exports.NextServiceDatePDFService = exports.NextServiceDateXlsxFileService = exports.ConsultationLetterHeadPDFService = exports.InvoiceLetterheadPdfService = exports.HCInvoiceprintService = exports.InvoicePortraitPrintService = exports.MyDate = exports.TrUtils = exports.VendorDebitNoteTotalsService = exports.VendorDebitNotePrintService = exports.VendorDebitNotePdfService = exports.VendorCreditNoteTotalsService = exports.VendorCreditNotePrintService = exports.VendorCreditNotePDFService = exports.VendorBalancesService = exports.TransferOrderPrintService = exports.TechnicianPrintService = exports.TechnicianpdfService = exports.TaskReportsPDfService = exports.TaskPDfService = exports.PrintSharedService = void 0;
|
|
6
6
|
var analysis_excel_service_1 = require("./excel-files/analysis-excel.service");
|
|
7
7
|
Object.defineProperty(exports, "AnalysisXlsxFileService", { enumerable: true, get: function () { return analysis_excel_service_1.AnalysisXlsxFileService; } });
|
|
8
8
|
var category_wise_item_excel_service_1 = require("./excel-files/category-wise-item-excel.service");
|
|
@@ -241,3 +241,7 @@ var invoice_letterhead_pdf_service_1 = require("./services/invoice-letterhead-pd
|
|
|
241
241
|
Object.defineProperty(exports, "InvoiceLetterheadPdfService", { enumerable: true, get: function () { return invoice_letterhead_pdf_service_1.InvoiceLetterheadPdfService; } });
|
|
242
242
|
var consultation_letterhead_pdf_service_1 = require("./services/consultation-letterhead-pdf.service");
|
|
243
243
|
Object.defineProperty(exports, "ConsultationLetterHeadPDFService", { enumerable: true, get: function () { return consultation_letterhead_pdf_service_1.ConsultationLetterHeadPDFService; } });
|
|
244
|
+
var next_service_date_excel_service_1 = require("./excel-files/next-service-date-excel.service");
|
|
245
|
+
Object.defineProperty(exports, "NextServiceDateXlsxFileService", { enumerable: true, get: function () { return next_service_date_excel_service_1.NextServiceDateXlsxFileService; } });
|
|
246
|
+
var next_service_date_pdf_service_1 = require("./services/next-service-date-pdf.service");
|
|
247
|
+
Object.defineProperty(exports, "NextServiceDatePDFService", { enumerable: true, get: function () { return next_service_date_pdf_service_1.NextServiceDatePDFService; } });
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NextServiceDatePDFService = void 0;
|
|
4
|
+
const my_date_1 = require("../utils/my-date");
|
|
5
|
+
const shared_pdf_service_1 = require("./shared-pdf.service");
|
|
6
|
+
class NextServiceDatePDFService {
|
|
7
|
+
static GetNextServiceDatePrint(InvoicesData, CName, searchValue) {
|
|
8
|
+
var dd = {
|
|
9
|
+
info: {
|
|
10
|
+
title: 'Next Service Date',
|
|
11
|
+
},
|
|
12
|
+
header: function (currentPage, pageCount) {
|
|
13
|
+
return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
|
|
14
|
+
},
|
|
15
|
+
pageMargins: [10, 15, 10, 15],
|
|
16
|
+
content: [
|
|
17
|
+
{ text: '' + CName + '', style: ['header'] },
|
|
18
|
+
{ text: 'Next Service Date', alignment: 'center', fontSize: 15, bold: true },
|
|
19
|
+
// { text: 'As of ' + MyDate.ConvertUTCDateToReadable(MyDate.GetDateTimeNowInUTC()), alignment: 'center', fontSize: 10 },
|
|
20
|
+
// SharedPDFService.HeaderAfterLine(),
|
|
21
|
+
shared_pdf_service_1.SharedPDFService.GetSearchValueDetails(searchValue),
|
|
22
|
+
this.GetInvoiceDataTable(InvoicesData),
|
|
23
|
+
],
|
|
24
|
+
styles: shared_pdf_service_1.SharedPDFService.GetStyles()
|
|
25
|
+
};
|
|
26
|
+
return dd;
|
|
27
|
+
}
|
|
28
|
+
static GetInvoiceDataTable(InvoicesData) {
|
|
29
|
+
let Data = [];
|
|
30
|
+
// InvoicesData.forEach((invoice: any) => {
|
|
31
|
+
Data.push(this.GetItemsTable(InvoicesData));
|
|
32
|
+
// });
|
|
33
|
+
return Data;
|
|
34
|
+
}
|
|
35
|
+
static getTableWidths() {
|
|
36
|
+
// if (isHC) {
|
|
37
|
+
// return [25, '*', '*', '*', '*'];
|
|
38
|
+
// } else {
|
|
39
|
+
return [25, '*', '*', '*', '*', '*', '*', '*'];
|
|
40
|
+
// }
|
|
41
|
+
}
|
|
42
|
+
static GetItemsTable(InvoiceData) {
|
|
43
|
+
// InvoicesData.forEach((InvoiceData: any) => {
|
|
44
|
+
return {
|
|
45
|
+
style: 'tableExample',
|
|
46
|
+
marginTop: 3,
|
|
47
|
+
marginBottom: 5,
|
|
48
|
+
table: {
|
|
49
|
+
widths: this.getTableWidths(),
|
|
50
|
+
headerRows: 1,
|
|
51
|
+
body: this.BuildTableBodyForLaborAndParts(InvoiceData)
|
|
52
|
+
// body:[['fsdfsdf','asfafdas','asdasdas','asdasdasd','asddass']]
|
|
53
|
+
},
|
|
54
|
+
layout: {
|
|
55
|
+
hLineWidth: function (i, node) {
|
|
56
|
+
return (i === 0 || i === 1 || i === node.table.body.length) ? 1 : 0.5;
|
|
57
|
+
},
|
|
58
|
+
vLineWidth: function (i, node) {
|
|
59
|
+
return (i === 0 || i === node.table.widths.length) ? 1 : 0.5;
|
|
60
|
+
},
|
|
61
|
+
// hLineStyle: function (i, node) {
|
|
62
|
+
// return (i === 0 || i === 1) ? { dash: { length: 5, space: 5 } } : null;
|
|
63
|
+
// },
|
|
64
|
+
hLineColor: function (i, node) {
|
|
65
|
+
return (i === 0 || i === 1 || i === node.table.body.length) ? 'gray' : 'lightgrey';
|
|
66
|
+
},
|
|
67
|
+
vLineColor: function (i, node) {
|
|
68
|
+
return 'gray';
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
// });
|
|
73
|
+
}
|
|
74
|
+
static BuildTableBodyForLaborAndParts(InvoiceData) {
|
|
75
|
+
let body = this.GetHeaderNames();
|
|
76
|
+
// let Row: any = [{ text: InvoiceData.Name, alignment: 'left', colSpan: isHC ? 5 : 8, bold: true, fontSize: 12 }, {}, {}, {}, {}];
|
|
77
|
+
// if (!isHC) {
|
|
78
|
+
// Row.push({});
|
|
79
|
+
// Row.push({});
|
|
80
|
+
// Row.push({});
|
|
81
|
+
// }
|
|
82
|
+
// body.unshift(Row);
|
|
83
|
+
// InvoicesData.forEach((InvoiceData: any) => {
|
|
84
|
+
InvoiceData.forEach((invoice, index) => {
|
|
85
|
+
let dataRow = [];
|
|
86
|
+
// if (isHC) {
|
|
87
|
+
// dataRow.push({ text: index + 1 });
|
|
88
|
+
// dataRow.push({ text: invoice.Code });
|
|
89
|
+
// if (!isHC) {
|
|
90
|
+
// dataRow.push({ text: invoice.Prod?.RegNo });
|
|
91
|
+
// dataRow.push({ text: TrUtils.IsNull(invoice.Prod) ? '' : invoice.Prod?.Model + ' ' + invoice.Prod?.Var });
|
|
92
|
+
// }
|
|
93
|
+
// // dataRow.push({ text: invoice.BFrom.Name, alignment: 'left', style: ['headerstyle'], });
|
|
94
|
+
// dataRow.push({ text: MyDate.ConvertUTCDateToReadable(invoice.CrDate), alignment: 'center', style: ['headerstyle'], });
|
|
95
|
+
// dataRow.push({ text: TrUtils.FixPriceValue(invoice.Total), alignment: 'right', style: ['headerstyle'], });
|
|
96
|
+
// dataRow.push({ text: TrUtils.FixPriceValue(invoice.Due), alignment: 'right', style: ['headerstyle'], });
|
|
97
|
+
// body.push(dataRow);
|
|
98
|
+
// if (InvoiceData.Invoices.length === (index + 1)) {
|
|
99
|
+
// let Row: any = [{ text: 'Total Due ', alignment: 'right', colSpan: isHC ? 4 : 6, bold: true, fontSize: 9 }, {}, {}, {}, { text: TrUtils.FixPriceValue(InvoiceData.Balance), fontSize: 9, alignment: 'right', bold: true }];
|
|
100
|
+
// if (!isHC) {
|
|
101
|
+
// Row.splice(2, 0, {}, {});
|
|
102
|
+
// // Row.push({});
|
|
103
|
+
// }
|
|
104
|
+
// body.push(Row);
|
|
105
|
+
// }
|
|
106
|
+
// } else {
|
|
107
|
+
dataRow.push({ text: index + 1 });
|
|
108
|
+
dataRow.push({ text: invoice.Customer.DName });
|
|
109
|
+
dataRow.push({ text: invoice.RegNo });
|
|
110
|
+
dataRow.push({ text: invoice.Make + '' + invoice.Model + '' + invoice.Var });
|
|
111
|
+
// if(!isHC){
|
|
112
|
+
dataRow.push({ text: my_date_1.MyDate.ConvertUTCDateToReadable(invoice.DDate), alignment: 'right' });
|
|
113
|
+
dataRow.push({ text: my_date_1.MyDate.ConvertUTCDateToReadable(invoice.LSDate), alignment: 'right' });
|
|
114
|
+
dataRow.push({ text: invoice.LMileage });
|
|
115
|
+
dataRow.push({ text: my_date_1.MyDate.ConvertUTCDateToReadable(invoice.NSDate) });
|
|
116
|
+
// dataRow.push({ text: TrUtils.FixPriceValue(invoice.Total), alignment: 'right' });
|
|
117
|
+
// dataRow.push({ text: TrUtils.IsNull(invoice.Prod) ? '' : invoice.Prod?.Model + ' ' + invoice.Prod?.Var });
|
|
118
|
+
// }
|
|
119
|
+
// dataRow.push({ text: invoice.BFrom.Name, alignment: 'left', style: ['headerstyle'], });
|
|
120
|
+
// dataRow.push({ text: TrUtils.FixPriceValue(invoice.UnAmt + invoice.Tax), alignment: 'right', style: ['headerstyle'], });
|
|
121
|
+
// dataRow.push({ text: TrUtils.FixPriceValue(invoice.Due), alignment: 'right', style: ['headerstyle'], });
|
|
122
|
+
body.push(dataRow);
|
|
123
|
+
// if (InvoiceData.Invoices.length === (index + 1)) {
|
|
124
|
+
// let Row: any = [{ text: 'Total Due ', alignment: 'right', colSpan: isHC?4:6, bold: true, fontSize: 9 }, {}, {}, {}, { text: TrUtils.FixPriceValue(InvoiceData.Balance), fontSize: 9, alignment: 'right', bold: true }];
|
|
125
|
+
// if(!isHC){
|
|
126
|
+
// Row.splice(2, 0,{},{});
|
|
127
|
+
// // Row.push({});
|
|
128
|
+
// }
|
|
129
|
+
// body.push(Row);
|
|
130
|
+
// }
|
|
131
|
+
// }
|
|
132
|
+
});
|
|
133
|
+
// });
|
|
134
|
+
return body;
|
|
135
|
+
}
|
|
136
|
+
static GetHeaderNames() {
|
|
137
|
+
let HeadingNames;
|
|
138
|
+
// if (isHC) {
|
|
139
|
+
// HeadingNames = [[{ text: 'S.No', style: 'tableheader1', Field: 'SNo', alignment: 'left', line: true },
|
|
140
|
+
// { text: isPhar ? 'Counter Sale Number' : 'Invoice Number', style: 'tableheader1', Field: 'BNo', alignment: 'left' },
|
|
141
|
+
// { text: 'Create Date', style: 'tableheader1', Field: 'CrDate' },
|
|
142
|
+
// { text: 'Total', style: 'tableheader1', Field: 'Total', alignment: 'right' },
|
|
143
|
+
// { text: 'Due', style: 'tableheader1', Field: 'Due', alignment: 'right' }]];
|
|
144
|
+
// if (!isHC) {
|
|
145
|
+
// HeadingNames[0].splice(2, 0, { text: 'Reg No', style: 'tableheader1', Field: 'Reg No', alignment: 'left' }
|
|
146
|
+
// , { text: 'Vehicle', style: 'tableheader1', Field: 'Vehicle', alignment: 'left' });
|
|
147
|
+
// // HeadingNames.splice(3, 0, { text: 'Vehicle', style: 'tableheader1', Field: 'Vehicle', alignment: 'left' });
|
|
148
|
+
// }
|
|
149
|
+
// } else {
|
|
150
|
+
HeadingNames = [[{ text: 'S.No', style: 'tableheader1', Field: 'SNo', alignment: 'left', line: true },
|
|
151
|
+
{ text: 'Customer Name', style: 'tableheader1', Field: 'Desc' },
|
|
152
|
+
{ text: 'Reg. No', style: 'tableheader1', Field: 'Batch' },
|
|
153
|
+
{ text: 'Vehicle', style: 'tableheader1', Field: 'Round', alignment: 'right' },
|
|
154
|
+
{ text: 'Sale Date', style: 'tableheader1', Field: 'Total', alignment: 'right' },
|
|
155
|
+
{ text: 'Last Service Date', style: 'tableheader1', Field: 'Total', alignment: 'right' },
|
|
156
|
+
{ text: 'Last Mileage', style: 'tableheader1', Field: 'Total', alignment: 'right' },
|
|
157
|
+
{ text: 'Next Service Date', style: 'tableheader1', Field: 'Total', alignment: 'right' }
|
|
158
|
+
]
|
|
159
|
+
];
|
|
160
|
+
// { text: 'Due', style: 'tableheader1', Field: 'Due', alignment: 'right' }]];
|
|
161
|
+
// if (!isHC) {
|
|
162
|
+
// HeadingNames[0].splice(2, 0, { text: 'Reg No', style: 'tableheader1', Field: 'Reg No', alignment: 'left' }
|
|
163
|
+
// , { text: 'Vehicle', style: 'tableheader1', Field: 'Vehicle', alignment: 'left' });
|
|
164
|
+
// // HeadingNames.splice(3, 0, { text: 'Vehicle', style: 'tableheader1', Field: 'Vehicle', alignment: 'left' });
|
|
165
|
+
// }
|
|
166
|
+
// }
|
|
167
|
+
return HeadingNames;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
exports.NextServiceDatePDFService = NextServiceDatePDFService;
|