Updates for audatex claims & mapa/mash calculations IO-718

This commit is contained in:
Patrick Fic
2021-03-04 13:23:52 -08:00
parent 7566f61d83
commit 0d317578b2
4 changed files with 28 additions and 6 deletions

View File

@@ -346,6 +346,7 @@ export const GET_JOB_BY_PK = gql`
inproduction inproduction
vehicleid vehicleid
plate_no plate_no
plate_st
v_vin v_vin
v_model_yr v_model_yr
v_model_desc v_model_desc
@@ -357,6 +358,7 @@ export const GET_JOB_BY_PK = gql`
vehicle { vehicle {
id id
plate_no plate_no
plate_st
v_vin v_vin
v_model_yr v_model_yr
v_model_desc v_model_desc

View File

@@ -42,7 +42,11 @@ export default async function RenderTemplate(
try { try {
const render = await jsreport.renderAsync(reportRequest); const render = await jsreport.renderAsync(reportRequest);
if (!renderAsHtml) { if (!renderAsHtml) {
render.download(Templates[templateObject.name].title || ""); render.download(
(Templates[templateObject.name] &&
Templates[templateObject.name].title) ||
""
);
} else { } else {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve(render.toString()); resolve(render.toString());

View File

@@ -378,3 +378,13 @@ export const TemplateList = (type, context) => {
: {}), : {}),
}; };
}; };
function getComponentPath(formItem) {
const { type } = formItem;
switch (type) {
case "checkbox":
return "/components/checkbox";
default:
return null;
}
}

View File

@@ -41,10 +41,10 @@ exports.totalsSsu = async function (req, res) {
}, },
}); });
res.status(200); res.status(200).send();
} catch (error) { } catch (error) {
console.log(error); console.log(error);
res.status(503); res.status(503).send();
} }
}; };
@@ -269,7 +269,13 @@ function IsAdditionalCost(jobLine) {
//936008 is Paint/Materials //936008 is Paint/Materials
//936007 is Shop/Materials //936007 is Shop/Materials
return !jobLine.db_ref || jobLine.db_ref.startsWith("9360"); //Remove paint and shop mat lines. They're calculated under rates.
const isPaintOrShopMat =
jobLine.db_ref === "936008" || jobLine.db_ref === "936007";
return (
!jobLine.db_ref || (jobLine.db_ref.startsWith("9360") && !isPaintOrShopMat)
);
} }
function CalculateAdditional(job) { function CalculateAdditional(job) {
@@ -305,7 +311,7 @@ function CalculateAdditional(job) {
function CalculateTaxesTotals(job, otherTotals) { function CalculateTaxesTotals(job, otherTotals) {
const subtotal = otherTotals.parts.parts.subtotal const subtotal = otherTotals.parts.parts.subtotal
.add(otherTotals.parts.sublets.subtotal) .add(otherTotals.parts.sublets.subtotal)
.add(otherTotals.rates.rates_subtotal) .add(otherTotals.rates.subtotal) //No longer using just rates subtotal to include mapa/mash.
.add(otherTotals.additional); .add(otherTotals.additional);
// .add(Dinero({ amount: (job.towing_payable || 0) * 100 })) // .add(Dinero({ amount: (job.towing_payable || 0) * 100 }))
// .add(Dinero({ amount: (job.storage_payable || 0) * 100 })); // .add(Dinero({ amount: (job.storage_payable || 0) * 100 }));
@@ -350,7 +356,7 @@ function CalculateTaxesTotals(job, otherTotals) {
statePartsTax, statePartsTax,
state_tax: statePartsTax state_tax: statePartsTax
.add( .add(
otherTotals.rates.rates_subtotal.percentage((job.tax_lbr_rt || 0) * 100) otherTotals.rates.subtotal.percentage((job.tax_lbr_rt || 0) * 100) // THis is currently using the lbr tax rate from PFH not PFL.
) )
.add( .add(
Dinero({ Dinero({