Refactoring for 3tier setup BOD-83
This commit is contained in:
@@ -2150,6 +2150,90 @@
|
|||||||
<folder_node>
|
<folder_node>
|
||||||
<name>labels</name>
|
<name>labels</name>
|
||||||
<children>
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>2tiername</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>
|
||||||
|
<name>2tiersetup</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>
|
||||||
|
<name>2tiersource</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>
|
||||||
|
<name>accountingtiers</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>alljobstatuses</name>
|
<name>alljobstatuses</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ const wsLink = new WebSocketLink({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const subscriptionMiddleware = {
|
const subscriptionMiddleware = {
|
||||||
applyMiddleware: async (options, next) => {
|
applyMiddleware: async (options, next) => {
|
||||||
options.authToken =
|
options.authToken =
|
||||||
@@ -118,7 +119,6 @@ export const client = new ApolloClient({
|
|||||||
export default class AppContainer extends Component {
|
export default class AppContainer extends Component {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.state = { client };
|
this.state = { client };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Form, Input, Button, Collapse, InputNumber } from "antd";
|
import { Form, Input, Button, Collapse, InputNumber, Radio } from "antd";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import ShopInfoROStatusComponent from "./shop-info.rostatus.component";
|
import ShopInfoROStatusComponent from "./shop-info.rostatus.component";
|
||||||
import ShopInfoOrderStatusComponent from "./shop-info.orderstatus.component";
|
import ShopInfoOrderStatusComponent from "./shop-info.orderstatus.component";
|
||||||
@@ -9,95 +9,126 @@ export default function ShopInfoComponent({ form }) {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Button type="primary" htmlType="submit">
|
<Button type='primary' htmlType='submit'>
|
||||||
{t("general.actions.save")}
|
{t("general.actions.save")}
|
||||||
</Button>
|
</Button>
|
||||||
<Collapse defaultActiveKey="shopinfo">
|
<Collapse defaultActiveKey='shopinfo'>
|
||||||
<Collapse.Panel key="shopinfo" header={t("bodyshop.labels.shopinfo")}>
|
<Collapse.Panel key='shopinfo' header={t("bodyshop.labels.shopinfo")}>
|
||||||
<Form.Item label={t("bodyshop.fields.shopname")} name="shopname">
|
<Form.Item label={t("bodyshop.fields.shopname")} name='shopname'>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("bodyshop.fields.address1")} name="address1">
|
<Form.Item label={t("bodyshop.fields.address1")} name='address1'>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label={t("bodyshop.fields.address2")} name="address2">
|
<Form.Item label={t("bodyshop.fields.address2")} name='address2'>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("bodyshop.fields.city")} name="city">
|
<Form.Item label={t("bodyshop.fields.city")} name='city'>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("bodyshop.fields.state")} name="state">
|
<Form.Item label={t("bodyshop.fields.state")} name='state'>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("bodyshop.fields.zip_post")} name="zip_post">
|
<Form.Item label={t("bodyshop.fields.zip_post")} name='zip_post'>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("bodyshop.fields.country")} name="country">
|
<Form.Item label={t("bodyshop.fields.country")} name='country'>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("bodyshop.fields.email")} name="email">
|
<Form.Item label={t("bodyshop.fields.email")} name='email'>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.federal_tax_id")}
|
label={t("bodyshop.fields.federal_tax_id")}
|
||||||
name="federal_tax_id"
|
name='federal_tax_id'>
|
||||||
>
|
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.insurance_vendor_id")}
|
label={t("bodyshop.fields.insurance_vendor_id")}
|
||||||
name="insurance_vendor_id"
|
name='insurance_vendor_id'>
|
||||||
>
|
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.logo_img_path")}
|
label={t("bodyshop.fields.logo_img_path")}
|
||||||
name="logo_img_path"
|
name='logo_img_path'>
|
||||||
>
|
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.state_tax_id")}
|
label={t("bodyshop.fields.state_tax_id")}
|
||||||
name="state_tax_id"
|
name='state_tax_id'>
|
||||||
>
|
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.invoice_federal_tax_rate")}
|
label={t("bodyshop.fields.invoice_federal_tax_rate")}
|
||||||
name={["invoice_tax_rates", "federal_tax_rate"]}
|
name={["invoice_tax_rates", "federal_tax_rate"]}>
|
||||||
>
|
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.invoice_state_tax_rate")}
|
label={t("bodyshop.fields.invoice_state_tax_rate")}
|
||||||
name={["invoice_tax_rates", "state_tax_rate"]}
|
name={["invoice_tax_rates", "state_tax_rate"]}>
|
||||||
>
|
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.invoice_local_tax_rate")}
|
label={t("bodyshop.fields.invoice_local_tax_rate")}
|
||||||
name={["invoice_tax_rates", "local_tax_rate"]}
|
name={["invoice_tax_rates", "local_tax_rate"]}>
|
||||||
>
|
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.labels.accountingtiers")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["accountingconfig", "tiers"]}>
|
||||||
|
<Radio.Group>
|
||||||
|
<Radio value={2}>2</Radio>
|
||||||
|
<Radio value={3}>3</Radio>
|
||||||
|
</Radio.Group>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item shouldUpdate>
|
||||||
|
{() => {
|
||||||
|
return (
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.labels.2tiersetup")}
|
||||||
|
shouldUpdate
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required:
|
||||||
|
form.getFieldValue(["accountingconfig", "tiers"]) === 2,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["accountingconfig", "twotierpref"]}>
|
||||||
|
<Radio.Group
|
||||||
|
disabled={
|
||||||
|
form.getFieldValue(["accountingconfig", "tiers"]) === 3
|
||||||
|
}>
|
||||||
|
<Radio value='name'>{t("bodyshop.labels.2tiername")}</Radio>
|
||||||
|
<Radio value='source'>
|
||||||
|
{t("bodyshop.labels.2tiersource")}
|
||||||
|
</Radio>
|
||||||
|
</Radio.Group>
|
||||||
|
</Form.Item>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</Form.Item>
|
||||||
</Collapse.Panel>
|
</Collapse.Panel>
|
||||||
<Collapse.Panel
|
<Collapse.Panel
|
||||||
key="roStatus"
|
key='roStatus'
|
||||||
header={t("bodyshop.labels.jobstatuses")}
|
header={t("bodyshop.labels.jobstatuses")}>
|
||||||
>
|
|
||||||
<ShopInfoROStatusComponent form={form} />
|
<ShopInfoROStatusComponent form={form} />
|
||||||
</Collapse.Panel>
|
</Collapse.Panel>
|
||||||
<Collapse.Panel
|
<Collapse.Panel
|
||||||
key="orderStatus"
|
key='orderStatus'
|
||||||
header={t("bodyshop.labels.orderstatuses")}
|
header={t("bodyshop.labels.orderstatuses")}>
|
||||||
>
|
|
||||||
<ShopInfoOrderStatusComponent form={form} />
|
<ShopInfoOrderStatusComponent form={form} />
|
||||||
</Collapse.Panel>
|
</Collapse.Panel>
|
||||||
<Collapse.Panel
|
<Collapse.Panel
|
||||||
key="responsibilityCenters"
|
key='responsibilityCenters'
|
||||||
header={t("bodyshop.labels.responsibilitycenters.title")}
|
header={t("bodyshop.labels.responsibilitycenters.title")}>
|
||||||
>
|
|
||||||
<ShopInfoResponsibilityCenterComponent form={form} />
|
<ShopInfoResponsibilityCenterComponent form={form} />
|
||||||
</Collapse.Panel>
|
</Collapse.Panel>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export const QUERY_BODYSHOP = gql`
|
|||||||
production_config
|
production_config
|
||||||
invoice_tax_rates
|
invoice_tax_rates
|
||||||
inhousevendorid
|
inhousevendorid
|
||||||
|
accountingconfig
|
||||||
employees {
|
employees {
|
||||||
id
|
id
|
||||||
first_name
|
first_name
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useQuery } from "@apollo/react-hooks";
|
import { useQuery } from "@apollo/react-hooks";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { selectInstanceConflict } from "../../redux/user/user.selectors";
|
|||||||
import HeaderContainer from "../../components/header/header.container";
|
import HeaderContainer from "../../components/header/header.container";
|
||||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||||
import PrintCenterModalContainer from "../../components/print-center-modal/print-center-modal.container";
|
import PrintCenterModalContainer from "../../components/print-center-modal/print-center-modal.container";
|
||||||
import ConflictComponent from '../../components/conflict/conflict.component'
|
import ConflictComponent from "../../components/conflict/conflict.component";
|
||||||
|
|
||||||
import "./manage.page.styles.scss";
|
import "./manage.page.styles.scss";
|
||||||
const ManageRootPage = lazy(() =>
|
const ManageRootPage = lazy(() =>
|
||||||
@@ -118,9 +118,8 @@ export function Manage({ match, conflict }) {
|
|||||||
</Header>
|
</Header>
|
||||||
<Layout>
|
<Layout>
|
||||||
<Content
|
<Content
|
||||||
className="content-container"
|
className='content-container'
|
||||||
style={{ padding: "0em 4em 4em" }}
|
style={{ padding: "0em 4em 4em" }}>
|
||||||
>
|
|
||||||
<FcmNotification />
|
<FcmNotification />
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
{conflict ? (
|
{conflict ? (
|
||||||
@@ -129,8 +128,7 @@ export function Manage({ match, conflict }) {
|
|||||||
<Suspense
|
<Suspense
|
||||||
fallback={
|
fallback={
|
||||||
<LoadingSpinner message={t("general.labels.loadingapp")} />
|
<LoadingSpinner message={t("general.labels.loadingapp")} />
|
||||||
}
|
}>
|
||||||
>
|
|
||||||
<BreadCrumbs />
|
<BreadCrumbs />
|
||||||
<EnterInvoiceModalContainer />
|
<EnterInvoiceModalContainer />
|
||||||
<EmailOverlayContainer />
|
<EmailOverlayContainer />
|
||||||
|
|||||||
@@ -142,6 +142,10 @@
|
|||||||
"zip_post": "Zip/Postal Code"
|
"zip_post": "Zip/Postal Code"
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
"2tiername": "Name => RO",
|
||||||
|
"2tiersetup": "2 Tier Setup",
|
||||||
|
"2tiersource": "Source => RO",
|
||||||
|
"accountingtiers": "Number of Tiers to Use for Export",
|
||||||
"alljobstatuses": "All Job Statuses",
|
"alljobstatuses": "All Job Statuses",
|
||||||
"allopenjobstatuses": "All Open Job Statuses",
|
"allopenjobstatuses": "All Open Job Statuses",
|
||||||
"customtemplates": "Custom Templates",
|
"customtemplates": "Custom Templates",
|
||||||
|
|||||||
@@ -142,6 +142,10 @@
|
|||||||
"zip_post": ""
|
"zip_post": ""
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
"2tiername": "",
|
||||||
|
"2tiersetup": "",
|
||||||
|
"2tiersource": "",
|
||||||
|
"accountingtiers": "",
|
||||||
"alljobstatuses": "",
|
"alljobstatuses": "",
|
||||||
"allopenjobstatuses": "",
|
"allopenjobstatuses": "",
|
||||||
"customtemplates": "",
|
"customtemplates": "",
|
||||||
|
|||||||
@@ -142,6 +142,10 @@
|
|||||||
"zip_post": ""
|
"zip_post": ""
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
"2tiername": "",
|
||||||
|
"2tiersetup": "",
|
||||||
|
"2tiersource": "",
|
||||||
|
"accountingtiers": "",
|
||||||
"alljobstatuses": "",
|
"alljobstatuses": "",
|
||||||
"allopenjobstatuses": "",
|
"allopenjobstatuses": "",
|
||||||
"customtemplates": "",
|
"customtemplates": "",
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."bodyshops" DROP COLUMN "accountingconfig";
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."bodyshops" ADD COLUMN "accountingconfig" jsonb NULL;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: drop_select_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_aggregations: false
|
||||||
|
columns:
|
||||||
|
- address1
|
||||||
|
- address2
|
||||||
|
- city
|
||||||
|
- country
|
||||||
|
- created_at
|
||||||
|
- email
|
||||||
|
- federal_tax_id
|
||||||
|
- id
|
||||||
|
- inhousevendorid
|
||||||
|
- insurance_vendor_id
|
||||||
|
- intakechecklist
|
||||||
|
- invoice_tax_rates
|
||||||
|
- logo_img_path
|
||||||
|
- md_order_statuses
|
||||||
|
- md_responsibility_centers
|
||||||
|
- md_ro_statuses
|
||||||
|
- messagingservicesid
|
||||||
|
- production_config
|
||||||
|
- region_config
|
||||||
|
- shopname
|
||||||
|
- shoprates
|
||||||
|
- state
|
||||||
|
- state_tax_id
|
||||||
|
- template_header
|
||||||
|
- textid
|
||||||
|
- updated_at
|
||||||
|
- zip_post
|
||||||
|
computed_fields: []
|
||||||
|
filter:
|
||||||
|
associations:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: create_select_permission
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: drop_select_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_aggregations: false
|
||||||
|
columns:
|
||||||
|
- accountingconfig
|
||||||
|
- address1
|
||||||
|
- address2
|
||||||
|
- city
|
||||||
|
- country
|
||||||
|
- created_at
|
||||||
|
- email
|
||||||
|
- federal_tax_id
|
||||||
|
- id
|
||||||
|
- inhousevendorid
|
||||||
|
- insurance_vendor_id
|
||||||
|
- intakechecklist
|
||||||
|
- invoice_tax_rates
|
||||||
|
- logo_img_path
|
||||||
|
- md_order_statuses
|
||||||
|
- md_responsibility_centers
|
||||||
|
- md_ro_statuses
|
||||||
|
- messagingservicesid
|
||||||
|
- production_config
|
||||||
|
- region_config
|
||||||
|
- shopname
|
||||||
|
- shoprates
|
||||||
|
- state
|
||||||
|
- state_tax_id
|
||||||
|
- template_header
|
||||||
|
- textid
|
||||||
|
- updated_at
|
||||||
|
- zip_post
|
||||||
|
computed_fields: []
|
||||||
|
filter:
|
||||||
|
associations:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: create_select_permission
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: drop_update_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- address1
|
||||||
|
- address2
|
||||||
|
- city
|
||||||
|
- country
|
||||||
|
- created_at
|
||||||
|
- email
|
||||||
|
- federal_tax_id
|
||||||
|
- id
|
||||||
|
- inhousevendorid
|
||||||
|
- insurance_vendor_id
|
||||||
|
- intakechecklist
|
||||||
|
- invoice_tax_rates
|
||||||
|
- logo_img_path
|
||||||
|
- md_order_statuses
|
||||||
|
- md_responsibility_centers
|
||||||
|
- md_ro_statuses
|
||||||
|
- production_config
|
||||||
|
- shopname
|
||||||
|
- shoprates
|
||||||
|
- state
|
||||||
|
- state_tax_id
|
||||||
|
- updated_at
|
||||||
|
- zip_post
|
||||||
|
filter:
|
||||||
|
associations:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: create_update_permission
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: drop_update_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- accountingconfig
|
||||||
|
- address1
|
||||||
|
- address2
|
||||||
|
- city
|
||||||
|
- country
|
||||||
|
- created_at
|
||||||
|
- email
|
||||||
|
- federal_tax_id
|
||||||
|
- id
|
||||||
|
- inhousevendorid
|
||||||
|
- insurance_vendor_id
|
||||||
|
- intakechecklist
|
||||||
|
- invoice_tax_rates
|
||||||
|
- logo_img_path
|
||||||
|
- md_order_statuses
|
||||||
|
- md_responsibility_centers
|
||||||
|
- md_ro_statuses
|
||||||
|
- production_config
|
||||||
|
- shopname
|
||||||
|
- shoprates
|
||||||
|
- state
|
||||||
|
- state_tax_id
|
||||||
|
- updated_at
|
||||||
|
- zip_post
|
||||||
|
filter:
|
||||||
|
associations:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: create_update_permission
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
[]
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
- args:
|
||||||
|
cascade: true
|
||||||
|
read_only: false
|
||||||
|
sql: |-
|
||||||
|
alter table owners
|
||||||
|
drop column accountingid;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."owners" DROP COLUMN "accountingid";
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."owners" ADD COLUMN "accountingid" bigserial NOT NULL;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: owners
|
||||||
|
schema: public
|
||||||
|
type: drop_insert_permission
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_upsert: true
|
||||||
|
check:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
columns:
|
||||||
|
- id
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- ownr_fn
|
||||||
|
- ownr_ln
|
||||||
|
- ownr_addr1
|
||||||
|
- ownr_addr2
|
||||||
|
- ownr_city
|
||||||
|
- ownr_st
|
||||||
|
- ownr_zip
|
||||||
|
- ownr_ctry
|
||||||
|
- ownr_ea
|
||||||
|
- ownr_ph1
|
||||||
|
- preferred_contact
|
||||||
|
- allow_text_message
|
||||||
|
- shopid
|
||||||
|
- ownr_ph2
|
||||||
|
- ownr_co_nm
|
||||||
|
- ownr_title
|
||||||
|
- accountingid
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: owners
|
||||||
|
schema: public
|
||||||
|
type: create_insert_permission
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: owners
|
||||||
|
schema: public
|
||||||
|
type: drop_select_permission
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_aggregations: false
|
||||||
|
columns:
|
||||||
|
- allow_text_message
|
||||||
|
- accountingid
|
||||||
|
- ownr_addr1
|
||||||
|
- ownr_addr2
|
||||||
|
- ownr_city
|
||||||
|
- ownr_co_nm
|
||||||
|
- ownr_ctry
|
||||||
|
- ownr_ea
|
||||||
|
- ownr_fn
|
||||||
|
- ownr_ln
|
||||||
|
- ownr_ph1
|
||||||
|
- ownr_ph2
|
||||||
|
- ownr_st
|
||||||
|
- ownr_title
|
||||||
|
- ownr_zip
|
||||||
|
- preferred_contact
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- id
|
||||||
|
- shopid
|
||||||
|
computed_fields: []
|
||||||
|
filter:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
limit: null
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: owners
|
||||||
|
schema: public
|
||||||
|
type: create_select_permission
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: owners
|
||||||
|
schema: public
|
||||||
|
type: drop_update_permission
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- allow_text_message
|
||||||
|
- accountingid
|
||||||
|
- ownr_addr1
|
||||||
|
- ownr_addr2
|
||||||
|
- ownr_city
|
||||||
|
- ownr_co_nm
|
||||||
|
- ownr_ctry
|
||||||
|
- ownr_ea
|
||||||
|
- ownr_fn
|
||||||
|
- ownr_ln
|
||||||
|
- ownr_ph1
|
||||||
|
- ownr_ph2
|
||||||
|
- ownr_st
|
||||||
|
- ownr_title
|
||||||
|
- ownr_zip
|
||||||
|
- preferred_contact
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- id
|
||||||
|
- shopid
|
||||||
|
filter:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: owners
|
||||||
|
schema: public
|
||||||
|
type: create_update_permission
|
||||||
@@ -444,6 +444,7 @@ tables:
|
|||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
columns:
|
columns:
|
||||||
|
- accountingconfig
|
||||||
- address1
|
- address1
|
||||||
- address2
|
- address2
|
||||||
- city
|
- city
|
||||||
@@ -482,6 +483,7 @@ tables:
|
|||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
columns:
|
columns:
|
||||||
|
- accountingconfig
|
||||||
- address1
|
- address1
|
||||||
- address2
|
- address2
|
||||||
- city
|
- city
|
||||||
@@ -2840,34 +2842,32 @@ tables:
|
|||||||
- active:
|
- active:
|
||||||
_eq: true
|
_eq: true
|
||||||
columns:
|
columns:
|
||||||
- accountingid
|
|
||||||
- allow_text_message
|
|
||||||
- created_at
|
|
||||||
- id
|
- id
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- ownr_fn
|
||||||
|
- ownr_ln
|
||||||
- ownr_addr1
|
- ownr_addr1
|
||||||
- ownr_addr2
|
- ownr_addr2
|
||||||
- ownr_city
|
- ownr_city
|
||||||
- ownr_co_nm
|
- ownr_st
|
||||||
|
- ownr_zip
|
||||||
- ownr_ctry
|
- ownr_ctry
|
||||||
- ownr_ea
|
- ownr_ea
|
||||||
- ownr_fn
|
|
||||||
- ownr_ln
|
|
||||||
- ownr_ph1
|
- ownr_ph1
|
||||||
- ownr_ph2
|
|
||||||
- ownr_st
|
|
||||||
- ownr_title
|
|
||||||
- ownr_zip
|
|
||||||
- preferred_contact
|
- preferred_contact
|
||||||
|
- allow_text_message
|
||||||
- shopid
|
- shopid
|
||||||
- updated_at
|
- ownr_ph2
|
||||||
|
- ownr_co_nm
|
||||||
|
- ownr_title
|
||||||
|
- accountingid
|
||||||
select_permissions:
|
select_permissions:
|
||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
columns:
|
columns:
|
||||||
- accountingid
|
|
||||||
- allow_text_message
|
- allow_text_message
|
||||||
- created_at
|
- accountingid
|
||||||
- id
|
|
||||||
- ownr_addr1
|
- ownr_addr1
|
||||||
- ownr_addr2
|
- ownr_addr2
|
||||||
- ownr_city
|
- ownr_city
|
||||||
@@ -2882,8 +2882,10 @@ tables:
|
|||||||
- ownr_title
|
- ownr_title
|
||||||
- ownr_zip
|
- ownr_zip
|
||||||
- preferred_contact
|
- preferred_contact
|
||||||
- shopid
|
- created_at
|
||||||
- updated_at
|
- updated_at
|
||||||
|
- id
|
||||||
|
- shopid
|
||||||
filter:
|
filter:
|
||||||
bodyshop:
|
bodyshop:
|
||||||
associations:
|
associations:
|
||||||
@@ -2897,10 +2899,8 @@ tables:
|
|||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
columns:
|
columns:
|
||||||
- accountingid
|
|
||||||
- allow_text_message
|
- allow_text_message
|
||||||
- created_at
|
- accountingid
|
||||||
- id
|
|
||||||
- ownr_addr1
|
- ownr_addr1
|
||||||
- ownr_addr2
|
- ownr_addr2
|
||||||
- ownr_city
|
- ownr_city
|
||||||
@@ -2915,8 +2915,10 @@ tables:
|
|||||||
- ownr_title
|
- ownr_title
|
||||||
- ownr_zip
|
- ownr_zip
|
||||||
- preferred_contact
|
- preferred_contact
|
||||||
- shopid
|
- created_at
|
||||||
- updated_at
|
- updated_at
|
||||||
|
- id
|
||||||
|
- shopid
|
||||||
filter:
|
filter:
|
||||||
bodyshop:
|
bodyshop:
|
||||||
associations:
|
associations:
|
||||||
|
|||||||
@@ -25,97 +25,195 @@ exports.default = async (req, res) => {
|
|||||||
const result = await client
|
const result = await client
|
||||||
.setHeaders({ Authorization: BearerToken })
|
.setHeaders({ Authorization: BearerToken })
|
||||||
.request(queries.QUERY_JOBS_FOR_RECEIVABLES_EXPORT, { id: jobId });
|
.request(queries.QUERY_JOBS_FOR_RECEIVABLES_EXPORT, { id: jobId });
|
||||||
|
|
||||||
const { jobs_by_pk } = result;
|
const { jobs_by_pk } = result;
|
||||||
const { bodyshop } = jobs_by_pk;
|
const { bodyshop } = jobs_by_pk;
|
||||||
//Build the XML file.
|
const QbXmlToExecute = [];
|
||||||
|
|
||||||
const InvoiceLineAdd = [];
|
//Is this a two tier, or 3 tier setup?
|
||||||
const invoice_allocation = jobs_by_pk.invoice_allocation;
|
const isThreeTier = bodyshop.accountingconfig.tiers === 3;
|
||||||
Object.keys(invoice_allocation.partsAllocations).forEach(
|
|
||||||
(partsAllocationKey) => {
|
|
||||||
if (
|
|
||||||
!!!invoice_allocation.partsAllocations[partsAllocationKey].allocations
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
|
|
||||||
invoice_allocation.partsAllocations[
|
QbXmlToExecute.push(
|
||||||
partsAllocationKey
|
generateCustomerQbxml(jobs_by_pk, bodyshop, isThreeTier)
|
||||||
].allocations.forEach((alloc) => {
|
|
||||||
InvoiceLineAdd.push(
|
|
||||||
generateInvoiceLine(
|
|
||||||
jobs_by_pk,
|
|
||||||
alloc,
|
|
||||||
bodyshop.md_responsibility_centers
|
|
||||||
)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
Object.keys(invoice_allocation.labMatAllocations).forEach(
|
|
||||||
(AllocationKey) => {
|
|
||||||
if (!!!invoice_allocation.labMatAllocations[AllocationKey].allocations)
|
|
||||||
return;
|
|
||||||
|
|
||||||
invoice_allocation.labMatAllocations[AllocationKey].allocations.forEach(
|
|
||||||
(alloc) => {
|
|
||||||
InvoiceLineAdd.push(
|
|
||||||
generateInvoiceLine(
|
|
||||||
jobs_by_pk,
|
|
||||||
alloc,
|
|
||||||
bodyshop.md_responsibility_centers
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const foo = {
|
if (isThreeTier) {
|
||||||
QBXML: {
|
QbXmlToExecute.push(generateJobQbxml(jobs_by_pk, bodyshop, 2));
|
||||||
QBXMLMsgsRq: {
|
QbXmlToExecute.push(generateJobQbxml(jobs_by_pk, bodyshop, 3));
|
||||||
"@onError": "stopOnError",
|
}
|
||||||
InvoiceAddRq: {
|
|
||||||
InvoiceAdd: {
|
|
||||||
CustomerRef: {
|
|
||||||
ListID: jobs_by_pk.owner.accountingid,
|
|
||||||
FullName: `${jobs_by_pk.ownr_ln}, ${jobs_by_pk.ownr_fn}`,
|
|
||||||
},
|
|
||||||
TxnDate: new Date(),
|
|
||||||
RefNumber: jobs_by_pk.ro_number,
|
|
||||||
BillAddress: {
|
|
||||||
Addr1: jobs_by_pk.ownr_addr1,
|
|
||||||
Addr2: jobs_by_pk.ownr_addr2,
|
|
||||||
City: jobs_by_pk.ownr_city,
|
|
||||||
State: jobs_by_pk.ownr_st,
|
|
||||||
PostalCode: jobs_by_pk.ownrzip,
|
|
||||||
},
|
|
||||||
// PONumber: "Ponumber",
|
|
||||||
|
|
||||||
InvoiceLineAdd: InvoiceLineAdd,
|
console.log(QbXmlToExecute);
|
||||||
},
|
res.status(200).json(QbXmlToExecute);
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
var requestXML = builder
|
|
||||||
.create(foo, { version: "1.30", encoding: "UTF-8", headless: true })
|
|
||||||
.end({ pretty: true });
|
|
||||||
|
|
||||||
const ret = `<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<?qbxml version="13.0"?>
|
|
||||||
${requestXML}
|
|
||||||
`;
|
|
||||||
|
|
||||||
console.log(ret);
|
|
||||||
res.status(200).send(ret);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("error", error);
|
console.log("error", error);
|
||||||
res.status(400).send(JSON.stringify(error));
|
res.status(400).send(JSON.stringify(error));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const generateCustomerQbxml = (jobs_by_pk, bodyshop, isThreeTier) => {
|
||||||
|
const customerQbxmlObj = {
|
||||||
|
QBXML: {
|
||||||
|
QBXMLMsgsRq: {
|
||||||
|
"@onError": "continueOnError",
|
||||||
|
CustomerAddRq: {
|
||||||
|
CustomerAdd: {
|
||||||
|
Name: isThreeTier
|
||||||
|
? jobs_by_pk.ins_co_nm
|
||||||
|
: jobs_by_pk.ownr_co_nm
|
||||||
|
? `${jobs_by_pk.ownr_co_nm} - ${jobs_by_pk.ownr_ln || ""} ${
|
||||||
|
jobs_by_pk.ownr_fn || ""
|
||||||
|
} #${jobs_by_pk.owner.accountingid || ""}`
|
||||||
|
: `${jobs_by_pk.ownr_ln || ""} ${jobs_by_pk.ownr_fn || ""} #${
|
||||||
|
jobs_by_pk.owner.accountingid || ""
|
||||||
|
}`,
|
||||||
|
BillAddress: isThreeTier
|
||||||
|
? null
|
||||||
|
: {
|
||||||
|
Addr1: jobs_by_pk.ownr_addr1,
|
||||||
|
Addr2: jobs_by_pk.ownr_addr2,
|
||||||
|
City: jobs_by_pk.ownr_city,
|
||||||
|
State: jobs_by_pk.ownr_st,
|
||||||
|
PostalCode: jobs_by_pk.ownrzip,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
var customerQbxml_partial = builder
|
||||||
|
.create(customerQbxmlObj, {
|
||||||
|
version: "1.30",
|
||||||
|
encoding: "UTF-8",
|
||||||
|
headless: true,
|
||||||
|
})
|
||||||
|
.end({ pretty: true });
|
||||||
|
|
||||||
|
const customerQbxml_Full = addQbxmlHeader(customerQbxml_partial);
|
||||||
|
|
||||||
|
return customerQbxml_Full;
|
||||||
|
};
|
||||||
|
|
||||||
|
const generateJobQbxml = (jobs_by_pk, bodyshop, isThreeTier, tierLevel) => {
|
||||||
|
const tier1Name = jobs_by_pk.ownr_co_nm;
|
||||||
|
const tier2Name = jobs_by_pk.ownr_co_nm
|
||||||
|
? `${jobs_by_pk.ownr_co_nm} - ${jobs_by_pk.ownr_ln || ""} ${
|
||||||
|
jobs_by_pk.ownr_fn || ""
|
||||||
|
} #${jobs_by_pk.owner.accountingid || ""}`
|
||||||
|
: `${jobs_by_pk.ownr_ln || ""} ${jobs_by_pk.ownr_fn || ""} #${
|
||||||
|
jobs_by_pk.owner.accountingid || ""
|
||||||
|
}`;
|
||||||
|
|
||||||
|
const jobQbxmlObj = {
|
||||||
|
QBXML: {
|
||||||
|
QBXMLMsgsRq: {
|
||||||
|
"@onError": "continueOnError",
|
||||||
|
CustomerAddRq: {
|
||||||
|
CustomerAdd: {
|
||||||
|
Name: tierLevel === 2 ? null : null,
|
||||||
|
ParentRef: {
|
||||||
|
FullName: tierLevel === 2 ? null : null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
var jobQbxml_partial = builder
|
||||||
|
.create(jobQbxmlObj, {
|
||||||
|
version: "1.30",
|
||||||
|
encoding: "UTF-8",
|
||||||
|
headless: true,
|
||||||
|
})
|
||||||
|
.end({ pretty: true });
|
||||||
|
|
||||||
|
const jobQbxml_Full = addQbxmlHeader(jobQbxml_partial);
|
||||||
|
return jobQbxml_Full;
|
||||||
|
};
|
||||||
|
|
||||||
|
const generateInvoiceQbxml = (jobs_by_pk, bodyshop) => {
|
||||||
|
//Build the Invoice XML file.
|
||||||
|
const InvoiceLineAdd = [];
|
||||||
|
const invoice_allocation = jobs_by_pk.invoice_allocation;
|
||||||
|
Object.keys(invoice_allocation.partsAllocations).forEach(
|
||||||
|
(partsAllocationKey) => {
|
||||||
|
if (
|
||||||
|
!!!invoice_allocation.partsAllocations[partsAllocationKey].allocations
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
invoice_allocation.partsAllocations[
|
||||||
|
partsAllocationKey
|
||||||
|
].allocations.forEach((alloc) => {
|
||||||
|
InvoiceLineAdd.push(
|
||||||
|
generateInvoiceLine(
|
||||||
|
jobs_by_pk,
|
||||||
|
alloc,
|
||||||
|
bodyshop.md_responsibility_centers
|
||||||
|
)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
Object.keys(invoice_allocation.labMatAllocations).forEach((AllocationKey) => {
|
||||||
|
if (!!!invoice_allocation.labMatAllocations[AllocationKey].allocations)
|
||||||
|
return;
|
||||||
|
invoice_allocation.labMatAllocations[AllocationKey].allocations.forEach(
|
||||||
|
(alloc) => {
|
||||||
|
InvoiceLineAdd.push(
|
||||||
|
generateInvoiceLine(
|
||||||
|
jobs_by_pk,
|
||||||
|
alloc,
|
||||||
|
bodyshop.md_responsibility_centers
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const invoiceQbxmlObj = {
|
||||||
|
QBXML: {
|
||||||
|
QBXMLMsgsRq: {
|
||||||
|
"@onError": "stopOnError",
|
||||||
|
InvoiceAddRq: {
|
||||||
|
InvoiceAdd: {
|
||||||
|
CustomerRef: {
|
||||||
|
//This can equal the Customer or the Customer Job.
|
||||||
|
FullName:
|
||||||
|
bodyshop.accountingconfig.tiers === 3
|
||||||
|
? "3tier"
|
||||||
|
: bodyshop.accountingconfig.twotierpref === "name"
|
||||||
|
? "2tiername"
|
||||||
|
: "2tiersource",
|
||||||
|
},
|
||||||
|
TxnDate: new Date(),
|
||||||
|
RefNumber: jobs_by_pk.ro_number,
|
||||||
|
BillAddress: {
|
||||||
|
Addr1: jobs_by_pk.ownr_addr1,
|
||||||
|
Addr2: jobs_by_pk.ownr_addr2,
|
||||||
|
City: jobs_by_pk.ownr_city,
|
||||||
|
State: jobs_by_pk.ownr_st,
|
||||||
|
PostalCode: jobs_by_pk.ownrzip,
|
||||||
|
},
|
||||||
|
PONumber: jobs_by_pk.clm_no,
|
||||||
|
InvoiceLineAdd: InvoiceLineAdd,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
var invoiceQbxml_partial = builder
|
||||||
|
.create(invoiceQbxmlObj, {
|
||||||
|
version: "1.30",
|
||||||
|
encoding: "UTF-8",
|
||||||
|
headless: true,
|
||||||
|
})
|
||||||
|
.end({ pretty: true });
|
||||||
|
|
||||||
|
const invoiceQbxml_Full = addQbxmlHeader(invoiceQbxml_partial);
|
||||||
|
|
||||||
|
return invoiceQbxml_Full;
|
||||||
|
};
|
||||||
|
|
||||||
const generateInvoiceLine = (job, allocation, responsibilityCenters) => {
|
const generateInvoiceLine = (job, allocation, responsibilityCenters) => {
|
||||||
const { amount, center } = allocation;
|
const { amount, center } = allocation;
|
||||||
const DineroAmount = Dinero(amount);
|
const DineroAmount = Dinero(amount);
|
||||||
@@ -140,3 +238,10 @@ const generateInvoiceLine = (job, allocation, responsibilityCenters) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const addQbxmlHeader = (xml) => {
|
||||||
|
return `<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<?qbxml version="13.0"?>
|
||||||
|
${xml}
|
||||||
|
`;
|
||||||
|
};
|
||||||
|
|||||||
@@ -57,12 +57,14 @@ query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($id: uuid!) {
|
|||||||
ownr_zip
|
ownr_zip
|
||||||
ownr_city
|
ownr_city
|
||||||
ownr_st
|
ownr_st
|
||||||
|
ins_co_nm
|
||||||
owner{
|
owner{
|
||||||
accountingid
|
accountingid
|
||||||
}
|
}
|
||||||
bodyshop {
|
bodyshop {
|
||||||
id
|
id
|
||||||
md_responsibility_centers
|
md_responsibility_centers
|
||||||
|
accountingconfig
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user