shareneus 1.4.51 → 1.4.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -123,3 +123,4 @@ export { ItemBarCodeLabelPdf } from './inventory/items/item-bar-code-label-pdf';
123
123
  export { GetItemPriceForPriceList } from "./inventory/items/item-price-for-pricelist";
124
124
  export { CalcItemFinalSalePrice } from "./inventory/items/item-price-for-pricelist";
125
125
  export { IsNotNull, IsNull } from "./shared/util";
126
+ export { GetAgeString } from "./shared/util";
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.IsNull = exports.IsNotNull = exports.CalcItemFinalSalePrice = exports.GetItemPriceForPriceList = exports.ItemBarCodeLabelPdf = 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;
5
+ exports.GetAgeString = exports.IsNull = exports.IsNotNull = exports.CalcItemFinalSalePrice = exports.GetItemPriceForPriceList = exports.ItemBarCodeLabelPdf = 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("./accounting/invoice/reports/excel/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("./accounting/invoice/reports/excel/category-wise-item-excel.service");
@@ -254,3 +254,5 @@ Object.defineProperty(exports, "CalcItemFinalSalePrice", { enumerable: true, get
254
254
  var util_1 = require("./shared/util");
255
255
  Object.defineProperty(exports, "IsNotNull", { enumerable: true, get: function () { return util_1.IsNotNull; } });
256
256
  Object.defineProperty(exports, "IsNull", { enumerable: true, get: function () { return util_1.IsNull; } });
257
+ var util_2 = require("./shared/util");
258
+ Object.defineProperty(exports, "GetAgeString", { enumerable: true, get: function () { return util_2.GetAgeString; } });
@@ -182,3 +182,46 @@ function GetMarginValue(price, cost) {
182
182
  // Return the calculated margin
183
183
  return margin;
184
184
  }
185
+ // /* Returns age as a human-readable string in years, months, weeks and days.
186
+ // * E.g. "10 years, 5 months, 1 week, 2 days"
187
+ // */
188
+ // export function GetAgeString(dateOfBirth: Date): string {
189
+ // const now = new Date();
190
+ // // 1) Calculate full years
191
+ // let years = now.getFullYear() - dateOfBirth.getFullYear();
192
+ // const anniversary = new Date(dateOfBirth);
193
+ // anniversary.setFullYear(dateOfBirth.getFullYear() + years);
194
+ // if (anniversary > now) {
195
+ // years--;
196
+ // anniversary.setFullYear(dateOfBirth.getFullYear() + years);
197
+ // }
198
+ // // 2) Calculate full months since last "anniversary"
199
+ // let temp = new Date(anniversary);
200
+ // let months = 0;
201
+ // while (true) {
202
+ // const next = new Date(temp);
203
+ // next.setMonth(next.getMonth() + 1);
204
+ // if (next <= now) {
205
+ // months++;
206
+ // temp = next;
207
+ // } else {
208
+ // break;
209
+ // }
210
+ // }
211
+ // // 3) Calculate remaining days → weeks + days
212
+ // const msPerDay = 24 * 60 * 60 * 1000;
213
+ // const daysTotal = Math.floor((now.getTime() - temp.getTime()) / msPerDay);
214
+ // const weeks = Math.floor(daysTotal / 7);
215
+ // const days = daysTotal % 7;
216
+ // // 4) Build the output, skipping zero-values
217
+ // const parts: string[] = [];
218
+ // if (years) parts.push(`${years} year${years > 1 ? 's' : ''}`);
219
+ // if (months) parts.push(`${months} month${months > 1 ? 's' : ''}`);
220
+ // if (weeks) parts.push(`${weeks} week${weeks > 1 ? 's' : ''}`);
221
+ // if (days) parts.push(`${days} day${days > 1 ? 's' : ''}`);
222
+ // // Fallback for same-day birth (unlikely in practice)
223
+ // if (parts.length === 0) {
224
+ // return '0 days';
225
+ // }
226
+ // return parts.join(', ');
227
+ // }
@@ -1298,7 +1298,7 @@ class SharedPDFService {
1298
1298
  return headersNames;
1299
1299
  }
1300
1300
  static PartsTaxAmounts1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
1301
- if (ShowTaxColumn) {
1301
+ if (ShowTaxColumn && !tr_utils_1.TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length > 0) {
1302
1302
  return {
1303
1303
  stack: [this.AllHSNPartCGSTTaxListTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)]
1304
1304
  };
@@ -1308,7 +1308,7 @@ class SharedPDFService {
1308
1308
  }
1309
1309
  }
1310
1310
  static PartsTaxAmounts(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
1311
- if (ShowTaxColumn) {
1311
+ if (ShowTaxColumn && !tr_utils_1.TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length > 0) {
1312
1312
  return {
1313
1313
  stack: [this.AllHSNPartCGSTTaxListTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)]
1314
1314
  };
@@ -1726,7 +1726,7 @@ class SharedPDFService {
1726
1726
  },
1727
1727
  { text: '', width: moreDiscDetails ? 40 : 60 },
1728
1728
  // this.GrandTotal(LaborAfterGST, PartsAfterGST, totalDisc, For, OverAllRecordTotal, Rounded, GrandTotal)
1729
- this.GrandTotal(RecordData, BasicLaborTotal, BasicPartsTotal, totalDisc, totalTax, For, OverAllRecordTotal, Rounded, GrandTotal, Adj, Consolidate, STotal, moreDiscDetails, RecordData)
1729
+ this.GrandTotal(RecordData, BasicLaborTotal, BasicPartsTotal, totalDisc, totalTax, For, OverAllRecordTotal, Rounded, GrandTotal, Adj, Consolidate, STotal, moreDiscDetails, RecordData.Entity.DecimalsNumber)
1730
1730
  ]
1731
1731
  // columnGap: 40
1732
1732
  ,
@@ -1,3 +1,12 @@
1
1
  export declare function GetNumber(value: any, defaultValue?: number): number;
2
2
  export declare function IsNull(value: unknown): boolean;
3
3
  export declare function IsNotNull(value: unknown): boolean;
4
+ /**
5
+ * Returns age as a human-readable string in years, months, weeks and days.
6
+ * E.g. "10 years, 5 months, 1 week, 2 days".
7
+ * If DOB is in the future or invalid, returns "0 days".
8
+ *
9
+ * @param DOB Date or parsable date-string of birth
10
+ * @param referenceDate Date to calculate age against (default: now)
11
+ */
12
+ export declare function GetAgeString(DOB: Date | string, referenceDate?: Date): string;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetNumber = GetNumber;
4
4
  exports.IsNull = IsNull;
5
5
  exports.IsNotNull = IsNotNull;
6
+ exports.GetAgeString = GetAgeString;
6
7
  function GetNumber(value, defaultValue = 0) {
7
8
  return (value == undefined || value == null || isNaN(value)) ? defaultValue : Number(value);
8
9
  }
@@ -13,3 +14,72 @@ function IsNull(value) {
13
14
  function IsNotNull(value) {
14
15
  return !IsNull(value);
15
16
  }
17
+ /**
18
+ * Returns age as a human-readable string in years, months, weeks and days.
19
+ * E.g. "10 years, 5 months, 1 week, 2 days".
20
+ * If DOB is in the future or invalid, returns "0 days".
21
+ *
22
+ * @param DOB Date or parsable date-string of birth
23
+ * @param referenceDate Date to calculate age against (default: now)
24
+ */
25
+ function GetAgeString(DOB, referenceDate = new Date()) {
26
+ // 1) Parse & validate DOB
27
+ const birthDate = DOB instanceof Date
28
+ ? new Date(DOB.getTime())
29
+ : new Date(DOB);
30
+ if (isNaN(birthDate.getTime())) {
31
+ // invalid date
32
+ return '0 days';
33
+ }
34
+ // 2) Normalize both dates to UTC midnight (avoid DST/timezone issues)
35
+ function toUtcMidnight(d) {
36
+ return new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));
37
+ }
38
+ const start = toUtcMidnight(birthDate);
39
+ const end = toUtcMidnight(referenceDate);
40
+ // 3) Prevent negative intervals
41
+ if (start > end) {
42
+ return '0 days';
43
+ }
44
+ // 4) Calculate full years
45
+ let years = end.getUTCFullYear() - start.getUTCFullYear();
46
+ // “Anniversary” = birthday + years
47
+ let anniversary = new Date(Date.UTC(start.getUTCFullYear() + years, start.getUTCMonth(), start.getUTCDate()));
48
+ if (anniversary > end) {
49
+ years--;
50
+ anniversary = new Date(Date.UTC(start.getUTCFullYear() + years, start.getUTCMonth(), start.getUTCDate()));
51
+ }
52
+ // 5) Calculate full months since last anniversary
53
+ let temp = new Date(anniversary);
54
+ let months = 0;
55
+ while (true) {
56
+ const next = new Date(Date.UTC(temp.getUTCFullYear(), temp.getUTCMonth() + 1, temp.getUTCDate()));
57
+ if (next <= end) {
58
+ months++;
59
+ temp = next;
60
+ }
61
+ else {
62
+ break;
63
+ }
64
+ }
65
+ // 6) Calculate remaining days → weeks + days
66
+ const msPerDay = 24 * 60 * 60 * 1000;
67
+ const daysTotal = Math.floor((end.getTime() - temp.getTime()) / msPerDay);
68
+ const weeks = Math.floor(daysTotal / 7);
69
+ const days = daysTotal % 7;
70
+ // 7) Build the output, skipping zero-valued units
71
+ const parts = [];
72
+ if (years)
73
+ parts.push(`${years} year${years > 1 ? 's' : ''}`);
74
+ if (months)
75
+ parts.push(`${months} month${months > 1 ? 's' : ''}`);
76
+ if (weeks)
77
+ parts.push(`${weeks} week${weeks > 1 ? 's' : ''}`);
78
+ if (days)
79
+ parts.push(`${days} day${days > 1 ? 's' : ''}`);
80
+ // 8) Fallback
81
+ if (parts.length === 0) {
82
+ return '0 days';
83
+ }
84
+ return parts.join(', ');
85
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.4.51",
3
+ "version": "1.4.53",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",