IO-1528 Autohouse Updates.
This commit is contained in:
@@ -70,11 +70,15 @@ exports.default = async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var ret = builder
|
var ret = builder
|
||||||
.create(autoHouseObject, {
|
.create(
|
||||||
version: "1.0",
|
{
|
||||||
encoding: "UTF-8",
|
version: "1.0",
|
||||||
})
|
encoding: "UTF-8",
|
||||||
.end({ pretty: true, allowEmptyTags: true });
|
keepNullNodes: true,
|
||||||
|
},
|
||||||
|
autoHouseObject
|
||||||
|
)
|
||||||
|
.end({ allowEmptyTags: true });
|
||||||
|
|
||||||
allxmlsToUpload.push({
|
allxmlsToUpload.push({
|
||||||
xml: ret,
|
xml: ret,
|
||||||
@@ -107,6 +111,11 @@ exports.default = async (req, res) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV !== "production") {
|
||||||
|
res.sendStatus(200);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let sftp = new Client();
|
let sftp = new Client();
|
||||||
sftp.on("error", (errors) =>
|
sftp.on("error", (errors) =>
|
||||||
logger.log("autohouse-sftp-error", "ERROR", "api", null, {
|
logger.log("autohouse-sftp-error", "ERROR", "api", null, {
|
||||||
@@ -239,7 +248,8 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
|||||||
ReferralDate: null,
|
ReferralDate: null,
|
||||||
EstimateAppointmentDate: null,
|
EstimateAppointmentDate: null,
|
||||||
SecondFollowUpDate: null,
|
SecondFollowUpDate: null,
|
||||||
AssignedDate: null,
|
AssignedDate:
|
||||||
|
job.asgn_date && moment(job.asgn_date).format(AhDateFormat),
|
||||||
EstComplete: null,
|
EstComplete: null,
|
||||||
CustomerAuthorizationDate: null,
|
CustomerAuthorizationDate: null,
|
||||||
InsuranceAuthorizationDate: null,
|
InsuranceAuthorizationDate: null,
|
||||||
@@ -248,7 +258,7 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
|||||||
job.scheduled_in && moment(job.scheduled_in).format(AhDateFormat),
|
job.scheduled_in && moment(job.scheduled_in).format(AhDateFormat),
|
||||||
CarinShop: job.actual_in && moment(job.actual_in).format(AhDateFormat),
|
CarinShop: job.actual_in && moment(job.actual_in).format(AhDateFormat),
|
||||||
InsInspDate: null,
|
InsInspDate: null,
|
||||||
StartDate: null,
|
StartDate: job.actual_in && moment(job.actual_in).format(AhDateFormat),
|
||||||
PartsOrder: null,
|
PartsOrder: null,
|
||||||
TeardownHold: null,
|
TeardownHold: null,
|
||||||
SupplementSubmittedDate: null,
|
SupplementSubmittedDate: null,
|
||||||
@@ -287,7 +297,10 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
|||||||
StructuralRate: job.rate_las,
|
StructuralRate: job.rate_las,
|
||||||
PMRate: job.rate_mapa,
|
PMRate: job.rate_mapa,
|
||||||
BMRate: job.rate_mash,
|
BMRate: job.rate_mash,
|
||||||
TaxRate: null,
|
TaxRate:
|
||||||
|
job.parts_tax_rates &&
|
||||||
|
job.parts_tax_rates.PAN &&
|
||||||
|
job.parts_tax_rates.PAN.prt_tax_rt,
|
||||||
StorageRateperDay: null,
|
StorageRateperDay: null,
|
||||||
DaysStored: null,
|
DaysStored: null,
|
||||||
},
|
},
|
||||||
@@ -389,39 +402,45 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
|||||||
job.job_totals.parts.parts.list.PAA.total
|
job.job_totals.parts.parts.list.PAA.total
|
||||||
).toFormat(AHDineroFormat),
|
).toFormat(AHDineroFormat),
|
||||||
PartsAMCost: repairCosts.PartsAMCost.toFormat(AHDineroFormat),
|
PartsAMCost: repairCosts.PartsAMCost.toFormat(AHDineroFormat),
|
||||||
PartsReconditioned: null,
|
PartsReconditioned:
|
||||||
|
repairCosts.PartsReconditionedCost.toFormat(AHDineroFormat),
|
||||||
PartsReconditionedCost:
|
PartsReconditionedCost:
|
||||||
repairCosts.PartsReconditionedCost.toFormat(AHDineroFormat),
|
repairCosts.PartsReconditionedCost.toFormat(AHDineroFormat),
|
||||||
PartsRecycled: Dinero(
|
PartsRecycled: Dinero(
|
||||||
job.job_totals.parts.parts.list.PAR &&
|
job.job_totals.parts.parts.list.PAR &&
|
||||||
job.job_totals.parts.parts.list.PAR.total
|
job.job_totals.parts.parts.list.PAR.total
|
||||||
).toFormat(AHDineroFormat),
|
).toFormat(AHDineroFormat),
|
||||||
PartsRecycledCost: null,
|
PartsRecycledCost:
|
||||||
|
repairCosts.PartsRecycledCost.toFormat(AHDineroFormat),
|
||||||
PartsOther: Dinero(
|
PartsOther: Dinero(
|
||||||
job.job_totals.parts.parts.list.PAO &&
|
job.job_totals.parts.parts.list.PAO &&
|
||||||
job.job_totals.parts.parts.list.PAO.total
|
job.job_totals.parts.parts.list.PAO.total
|
||||||
).toFormat(AHDineroFormat),
|
).toFormat(AHDineroFormat),
|
||||||
PartsOtherCost: null,
|
PartsOtherCost: repairCosts.PartsOtherCost.toFormat(AHDineroFormat),
|
||||||
SubletTotal: Dinero(job.job_totals.parts.sublets.total).toFormat(
|
SubletTotal: Dinero(job.job_totals.parts.sublets.total).toFormat(
|
||||||
AHDineroFormat
|
AHDineroFormat
|
||||||
),
|
),
|
||||||
SubletTotalCost: 0,
|
SubletTotalCost: repairCosts.SubletTotalCost.toFormat(AHDineroFormat),
|
||||||
BodyLaborTotal: Dinero(job.job_totals.rates.lab.total).toFormat(
|
BodyLaborTotal: Dinero(job.job_totals.rates.lab.total).toFormat(
|
||||||
AHDineroFormat
|
AHDineroFormat
|
||||||
),
|
),
|
||||||
BodyLaborTotalCost: 0,
|
BodyLaborTotalCost:
|
||||||
|
repairCosts.BodyLaborTotalCost.toFormat(AHDineroFormat),
|
||||||
RefinishLaborTotal: Dinero(job.job_totals.rates.lar.total).toFormat(
|
RefinishLaborTotal: Dinero(job.job_totals.rates.lar.total).toFormat(
|
||||||
AHDineroFormat
|
AHDineroFormat
|
||||||
),
|
),
|
||||||
RefinishLaborTotalCost: 0,
|
RefinishLaborTotalCost:
|
||||||
|
repairCosts.RefinishLaborTotalCost.toFormat(AHDineroFormat),
|
||||||
MechanicalLaborTotal: Dinero(job.job_totals.rates.lam.total).toFormat(
|
MechanicalLaborTotal: Dinero(job.job_totals.rates.lam.total).toFormat(
|
||||||
AHDineroFormat
|
AHDineroFormat
|
||||||
),
|
),
|
||||||
MechanicalLaborTotalCost: 0,
|
MechanicalLaborTotalCost:
|
||||||
|
repairCosts.MechanicalLaborTotalCost.toFormat(AHDineroFormat),
|
||||||
StructuralLaborTotal: Dinero(job.job_totals.rates.las.total).toFormat(
|
StructuralLaborTotal: Dinero(job.job_totals.rates.las.total).toFormat(
|
||||||
AHDineroFormat
|
AHDineroFormat
|
||||||
),
|
),
|
||||||
StructuralLaborTotalCost: null,
|
StructuralLaborTotalCost:
|
||||||
|
repairCosts.StructuralLaborTotalCost.toFormat(AHDineroFormat),
|
||||||
MiscellaneousChargeTotal: null,
|
MiscellaneousChargeTotal: null,
|
||||||
MiscellaneousChargeTotalCost: null,
|
MiscellaneousChargeTotalCost: null,
|
||||||
PMTotal: Dinero(job.job_totals.rates.mapa.total).toFormat(
|
PMTotal: Dinero(job.job_totals.rates.mapa.total).toFormat(
|
||||||
@@ -437,11 +456,11 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
|||||||
TowingTotal: Dinero(job.job_totals.additional.towing).toFormat(
|
TowingTotal: Dinero(job.job_totals.additional.towing).toFormat(
|
||||||
AHDineroFormat
|
AHDineroFormat
|
||||||
),
|
),
|
||||||
TowingTotalCost: null,
|
TowingTotalCost: repairCosts.TowingTotalCost.toFormat(AHDineroFormat),
|
||||||
StorageTotal: Dinero(job.job_totals.additional.storage).toFormat(
|
StorageTotal: Dinero(job.job_totals.additional.storage).toFormat(
|
||||||
AHDineroFormat
|
AHDineroFormat
|
||||||
),
|
),
|
||||||
StorageTotalCost: null,
|
StorageTotalCost: repairCosts.StorageTotalCost.toFormat(AHDineroFormat),
|
||||||
DetailTotal: null,
|
DetailTotal: null,
|
||||||
DetailTotalCost: null,
|
DetailTotalCost: null,
|
||||||
SalesTaxTotal: Dinero(job.job_totals.totals.local_tax)
|
SalesTaxTotal: Dinero(job.job_totals.totals.local_tax)
|
||||||
@@ -472,7 +491,7 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
|||||||
Hub50Comment: null,
|
Hub50Comment: null,
|
||||||
DateofChange: null,
|
DateofChange: null,
|
||||||
BodyTechName: null,
|
BodyTechName: null,
|
||||||
TotalLossYN: null,
|
TotalLossYN: job.tlos_ind ? "Y" : "N",
|
||||||
InsScreenCommentsLine1: null,
|
InsScreenCommentsLine1: null,
|
||||||
InsScreenCommentsLine2: null,
|
InsScreenCommentsLine2: null,
|
||||||
AssignmentCaller: null,
|
AssignmentCaller: null,
|
||||||
@@ -483,7 +502,9 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
|||||||
PaintTechName: null,
|
PaintTechName: null,
|
||||||
ImportType: null,
|
ImportType: null,
|
||||||
ImportFile: null,
|
ImportFile: null,
|
||||||
GSTTax: null,
|
GSTTax: Dinero(job.job_totals.totals.federal_tax).toFormat(
|
||||||
|
AHDineroFormat
|
||||||
|
),
|
||||||
RepairDelayStatusCode: null,
|
RepairDelayStatusCode: null,
|
||||||
RepairDelaycomment: null,
|
RepairDelaycomment: null,
|
||||||
AgentMktgID: null,
|
AgentMktgID: null,
|
||||||
|
|||||||
@@ -554,6 +554,7 @@ exports.AUTOHOUSE_QUERY = `query AUTOHOUSE_EXPORT($start: timestamptz, $bodyshop
|
|||||||
rate_mash
|
rate_mash
|
||||||
job_totals
|
job_totals
|
||||||
driveable
|
driveable
|
||||||
|
parts_tax_rates
|
||||||
bodyshop {
|
bodyshop {
|
||||||
id
|
id
|
||||||
shopname
|
shopname
|
||||||
|
|||||||
Reference in New Issue
Block a user