shareneus 1.5.27 → 1.5.29
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.
|
@@ -23,8 +23,8 @@ type PriceListDoc = {
|
|
|
23
23
|
export declare function ApplyServicePriceListToProcedure(procedure: any, priceList: PriceListDoc | null, quantity?: number): any;
|
|
24
24
|
export declare function ApplyServicePriceListToOpcode(opcode: any, priceList: PriceListDoc | null, quantity?: number): any;
|
|
25
25
|
/**
|
|
26
|
-
* Applies price list to Service with support for equipment-based pricing (
|
|
27
|
-
* Handles both simple services (healthcare) and equipment-based services (automotive, HVAC)
|
|
26
|
+
* Applies price list to Service with support for equipment-based pricing (FitPriceCosts)
|
|
27
|
+
* Handles both simple services (healthcare) and equipment-based services (automotive, HVAC, medical, industrial, etc.)
|
|
28
28
|
*/
|
|
29
|
-
export declare function GetServicePriceForPriceList(service: any, priceList: PriceListDoc | null,
|
|
29
|
+
export declare function GetServicePriceForPriceList(service: any, priceList: PriceListDoc | null, equipment?: any, quantity?: number): any;
|
|
30
30
|
export {};
|
|
@@ -235,10 +235,10 @@ function buildAppliedTierMeta(tier) {
|
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
238
|
-
* Applies price list to Service with support for equipment-based pricing (
|
|
239
|
-
* Handles both simple services (healthcare) and equipment-based services (automotive, HVAC)
|
|
238
|
+
* Applies price list to Service with support for equipment-based pricing (FitPriceCosts)
|
|
239
|
+
* Handles both simple services (healthcare) and equipment-based services (automotive, HVAC, medical, industrial, etc.)
|
|
240
240
|
*/
|
|
241
|
-
function GetServicePriceForPriceList(service, priceList,
|
|
241
|
+
function GetServicePriceForPriceList(service, priceList, equipment = null, quantity = 1) {
|
|
242
242
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
243
243
|
if (!service || !priceList) {
|
|
244
244
|
return service;
|
|
@@ -253,16 +253,16 @@ function GetServicePriceForPriceList(service, priceList, vehicle = null, quantit
|
|
|
253
253
|
if (priceList.TType === "SALE" && service.Sale) {
|
|
254
254
|
// Check if equipment-based service (FitPriceCosts) or simple service (Price)
|
|
255
255
|
if (service.FitPriceCosts && service.FitPriceCosts.length > 0) {
|
|
256
|
-
// Equipment-based service - need
|
|
257
|
-
if (!
|
|
258
|
-
warnings.push("
|
|
256
|
+
// Equipment-based service - need equipment information
|
|
257
|
+
if (!equipment) {
|
|
258
|
+
warnings.push("Equipment information required for equipment-based service pricing.");
|
|
259
259
|
service.PriceListWarnings = warnings;
|
|
260
260
|
return service;
|
|
261
261
|
}
|
|
262
|
-
// Find matching FitPriceCost for
|
|
263
|
-
matchedFitPriceCost = findMatchingFitPriceCost(service.FitPriceCosts,
|
|
262
|
+
// Find matching FitPriceCost for equipment
|
|
263
|
+
matchedFitPriceCost = findMatchingFitPriceCost(service.FitPriceCosts, equipment);
|
|
264
264
|
if (!matchedFitPriceCost || !matchedFitPriceCost.Sale) {
|
|
265
|
-
warnings.push(`No pricing found for ${
|
|
265
|
+
warnings.push(`No pricing found for ${equipment.Make || 'Unknown'} ${equipment.Model || ''}`);
|
|
266
266
|
service.PriceListWarnings = warnings;
|
|
267
267
|
return service;
|
|
268
268
|
}
|
|
@@ -373,16 +373,16 @@ function GetServicePriceForPriceList(service, priceList, vehicle = null, quantit
|
|
|
373
373
|
let baseCost = null;
|
|
374
374
|
let baseCostSource = "BASE";
|
|
375
375
|
if (service.FitPriceCosts && service.FitPriceCosts.length > 0) {
|
|
376
|
-
// Equipment-based service - need
|
|
377
|
-
if (!
|
|
378
|
-
warnings.push("
|
|
376
|
+
// Equipment-based service - need equipment information
|
|
377
|
+
if (!equipment) {
|
|
378
|
+
warnings.push("Equipment information required for equipment-based service costing.");
|
|
379
379
|
service.PriceListWarnings = warnings;
|
|
380
380
|
return service;
|
|
381
381
|
}
|
|
382
382
|
// Reuse the matchedFitPriceCost from Sale section if available
|
|
383
|
-
const fitPriceCostEntry = matchedFitPriceCost || findMatchingFitPriceCost(service.FitPriceCosts,
|
|
383
|
+
const fitPriceCostEntry = matchedFitPriceCost || findMatchingFitPriceCost(service.FitPriceCosts, equipment);
|
|
384
384
|
if (!fitPriceCostEntry || !fitPriceCostEntry.Pur) {
|
|
385
|
-
warnings.push(`No costing found for ${
|
|
385
|
+
warnings.push(`No costing found for ${equipment.Make || 'Unknown'} ${equipment.Model || ''}`);
|
|
386
386
|
service.PriceListWarnings = warnings;
|
|
387
387
|
return service;
|
|
388
388
|
}
|
|
@@ -446,41 +446,41 @@ function GetServicePriceForPriceList(service, priceList, vehicle = null, quantit
|
|
|
446
446
|
return service;
|
|
447
447
|
}
|
|
448
448
|
/**
|
|
449
|
-
* Finds the matching FitPriceCost entry for a given
|
|
449
|
+
* Finds the matching FitPriceCost entry for a given equipment (automotive, HVAC, medical, industrial, etc.)
|
|
450
450
|
* Tries most specific match first (Make + Model + Variant), then progressively less specific
|
|
451
451
|
*/
|
|
452
|
-
function findMatchingFitPriceCost(fitPriceCosts,
|
|
452
|
+
function findMatchingFitPriceCost(fitPriceCosts, equipment) {
|
|
453
453
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
454
|
-
if (!Array.isArray(fitPriceCosts) || fitPriceCosts.length === 0 || !
|
|
454
|
+
if (!Array.isArray(fitPriceCosts) || fitPriceCosts.length === 0 || !equipment) {
|
|
455
455
|
return null;
|
|
456
456
|
}
|
|
457
|
-
const
|
|
458
|
-
const
|
|
459
|
-
const
|
|
457
|
+
const equipmentMakeId = (_b = (_a = equipment.Make_Id) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
458
|
+
const equipmentModelId = (_d = (_c = equipment.Model_Id) === null || _c === void 0 ? void 0 : _c.toString) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
459
|
+
const equipmentVarId = ((_f = (_e = equipment.Var_Id) === null || _e === void 0 ? void 0 : _e.toString) === null || _f === void 0 ? void 0 : _f.call(_e)) || ((_h = (_g = equipment.Variant_Id) === null || _g === void 0 ? void 0 : _g.toString) === null || _h === void 0 ? void 0 : _h.call(_g));
|
|
460
460
|
// Try Make + Model + Variant
|
|
461
|
-
if (
|
|
461
|
+
if (equipmentMakeId && equipmentModelId && equipmentVarId) {
|
|
462
462
|
const match = fitPriceCosts.find((fpc) => {
|
|
463
463
|
if (!Array.isArray(fpc.Fit) || fpc.Fit.length === 0)
|
|
464
464
|
return false;
|
|
465
465
|
return fpc.Fit.some((fit) => {
|
|
466
466
|
var _a, _b, _c, _d, _e, _f;
|
|
467
|
-
return ((_b = (_a = fit.Make_Id) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) ===
|
|
468
|
-
((_d = (_c = fit.Model_Id) === null || _c === void 0 ? void 0 : _c.toString) === null || _d === void 0 ? void 0 : _d.call(_c)) ===
|
|
469
|
-
((_f = (_e = fit.Var_Id) === null || _e === void 0 ? void 0 : _e.toString) === null || _f === void 0 ? void 0 : _f.call(_e)) ===
|
|
467
|
+
return ((_b = (_a = fit.Make_Id) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) === equipmentMakeId &&
|
|
468
|
+
((_d = (_c = fit.Model_Id) === null || _c === void 0 ? void 0 : _c.toString) === null || _d === void 0 ? void 0 : _d.call(_c)) === equipmentModelId &&
|
|
469
|
+
((_f = (_e = fit.Var_Id) === null || _e === void 0 ? void 0 : _e.toString) === null || _f === void 0 ? void 0 : _f.call(_e)) === equipmentVarId;
|
|
470
470
|
});
|
|
471
471
|
});
|
|
472
472
|
if (match)
|
|
473
473
|
return match;
|
|
474
474
|
}
|
|
475
475
|
// Try Make + Model
|
|
476
|
-
if (
|
|
476
|
+
if (equipmentMakeId && equipmentModelId) {
|
|
477
477
|
const match = fitPriceCosts.find((fpc) => {
|
|
478
478
|
if (!Array.isArray(fpc.Fit) || fpc.Fit.length === 0)
|
|
479
479
|
return false;
|
|
480
480
|
return fpc.Fit.some((fit) => {
|
|
481
481
|
var _a, _b, _c, _d;
|
|
482
|
-
return ((_b = (_a = fit.Make_Id) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) ===
|
|
483
|
-
((_d = (_c = fit.Model_Id) === null || _c === void 0 ? void 0 : _c.toString) === null || _d === void 0 ? void 0 : _d.call(_c)) ===
|
|
482
|
+
return ((_b = (_a = fit.Make_Id) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) === equipmentMakeId &&
|
|
483
|
+
((_d = (_c = fit.Model_Id) === null || _c === void 0 ? void 0 : _c.toString) === null || _d === void 0 ? void 0 : _d.call(_c)) === equipmentModelId &&
|
|
484
484
|
!fit.Var_Id;
|
|
485
485
|
});
|
|
486
486
|
});
|
|
@@ -488,13 +488,13 @@ function findMatchingFitPriceCost(fitPriceCosts, vehicle) {
|
|
|
488
488
|
return match;
|
|
489
489
|
}
|
|
490
490
|
// Try Make only
|
|
491
|
-
if (
|
|
491
|
+
if (equipmentMakeId) {
|
|
492
492
|
const match = fitPriceCosts.find((fpc) => {
|
|
493
493
|
if (!Array.isArray(fpc.Fit) || fpc.Fit.length === 0)
|
|
494
494
|
return false;
|
|
495
495
|
return fpc.Fit.some((fit) => {
|
|
496
496
|
var _a, _b;
|
|
497
|
-
return ((_b = (_a = fit.Make_Id) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) ===
|
|
497
|
+
return ((_b = (_a = fit.Make_Id) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) === equipmentMakeId &&
|
|
498
498
|
!fit.Model_Id;
|
|
499
499
|
});
|
|
500
500
|
});
|