@@ -26084,6 +26084,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>additionalpayeroverallocation</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>additionaltotal</name>
|
<name>additionaltotal</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -28062,6 +28083,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>multipayers</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>net_repairs</name>
|
<name>net_repairs</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -28293,6 +28335,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>pimraryamountpayable</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<folder_node>
|
<folder_node>
|
||||||
<name>plitooltips</name>
|
<name>plitooltips</name>
|
||||||
<children>
|
<children>
|
||||||
@@ -35283,6 +35346,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>external</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>findermodal</name>
|
<name>findermodal</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ import { connect } from "react-redux";
|
|||||||
import { useHistory, useLocation, useParams } from "react-router-dom";
|
import { useHistory, useLocation, useParams } from "react-router-dom";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { logImEXEvent } from "../../../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../../../firebase/firebase.utils";
|
||||||
import { MARK_LATEST_APPOINTMENT_AS_ARRIVED } from "../../../../graphql/appointments.queries";
|
import {
|
||||||
|
MARK_APPOINTMENT_ARRIVED,
|
||||||
|
MARK_LATEST_APPOINTMENT_ARRIVED,
|
||||||
|
} from "../../../../graphql/appointments.queries";
|
||||||
import { UPDATE_JOB } from "../../../../graphql/jobs.queries";
|
import { UPDATE_JOB } from "../../../../graphql/jobs.queries";
|
||||||
import {
|
import {
|
||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
@@ -41,7 +44,8 @@ export function JobChecklistForm({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [intakeJob] = useMutation(UPDATE_JOB);
|
const [intakeJob] = useMutation(UPDATE_JOB);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [markAptArrived] = useMutation(MARK_LATEST_APPOINTMENT_AS_ARRIVED);
|
const [markAptArrived] = useMutation(MARK_APPOINTMENT_ARRIVED);
|
||||||
|
const [markLatestAptArrived] = useMutation(MARK_LATEST_APPOINTMENT_ARRIVED);
|
||||||
const [updateOwner] = useMutation(UPDATE_OWNER);
|
const [updateOwner] = useMutation(UPDATE_OWNER);
|
||||||
|
|
||||||
const { jobId } = useParams();
|
const { jobId } = useParams();
|
||||||
@@ -125,6 +129,18 @@ export function JobChecklistForm({
|
|||||||
variables: { appointmentId: search.appointmentId },
|
variables: { appointmentId: search.appointmentId },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!!appUpdate.errors) {
|
||||||
|
notification["error"]({
|
||||||
|
message: t("checklist.errors.complete", {
|
||||||
|
error: JSON.stringify(result.errors),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (type === "intake" && !search.appointmentId) {
|
||||||
|
const appUpdate = await markLatestAptArrived({
|
||||||
|
variables: { jobId: jobId },
|
||||||
|
});
|
||||||
|
|
||||||
if (!!appUpdate.errors) {
|
if (!!appUpdate.errors) {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("checklist.errors.complete", {
|
message: t("checklist.errors.complete", {
|
||||||
@@ -133,6 +149,7 @@ export function JobChecklistForm({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === "intake" && job.owner && job.owner.id) {
|
if (type === "intake" && job.owner && job.owner.id) {
|
||||||
//Updae Owner Allow to Text
|
//Updae Owner Allow to Text
|
||||||
const updateOwnerResult = await updateOwner({
|
const updateOwnerResult = await updateOwner({
|
||||||
@@ -175,12 +192,7 @@ export function JobChecklistForm({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
console.log(job, {
|
|
||||||
removeFromProduction: true,
|
|
||||||
actual_completion:
|
|
||||||
job && job.actual_completion && moment(job.actual_completion),
|
|
||||||
actual_delivery: job && job.actual_delivery && moment(job.actual_delivery),
|
|
||||||
});
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
title={t("checklist.labels.checklist")}
|
title={t("checklist.labels.checklist")}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||||
import { CardElement } from "@stripe/react-stripe-js";
|
import { CardElement } from "@stripe/react-stripe-js";
|
||||||
import { Checkbox, Form, Input, Radio, Select } from "antd";
|
import { Checkbox, Form, Input, Radio, Select } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
@@ -23,6 +24,11 @@ export function PaymentFormComponent({
|
|||||||
disabled,
|
disabled,
|
||||||
}) {
|
}) {
|
||||||
const [stripeState, setStripeState] = stripeStateArr;
|
const [stripeState, setStripeState] = stripeStateArr;
|
||||||
|
const { Qb_Multi_Ar } = useTreatments(
|
||||||
|
["Qb_Multi_Ar"],
|
||||||
|
{},
|
||||||
|
bodyshop && bodyshop.imexshopid
|
||||||
|
);
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const handleStripeChange = (e) => {
|
const handleStripeChange = (e) => {
|
||||||
@@ -106,9 +112,21 @@ export function PaymentFormComponent({
|
|||||||
<Select.Option value={t("payments.labels.customer")}>
|
<Select.Option value={t("payments.labels.customer")}>
|
||||||
{t("payments.labels.customer")}
|
{t("payments.labels.customer")}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
<Select.Option value={t("payments.labels.insurance")}>
|
{Qb_Multi_Ar.treatment === "on" ? (
|
||||||
{t("payments.labels.insurance")}
|
<>
|
||||||
</Select.Option>
|
<Select.OptGroup label={t("payments.labels.external")}>
|
||||||
|
{bodyshop.md_ins_cos.map((i, idx) => (
|
||||||
|
<Select.Option key={idx} value={i.name}>
|
||||||
|
{i.name}
|
||||||
|
</Select.Option>
|
||||||
|
))}
|
||||||
|
</Select.OptGroup>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<Select.Option value={t("payments.labels.insurance")}>
|
||||||
|
{t("payments.labels.insurance")}
|
||||||
|
</Select.Option>
|
||||||
|
)}
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import DataLabel from "../data-label/data-label.component";
|
|||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||||
|
|
||||||
const SelectorDiv = styled.div`
|
const SelectorDiv = styled.div`
|
||||||
.ant-form-item .ant-select {
|
.ant-form-item .ant-select {
|
||||||
@@ -37,6 +38,11 @@ export default connect(
|
|||||||
|
|
||||||
export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const { Qb_Multi_Ar } = useTreatments(
|
||||||
|
["Qb_Multi_Ar"],
|
||||||
|
{},
|
||||||
|
bodyshop && bodyshop.imexshopid
|
||||||
|
);
|
||||||
|
|
||||||
const [costOptions, setCostOptions] = useState(
|
const [costOptions, setCostOptions] = useState(
|
||||||
[
|
[
|
||||||
@@ -4535,24 +4541,26 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<LayoutFormRow header={<div>Multiple Payers Item</div>}>
|
{Qb_Multi_Ar.treatment === "on" && (
|
||||||
<Form.Item
|
<LayoutFormRow header={<div>Multiple Payers Item</div>}>
|
||||||
label={t("bodyshop.fields.responsibilitycenter_accountitem")}
|
<Form.Item
|
||||||
rules={[
|
label={t("bodyshop.fields.responsibilitycenter_accountitem")}
|
||||||
{
|
rules={[
|
||||||
required: true,
|
{
|
||||||
//message: t("general.validation.required"),
|
required: true,
|
||||||
},
|
//message: t("general.validation.required"),
|
||||||
]}
|
},
|
||||||
name={[
|
]}
|
||||||
"md_responsibility_centers",
|
name={[
|
||||||
"qb_multiple_payers",
|
"md_responsibility_centers",
|
||||||
"accountitem",
|
"qb_multiple_payers",
|
||||||
]}
|
"accountitem",
|
||||||
>
|
]}
|
||||||
<Input />
|
>
|
||||||
</Form.Item>
|
<Input />
|
||||||
</LayoutFormRow>
|
</Form.Item>
|
||||||
|
</LayoutFormRow>
|
||||||
|
)}
|
||||||
<Typography.Title level={4}>
|
<Typography.Title level={4}>
|
||||||
{t("bodyshop.labels.responsibilitycenters.sales_tax_codes")}
|
{t("bodyshop.labels.responsibilitycenters.sales_tax_codes")}
|
||||||
</Typography.Title>
|
</Typography.Title>
|
||||||
|
|||||||
@@ -1,77 +1,81 @@
|
|||||||
import { gql } from "@apollo/client";
|
import { gql } from "@apollo/client";
|
||||||
|
|
||||||
export const QUERY_ALL_ACTIVE_APPOINTMENTS = gql`
|
export const QUERY_ALL_ACTIVE_APPOINTMENTS = gql`
|
||||||
query QUERY_ALL_ACTIVE_APPOINTMENTS(
|
query QUERY_ALL_ACTIVE_APPOINTMENTS(
|
||||||
$start: timestamptz!
|
$start: timestamptz!
|
||||||
$end: timestamptz!
|
$end: timestamptz!
|
||||||
$startd: date!
|
$startd: date!
|
||||||
$endd: date!
|
$endd: date!
|
||||||
) {
|
|
||||||
employee_vacation(
|
|
||||||
where: { _or: [{ start: { _gte: $startd } },
|
|
||||||
{ end: { _lte: $endd } },
|
|
||||||
{_and:[{start:{_lte: $startd}},{end:{_gte:$endd}}]}] }
|
|
||||||
) {
|
) {
|
||||||
id
|
employee_vacation(
|
||||||
start
|
where: {
|
||||||
end
|
_or: [
|
||||||
employee {
|
{ start: { _gte: $startd } }
|
||||||
|
{ end: { _lte: $endd } }
|
||||||
|
{ _and: [{ start: { _lte: $startd } }, { end: { _gte: $endd } }] }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
) {
|
||||||
id
|
id
|
||||||
last_name
|
start
|
||||||
first_name
|
end
|
||||||
|
employee {
|
||||||
|
id
|
||||||
|
last_name
|
||||||
|
first_name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
appointments(
|
||||||
appointments(
|
where: {
|
||||||
where: {
|
canceled: { _eq: false }
|
||||||
canceled: { _eq: false }
|
end: { _lte: $end }
|
||||||
end: { _lte: $end }
|
start: { _gte: $start }
|
||||||
start: { _gte: $start }
|
}
|
||||||
}
|
) {
|
||||||
) {
|
start
|
||||||
start
|
|
||||||
id
|
|
||||||
end
|
|
||||||
arrived
|
|
||||||
title
|
|
||||||
isintake
|
|
||||||
block
|
|
||||||
color
|
|
||||||
note
|
|
||||||
job {
|
|
||||||
alt_transport
|
|
||||||
ro_number
|
|
||||||
ownr_ln
|
|
||||||
ownr_co_nm
|
|
||||||
ownr_fn
|
|
||||||
ownr_ph1
|
|
||||||
ownr_ph2
|
|
||||||
ownr_ea
|
|
||||||
clm_total
|
|
||||||
id
|
id
|
||||||
clm_no
|
end
|
||||||
ins_co_nm
|
arrived
|
||||||
v_model_yr
|
title
|
||||||
v_make_desc
|
isintake
|
||||||
v_model_desc
|
block
|
||||||
labhrs: joblines_aggregate(
|
color
|
||||||
where: { mod_lbr_ty: { _neq: "LAR" }, removed: { _eq: false } }
|
note
|
||||||
) {
|
job {
|
||||||
aggregate {
|
alt_transport
|
||||||
sum {
|
ro_number
|
||||||
mod_lb_hrs
|
ownr_ln
|
||||||
|
ownr_co_nm
|
||||||
|
ownr_fn
|
||||||
|
ownr_ph1
|
||||||
|
ownr_ph2
|
||||||
|
ownr_ea
|
||||||
|
clm_total
|
||||||
|
id
|
||||||
|
clm_no
|
||||||
|
ins_co_nm
|
||||||
|
v_model_yr
|
||||||
|
v_make_desc
|
||||||
|
v_model_desc
|
||||||
|
labhrs: joblines_aggregate(
|
||||||
|
where: { mod_lbr_ty: { _neq: "LAR" }, removed: { _eq: false } }
|
||||||
|
) {
|
||||||
|
aggregate {
|
||||||
|
sum {
|
||||||
|
mod_lb_hrs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
larhrs: joblines_aggregate(
|
||||||
|
where: { mod_lbr_ty: { _eq: "LAR" }, removed: { _eq: false } }
|
||||||
|
) {
|
||||||
|
aggregate {
|
||||||
|
sum {
|
||||||
|
mod_lb_hrs
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
larhrs: joblines_aggregate(
|
|
||||||
where: { mod_lbr_ty: { _eq: "LAR" }, removed: { _eq: false } }
|
|
||||||
) {
|
|
||||||
aggregate {
|
|
||||||
sum {
|
|
||||||
mod_lb_hrs
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@@ -382,8 +386,8 @@ export const QUERY_SCHEDULE_LOAD_DATA = gql`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const MARK_LATEST_APPOINTMENT_AS_ARRIVED = gql`
|
export const MARK_APPOINTMENT_ARRIVED = gql`
|
||||||
mutation MARK_LATEST_APPOINTMENT_AS_ARRIVED($appointmentId: uuid!) {
|
mutation MARK_APPOINTMENT_ARRIVED($appointmentId: uuid!) {
|
||||||
update_appointments(
|
update_appointments(
|
||||||
where: { id: { _eq: $appointmentId } }
|
where: { id: { _eq: $appointmentId } }
|
||||||
_set: { arrived: true }
|
_set: { arrived: true }
|
||||||
@@ -396,3 +400,21 @@ export const MARK_LATEST_APPOINTMENT_AS_ARRIVED = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
export const MARK_LATEST_APPOINTMENT_ARRIVED = gql`
|
||||||
|
mutation MARK_LATEST_APPOINTMENT_ARRIVED($jobId: uuid!) {
|
||||||
|
update_appointments(
|
||||||
|
where: {
|
||||||
|
jobid: { _eq: $jobId }
|
||||||
|
canceled: { _eq: false }
|
||||||
|
isintake: { _eq: true }
|
||||||
|
}
|
||||||
|
_set: { arrived: true }
|
||||||
|
) {
|
||||||
|
affected_rows
|
||||||
|
returning {
|
||||||
|
id
|
||||||
|
arrived
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useApolloClient, useMutation } from "@apollo/client";
|
|||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
Button,
|
Button,
|
||||||
|
Col,
|
||||||
Divider,
|
Divider,
|
||||||
Form,
|
Form,
|
||||||
Input,
|
Input,
|
||||||
@@ -10,9 +11,12 @@ import {
|
|||||||
notification,
|
notification,
|
||||||
PageHeader,
|
PageHeader,
|
||||||
Popconfirm,
|
Popconfirm,
|
||||||
|
Row,
|
||||||
Select,
|
Select,
|
||||||
Space,
|
Space,
|
||||||
|
Statistic,
|
||||||
Switch,
|
Switch,
|
||||||
|
Typography,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -33,7 +37,7 @@ import { generateJobLinesUpdatesForInvoicing } from "../../graphql/jobs-lines.qu
|
|||||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import Dinero from "dinero.js";
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
jobRO: selectJobReadOnly,
|
jobRO: selectJobReadOnly,
|
||||||
@@ -325,75 +329,164 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
<Divider>{t("jobs.labels.multipayers")}</Divider>
|
||||||
{Qb_Multi_Ar.treatment === "on" && (
|
{Qb_Multi_Ar.treatment === "on" && (
|
||||||
<>
|
<Row gutter={[16, 16]}>
|
||||||
<Form.List name={["qb_multiple_payers"]}>
|
<Col lg={8} md={24}>
|
||||||
{(fields, { add, remove }) => {
|
<Form.List
|
||||||
return (
|
name={["qb_multiple_payers"]}
|
||||||
<div>
|
rules={[
|
||||||
{fields.map((field, index) => (
|
({ getFieldValue }) => ({
|
||||||
<Form.Item key={field.key}>
|
validator(_, value) {
|
||||||
<Space>
|
let totalAllocated = Dinero();
|
||||||
<Form.Item
|
|
||||||
label={t("jobs.fields.qb_multiple_payers.name")}
|
const payers = form.getFieldValue("qb_multiple_payers");
|
||||||
key={`${index}name`}
|
payers &&
|
||||||
name={[field.name, "name"]}
|
payers.forEach((payer) => {
|
||||||
rules={[
|
totalAllocated = totalAllocated.add(
|
||||||
{
|
Dinero({
|
||||||
required: true,
|
amount: Math.round((payer?.amount || 0) * 100),
|
||||||
},
|
})
|
||||||
]}
|
);
|
||||||
>
|
});
|
||||||
<Select
|
const discrep = job.job_totals
|
||||||
style={{ minWidth: "12rem" }}
|
? Dinero(job.job_totals.totals.total_repairs).subtract(
|
||||||
disabled={jobRO}
|
totalAllocated
|
||||||
|
)
|
||||||
|
: Dinero();
|
||||||
|
return discrep.getAmount() > 0
|
||||||
|
? Promise.resolve()
|
||||||
|
: Promise.reject(
|
||||||
|
new Error(
|
||||||
|
t("jobs.labels.additionalpayeroverallocation")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{(fields, { add, remove }) => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{fields.map((field, index) => (
|
||||||
|
<Form.Item key={field.key}>
|
||||||
|
<Space>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.qb_multiple_payers.name")}
|
||||||
|
key={`${index}name`}
|
||||||
|
name={[field.name, "name"]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
{bodyshop.md_ins_cos.map((s) => (
|
<Select
|
||||||
<Select.Option key={s.name} value={s.name}>
|
style={{ minWidth: "12rem" }}
|
||||||
{s.name}
|
disabled={jobRO}
|
||||||
</Select.Option>
|
>
|
||||||
))}
|
{bodyshop.md_ins_cos.map((s) => (
|
||||||
</Select>
|
<Select.Option key={s.name} value={s.name}>
|
||||||
</Form.Item>
|
{s.name}
|
||||||
|
</Select.Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("jobs.fields.qb_multiple_payers.amount")}
|
label={t("jobs.fields.qb_multiple_payers.amount")}
|
||||||
key={`${index}amount`}
|
key={`${index}amount`}
|
||||||
name={[field.name, "amount"]}
|
name={[field.name, "amount"]}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<CurrencyInput min={0} disabled={jobRO} />
|
<CurrencyInput min={0} disabled={jobRO} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<DeleteFilled
|
<DeleteFilled
|
||||||
disabled={jobRO}
|
disabled={jobRO}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
remove(field.name);
|
remove(field.name);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
|
</Form.Item>
|
||||||
|
))}
|
||||||
|
<Form.Item>
|
||||||
|
<Button
|
||||||
|
disabled={jobRO}
|
||||||
|
onClick={() => {
|
||||||
|
add();
|
||||||
|
}}
|
||||||
|
style={{ width: "100%" }}
|
||||||
|
>
|
||||||
|
{t("jobs.actions.dms.addpayer")}
|
||||||
|
</Button>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
))}
|
</div>
|
||||||
<Form.Item>
|
);
|
||||||
<Button
|
}}
|
||||||
disabled={jobRO}
|
</Form.List>
|
||||||
onClick={() => {
|
</Col>
|
||||||
if (fields.length < 3) add();
|
<Col lg={16} md={24}>
|
||||||
|
<Form.Item shouldUpdate>
|
||||||
|
{() => {
|
||||||
|
//Perform Calculation to determine discrepancy.
|
||||||
|
let totalAllocated = Dinero();
|
||||||
|
|
||||||
|
const payers = form.getFieldValue("qb_multiple_payers");
|
||||||
|
payers &&
|
||||||
|
payers.forEach((payer) => {
|
||||||
|
totalAllocated = totalAllocated.add(
|
||||||
|
Dinero({
|
||||||
|
amount: Math.round((payer?.amount || 0) * 100),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
const discrep = job.job_totals
|
||||||
|
? Dinero(job.job_totals.totals.total_repairs).subtract(
|
||||||
|
totalAllocated
|
||||||
|
)
|
||||||
|
: Dinero();
|
||||||
|
return (
|
||||||
|
<Space size="large" wrap align="center">
|
||||||
|
<Statistic
|
||||||
|
title={t("jobs.labels.total_cust_payable")}
|
||||||
|
value={(job.job_totals
|
||||||
|
? Dinero(job.job_totals.totals.custPayable)
|
||||||
|
: Dinero()
|
||||||
|
).toFormat()}
|
||||||
|
/>
|
||||||
|
<Divider type="vertical" />
|
||||||
|
<Statistic
|
||||||
|
title={t("jobs.labels.total_repairs")}
|
||||||
|
value={(job.job_totals
|
||||||
|
? Dinero(job.job_totals.totals.total_repairs)
|
||||||
|
: Dinero()
|
||||||
|
).toFormat()}
|
||||||
|
/>
|
||||||
|
<Typography.Title>-</Typography.Title>
|
||||||
|
<Statistic
|
||||||
|
title={t("jobs.labels.dms.totalallocated")}
|
||||||
|
value={totalAllocated.toFormat()}
|
||||||
|
/>
|
||||||
|
<Typography.Title>=</Typography.Title>
|
||||||
|
<Statistic
|
||||||
|
title={t("jobs.labels.pimraryamountpayable")}
|
||||||
|
valueStyle={{
|
||||||
|
color: discrep.getAmount() > 0 ? "green" : "red",
|
||||||
}}
|
}}
|
||||||
style={{ width: "100%" }}
|
value={discrep.toFormat()}
|
||||||
>
|
/>
|
||||||
{t("jobs.actions.dms.addpayer")}
|
</Space>
|
||||||
</Button>
|
);
|
||||||
</Form.Item>
|
}}
|
||||||
</div>
|
</Form.Item>
|
||||||
);
|
</Col>
|
||||||
}}
|
</Row>
|
||||||
</Form.List>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
<Divider />
|
<Divider />
|
||||||
<JobsCloseLines job={job} />
|
<JobsCloseLines job={job} />
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ function JobsCreateContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) {
|
|||||||
let job = Object.assign(
|
let job = Object.assign(
|
||||||
{},
|
{},
|
||||||
values,
|
values,
|
||||||
|
{ date_open: new Date() },
|
||||||
{
|
{
|
||||||
vehicle:
|
vehicle:
|
||||||
state.vehicle.selectedid || state.vehicle.none
|
state.vehicle.selectedid || state.vehicle.none
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { SyncOutlined } from "@ant-design/icons";
|
import { SyncOutlined } from "@ant-design/icons";
|
||||||
import { useQuery } from "@apollo/client";
|
import { useQuery } from "@apollo/client";
|
||||||
import { Button, Card, Input, Space, Table } from "antd";
|
import { Button, Card, Input, Space, Table } from "antd";
|
||||||
|
import _ from "lodash";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -14,7 +15,6 @@ import OwnerNameDisplay from "../../components/owner-name-display/owner-name-dis
|
|||||||
import ProductionListColumnComment from "../../components/production-list-columns/production-list-columns.comment.component";
|
import ProductionListColumnComment from "../../components/production-list-columns/production-list-columns.comment.component";
|
||||||
import { QUERY_PARTS_QUEUE } from "../../graphql/jobs.queries";
|
import { QUERY_PARTS_QUEUE } from "../../graphql/jobs.queries";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import { onlyUnique } from "../../utils/arrayHelper";
|
|
||||||
import { DateTimeFormatter, TimeAgoFormatter } from "../../utils/DateFormatter";
|
import { DateTimeFormatter, TimeAgoFormatter } from "../../utils/DateFormatter";
|
||||||
import { alphaSort, dateSort } from "../../utils/sorters";
|
import { alphaSort, dateSort } from "../../utils/sorters";
|
||||||
import useLocalStorage from "../../utils/useLocalStorage";
|
import useLocalStorage from "../../utils/useLocalStorage";
|
||||||
@@ -94,6 +94,14 @@ export function PartsQueuePageComponent({ bodyshop }) {
|
|||||||
// searchParams.page = pagination.current;
|
// searchParams.page = pagination.current;
|
||||||
searchParams.sortcolumn = sorter.columnKey;
|
searchParams.sortcolumn = sorter.columnKey;
|
||||||
searchParams.sortorder = sorter.order;
|
searchParams.sortorder = sorter.order;
|
||||||
|
|
||||||
|
if (filters.status) {
|
||||||
|
searchParams.statusFilters = JSON.stringify(
|
||||||
|
_.flattenDeep(filters.status)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
delete searchParams.statusFilters;
|
||||||
|
}
|
||||||
setFilter(filters);
|
setFilter(filters);
|
||||||
history.push({ search: queryString.stringify(searchParams) });
|
history.push({ search: queryString.stringify(searchParams) });
|
||||||
};
|
};
|
||||||
@@ -136,19 +144,14 @@ export function PartsQueuePageComponent({ bodyshop }) {
|
|||||||
key: "status",
|
key: "status",
|
||||||
sorter: (a, b) => alphaSort(a.status, b.status),
|
sorter: (a, b) => alphaSort(a.status, b.status),
|
||||||
sortOrder: sortcolumn === "status" && sortorder,
|
sortOrder: sortcolumn === "status" && sortorder,
|
||||||
|
filteredValue: statusFilters ? JSON.parse(statusFilters) : null,
|
||||||
filters:
|
filters:
|
||||||
(jobs &&
|
bodyshop.md_ro_statuses.active_statuses.map((s) => {
|
||||||
jobs
|
return {
|
||||||
.map((j) => j.status)
|
text: s || "No Status*",
|
||||||
.filter(onlyUnique)
|
value: [s],
|
||||||
.map((s) => {
|
};
|
||||||
return {
|
}) || [],
|
||||||
text: s || "No Status*",
|
|
||||||
value: [s],
|
|
||||||
};
|
|
||||||
})) ||
|
|
||||||
[],
|
|
||||||
onFilter: (value, record) => value.includes(record.status),
|
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.status || t("general.labels.na");
|
return record.status || t("general.labels.na");
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1546,6 +1546,7 @@
|
|||||||
"actual_completion_inferred": "$t(jobs.fields.actual_completion) inferred using $t(jobs.fields.scheduled_completion).",
|
"actual_completion_inferred": "$t(jobs.fields.actual_completion) inferred using $t(jobs.fields.scheduled_completion).",
|
||||||
"actual_delivery_inferred": "$t(jobs.fields.actual_delivery) inferred using $t(jobs.fields.scheduled_delivery).",
|
"actual_delivery_inferred": "$t(jobs.fields.actual_delivery) inferred using $t(jobs.fields.scheduled_delivery).",
|
||||||
"actual_in_inferred": "$t(jobs.fields.actual_in) inferred using $t(jobs.fields.scheduled_in).",
|
"actual_in_inferred": "$t(jobs.fields.actual_in) inferred using $t(jobs.fields.scheduled_in).",
|
||||||
|
"additionalpayeroverallocation": "You have allocated more than the sale of the Job to additional payers.",
|
||||||
"additionaltotal": "Additional Total",
|
"additionaltotal": "Additional Total",
|
||||||
"adjustmentrate": "Adjustment Rate",
|
"adjustmentrate": "Adjustment Rate",
|
||||||
"adjustments": "Adjustments",
|
"adjustments": "Adjustments",
|
||||||
@@ -1649,6 +1650,7 @@
|
|||||||
"mapa": "Paint Materials",
|
"mapa": "Paint Materials",
|
||||||
"markforreexport": "Mark for Re-export",
|
"markforreexport": "Mark for Re-export",
|
||||||
"mash": "Shop Materials",
|
"mash": "Shop Materials",
|
||||||
|
"multipayers": "Additional Payers",
|
||||||
"net_repairs": "Net Repairs",
|
"net_repairs": "Net Repairs",
|
||||||
"notes": "Notes",
|
"notes": "Notes",
|
||||||
"othertotal": "Other Totals",
|
"othertotal": "Other Totals",
|
||||||
@@ -1660,6 +1662,7 @@
|
|||||||
"partsfilter": "Parts Only",
|
"partsfilter": "Parts Only",
|
||||||
"partssubletstotal": "Parts & Sublets Total",
|
"partssubletstotal": "Parts & Sublets Total",
|
||||||
"partstotal": "Parts Total (ex. Taxes)",
|
"partstotal": "Parts Total (ex. Taxes)",
|
||||||
|
"pimraryamountpayable": "Total Primary Payable",
|
||||||
"plitooltips": {
|
"plitooltips": {
|
||||||
"billtotal": "The total amount of all bill lines that have been posted against this RO (not including credits, taxes, or labor adjustments).",
|
"billtotal": "The total amount of all bill lines that have been posted against this RO (not including credits, taxes, or labor adjustments).",
|
||||||
"calculatedcreditsnotreceived": "The calculated credits not received is derived by subtracting the amount of credit memos entered from the <b>retail</b> total of returns created. This does not take into account whether the credit was marked as received. You can find more information <a href=\"https://help.imex.online/en/article/credits-not-received-changes-1jy9snw\" target=\"_blank\">here</a>.",
|
"calculatedcreditsnotreceived": "The calculated credits not received is derived by subtracting the amount of credit memos entered from the <b>retail</b> total of returns created. This does not take into account whether the credit was marked as received. You can find more information <a href=\"https://help.imex.online/en/article/credits-not-received-changes-1jy9snw\" target=\"_blank\">here</a>.",
|
||||||
@@ -2088,6 +2091,7 @@
|
|||||||
"customer": "Customer",
|
"customer": "Customer",
|
||||||
"edit": "Edit Payment",
|
"edit": "Edit Payment",
|
||||||
"electronicpayment": "Use Electronic Payment Processing?",
|
"electronicpayment": "Use Electronic Payment Processing?",
|
||||||
|
"external": "External",
|
||||||
"findermodal": "ICBC Payment Finder",
|
"findermodal": "ICBC Payment Finder",
|
||||||
"insurance": "Insurance",
|
"insurance": "Insurance",
|
||||||
"new": "New Payment",
|
"new": "New Payment",
|
||||||
|
|||||||
@@ -1546,6 +1546,7 @@
|
|||||||
"actual_completion_inferred": "",
|
"actual_completion_inferred": "",
|
||||||
"actual_delivery_inferred": "",
|
"actual_delivery_inferred": "",
|
||||||
"actual_in_inferred": "",
|
"actual_in_inferred": "",
|
||||||
|
"additionalpayeroverallocation": "",
|
||||||
"additionaltotal": "",
|
"additionaltotal": "",
|
||||||
"adjustmentrate": "",
|
"adjustmentrate": "",
|
||||||
"adjustments": "",
|
"adjustments": "",
|
||||||
@@ -1649,6 +1650,7 @@
|
|||||||
"mapa": "",
|
"mapa": "",
|
||||||
"markforreexport": "",
|
"markforreexport": "",
|
||||||
"mash": "",
|
"mash": "",
|
||||||
|
"multipayers": "",
|
||||||
"net_repairs": "",
|
"net_repairs": "",
|
||||||
"notes": "Notas",
|
"notes": "Notas",
|
||||||
"othertotal": "",
|
"othertotal": "",
|
||||||
@@ -1660,6 +1662,7 @@
|
|||||||
"partsfilter": "",
|
"partsfilter": "",
|
||||||
"partssubletstotal": "",
|
"partssubletstotal": "",
|
||||||
"partstotal": "",
|
"partstotal": "",
|
||||||
|
"pimraryamountpayable": "",
|
||||||
"plitooltips": {
|
"plitooltips": {
|
||||||
"billtotal": "",
|
"billtotal": "",
|
||||||
"calculatedcreditsnotreceived": "",
|
"calculatedcreditsnotreceived": "",
|
||||||
@@ -2088,6 +2091,7 @@
|
|||||||
"customer": "",
|
"customer": "",
|
||||||
"edit": "",
|
"edit": "",
|
||||||
"electronicpayment": "",
|
"electronicpayment": "",
|
||||||
|
"external": "",
|
||||||
"findermodal": "",
|
"findermodal": "",
|
||||||
"insurance": "",
|
"insurance": "",
|
||||||
"new": "",
|
"new": "",
|
||||||
|
|||||||
@@ -1546,6 +1546,7 @@
|
|||||||
"actual_completion_inferred": "",
|
"actual_completion_inferred": "",
|
||||||
"actual_delivery_inferred": "",
|
"actual_delivery_inferred": "",
|
||||||
"actual_in_inferred": "",
|
"actual_in_inferred": "",
|
||||||
|
"additionalpayeroverallocation": "",
|
||||||
"additionaltotal": "",
|
"additionaltotal": "",
|
||||||
"adjustmentrate": "",
|
"adjustmentrate": "",
|
||||||
"adjustments": "",
|
"adjustments": "",
|
||||||
@@ -1649,6 +1650,7 @@
|
|||||||
"mapa": "",
|
"mapa": "",
|
||||||
"markforreexport": "",
|
"markforreexport": "",
|
||||||
"mash": "",
|
"mash": "",
|
||||||
|
"multipayers": "",
|
||||||
"net_repairs": "",
|
"net_repairs": "",
|
||||||
"notes": "Remarques",
|
"notes": "Remarques",
|
||||||
"othertotal": "",
|
"othertotal": "",
|
||||||
@@ -1660,6 +1662,7 @@
|
|||||||
"partsfilter": "",
|
"partsfilter": "",
|
||||||
"partssubletstotal": "",
|
"partssubletstotal": "",
|
||||||
"partstotal": "",
|
"partstotal": "",
|
||||||
|
"pimraryamountpayable": "",
|
||||||
"plitooltips": {
|
"plitooltips": {
|
||||||
"billtotal": "",
|
"billtotal": "",
|
||||||
"calculatedcreditsnotreceived": "",
|
"calculatedcreditsnotreceived": "",
|
||||||
@@ -2088,6 +2091,7 @@
|
|||||||
"customer": "",
|
"customer": "",
|
||||||
"edit": "",
|
"edit": "",
|
||||||
"electronicpayment": "",
|
"electronicpayment": "",
|
||||||
|
"external": "",
|
||||||
"findermodal": "",
|
"findermodal": "",
|
||||||
"insurance": "",
|
"insurance": "",
|
||||||
"new": "",
|
"new": "",
|
||||||
|
|||||||
@@ -73,11 +73,19 @@ exports.default = async (req, res) => {
|
|||||||
|
|
||||||
for (const payment of payments) {
|
for (const payment of payments) {
|
||||||
try {
|
try {
|
||||||
const isThreeTier = bodyshop.accountingconfig.tiers === 3;
|
let isThreeTier = bodyshop.accountingconfig.tiers === 3;
|
||||||
const twoTierPref = bodyshop.accountingconfig.twotierpref;
|
let twoTierPref = bodyshop.accountingconfig.twotierpref;
|
||||||
|
|
||||||
//Replace this with a for-each loop to check every single Job that's included in the list.
|
//Replace this with a for-each loop to check every single Job that's included in the list.
|
||||||
|
|
||||||
|
//QB Multi AR - If it is in this scenario, overwrite whatever defaults are set since multi AR
|
||||||
|
//will always go Source => RO
|
||||||
|
if (payment.payer !== "Customer") {
|
||||||
|
payment.job.ins_co_nm = payment.payer;
|
||||||
|
twoTierPref = "source";
|
||||||
|
isThreeTier = false;
|
||||||
|
}
|
||||||
|
|
||||||
let insCoCustomerTier, ownerCustomerTier, jobTier;
|
let insCoCustomerTier, ownerCustomerTier, jobTier;
|
||||||
if (isThreeTier || (!isThreeTier && twoTierPref === "source")) {
|
if (isThreeTier || (!isThreeTier && twoTierPref === "source")) {
|
||||||
//Insert the insurance company tier.
|
//Insert the insurance company tier.
|
||||||
@@ -106,7 +114,9 @@ exports.default = async (req, res) => {
|
|||||||
oauthClient,
|
oauthClient,
|
||||||
qbo_realmId,
|
qbo_realmId,
|
||||||
req,
|
req,
|
||||||
payment.job
|
payment.job,
|
||||||
|
isThreeTier,
|
||||||
|
insCoCustomerTier
|
||||||
);
|
);
|
||||||
//Query for the owner itself.
|
//Query for the owner itself.
|
||||||
if (!ownerCustomerTier) {
|
if (!ownerCustomerTier) {
|
||||||
@@ -122,7 +132,17 @@ exports.default = async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Query for the Job or Create it.
|
//Query for the Job or Create it.
|
||||||
jobTier = await QueryJob(oauthClient, qbo_realmId, req, payment.job);
|
jobTier = await QueryJob(
|
||||||
|
oauthClient,
|
||||||
|
qbo_realmId,
|
||||||
|
req,
|
||||||
|
payment.job,
|
||||||
|
isThreeTier
|
||||||
|
? ownerCustomerTier
|
||||||
|
: twoTierPref === "source"
|
||||||
|
? insCoCustomerTier
|
||||||
|
: ownerCustomerTier
|
||||||
|
);
|
||||||
|
|
||||||
// Need to validate that the job tier is associated to the right individual?
|
// Need to validate that the job tier is associated to the right individual?
|
||||||
|
|
||||||
@@ -237,7 +257,8 @@ async function InsertPayment(
|
|||||||
qbo_realmId,
|
qbo_realmId,
|
||||||
req,
|
req,
|
||||||
payment.job.ro_number,
|
payment.job.ro_number,
|
||||||
false
|
false,
|
||||||
|
parentRef
|
||||||
);
|
);
|
||||||
|
|
||||||
if (invoices && invoices.length !== 1) {
|
if (invoices && invoices.length !== 1) {
|
||||||
@@ -260,7 +281,7 @@ async function InsertPayment(
|
|||||||
PaymentMethodRef: {
|
PaymentMethodRef: {
|
||||||
value: paymentMethods[payment.type],
|
value: paymentMethods[payment.type],
|
||||||
},
|
},
|
||||||
...(invoices && invoices.length === 1
|
...(invoices && invoices.length === 1 && invoices[0]
|
||||||
? {
|
? {
|
||||||
Line: [
|
Line: [
|
||||||
{
|
{
|
||||||
@@ -305,13 +326,14 @@ async function QueryMetaData(
|
|||||||
qbo_realmId,
|
qbo_realmId,
|
||||||
req,
|
req,
|
||||||
ro_number,
|
ro_number,
|
||||||
isCreditMemo
|
isCreditMemo,
|
||||||
|
parentTierRef
|
||||||
) {
|
) {
|
||||||
const invoice = await oauthClient.makeApiCall({
|
const invoice = await oauthClient.makeApiCall({
|
||||||
url: urlBuilder(
|
url: urlBuilder(
|
||||||
qbo_realmId,
|
qbo_realmId,
|
||||||
"query",
|
"query",
|
||||||
`select * From Invoice where DocNumber = '${ro_number}'`
|
`select * From Invoice where DocNumber like '${ro_number}%'`
|
||||||
),
|
),
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -407,7 +429,14 @@ async function QueryMetaData(
|
|||||||
invoices:
|
invoices:
|
||||||
invoice.json &&
|
invoice.json &&
|
||||||
invoice.json.QueryResponse &&
|
invoice.json.QueryResponse &&
|
||||||
invoice.json.QueryResponse.Invoice,
|
invoice.json.QueryResponse.Invoice &&
|
||||||
|
(parentTierRef
|
||||||
|
? [
|
||||||
|
invoice.json.QueryResponse.Invoice.find(
|
||||||
|
(x) => x.CustomerRef.value === parentTierRef.Id
|
||||||
|
),
|
||||||
|
]
|
||||||
|
: [invoice.json.QueryResponse.Invoice[0]]),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
async function InsertCreditMemo(
|
async function InsertCreditMemo(
|
||||||
@@ -423,7 +452,8 @@ async function InsertCreditMemo(
|
|||||||
qbo_realmId,
|
qbo_realmId,
|
||||||
req,
|
req,
|
||||||
payment.job.ro_number,
|
payment.job.ro_number,
|
||||||
true
|
true,
|
||||||
|
parentRef
|
||||||
);
|
);
|
||||||
|
|
||||||
if (invoices && invoices.length !== 1) {
|
if (invoices && invoices.length !== 1) {
|
||||||
|
|||||||
@@ -100,7 +100,9 @@ exports.default = async (req, res) => {
|
|||||||
oauthClient,
|
oauthClient,
|
||||||
qbo_realmId,
|
qbo_realmId,
|
||||||
req,
|
req,
|
||||||
job
|
job,
|
||||||
|
isThreeTier,
|
||||||
|
insCoCustomerTier
|
||||||
);
|
);
|
||||||
//Query for the owner itself.
|
//Query for the owner itself.
|
||||||
if (!ownerCustomerTier) {
|
if (!ownerCustomerTier) {
|
||||||
@@ -121,7 +123,11 @@ exports.default = async (req, res) => {
|
|||||||
qbo_realmId,
|
qbo_realmId,
|
||||||
req,
|
req,
|
||||||
job,
|
job,
|
||||||
isThreeTier ? ownerCustomerTier : null // ownerCustomerTier || insCoCustomerTier
|
isThreeTier
|
||||||
|
? ownerCustomerTier
|
||||||
|
: twoTierPref === "source"
|
||||||
|
? insCoCustomerTier
|
||||||
|
: ownerCustomerTier
|
||||||
);
|
);
|
||||||
|
|
||||||
// Need to validate that the job tier is associated to the right individual?
|
// Need to validate that the job tier is associated to the right individual?
|
||||||
@@ -342,7 +348,14 @@ async function InsertInsuranceCo(oauthClient, qbo_realmId, req, job, bodyshop) {
|
|||||||
}
|
}
|
||||||
exports.InsertInsuranceCo = InsertInsuranceCo;
|
exports.InsertInsuranceCo = InsertInsuranceCo;
|
||||||
|
|
||||||
async function QueryOwner(oauthClient, qbo_realmId, req, job) {
|
async function QueryOwner(
|
||||||
|
oauthClient,
|
||||||
|
qbo_realmId,
|
||||||
|
req,
|
||||||
|
job,
|
||||||
|
isThreeTier,
|
||||||
|
parentTierRef
|
||||||
|
) {
|
||||||
const ownerName = generateOwnerTier(job, true, null);
|
const ownerName = generateOwnerTier(job, true, null);
|
||||||
const result = await oauthClient.makeApiCall({
|
const result = await oauthClient.makeApiCall({
|
||||||
url: urlBuilder(
|
url: urlBuilder(
|
||||||
@@ -362,7 +375,9 @@ async function QueryOwner(oauthClient, qbo_realmId, req, job) {
|
|||||||
result.json &&
|
result.json &&
|
||||||
result.json.QueryResponse &&
|
result.json.QueryResponse &&
|
||||||
result.json.QueryResponse.Customer &&
|
result.json.QueryResponse.Customer &&
|
||||||
result.json.QueryResponse.Customer[0]
|
result.json.QueryResponse.Customer.find(
|
||||||
|
(x) => x.ParentRef?.value === parentTierRef?.Id
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
exports.QueryOwner = QueryOwner;
|
exports.QueryOwner = QueryOwner;
|
||||||
|
|||||||
@@ -205,8 +205,8 @@ exports.default = async (req, res) => {
|
|||||||
Party: {
|
Party: {
|
||||||
PersonInfo: {
|
PersonInfo: {
|
||||||
PersonName: {
|
PersonName: {
|
||||||
FirstName: job.ownr_fn,
|
FirstName: job.ownr_co_nm ? "N/A" : job.ownr_fn,
|
||||||
LastName: job.ownr_ln,
|
LastName: job.ownr_co_nm ? job.ownr_co_nm : job.ownr_ln,
|
||||||
},
|
},
|
||||||
// Communications: [
|
// Communications: [
|
||||||
// {
|
// {
|
||||||
@@ -336,7 +336,7 @@ exports.default = async (req, res) => {
|
|||||||
LossDateTime:
|
LossDateTime:
|
||||||
job.loss_date &&
|
job.loss_date &&
|
||||||
moment(job.loss_date)
|
moment(job.loss_date)
|
||||||
.tz(bodyshop.timezone)
|
//.tz(bodyshop.timezone)
|
||||||
.format(momentFormat),
|
.format(momentFormat),
|
||||||
LossDescCode: "Collision",
|
LossDescCode: "Collision",
|
||||||
PrimaryPOI: {
|
PrimaryPOI: {
|
||||||
@@ -515,8 +515,11 @@ exports.default = async (req, res) => {
|
|||||||
{
|
{
|
||||||
TotalType: "LAB",
|
TotalType: "LAB",
|
||||||
TotalTypeDesc: "Body Labor",
|
TotalTypeDesc: "Body Labor",
|
||||||
TotalHours: job.job_totals.rates.lab.hours,
|
TotalHours:
|
||||||
TotalAmt: Dinero(job.job_totals.rates.lab.total).toFormat("0.00"),
|
job.job_totals.rates.lab.hours + job.job_totals.rates.la1.hours,
|
||||||
|
TotalAmt: Dinero(job.job_totals.rates.lab.total)
|
||||||
|
.add(Dinero(job.job_totals.rates.la1.total))
|
||||||
|
.toFormat("0.00"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
TotalType: "LAF",
|
TotalType: "LAF",
|
||||||
@@ -635,9 +638,9 @@ exports.default = async (req, res) => {
|
|||||||
{
|
{
|
||||||
TotalType: "OTAC",
|
TotalType: "OTAC",
|
||||||
TotalTypeDesc: "Additional Charges",
|
TotalTypeDesc: "Additional Charges",
|
||||||
TotalAmt: Dinero(
|
TotalAmt: Dinero(job.job_totals.additional.additionalCosts)
|
||||||
job.job_totals.additional.additionalCosts
|
.add(Dinero(job.job_totals.additional.pvrt))
|
||||||
).toFormat("0.00"),
|
.toFormat("0.00"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
SummaryTotalsInfo: [
|
SummaryTotalsInfo: [
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ exports.default = async (req, res) => {
|
|||||||
bodyshopid: bodyshop.id,
|
bodyshopid: bodyshop.id,
|
||||||
start: start
|
start: start
|
||||||
? moment(start).startOf("day")
|
? moment(start).startOf("day")
|
||||||
: moment().subtract(3, "days").startOf("day"),
|
: moment().subtract(5, "days").startOf("day"),
|
||||||
...(end && { end: moment(end).startOf("day") }),
|
...(end && { end: moment(end).startOf("day") }),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -316,6 +316,10 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
|||||||
moment(job.date_open)
|
moment(job.date_open)
|
||||||
.tz(job.bodyshop.timezone)
|
.tz(job.bodyshop.timezone)
|
||||||
.format(AhDateFormat)) ||
|
.format(AhDateFormat)) ||
|
||||||
|
(job.created_at &&
|
||||||
|
moment(job.created_at)
|
||||||
|
.tz(job.bodyshop.timezone)
|
||||||
|
.format(AhDateFormat)) ||
|
||||||
"",
|
"",
|
||||||
ScheduledArrivalDate:
|
ScheduledArrivalDate:
|
||||||
(job.scheduled_in &&
|
(job.scheduled_in &&
|
||||||
|
|||||||
@@ -623,6 +623,7 @@ exports.AUTOHOUSE_QUERY = `query AUTOHOUSE_EXPORT($start: timestamptz, $bodyshop
|
|||||||
}
|
}
|
||||||
jobs(where: {_and: [{converted: {_eq: true}}, {updated_at: {_gt: $start}}, {updated_at: {_lte: $end}}, {shopid: {_eq: $bodyshopid}}]}) {
|
jobs(where: {_and: [{converted: {_eq: true}}, {updated_at: {_gt: $start}}, {updated_at: {_lte: $end}}, {shopid: {_eq: $bodyshopid}}]}) {
|
||||||
id
|
id
|
||||||
|
created_at
|
||||||
ro_number
|
ro_number
|
||||||
status
|
status
|
||||||
est_ct_fn
|
est_ct_fn
|
||||||
|
|||||||
Reference in New Issue
Block a user