shareneus 1.6.66 → 1.6.67
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.
|
@@ -175,7 +175,7 @@ function resolvePurchaseOtherDetails(transactionData, printConfig = {}) {
|
|
|
175
175
|
// const ChassisNo = transactionData?.Product?.VIN;
|
|
176
176
|
const lines = [
|
|
177
177
|
{ label: documentNumberLabel, value: billNumber },
|
|
178
|
-
{ label: 'Date', value: billDate ?
|
|
178
|
+
{ label: 'Date', value: billDate ? billDate : '' },
|
|
179
179
|
// { label: 'Vehicle', value: vehicleDetails },
|
|
180
180
|
// { label: 'Regn. No', value: firstValue(RegnNo) },
|
|
181
181
|
// { label: 'Engine No', value: firstValue(EngNo) },
|
|
@@ -216,7 +216,7 @@ function resolveInsuranceDetails(transactionData) {
|
|
|
216
216
|
}
|
|
217
217
|
function resolveOtherDetails(transactionData, printConfig = {}) {
|
|
218
218
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
219
|
-
const invoiceDate = (0, pdf_shared_utils_1.firstValue)(transactionData === null || transactionData === void 0 ? void 0 : transactionData.
|
|
219
|
+
const invoiceDate = (0, pdf_shared_utils_1.firstValue)(transactionData === null || transactionData === void 0 ? void 0 : transactionData.CrDate, transactionData === null || transactionData === void 0 ? void 0 : transactionData.DDate, transactionData === null || transactionData === void 0 ? void 0 : transactionData.InvDt, transactionData === null || transactionData === void 0 ? void 0 : transactionData.Date);
|
|
220
220
|
const invoiceNumber = (0, pdf_shared_utils_1.firstValue)(transactionData === null || transactionData === void 0 ? void 0 : transactionData._id, transactionData === null || transactionData === void 0 ? void 0 : transactionData.Code, transactionData === null || transactionData === void 0 ? void 0 : transactionData.InvNo, transactionData === null || transactionData === void 0 ? void 0 : transactionData.No);
|
|
221
221
|
const documentNumberLabel = resolveDocumentNumberLabel(printConfig, 'Invoice');
|
|
222
222
|
const productName = [
|
|
@@ -236,7 +236,7 @@ function resolveOtherDetails(transactionData, printConfig = {}) {
|
|
|
236
236
|
const shouldShowDoctorName = documentNumberLabel === 'Sales Receipt#';
|
|
237
237
|
const lines = [
|
|
238
238
|
{ label: documentNumberLabel, value: invoiceNumber },
|
|
239
|
-
{ label: 'Date', value: invoiceDate ?
|
|
239
|
+
{ label: 'Date', value: invoiceDate ? invoiceDate : '' },
|
|
240
240
|
{ label: 'Vehicle', value: vehicleDetails },
|
|
241
241
|
{ label: 'Regn. No', value: (0, pdf_shared_utils_1.firstValue)(RegnNo) },
|
|
242
242
|
{ label: 'Engine No', value: (0, pdf_shared_utils_1.firstValue)(EngNo) },
|
|
@@ -410,23 +410,23 @@ function getAddressFieldValue(address, keys) {
|
|
|
410
410
|
}
|
|
411
411
|
return '';
|
|
412
412
|
}
|
|
413
|
-
function formatDisplayDate(value) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
function leftPadWithZero(value) {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
}
|
|
413
|
+
// function formatDisplayDate(value: string) {
|
|
414
|
+
// if (!value) {
|
|
415
|
+
// return '-';
|
|
416
|
+
// }
|
|
417
|
+
// const dt = new Date(value);
|
|
418
|
+
// if (!Number.isNaN(dt.getTime())) {
|
|
419
|
+
// const day = leftPadWithZero(dt.getDate());
|
|
420
|
+
// const month = leftPadWithZero(dt.getMonth() + 1);
|
|
421
|
+
// const year = dt.getFullYear();
|
|
422
|
+
// return `${day}/${month}/${year}`;
|
|
423
|
+
// }
|
|
424
|
+
// return value;
|
|
425
|
+
// }
|
|
426
|
+
// function leftPadWithZero(value: number) {
|
|
427
|
+
// const text = String(value);
|
|
428
|
+
// return text.length >= 2 ? text : `0${text}`;
|
|
429
|
+
// }
|
|
430
430
|
function resolveShowBarCode(transactionData, printConfig = {}) {
|
|
431
431
|
var _a, _b;
|
|
432
432
|
if (Object.prototype.hasOwnProperty.call(printConfig || {}, 'Customer')) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildInvoiceTotalsAndNotesSection = buildInvoiceTotalsAndNotesSection;
|
|
4
4
|
exports.buildSignatureSection = buildSignatureSection;
|
|
5
|
+
const my_date_1 = require("../../utils/my-date");
|
|
5
6
|
const pdf_header_footer_section_1 = require("../header-footer-section/pdf-header-footer.section");
|
|
6
7
|
const pdf_shared_utils_1 = require("../header-footer-section/pdf-shared.utils");
|
|
7
8
|
const math_operations_1 = require("../math-operations");
|
|
@@ -184,13 +185,13 @@ function buildSignatureSection(PrintConfig, invoiceData, availableWidth) {
|
|
|
184
185
|
return [...signatureRows, ...buildGatePassSection(companyName, invoiceData, availableWidth)];
|
|
185
186
|
}
|
|
186
187
|
function buildGatePassSection(companyName, invoiceData, availableWidth) {
|
|
187
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
188
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
188
189
|
const customerName = (0, pdf_shared_utils_1.firstValue)((_a = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Customer) === null || _a === void 0 ? void 0 : _a.Name, (_b = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Cust) === null || _b === void 0 ? void 0 : _b.Name, (_c = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.BillTo) === null || _c === void 0 ? void 0 : _c.Name, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.CustomerName);
|
|
189
190
|
const serviceAdvisor = (0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Name, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.ServiceAdvisor, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.AdvisorName, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.SAName);
|
|
190
191
|
const chassisNo = (0, pdf_shared_utils_1.firstValue)((_d = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Prod) === null || _d === void 0 ? void 0 : _d.CIN, (_e = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Prod) === null || _e === void 0 ? void 0 : _e.ChassisNo, (_f = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Product) === null || _f === void 0 ? void 0 : _f.VIN, (_g = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Vehicle) === null || _g === void 0 ? void 0 : _g.VIN);
|
|
191
192
|
const regnNo = (0, pdf_shared_utils_1.firstValue)((_h = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Prod) === null || _h === void 0 ? void 0 : _h.RegnNo, (_j = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Product) === null || _j === void 0 ? void 0 : _j.RegNo, (_k = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Veh) === null || _k === void 0 ? void 0 : _k.RegNo, (_l = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Vehicle) === null || _l === void 0 ? void 0 : _l.RegNo, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.VehicleNo, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.VehNo);
|
|
192
193
|
const vehicleModel = (0, pdf_shared_utils_1.firstValue)((_m = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Prod) === null || _m === void 0 ? void 0 : _m.Model, (_o = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Product) === null || _o === void 0 ? void 0 : _o.Model, (_p = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Vehicle) === null || _p === void 0 ? void 0 : _p.Model);
|
|
193
|
-
const gatePassDate =
|
|
194
|
+
const gatePassDate = my_date_1.MyDate.ConvertUTCDateToReadable(my_date_1.MyDate.GetDateTimeNowInUTC((_r = (_q = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Entity) === null || _q === void 0 ? void 0 : _q.User) === null || _r === void 0 ? void 0 : _r.TZ));
|
|
194
195
|
const dividerLine = {
|
|
195
196
|
canvas: [
|
|
196
197
|
{ type: 'line', x1: 0, y1: 0, x2: Math.max(1, availableWidth), y2: 0, lineWidth: 1, lineColor: '#1f2937' }
|
|
@@ -283,27 +284,27 @@ function buildGatePassSection(companyName, invoiceData, availableWidth) {
|
|
|
283
284
|
}
|
|
284
285
|
];
|
|
285
286
|
}
|
|
286
|
-
function formatGatePassDate(value) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
function formatAsDDMMYYYY(dateValue) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
function leftPadWithZero(value) {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
287
|
+
// function formatGatePassDate(value: string) {
|
|
288
|
+
// const raw = firstValue(value);
|
|
289
|
+
// if (!raw) {
|
|
290
|
+
// return formatAsDDMMYYYY(new Date());
|
|
291
|
+
// }
|
|
292
|
+
// const parsed = new Date(raw);
|
|
293
|
+
// if (Number.isNaN(parsed.getTime())) {
|
|
294
|
+
// return raw;
|
|
295
|
+
// }
|
|
296
|
+
// return formatAsDDMMYYYY(parsed);
|
|
297
|
+
// }
|
|
298
|
+
// function formatAsDDMMYYYY(dateValue: Date) {
|
|
299
|
+
// const day = leftPadWithZero(dateValue.getDate());
|
|
300
|
+
// const month = leftPadWithZero(dateValue.getMonth() + 1);
|
|
301
|
+
// const year = dateValue.getFullYear();
|
|
302
|
+
// return `${day}/${month}/${year}`;
|
|
303
|
+
// }
|
|
304
|
+
// function leftPadWithZero(value: number) {
|
|
305
|
+
// const text = String(value);
|
|
306
|
+
// return text.length >= 2 ? text : `0${text}`;
|
|
307
|
+
// }
|
|
307
308
|
function buildSimpleTextCardStack(title, value) {
|
|
308
309
|
return [
|
|
309
310
|
{ text: title, bold: true, fontSize: 9, color: '#374151', margin: [0, 0, 0, 4] },
|
|
@@ -521,7 +521,7 @@ function ComputeDocumentTotals(input) {
|
|
|
521
521
|
// 5. DocTotal rounding
|
|
522
522
|
let roundedTotal = grandTotal;
|
|
523
523
|
let roundAdj = 0;
|
|
524
|
-
if (
|
|
524
|
+
if (Rounding.DocTotal !== false) { // default true
|
|
525
525
|
roundedTotal = RoundAmount(grandTotal, { Method: Rounding.Method, Precision: Rounding.Precision });
|
|
526
526
|
roundAdj = (0, math_operations_1.Subtract)(roundedTotal, grandTotal);
|
|
527
527
|
}
|