Compare commits
33 Commits
feature/IO
...
bugfix/pro
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26e164b4d1 | ||
|
|
84bb25985b | ||
|
|
e38a58550f | ||
|
|
25ef4c6228 | ||
|
|
277fbeebc8 | ||
|
|
399df78957 | ||
|
|
294325343b | ||
|
|
ed17eec948 | ||
|
|
f87c95079c | ||
|
|
327149ffc9 | ||
|
|
f81b21b933 | ||
|
|
a559b56983 | ||
|
|
6a9030b653 | ||
|
|
fc7da187f4 | ||
|
|
f593f83ec1 | ||
|
|
5752f123ac | ||
|
|
6396d68584 | ||
|
|
bfd29f25dd | ||
|
|
e75e35e4ee | ||
|
|
d7ddbf7e8d | ||
|
|
1b0198af63 | ||
|
|
ace16ba873 | ||
|
|
f57a4bd948 | ||
|
|
fef4393f9c | ||
|
|
4940b10910 | ||
|
|
9c8e241ef7 | ||
|
|
c3d6b98c89 | ||
|
|
4b49654083 | ||
|
|
78223078f4 | ||
|
|
ca4b78d44c | ||
|
|
d7bfc789e2 | ||
|
|
b54d0ed62a | ||
|
|
8386443cb0 |
@@ -1,7 +1,7 @@
|
||||
import { useSplitClient } from "@splitsoftware/splitio-react";
|
||||
import { Button, Result } from "antd";
|
||||
import LogRocket from "logrocket";
|
||||
import React, { lazy, Suspense, useEffect, useState } from "react";
|
||||
import React, { lazy, Suspense, useEffect, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { Route, Routes } from "react-router-dom";
|
||||
@@ -9,7 +9,7 @@ import { createStructuredSelector } from "reselect";
|
||||
import DocumentEditorContainer from "../components/document-editor/document-editor.container";
|
||||
import ErrorBoundary from "../components/error-boundary/error-boundary.component";
|
||||
|
||||
//Component Imports
|
||||
// Component Imports
|
||||
import LoadingSpinner from "../components/loading-spinner/loading-spinner.component";
|
||||
import DisclaimerPage from "../pages/disclaimer/disclaimer.page";
|
||||
import LandingPage from "../pages/landing/landing.page";
|
||||
@@ -28,15 +28,16 @@ import { ProductFruits } from "react-product-fruits";
|
||||
const ResetPassword = lazy(() => import("../pages/reset-password/reset-password.component"));
|
||||
const ManagePage = lazy(() => import("../pages/manage/manage.page.container"));
|
||||
const SignInPage = lazy(() => import("../pages/sign-in/sign-in.page"));
|
||||
|
||||
const CsiPage = lazy(() => import("../pages/csi/csi.container.page"));
|
||||
const MobilePaymentContainer = lazy(() => import("../pages/mobile-payment/mobile-payment.container"));
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
online: selectOnline,
|
||||
bodyshop: selectBodyshop,
|
||||
currentEula: selectCurrentEula
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
checkUserSession: () => dispatch(checkUserSession()),
|
||||
setOnline: (isOnline) => dispatch(setOnline(isOnline))
|
||||
@@ -47,6 +48,23 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline
|
||||
const [listenersAdded, setListenersAdded] = useState(false);
|
||||
const { t } = useTranslation();
|
||||
|
||||
const workspaceCode = useMemo(
|
||||
() =>
|
||||
InstanceRenderMgr({
|
||||
imex: null,
|
||||
rome: "9BkbEseqNqxw8jUH",
|
||||
promanager: "aoJoEifvezYI0Z0P"
|
||||
}),
|
||||
[]
|
||||
);
|
||||
|
||||
const workspaceLogin = useMemo(
|
||||
() => ({
|
||||
email: currentUser.email,
|
||||
username: currentUser.email
|
||||
}),
|
||||
[currentUser.email]
|
||||
);
|
||||
useEffect(() => {
|
||||
if (!navigator.onLine) {
|
||||
setOnline(false);
|
||||
@@ -55,16 +73,12 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline
|
||||
checkUserSession();
|
||||
}, [checkUserSession, setOnline]);
|
||||
|
||||
//const b = Grid.useBreakpoint();
|
||||
// console.log("Breakpoints:", b);
|
||||
|
||||
// Associate event listeners, memoize to prevent multiple listeners being added
|
||||
useEffect(() => {
|
||||
const offlineListener = (e) => {
|
||||
const offlineListener = () => {
|
||||
setOnline(false);
|
||||
};
|
||||
|
||||
const onlineListener = (e) => {
|
||||
const onlineListener = () => {
|
||||
setOnline(true);
|
||||
};
|
||||
|
||||
@@ -98,7 +112,7 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline
|
||||
InstanceRenderMgr({
|
||||
imex: "gvfvfw/bodyshopapp",
|
||||
rome: "rome-online/rome-online",
|
||||
promanager: "" //TODO:AIO Add in log rocket for promanager instances.
|
||||
promanager: "" // TODO: AIO Add in log rocket for promanager instances.
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -111,30 +125,25 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline
|
||||
|
||||
handleBeta();
|
||||
|
||||
if (!online)
|
||||
if (!online) {
|
||||
return (
|
||||
<Result
|
||||
status="warning"
|
||||
title={t("general.labels.nointernet")}
|
||||
subTitle={t("general.labels.nointernet_sub")}
|
||||
extra={
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
window.location.reload();
|
||||
}}
|
||||
>
|
||||
<Button type="primary" onClick={() => window.location.reload()}>
|
||||
{t("general.actions.refresh")}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (currentEula && !currentUser.eulaIsAccepted) {
|
||||
return <Eula />;
|
||||
}
|
||||
|
||||
// Any route that is not assigned and matched will default to the Landing Page component
|
||||
return (
|
||||
<Suspense
|
||||
fallback={
|
||||
@@ -147,19 +156,9 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline
|
||||
/>
|
||||
}
|
||||
>
|
||||
<ProductFruits
|
||||
workspaceCode={InstanceRenderMgr({
|
||||
imex: null,
|
||||
rome: "9BkbEseqNqxw8jUH",
|
||||
promanager: "aoJoEifvezYI0Z0P"
|
||||
})}
|
||||
debug
|
||||
language="en"
|
||||
user={{
|
||||
email: currentUser.email,
|
||||
username: currentUser.email
|
||||
}}
|
||||
/>
|
||||
{currentUser && currentUser.email && (
|
||||
<ProductFruits workspaceCode={workspaceCode} debug language="en" user={workspaceLogin} />
|
||||
)}
|
||||
|
||||
<Routes>
|
||||
<Route
|
||||
|
||||
@@ -4,7 +4,6 @@ import { useTranslation } from "react-i18next";
|
||||
import InstanceRenderMgr from "../../utils/instanceRenderMgr";
|
||||
|
||||
//To be used as a form element only.
|
||||
const { Option } = Select;
|
||||
const BillLineSearchSelect = ({ options, disabled, allowRemoved, ...restProps }, ref) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Button, Space, notification } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { DELETE_DELIVERY_CHECKLIST, DELETE_INTAKE_CHECKLIST } from "../../graphql/jobs.queries";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
|
||||
export default function JobAdminDeleteIntake({ job }) {
|
||||
const { t } = useTranslation();
|
||||
@@ -47,16 +48,22 @@ export default function JobAdminDeleteIntake({ job }) {
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
return (
|
||||
const InstanceRender = InstanceRenderManager({
|
||||
imex: true,
|
||||
rome: "USE_IMEX",
|
||||
promanager: false
|
||||
});
|
||||
|
||||
return InstanceRender ? (
|
||||
<>
|
||||
<Space wrap>
|
||||
<Button loading={loading} onClick={handleDelete} disabled={!job.intakechecklist}>
|
||||
{t("jobs.labels.deleteintake")}
|
||||
</Button>
|
||||
<Button loading={loading} onClick={handleDeleteDelivery} disabled={!job.deliverychecklist}>
|
||||
<Button loading={loading} onClick={handleDeleteDelivery} disabled={!job.deliverchecklist}>
|
||||
{t("jobs.labels.deletedelivery")}
|
||||
</Button>
|
||||
</Space>
|
||||
</>
|
||||
);
|
||||
) : null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Button, Result, Space, Steps } from "antd";
|
||||
import { PageHeader } from "@ant-design/pro-layout";
|
||||
import { Button, Result, Space, Steps } from "antd";
|
||||
|
||||
import React, { useContext, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -9,7 +9,6 @@ import JobsCreateJobsInfo from "../../components/jobs-create-jobs-info/jobs-crea
|
||||
import JobsCreateOwnerInfoContainer from "../../components/jobs-create-owner-info/jobs-create-owner-info.container";
|
||||
import JobsCreateVehicleInfoContainer from "../../components/jobs-create-vehicle-info/jobs-create-vehicle-info.container";
|
||||
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
||||
import FormsFieldChanged from "../../components/form-fields-changed-alert/form-fields-changed-alert.component";
|
||||
|
||||
export default function JobsCreateComponent({ form }) {
|
||||
const [pageIndex, setPageIndex] = useState(0);
|
||||
@@ -41,10 +40,11 @@ export default function JobsCreateComponent({ form }) {
|
||||
|
||||
const next = () => {
|
||||
setPageIndex(pageIndex + 1);
|
||||
console.log("NExt");
|
||||
console.log("Next");
|
||||
};
|
||||
const prev = () => {
|
||||
setPageIndex(pageIndex - 1);
|
||||
console.log("Previous");
|
||||
};
|
||||
const { Step } = Steps;
|
||||
|
||||
@@ -53,26 +53,26 @@ export default function JobsCreateComponent({ form }) {
|
||||
<PageHeader
|
||||
extra={
|
||||
<Space wrap>
|
||||
{pageIndex > 0 && <Button onClick={() => prev()}>Previous</Button>}
|
||||
{pageIndex > 0 && <Button onClick={() => prev()}>{t("general.actions.previous")}</Button>}
|
||||
{pageIndex < steps.length - 1 && (
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
next();
|
||||
// form
|
||||
// .validateFields()
|
||||
// .then((r) => {
|
||||
// if (steps[pageIndex].validation) {
|
||||
// setErrorMessage(null);
|
||||
// next();
|
||||
// } else {
|
||||
// setErrorMessage(steps[pageIndex].error);
|
||||
// }
|
||||
// })
|
||||
// .catch((error) => console.log("error", error));
|
||||
form
|
||||
.validateFields()
|
||||
.then((r) => {
|
||||
if (steps[pageIndex].validation) {
|
||||
setErrorMessage(null);
|
||||
next();
|
||||
} else {
|
||||
setErrorMessage(steps[pageIndex].error);
|
||||
}
|
||||
})
|
||||
.catch((error) => console.log("error", error));
|
||||
}}
|
||||
>
|
||||
Next
|
||||
{t("general.actions.next")}
|
||||
</Button>
|
||||
)}
|
||||
{pageIndex === steps.length - 1 && (
|
||||
@@ -104,17 +104,17 @@ export default function JobsCreateComponent({ form }) {
|
||||
}}
|
||||
onClick={() => {
|
||||
setPageIndex(idx);
|
||||
// form
|
||||
// .validateFields()
|
||||
// .then((r) => {
|
||||
// if (steps[pageIndex].validation) {
|
||||
// setErrorMessage(null);
|
||||
// setPageIndex(idx);
|
||||
// } else {
|
||||
// setErrorMessage(steps[pageIndex].error);
|
||||
// }
|
||||
// })
|
||||
// .catch((error) => console.log("error", error));
|
||||
form
|
||||
.validateFields()
|
||||
.then((r) => {
|
||||
if (steps[pageIndex].validation) {
|
||||
setErrorMessage(null);
|
||||
setPageIndex(idx);
|
||||
} else {
|
||||
setErrorMessage(steps[pageIndex].error);
|
||||
}
|
||||
})
|
||||
.catch((error) => console.log("error", error));
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
@@ -144,7 +144,7 @@ export default function JobsCreateComponent({ form }) {
|
||||
) : (
|
||||
<div>
|
||||
<ProgressButtons top />
|
||||
<FormsFieldChanged form={form} />
|
||||
|
||||
{errorMessage ? (
|
||||
<div>
|
||||
<AlertComponent message={errorMessage} type="error" />
|
||||
|
||||
@@ -1140,6 +1140,8 @@
|
||||
"download": "Download",
|
||||
"edit": "Edit",
|
||||
"login": "Login",
|
||||
"next": "Next",
|
||||
"previous": "Previous",
|
||||
"print": "Print",
|
||||
"refresh": "Refresh",
|
||||
"remove": "Remove",
|
||||
@@ -2934,6 +2936,8 @@
|
||||
"purchases_by_cost_center_summary": "Purchases by Cost Center (Summary)",
|
||||
"purchases_by_date_range_detail": "Purchases by Date - Detail",
|
||||
"purchases_by_date_range_summary": "Purchases by Date - Summary",
|
||||
"purchases_by_ro_detail_date": "Purchases by RO - Detail",
|
||||
"purchases_by_ro_summary_date": "Purchases by RO - Summary",
|
||||
"purchases_by_vendor_detailed_date_range": "Purchases By Vendor - Detailed",
|
||||
"purchases_by_vendor_summary_date_range": "Purchases by Vendor - Summary",
|
||||
"purchases_grouped_by_vendor_detailed": "Purchases Grouped by Vendor - Detailed",
|
||||
|
||||
@@ -1140,6 +1140,8 @@
|
||||
"download": "",
|
||||
"edit": "Editar",
|
||||
"login": "",
|
||||
"next": "",
|
||||
"previous": "",
|
||||
"print": "",
|
||||
"refresh": "",
|
||||
"remove": "",
|
||||
@@ -2934,6 +2936,8 @@
|
||||
"purchases_by_cost_center_summary": "",
|
||||
"purchases_by_date_range_detail": "",
|
||||
"purchases_by_date_range_summary": "",
|
||||
"purchases_by_ro_detail_date": "",
|
||||
"purchases_by_ro_summary_date": "",
|
||||
"purchases_by_vendor_detailed_date_range": "",
|
||||
"purchases_by_vendor_summary_date_range": "",
|
||||
"purchases_grouped_by_vendor_detailed": "",
|
||||
|
||||
@@ -1140,6 +1140,8 @@
|
||||
"download": "",
|
||||
"edit": "modifier",
|
||||
"login": "",
|
||||
"next": "",
|
||||
"previous": "",
|
||||
"print": "",
|
||||
"refresh": "",
|
||||
"remove": "",
|
||||
@@ -2934,6 +2936,8 @@
|
||||
"purchases_by_cost_center_summary": "",
|
||||
"purchases_by_date_range_detail": "",
|
||||
"purchases_by_date_range_summary": "",
|
||||
"purchases_by_ro_detail_date": "",
|
||||
"purchases_by_ro_summary_date": "",
|
||||
"purchases_by_vendor_detailed_date_range": "",
|
||||
"purchases_by_vendor_summary_date_range": "",
|
||||
"purchases_grouped_by_vendor_detailed": "",
|
||||
|
||||
@@ -1081,6 +1081,32 @@ export const TemplateList = (type, context) => {
|
||||
},
|
||||
group: "purchases"
|
||||
},
|
||||
purchases_by_ro_detail_date: {
|
||||
title: i18n.t("reportcenter.templates.purchases_by_ro_detail_date"),
|
||||
description: "",
|
||||
subject: i18n.t("reportcenter.templates.purchases_by_ro_detail_date"),
|
||||
key: "purchases_by_ro_detail_date",
|
||||
//idtype: "vendor",
|
||||
disabled: false,
|
||||
rangeFilter: {
|
||||
object: i18n.t("reportcenter.labels.objects.jobs"),
|
||||
field: i18n.t("jobs.fields.date_invoiced")
|
||||
},
|
||||
group: "purchases"
|
||||
},
|
||||
purchases_by_ro_summary_date: {
|
||||
title: i18n.t("reportcenter.templates.purchases_by_ro_summary_date"),
|
||||
description: "",
|
||||
subject: i18n.t("reportcenter.templates.purchases_by_ro_summary_date"),
|
||||
key: "purchases_by_ro_summary_date",
|
||||
//idtype: "vendor",
|
||||
disabled: false,
|
||||
rangeFilter: {
|
||||
object: i18n.t("reportcenter.labels.objects.jobs"),
|
||||
field: i18n.t("jobs.fields.date_invoiced")
|
||||
},
|
||||
group: "purchases"
|
||||
},
|
||||
job_costing_ro_date_summary: {
|
||||
title: i18n.t("reportcenter.templates.job_costing_ro_date_summary"),
|
||||
description: "",
|
||||
|
||||
@@ -891,7 +891,11 @@ function checkStateTax(jobline, jobs_by_pk) {
|
||||
}
|
||||
|
||||
const isAdditionalCost =
|
||||
(jobline.lbr_op === "OP13" || (jobline.db_ref && jobline.db_ref.startsWith("9360"))) && !isPaintOrShopMat;
|
||||
(jobline.lbr_op === "OP13" ||
|
||||
(jobline.lbr_op === "OP14" && jobline.act_price > 0 && jobline.mod_lb_hrs === 0) ||
|
||||
(jobline.db_ref && jobline.db_ref.startsWith("9360")) ||
|
||||
(jobline.db_ref && jobline.db_ref.startsWith("90051"))) &&
|
||||
!isPaintOrShopMat;
|
||||
|
||||
if (!jobline.part_type && isAdditionalCost) {
|
||||
if (jobs_by_pk.tax_lbr_rt === 0) {
|
||||
@@ -901,18 +905,12 @@ function checkStateTax(jobline, jobs_by_pk) {
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
jobline.db_ref === "900511" ||
|
||||
jobline.db_ref === "900510" ||
|
||||
(jobline.mod_lb_hrs === 0 && jobline.act_price > 0 && jobline.lbr_op === "OP14")
|
||||
)
|
||||
return true; //Extending IO-1375 as a part of IO-2023
|
||||
|
||||
if (jobline.tax_part === false) {
|
||||
return false;
|
||||
} else {
|
||||
if (jobline.part_type) {
|
||||
if (
|
||||
!jobs_by_pk.parts_tax_rates[`${jobline.part_type.toUpperCase()}`] ||
|
||||
jobs_by_pk.parts_tax_rates[`${jobline.part_type.toUpperCase()}`].prt_tax_in === false ||
|
||||
jobs_by_pk.parts_tax_rates[`${jobline.part_type.toUpperCase()}`].prt_tax_rt === 0
|
||||
) {
|
||||
|
||||
@@ -211,6 +211,8 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
||||
}
|
||||
|
||||
const repairCosts = CreateCosts(job);
|
||||
const jobline = CreateJobLines(job.joblines);
|
||||
const timeticket = CreateTimeTickets(job.timetickets);
|
||||
|
||||
try {
|
||||
const ret = {
|
||||
@@ -276,8 +278,11 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
||||
DateInvoiced:
|
||||
(job.date_invoiced && moment(job.date_invoiced).tz(job.bodyshop.timezone).format(DateFormat)) || "",
|
||||
DateExported:
|
||||
(job.date_exported && moment(job.date_exported).tz(job.bodyshop.timezone).format(DateFormat)) || ""
|
||||
(job.date_exported && moment(job.date_exported).tz(job.bodyshop.timezone).format(DateFormat)) || "",
|
||||
DateVoid: (job.date_void && moment(job.date_void).tz(job.bodyshop.timezone).format(DateFormat)) || ""
|
||||
},
|
||||
JobLineDetails: { jobline },
|
||||
TimeTicketDetails: { timeticket },
|
||||
Sales: {
|
||||
Labour: {
|
||||
Aluminum: Dinero(job.job_totals.rates.laa.total).toFormat(DineroFormat),
|
||||
@@ -625,3 +630,38 @@ const CreateCosts = (job) => {
|
||||
}, 0)
|
||||
};
|
||||
};
|
||||
|
||||
const CreateJobLines = (joblines) => {
|
||||
const repairLines = [];
|
||||
joblines.forEach((jobline) => {
|
||||
repairLines.push({
|
||||
line_description: jobline.line_desc,
|
||||
oem_part_no: jobline.oem_partno,
|
||||
alt_part_no: jobline.alt_partno,
|
||||
op_code_desc: jobline.op_code_desc,
|
||||
part_type: jobline.part_type,
|
||||
part_qty: jobline.part_qty,
|
||||
part_price: jobline.act_price,
|
||||
labor_type: jobline.mod_lbr_ty,
|
||||
labor_hours: jobline.mod_lb_hrs
|
||||
});
|
||||
});
|
||||
return repairLines;
|
||||
};
|
||||
|
||||
const CreateTimeTickets = (timetickets) => {
|
||||
const timeTickets = [];
|
||||
timetickets.forEach((ticket) => {
|
||||
timeTickets.push({
|
||||
date: ticket.date,
|
||||
employee: ticket.employee.employee_number
|
||||
.trim()
|
||||
.concat(" - ", ticket.employee.first_name.trim(), " ", ticket.employee.last_name.trim())
|
||||
.trim(),
|
||||
productive_hrs: ticket.productivehrs,
|
||||
actual_hrs: ticket.actualhrs,
|
||||
cost_center: ticket.cost_center
|
||||
});
|
||||
});
|
||||
return timeTickets;
|
||||
};
|
||||
|
||||
@@ -1113,7 +1113,7 @@ exports.KAIZEN_QUERY = `query KAIZEN_EXPORT($start: timestamptz, $bodyshopid: uu
|
||||
use_paint_scale_data
|
||||
timezone
|
||||
}
|
||||
jobs(where: {_and: [{updated_at: {_gt: $start}}, {updated_at: {_lte: $end}}, {shopid: {_eq: $bodyshopid}}]}) {
|
||||
jobs(where: {_and: [{updated_at: {_gt: $start}}, {updated_at: {_lte: $end}}, {converted: {_eq: true}}, {shopid: {_eq: $bodyshopid}}]}) {
|
||||
actual_completion
|
||||
actual_delivery
|
||||
actual_in
|
||||
@@ -1138,6 +1138,7 @@ exports.KAIZEN_QUERY = `query KAIZEN_EXPORT($start: timestamptz, $bodyshopid: uu
|
||||
date_invoiced
|
||||
date_open
|
||||
date_repairstarted
|
||||
date_void
|
||||
employee_body_rel {
|
||||
first_name
|
||||
last_name
|
||||
@@ -1168,6 +1169,7 @@ exports.KAIZEN_QUERY = `query KAIZEN_EXPORT($start: timestamptz, $bodyshopid: uu
|
||||
ins_co_nm
|
||||
joblines(where: {removed: {_eq: false}}) {
|
||||
act_price
|
||||
alt_partno
|
||||
billlines(order_by: {bill: {date: desc_nulls_last}} limit: 1) {
|
||||
actual_cost
|
||||
actual_price
|
||||
@@ -1188,6 +1190,8 @@ exports.KAIZEN_QUERY = `query KAIZEN_EXPORT($start: timestamptz, $bodyshopid: uu
|
||||
line_no
|
||||
mod_lb_hrs
|
||||
mod_lbr_ty
|
||||
oem_partno
|
||||
op_code_desc
|
||||
parts_order_lines(order_by: {parts_order: {order_date: desc_nulls_last}} limit: 1){
|
||||
parts_order{
|
||||
id
|
||||
@@ -1200,7 +1204,6 @@ exports.KAIZEN_QUERY = `query KAIZEN_EXPORT($start: timestamptz, $bodyshopid: uu
|
||||
profitcenter_labor
|
||||
prt_dsmk_m
|
||||
prt_dsmk_p
|
||||
oem_partno
|
||||
status
|
||||
}
|
||||
job_totals
|
||||
@@ -1251,12 +1254,18 @@ exports.KAIZEN_QUERY = `query KAIZEN_EXPORT($start: timestamptz, $bodyshopid: uu
|
||||
scheduled_in
|
||||
status
|
||||
timetickets {
|
||||
id
|
||||
rate
|
||||
cost_center
|
||||
actualhrs
|
||||
productivehrs
|
||||
cost_center
|
||||
date
|
||||
employee {
|
||||
employee_number
|
||||
first_name
|
||||
last_name
|
||||
}
|
||||
flat_rate
|
||||
id
|
||||
productivehrs
|
||||
rate
|
||||
}
|
||||
tlos_ind
|
||||
v_color
|
||||
@@ -2481,7 +2490,6 @@ query QUERY_TASK_BY_ID($id: uuid!) {
|
||||
|
||||
`;
|
||||
|
||||
|
||||
exports.GET_JOBS_BY_PKS = `query GET_JOBS_BY_PKS($ids: [uuid!]!) {
|
||||
jobs(where: {id: {_in: $ids}}) {
|
||||
id
|
||||
|
||||
@@ -318,7 +318,9 @@ function GenerateCostingData(job) {
|
||||
if (!partsProfitCenter)
|
||||
console.log("Unknown cost/profit center mapping for parts.", val.line_desc, val.part_type);
|
||||
const partsAmount = Dinero({
|
||||
amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100)
|
||||
amount: val.act_price_before_ppc
|
||||
? Math.round(val.act_price_before_ppc * 100)
|
||||
: Math.round(val.act_price * 100)
|
||||
})
|
||||
.multiply(val.part_qty || 1)
|
||||
.add(
|
||||
@@ -327,7 +329,9 @@ function GenerateCostingData(job) {
|
||||
? val.prt_dsmk_m
|
||||
? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
|
||||
: Dinero({
|
||||
amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100)
|
||||
amount: val.act_price_before_ppc
|
||||
? Math.round(val.act_price_before_ppc * 100)
|
||||
: Math.round(val.act_price * 100)
|
||||
})
|
||||
.multiply(val.part_qty || 0)
|
||||
.percentage(Math.abs(val.prt_dsmk_p || 0))
|
||||
@@ -368,7 +372,10 @@ function GenerateCostingData(job) {
|
||||
}
|
||||
|
||||
//Additional Profit Center
|
||||
if ((!val.part_type && !val.mod_lbr_ty) || (!val.part_type && val.mod_lbr_ty)) {
|
||||
if (
|
||||
(!val.part_type && !val.mod_lbr_ty) ||
|
||||
(!val.part_type && val.mod_lbr_ty && val.act_price > 0 && val.lbr_op !== "OP14")
|
||||
) {
|
||||
//Does it already have a defined profit center?
|
||||
//If so, use it, otherwise try to use the same from the auto-allocate logic in IO app jobs-close-auto-allocate.
|
||||
const partsProfitCenter = val.profitcenter_part || getAdditionalCostCenter(val, defaultProfits) || "Unknown";
|
||||
|
||||
@@ -643,7 +643,7 @@ function CalculateAdditional(job) {
|
||||
additionalCosts: null,
|
||||
additionalCostItems: [],
|
||||
adjustments: null,
|
||||
towing: null,
|
||||
towing: Dinero(),
|
||||
shipping: Dinero(),
|
||||
storage: null,
|
||||
pvrt: null,
|
||||
@@ -668,7 +668,7 @@ function CalculateAdditional(job) {
|
||||
}
|
||||
|
||||
if (val.line_desc.toLowerCase().includes("towing")) {
|
||||
ret.towing = lineValue;
|
||||
ret.towing = ret.towing.add(lineValue);
|
||||
return acc;
|
||||
} else {
|
||||
ret.additionalCostItems.push({ key: val.line_desc, total: lineValue });
|
||||
@@ -909,6 +909,25 @@ function CalculateTaxesTotals(job, otherTotals) {
|
||||
}
|
||||
});
|
||||
|
||||
if (job.adjustment_bottom_line) {
|
||||
const subtotal_before_adjustment = subtotal.add(Dinero({ amount: Math.round(job.adjustment_bottom_line * -100) }));
|
||||
const percent_of_adjustment =
|
||||
Math.round(
|
||||
subtotal_before_adjustment.toUnit() /
|
||||
(job.adjustment_bottom_line > 0 ? job.adjustment_bottom_line : job.adjustment_bottom_line * -1)
|
||||
) / 100;
|
||||
|
||||
Object.keys(taxableAmountsByTier).forEach((taxTierKey) => {
|
||||
taxable_adjustment = taxableAmountsByTier[taxTierKey].multiply(percent_of_adjustment);
|
||||
console.log("🚀 ~ taxableAmountsByTier ~ taxable_adjustment:", taxable_adjustment);
|
||||
if (job.adjustment_bottom_line > 0) {
|
||||
taxableAmountsByTier[taxTierKey] = taxableAmountsByTier[taxTierKey].add(taxable_adjustment);
|
||||
} else {
|
||||
taxableAmountsByTier[taxTierKey] = taxableAmountsByTier[taxTierKey].subtract(taxable_adjustment);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const remainingTaxableAmounts = taxableAmountsByTier;
|
||||
console.log("*** Taxable Amounts by Tier***");
|
||||
console.table(JSON.parse(JSON.stringify(taxableAmountsByTier)));
|
||||
|
||||
@@ -489,7 +489,7 @@ function CalculateAdditional(job) {
|
||||
additionalCosts: null,
|
||||
additionalCostItems: [],
|
||||
adjustments: null,
|
||||
towing: null,
|
||||
towing: Dinero(),
|
||||
shipping: Dinero(),
|
||||
storage: null,
|
||||
pvrt: null,
|
||||
@@ -512,7 +512,7 @@ function CalculateAdditional(job) {
|
||||
}
|
||||
|
||||
if (val.line_desc.toLowerCase().includes("towing")) {
|
||||
ret.towing = lineValue;
|
||||
ret.towing = ret.towing.add(lineValue);
|
||||
return acc;
|
||||
} else {
|
||||
ret.additionalCostItems.push({ key: val.line_desc, total: lineValue });
|
||||
|
||||
Reference in New Issue
Block a user