@@ -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>
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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,13 @@ async function QueryMetaData(
|
|||||||
invoices:
|
invoices:
|
||||||
invoice.json &&
|
invoice.json &&
|
||||||
invoice.json.QueryResponse &&
|
invoice.json.QueryResponse &&
|
||||||
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 +451,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) {
|
||||||
|
|||||||
@@ -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