shareneus 1.5.12 → 1.5.14

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.
@@ -105,9 +105,7 @@ class PurchaseOrderTotalsService {
105
105
  if (tr_utils_1.TrUtils.IsNull(Part.Ind)) {
106
106
  Part.DiscountedPrice = this.GetPartDiscountedPrice(Part.Disc, Part.RecDisc);
107
107
  // Part.AfterDiscountPrice = Part.NetAmt;
108
- console.log('Part total', Part.UnAmt, Part.Disc, Part.RecDisc);
109
108
  Part.AfterDiscountPrice = (0, math_operations_1.Subtract)(Part.UnAmt, Part.Disc, Part.RecDisc);
110
- console.log('After discount', Part.AfterDiscountPrice);
111
109
  }
112
110
  Part.GSTAmt = (0, math_operations_1.Add)(Part.SGST, Part.CGST, Part.IGST);
113
111
  Part.Desc = Part.Name;
@@ -161,7 +159,6 @@ class PurchaseOrderTotalsService {
161
159
  static GetTotalsInfo(PartsList, LaborList, IsTaxable, TaxCodes, HasNoTax, GetSubTotal, Discount, DiscInPerc, Adjust, DecimalsNumber) {
162
160
  let finalTotalsData = {};
163
161
  let PartsInfo = this.GetPartsTotalTaxAndAfterDiscount(PartsList);
164
- console.log('PartsInfo', tr_utils_1.TrUtils.Stringify(PartsInfo));
165
162
  let PartsTotalAfterDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(PartsInfo[0]);
166
163
  let PartsDiscTotal = tr_utils_1.TrUtils.SetValueToZeroIfNull(PartsInfo[1]);
167
164
  let PartsTaxTotal = tr_utils_1.TrUtils.SetValueToZeroIfNull(PartsInfo[2]);
@@ -169,7 +166,6 @@ class PurchaseOrderTotalsService {
169
166
  let ServicesTotalAfterDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(ServicesInfo[0]);
170
167
  let ServicesDiscTotal = tr_utils_1.TrUtils.SetValueToZeroIfNull(ServicesInfo[1]);
171
168
  let ServicesTaxTotal = tr_utils_1.TrUtils.SetValueToZeroIfNull(ServicesInfo[2]);
172
- console.log('Subtotal', PartsTotalAfterDisc, PartsDiscTotal, ServicesTotalAfterDisc, ServicesDiscTotal);
173
169
  finalTotalsData.SubTotal = (0, math_operations_1.Add)(PartsTotalAfterDisc, PartsDiscTotal, ServicesTotalAfterDisc, ServicesDiscTotal);
174
170
  finalTotalsData.Adj = tr_utils_1.TrUtils.FixPriceValue(Adjust, DecimalsNumber);
175
171
  // if (GetSubTotal) {
@@ -208,7 +204,6 @@ class PurchaseOrderTotalsService {
208
204
  let PartsDiscountedTotal = 0;
209
205
  let TotalTaxAmt = 0;
210
206
  PartsList.forEach((Part) => {
211
- console.log('Part', Part.AfterDiscountPrice, Part.DiscountedPrice, Part.GSTAmt);
212
207
  PartsTotalAfterDisc = (0, math_operations_1.Add)(PartsTotalAfterDisc, Part.AfterDiscountPrice);
213
208
  PartsDiscountedTotal = (0, math_operations_1.Add)(PartsDiscountedTotal, Part.DiscountedPrice);
214
209
  TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.GSTAmt);
@@ -1,6 +1,6 @@
1
- export declare function SalesTotalCalculations(items?: any[], ops?: any[], isTaxable?: boolean, taxCodes?: any[]): any;
1
+ export declare function SalesTotalCalculations(items?: any[], ops?: any[], isTaxable?: boolean, taxCodes?: any[], Adjust?: number): any;
2
2
  /**
3
3
  * Enhanced version with decimal places control
4
4
  */
5
- export declare function SalesTotalCalculationsWithDecimals(items?: any[], ops?: any[], isTaxable?: boolean, taxCodes?: any[], decimalPlaces?: number): any;
5
+ export declare function SalesTotalCalculationsWithDecimals(items: any[] | undefined, ops: any[] | undefined, isTaxable: boolean | undefined, taxCodes: any[] | undefined, Adjust: number, decimalPlaces?: number): any;
6
6
  export declare function CalculateTaxSummary(items: any[], taxCodes: any[]): unknown[];
@@ -11,7 +11,7 @@ const util_1 = require("../shared/util");
11
11
  function safeArray(arr) {
12
12
  return Array.isArray(arr) ? arr : [];
13
13
  }
14
- function SalesTotalCalculations(items = [], ops = [], isTaxable = false, taxCodes = []) {
14
+ function SalesTotalCalculations(items = [], ops = [], isTaxable = false, taxCodes = [], Adjust = 0) {
15
15
  // Handle null/undefined arrays
16
16
  const safeItems = safeArray(items);
17
17
  const safeOps = safeArray(ops);
@@ -92,6 +92,7 @@ function SalesTotalCalculations(items = [], ops = [], isTaxable = false, taxCode
92
92
  const netAmountAfterDiscount = (0, math_operations_1.Subtract)(subtotal, totalDiscount);
93
93
  // Step 2: Add tax if taxable
94
94
  total = isTaxable ? (0, math_operations_1.Add)(netAmountAfterDiscount, totalTax) : netAmountAfterDiscount;
95
+ total = (0, math_operations_1.Add)(total, (0, util_1.GetNumber)(Adjust));
95
96
  // FIXED ROUNDING: Use Math.round instead of Math.floor
96
97
  const roundedTotal = Math.round(total);
97
98
  roundOff = (0, math_operations_1.Subtract)(roundedTotal, total);
@@ -133,8 +134,8 @@ function SalesTotalCalculations(items = [], ops = [], isTaxable = false, taxCode
133
134
  /**
134
135
  * Enhanced version with decimal places control
135
136
  */
136
- function SalesTotalCalculationsWithDecimals(items = [], ops = [], isTaxable = false, taxCodes = [], decimalPlaces = 2) {
137
- const result = SalesTotalCalculations(items, ops, isTaxable, taxCodes);
137
+ function SalesTotalCalculationsWithDecimals(items = [], ops = [], isTaxable = false, taxCodes = [], Adjust, decimalPlaces = 2) {
138
+ const result = SalesTotalCalculations(items, ops, isTaxable, taxCodes, Adjust);
138
139
  // Round all values to specified decimal places
139
140
  const roundToDecimals = (num) => Math.round(num * Math.pow(10, decimalPlaces)) / Math.pow(10, decimalPlaces);
140
141
  // Base rounded result
@@ -17,6 +17,7 @@ export declare class NextServiceDateXlsxFileService {
17
17
  static GetTotals(MainData: any): any;
18
18
  static setHeadingInCell(HeaderName: any, showSearch: any, isDetails: boolean): void;
19
19
  static setInvoiceDetailsInCell(MainData: any, isDetails: boolean, DecimalsNumber: number): void;
20
+ static PhoneGetter(Customer: any): any;
20
21
  static SetInvoiceDataInExcel(InvoiceInfo: any, isDetails: boolean, DecimalsNumber: number): void;
21
22
  static ConvertDateToReadableFormat(DateObject: any): any;
22
23
  static ConvertToString(Text: any, IsString: any, DecimalsNumber: number): any;
@@ -96,6 +96,12 @@ class NextServiceDateXlsxFileService {
96
96
  bold: true,
97
97
  ChildHeadings: [],
98
98
  },
99
+ {
100
+ text: 'Mobile No',
101
+ ColRange: 1,
102
+ bold: true,
103
+ ChildHeadings: [],
104
+ },
99
105
  {
100
106
  text: 'Reg. No',
101
107
  ColRange: 1,
@@ -194,6 +200,15 @@ class NextServiceDateXlsxFileService {
194
200
  this.SetInvoiceDataInExcel(InvoiceList, isDetails, DecimalsNumber);
195
201
  });
196
202
  }
203
+ static PhoneGetter(Customer) {
204
+ if (!tr_utils_1.TrUtils.IsEmpty(Customer) && !tr_utils_1.TrUtils.IsEmpty(Customer.Cons) &&
205
+ !tr_utils_1.TrUtils.IsNull(Customer.Cons.Phones)) {
206
+ return Customer.Cons.Phones.Main;
207
+ }
208
+ else {
209
+ return '';
210
+ }
211
+ }
197
212
  static SetInvoiceDataInExcel(InvoiceInfo, isDetails, DecimalsNumber) {
198
213
  var _a;
199
214
  InvoiceInfo.LSDate = this.ConvertDateToReadableFormat(InvoiceInfo.LSDate);
@@ -201,6 +216,7 @@ class NextServiceDateXlsxFileService {
201
216
  InvoiceInfo.DDate = this.ConvertDateToReadableFormat(InvoiceInfo.DDate);
202
217
  let InvoiceData = [
203
218
  { text: (_a = InvoiceInfo.Customer) === null || _a === void 0 ? void 0 : _a.DName, ColRange: 1, IsString: true },
219
+ { text: this.PhoneGetter(InvoiceInfo.Customer), ColRange: 1, IsString: true },
204
220
  { text: InvoiceInfo.RegNo, ColRange: 1, IsString: true },
205
221
  { text: InvoiceInfo.Make + '' + InvoiceInfo.Model + '' + InvoiceInfo.Var, ColRange: 1, IsString: false },
206
222
  { text: InvoiceInfo.DDate, ColRange: 1, IsString: false },
@@ -223,6 +223,7 @@ export declare class NextServiceDatePDFService {
223
223
  vLineColor: (i: any, node: any) => string;
224
224
  };
225
225
  };
226
+ static PhoneGetter(Customer: any): any;
226
227
  static BuildTableBodyForLaborAndParts(InvoiceData: any): any;
227
228
  static GetHeaderNames(): any;
228
229
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NextServiceDatePDFService = void 0;
4
4
  const shared_pdf_service_1 = require("../../../shared/shared-pdf.service");
5
5
  const my_date_1 = require("../../../utils/my-date");
6
+ const tr_utils_1 = require("../../../utils/tr-utils");
6
7
  class NextServiceDatePDFService {
7
8
  static GetNextServiceDatePrint(InvoicesData, CName, searchValue) {
8
9
  var dd = {
@@ -34,7 +35,7 @@ class NextServiceDatePDFService {
34
35
  // if (isHC) {
35
36
  // return [25, '*', '*', '*', '*'];
36
37
  // } else {
37
- return [25, '*', '*', '*', '*', '*', '*', '*'];
38
+ return [20, '*', '*', '*', '*', '*', '*', '*', '*'];
38
39
  // }
39
40
  }
40
41
  static GetItemsTable(InvoiceData) {
@@ -69,6 +70,15 @@ class NextServiceDatePDFService {
69
70
  };
70
71
  // });
71
72
  }
73
+ static PhoneGetter(Customer) {
74
+ if (!tr_utils_1.TrUtils.IsEmpty(Customer) && !tr_utils_1.TrUtils.IsEmpty(Customer.Cons) &&
75
+ !tr_utils_1.TrUtils.IsNull(Customer.Cons.Phones)) {
76
+ return Customer.Cons.Phones.Main;
77
+ }
78
+ else {
79
+ return '';
80
+ }
81
+ }
72
82
  static BuildTableBodyForLaborAndParts(InvoiceData) {
73
83
  let body = this.GetHeaderNames();
74
84
  // let Row: any = [{ text: InvoiceData.Name, alignment: 'left', colSpan: isHC ? 5 : 8, bold: true, fontSize: 12 }, {}, {}, {}, {}];
@@ -104,6 +114,7 @@ class NextServiceDatePDFService {
104
114
  // } else {
105
115
  dataRow.push({ text: index + 1 });
106
116
  dataRow.push({ text: invoice.Customer.DName });
117
+ dataRow.push({ text: this.PhoneGetter(invoice.Customer) });
107
118
  dataRow.push({ text: invoice.RegNo });
108
119
  dataRow.push({ text: invoice.Make + '' + invoice.Model + '' + invoice.Var });
109
120
  // if(!isHC){
@@ -147,6 +158,7 @@ class NextServiceDatePDFService {
147
158
  // } else {
148
159
  HeadingNames = [[{ text: 'S.No', style: 'tableheader1', Field: 'SNo', alignment: 'left', line: true },
149
160
  { text: 'Customer Name', style: 'tableheader1', Field: 'Desc', alignment: 'left' },
161
+ { text: 'Mobile No', style: 'tableheader1', Field: 'MobileNo', alignment: 'left' },
150
162
  { text: 'Reg. No', style: 'tableheader1', Field: 'Batch', alignment: 'left' },
151
163
  { text: 'Vehicle', style: 'tableheader1', Field: 'Round', alignment: 'left' },
152
164
  { text: 'Sale Date', style: 'tableheader1', Field: 'Total', alignment: 'left' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.5.12",
3
+ "version": "1.5.14",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",