Merged in release/2021-12-03 (pull request #282)

release/2021-12-03

Approved-by: Patrick Fic
This commit is contained in:
Patrick Fic
2021-12-01 21:38:21 +00:00
15 changed files with 968 additions and 756 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
<babeledit_project version="1.2" be_version="2.7.1"> <babeledit_project be_version="2.7.1" version="1.2">
<!-- <!--
BabelEdit project file BabelEdit project file
@@ -7994,6 +7994,27 @@
<folder_node> <folder_node>
<name>cdk</name> <name>cdk</name>
<children> <children>
<concept_node>
<name>controllist</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>payers</name> <name>payers</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -8038,6 +8059,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>pbs_serialnumber</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>title</name> <name>title</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>

View File

@@ -34,7 +34,7 @@ export const tracker = new Tracker({
// trackerAssist({ confirmText: "Technical support is about to assist you." }) // trackerAssist({ confirmText: "Technical support is about to assist you." })
// ); // check the list of available options below // ); // check the list of available options below
export const recordGraphQL = tracker.use(trackerGraphQL()); export const recordGraphQL = tracker.use(trackerGraphQL());
tracker.start(); //tracker.start();
if (process.env.NODE_ENV === "production") LogRocket.init("gvfvfw/bodyshopapp"); if (process.env.NODE_ENV === "production") LogRocket.init("gvfvfw/bodyshopapp");
export const factory = SplitSdk({ export const factory = SplitSdk({

View File

@@ -34,10 +34,7 @@ export function DmsCustomerSelector({ bodyshop }) {
setVisible(true); setVisible(true);
setDmsType("pbs"); setDmsType("pbs");
setcustomerList(customerList); setcustomerList(customerList);
console.log(
"🚀 ~ file: dms-customer-selector.component.jsx ~ line 37 ~ socket.on ~ customerList",
customerList
);
}); });
const onUseSelected = () => { const onUseSelected = () => {
@@ -49,7 +46,7 @@ export function DmsCustomerSelector({ bodyshop }) {
const onUseGeneric = () => { const onUseGeneric = () => {
setVisible(false); setVisible(false);
socket.emit( socket.emit(
"cdk-selected-customer", `${dmsType}selected-customer`,
bodyshop.cdk_configuration.generic_customer_number bodyshop.cdk_configuration.generic_customer_number
); );
setSelectedCustomer(null); setSelectedCustomer(null);
@@ -57,7 +54,7 @@ export function DmsCustomerSelector({ bodyshop }) {
const onCreateNew = () => { const onCreateNew = () => {
setVisible(false); setVisible(false);
socket.emit("cdk-selected-customer", null); socket.emit(`${dmsType}-selected-customer`, null);
setSelectedCustomer(null); setSelectedCustomer(null);
}; };
@@ -102,12 +99,6 @@ export function DmsCustomerSelector({ bodyshop }) {
dataIndex: "ContactId", dataIndex: "ContactId",
key: "ContactId", key: "ContactId",
}, },
{
title: t("jobs.fields.dms.vinowner"),
dataIndex: "vinOwner",
key: "vinOwner",
render: (text, record) => <Checkbox disabled checked={record.vinOwner} />,
},
{ {
title: t("jobs.fields.dms.name1"), title: t("jobs.fields.dms.name1"),
key: "name1", key: "name1",
@@ -127,6 +118,7 @@ export function DmsCustomerSelector({ bodyshop }) {
if (!visible) return null; if (!visible) return null;
return ( return (
<Col span={24}> <Col span={24}>
{dmsType}
<Table <Table
title={() => ( title={() => (
<div> <div>

View File

@@ -1,14 +1,16 @@
import { DeleteFilled } from "@ant-design/icons"; import { DeleteFilled, DownOutlined } from "@ant-design/icons";
import { import {
Button, Button,
Card, Card,
Divider, Divider,
Dropdown,
Form, Form,
Input, Input,
InputNumber, InputNumber,
Select, Select,
Space, Space,
Statistic, Statistic,
Menu,
Typography, Typography,
} from "antd"; } from "antd";
import Dinero from "dinero.js"; import Dinero from "dinero.js";
@@ -252,6 +254,42 @@ export function DmsPostForm({ bodyshop, socket, job }) {
}} }}
</Form.Item> </Form.Item>
<Dropdown
overlay={
<Menu>
{bodyshop.cdk_configuration.controllist &&
bodyshop.cdk_configuration.controllist.map(
(key, idx) => (
<Menu.Item
key={idx}
onClick={() => {
form.setFieldsValue({
payers: form
.getFieldValue("payers")
.map((row, mapIndex) => {
if (index !== mapIndex) return row;
return {
...row,
controlnumber: key.controlnumber,
};
}),
});
}}
>
{key.name}
</Menu.Item>
)
)}
</Menu>
}
>
<a href=" #" onClick={(e) => e.preventDefault()}>
{t("bodyshop.labels.dms.cdk.controllist")}{" "}
<DownOutlined />
</a>
</Dropdown>
<DeleteFilled <DeleteFilled
onClick={() => { onClick={() => {
remove(field.name); remove(field.name);

View File

@@ -100,7 +100,7 @@ export function JobsAvailableContainer({
} }
//IO-539 Check for Parts Rate on PAL for SGI use case. //IO-539 Check for Parts Rate on PAL for SGI use case.
await CheckTaxRates(estData.est_data, bodyshop); await CheckTaxRates(estData.est_data, bodyshop);
console.log(estData);
const newTotals = ( const newTotals = (
await Axios.post("/job/totals", { await Axios.post("/job/totals", {
job: { job: {

View File

@@ -472,7 +472,7 @@ export default function ShopInfoGeneral({ form }) {
label={t("bodyshop.fields.md_email_cc", { template: "parts_order" })} label={t("bodyshop.fields.md_email_cc", { template: "parts_order" })}
rules={[ rules={[
{ {
required: true,
//message: t("general.validation.required"), //message: t("general.validation.required"),
type: "array", type: "array",
}, },
@@ -492,7 +492,7 @@ export default function ShopInfoGeneral({ form }) {
label={t("bodyshop.fields.md_ded_notes")} label={t("bodyshop.fields.md_ded_notes")}
rules={[ rules={[
{ {
required: true,
//message: t("general.validation.required"), //message: t("general.validation.required"),
type: "array", type: "array",
}, },

View File

@@ -73,7 +73,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
return ( return (
<div> <div>
{bodyshop.cdk_dealerid && ( {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber)&& (
<> <>
<DataLabel label={t("bodyshop.labels.dms.cdk_dealerid")}> <DataLabel label={t("bodyshop.labels.dms.cdk_dealerid")}>
{form.getFieldValue("cdk_dealerid")} {form.getFieldValue("cdk_dealerid")}
@@ -201,6 +201,63 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
}} }}
</Form.List> </Form.List>
</LayoutFormRow> </LayoutFormRow>
<LayoutFormRow header={t("bodyshop.labels.dms.cdk.controllist")}>
<Form.List name={["cdk_configuration", "controllist"]}>
{(fields, { add, remove }) => {
return (
<div>
{fields.map((field, index) => (
<Form.Item key={field.key}>
<LayoutFormRow noDivider>
<Form.Item
label={t("jobs.fields.dms.payer.name")}
key={`${index}name`}
name={[field.name, "name"]}
rules={[
{
required: true,
},
]}
>
<Input />
</Form.Item>
<Form.Item
label={t("jobs.fields.dms.payer.controlnumber")}
key={`${index}controlnumber`}
name={[field.name, "controlnumber"]}
rules={[
{
required: true,
},
]}
>
<Input />
</Form.Item>
<DeleteFilled
onClick={() => {
remove(field.name);
}}
/>
</LayoutFormRow>
</Form.Item>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => {
add();
}}
style={{ width: "100%" }}
>
{t("general.actions.add")}
</Button>
</Form.Item>
</div>
);
}}
</Form.List>
</LayoutFormRow>
</> </>
)} )}
@@ -293,7 +350,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
<Input onBlur={handleBlur} /> <Input onBlur={handleBlur} />
</Form.Item> */} </Form.Item> */}
{bodyshop.cdk_dealerid && ( {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
<Form.Item <Form.Item
label={t("bodyshop.fields.dms.dms_acctnumber")} label={t("bodyshop.fields.dms.dms_acctnumber")}
key={`${index}dms_acctnumber`} key={`${index}dms_acctnumber`}
@@ -307,7 +364,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
<Input onBlur={handleBlur} /> <Input onBlur={handleBlur} />
</Form.Item> </Form.Item>
)} )}
{bodyshop.cdk_dealerid && ( {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
<Form.Item <Form.Item
label={t("bodyshop.fields.dms.dms_wip_acctnumber")} label={t("bodyshop.fields.dms.dms_wip_acctnumber")}
key={`${index}dms_wip_acctnumber`} key={`${index}dms_wip_acctnumber`}
@@ -430,7 +487,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
> >
<Input onBlur={handleBlur} /> <Input onBlur={handleBlur} />
</Form.Item> </Form.Item>
{bodyshop.cdk_dealerid && ( {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
<Form.Item <Form.Item
label={t("bodyshop.fields.dms.dms_acctnumber")} label={t("bodyshop.fields.dms.dms_acctnumber")}
key={`${index}dms_acctnumber`} key={`${index}dms_acctnumber`}
@@ -470,7 +527,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
</LayoutFormRow> </LayoutFormRow>
<SelectorDiv> <SelectorDiv>
{bodyshop.cdk_dealerid && ( {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
<> <>
<Form.List name={["md_responsibility_centers", "dms_defaults"]}> <Form.List name={["md_responsibility_centers", "dms_defaults"]}>
{(fields, { add, remove }) => { {(fields, { add, remove }) => {
@@ -3921,7 +3978,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
> >
<Input /> <Input />
</Form.Item> </Form.Item>
{bodyshop.cdk_dealerid && ( {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
<Form.Item <Form.Item
label={t("bodyshop.fields.dms.dms_acctnumber")} label={t("bodyshop.fields.dms.dms_acctnumber")}
rules={[ rules={[
@@ -4019,7 +4076,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
> >
<Input /> <Input />
</Form.Item> </Form.Item>
{bodyshop.cdk_dealerid && ( {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
<Form.Item <Form.Item
label={t("bodyshop.fields.dms.dms_acctnumber")} label={t("bodyshop.fields.dms.dms_acctnumber")}
rules={[ rules={[
@@ -4117,7 +4174,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
> >
<Input /> <Input />
</Form.Item> </Form.Item>
{bodyshop.cdk_dealerid && ( {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
<Form.Item <Form.Item
label={t("bodyshop.fields.dms.dms_acctnumber")} label={t("bodyshop.fields.dms.dms_acctnumber")}
rules={[ rules={[

View File

@@ -496,9 +496,11 @@
"deliverchecklist": "Delivery Checklist", "deliverchecklist": "Delivery Checklist",
"dms": { "dms": {
"cdk": { "cdk": {
"controllist": "Control Number List",
"payers": "CDK Payers" "payers": "CDK Payers"
}, },
"cdk_dealerid": "CDK Dealer ID", "cdk_dealerid": "CDK Dealer ID",
"pbs_serialnumber": "PBS Serial Number",
"title": "DMS" "title": "DMS"
}, },
"emaillater": "Email Later", "emaillater": "Email Later",

View File

@@ -496,9 +496,11 @@
"deliverchecklist": "", "deliverchecklist": "",
"dms": { "dms": {
"cdk": { "cdk": {
"controllist": "",
"payers": "" "payers": ""
}, },
"cdk_dealerid": "", "cdk_dealerid": "",
"pbs_serialnumber": "",
"title": "" "title": ""
}, },
"emaillater": "", "emaillater": "",

View File

@@ -496,9 +496,11 @@
"deliverchecklist": "", "deliverchecklist": "",
"dms": { "dms": {
"cdk": { "cdk": {
"controllist": "",
"payers": "" "payers": ""
}, },
"cdk_dealerid": "", "cdk_dealerid": "",
"pbs_serialnumber": "",
"title": "" "title": ""
}, },
"emaillater": "", "emaillater": "",

View File

@@ -85,7 +85,7 @@ exports.PbsSelectedCustomer = async function PbsSelectedCustomer(
CdkBase.createLogEvent(socket, "DEBUG", `Inserting account data.`); CdkBase.createLogEvent(socket, "DEBUG", `Inserting account data.`);
await InsertAccountPostingData(socket); await InsertAccountPostingData(socket);
CdkBase.createLogEvent(socket, "DEBUG", `Marking job as exported.`); CdkBase.createLogEvent(socket, "DEBUG", `Marking job as exported.`);
// await MarkJobExported(socket, socket.JobData.id); await MarkJobExported(socket, socket.JobData.id);
socket.emit("export-success", socket.JobData.id); socket.emit("export-success", socket.JobData.id);
} catch (error) { } catch (error) {

View File

@@ -192,7 +192,7 @@ exports.default = async function (socket, jobid) {
// ); // );
taxAllocations.state.sale = taxAllocations.state.sale.add( taxAllocations.state.sale = taxAllocations.state.sale.add(
Dinero({ amount: (ca_bc_pvrt || 0) * 100 }) Dinero({ amount: Math.round((ca_bc_pvrt || 0) * 100) })
); );
} }

View File

@@ -2,7 +2,7 @@ const path = require("path");
const queries = require("../graphql-client/queries"); const queries = require("../graphql-client/queries");
const Dinero = require("dinero.js"); const Dinero = require("dinero.js");
const moment = require("moment"); const moment = require("moment");
var builder = require("xmlbuilder2");
const _ = require("lodash"); const _ = require("lodash");
const logger = require("../utils/logger"); const logger = require("../utils/logger");
require("dotenv").config({ require("dotenv").config({
@@ -11,9 +11,18 @@ require("dotenv").config({
`.env.${process.env.NODE_ENV || "development"}` `.env.${process.env.NODE_ENV || "development"}`
), ),
}); });
const soap = require("soap");
const entegralEndpoint =
process.env.NODE_ENV === "production"
? "https://ws.entegral.com/RepairOrderFolderService/RepairOrderFolderService.asmx?op=RepairOrderFolderAddRq"
: "https://uat-ws.armsbusinesssolutions.net/RepairOrderFolderService/RepairOrderFolderService.asmx?WSDL";
const client = require("../graphql-client/graphql-client").client; const client = require("../graphql-client/graphql-client").client;
const uuid = require("uuid").v4; const uuid = require("uuid").v4;
const momentFormat = "yyyy-MM-DDTHH:mm:ss.SSSSSSSZ";
exports.default = async (req, res) => { exports.default = async (req, res) => {
//Query for the List of Bodyshop Clients. //Query for the List of Bodyshop Clients.
logger.log("arms-start", "DEBUG", "api", null, null); logger.log("arms-start", "DEBUG", "api", null, null);
@@ -33,8 +42,8 @@ exports.default = async (req, res) => {
}); });
const ret = jobs.map((job) => { const ret = jobs.map((job) => {
const transId = uuid(); // Can this actually be the job id? const transId = uuid(); // Can this actually be the job id?
return { return {
RepairOrderFolderAddRq: {
RqUID: transId, RqUID: transId,
DocumentInfo: { DocumentInfo: {
BMSVer: "4.0.0", BMSVer: "4.0.0",
@@ -42,31 +51,33 @@ exports.default = async (req, res) => {
DocumentVerCode: "EM", DocumentVerCode: "EM",
DocumentVerNum: GetSupplementNumber(job.joblines), //TODO Get Supplement Number DocumentVerNum: GetSupplementNumber(job.joblines), //TODO Get Supplement Number
DocumentStatus: GetDocumentstatus(job, bodyshop), DocumentStatus: GetDocumentstatus(job, bodyshop),
CreateDateTime: moment().format(), CreateDateTime: moment().format(momentFormat),
// TransmitDateTime: "2009-03-11T11:58:31.0404914-07:00", Omitted from ARMS docs TransmitDateTime: moment().format(momentFormat), // Omitted from ARMS docs
}, },
EventInfo: { EventInfo: {
AssignmentEvent: { AssignmentEvent: {
CreateDateTime: CreateDateTime:
job.asgn_date && moment(job.asgn_date).format(), job.asgn_date && moment(job.asgn_date).format(momentFormat),
}, },
EstimateEvent: { EstimateEvent: {
UploadDateTime: "2009-03-02T17:00:00.0000000-08:00", //TODO Figure out what this actually is. 'Date Estimate was uploaded' UploadDateTime: moment().format(momentFormat),
}, },
RepairEvent: { RepairEvent: {
ArrivalDateTime: ArrivalDateTime:
job.date_open && moment(job.date_open).format(), job.date_open && moment(job.date_open).format(momentFormat),
ArrivalOdometerReading: job.kmin, ArrivalOdometerReading: job.kmin,
TargetCompletionDateTime: TargetCompletionDateTime:
job.scheduled_completion && job.scheduled_completion &&
moment(job.scheduled_completion).format(), moment(job.scheduled_completion).format(momentFormat),
ActualCompletionDateTime: ActualCompletionDateTime:
job.actual_completion && job.actual_completion &&
moment(job.actual_completion).format(), moment(job.actual_completion).format(momentFormat),
ActualPickUpDateTime: ActualPickUpDateTime:
job.actual_delivery && moment(job.actual_delivery).format(), job.actual_delivery &&
moment(job.actual_delivery).format(momentFormat),
CloseDateTime: CloseDateTime:
job.date_exported && moment(job.date_exported).format(), job.date_exported &&
moment(job.date_exported).format(momentFormat),
}, },
}, },
RepairOrderHeader: { RepairOrderHeader: {
@@ -263,13 +274,14 @@ exports.default = async (req, res) => {
LossInfo: { LossInfo: {
Facts: { Facts: {
LossDateTime: LossDateTime:
job.loss_date && moment(job.loss_date).format(), job.loss_date &&
moment(job.loss_date).format(momentFormat),
LossDescCode: "Collision", LossDescCode: "Collision",
PrimaryPOI: { PrimaryPOI: {
POICode: job.area_of_damage.impact1, POICode: job.area_of_damage && job.area_of_damage.impact1,
}, },
SecondaryPOI: { SecondaryPOI: {
POICode: job.area_of_damage.impact2, POICode: job.area_of_damage && job.area_of_damage.impact2,
}, },
}, },
TotalLossInd: job.tlos_ind, TotalLossInd: job.tlos_ind,
@@ -443,7 +455,7 @@ exports.default = async (req, res) => {
TotalTypeDesc: "Body Labor", TotalTypeDesc: "Body Labor",
TotalHours: job.job_totals.rates.lab.hours, TotalHours: job.job_totals.rates.lab.hours,
TotalAmt: Dinero(job.job_totals.rates.lab.total).toFormat( TotalAmt: Dinero(job.job_totals.rates.lab.total).toFormat(
0.0 "0.0"
), ),
}, },
{ {
@@ -451,7 +463,7 @@ exports.default = async (req, res) => {
TotalTypeDesc: "Frame Labor", TotalTypeDesc: "Frame Labor",
TotalHours: job.job_totals.rates.laf.hours, TotalHours: job.job_totals.rates.laf.hours,
TotalAmt: Dinero(job.job_totals.rates.laf.total).toFormat( TotalAmt: Dinero(job.job_totals.rates.laf.total).toFormat(
0.0 "0.0"
), ),
}, },
{ {
@@ -459,7 +471,7 @@ exports.default = async (req, res) => {
TotalTypeDesc: "Mechanical Labor", TotalTypeDesc: "Mechanical Labor",
TotalHours: job.job_totals.rates.lam.hours, TotalHours: job.job_totals.rates.lam.hours,
TotalAmt: Dinero(job.job_totals.rates.lam.total).toFormat( TotalAmt: Dinero(job.job_totals.rates.lam.total).toFormat(
0.0 "0.0"
), ),
}, },
{ {
@@ -467,7 +479,7 @@ exports.default = async (req, res) => {
TotalTypeDesc: "Refinish Labor", TotalTypeDesc: "Refinish Labor",
TotalHours: job.job_totals.rates.lar.hours, TotalHours: job.job_totals.rates.lar.hours,
TotalAmt: Dinero(job.job_totals.rates.lar.total).toFormat( TotalAmt: Dinero(job.job_totals.rates.lar.total).toFormat(
0.0 "0.0"
), ),
}, },
], ],
@@ -533,22 +545,22 @@ exports.default = async (req, res) => {
{ {
TotalType: "OTSL", TotalType: "OTSL",
TotalTypeDesc: "Sublet", TotalTypeDesc: "Sublet",
TotalAmt: Dinero( TotalAmt: Dinero(job.job_totals.parts.sublets.total).toFormat(
job.job_totals.parts.sublets.total "0.0"
).toFormat("0.0"), ),
}, },
{ {
TotalType: "MAPA", TotalType: "MAPA",
TotalTypeDesc: "Paint Materials", TotalTypeDesc: "Paint Materials",
TotalAmt: Dinero(job.job_totals.rates.mapa.total).toFormat( TotalAmt: Dinero(job.job_totals.rates.mapa.total).toFormat(
0.0 "0.0"
), ),
}, },
{ {
TotalType: "MASH", TotalType: "MASH",
TotalTypeDesc: "Shop Materials", TotalTypeDesc: "Shop Materials",
TotalAmt: Dinero(job.job_totals.rates.mash.total).toFormat( TotalAmt: Dinero(job.job_totals.rates.mash.total).toFormat(
0.0 "0.0"
), ),
}, },
// { // {
@@ -561,15 +573,15 @@ exports.default = async (req, res) => {
{ {
TotalType: "OTST", TotalType: "OTST",
TotalTypeDesc: "Storage", TotalTypeDesc: "Storage",
TotalAmt: Dinero( TotalAmt: Dinero(job.job_totals.additional.storage).toFormat(
job.job_totals.additional.storage "0.0"
).toFormat("0.0"), ),
}, },
{ {
TotalType: "OTTW", TotalType: "OTTW",
TotalTypeDesc: "Towing", TotalTypeDesc: "Towing",
TotalAmt: Dinero(job.job_totals.additional.towing).toFormat( TotalAmt: Dinero(job.job_totals.additional.towing).toFormat(
0.0 "0.0"
), ),
}, },
{ {
@@ -586,7 +598,7 @@ exports.default = async (req, res) => {
TotalSubType: "T2", TotalSubType: "T2",
TotalTypeDesc: "Net Total", TotalTypeDesc: "Net Total",
TotalAmt: Dinero(job.job_totals.totals.subtotal).toFormat( TotalAmt: Dinero(job.job_totals.totals.subtotal).toFormat(
0.0 "0.0"
), ),
}, },
{ {
@@ -594,16 +606,16 @@ exports.default = async (req, res) => {
TotalSubType: "F7", TotalSubType: "F7",
TotalTypeDesc: "Sales Tax", TotalTypeDesc: "Sales Tax",
TotalAmt: Dinero(job.job_totals.totals.state_tax).toFormat( TotalAmt: Dinero(job.job_totals.totals.state_tax).toFormat(
0.0 "0.0"
), ),
}, },
{ {
TotalType: "TOT", TotalType: "TOT",
TotalSubType: "GST", TotalSubType: "GST",
TotalTypeDesc: "GST Tax", TotalTypeDesc: "GST Tax",
TotalAmt: Dinero( TotalAmt: Dinero(job.job_totals.totals.federal_tax).toFormat(
job.job_totals.totals.federal_tax "0.0"
).toFormat("0.0"), ),
}, },
{ {
TotalType: "TOT", TotalType: "TOT",
@@ -722,15 +734,15 @@ exports.default = async (req, res) => {
// }, // },
ProductionStatus: { ProductionStatus: {
ProductionStage: { ProductionStage: {
ProductionStageCode: 4, ProductionStageCode: GetProductionStageCode(job),
ProductionStageDateTime: "2009-03-11T11:58:32.1898319-07:00", ProductionStageDateTime: moment().format(momentFormat),
ProductionStageStatusComment: // ProductionStageStatusComment:
"Going to be painted this afternoon", // "Going to be painted this afternoon",
}, },
RepairStatus: { RepairStatus: {
RepairStatusCode: 2, RepairStatusCode: GetRepairStatusCode(job),
RepairStatusDateTime: "2009-03-11T11:58:32.1898319-07:00", RepairStatusDateTime: moment().format(momentFormat),
RepairStatusMemo: "Waiting on back ordered parts", // RepairStatusMemo: "Waiting on back ordered parts",
}, },
}, },
// RepairOrderNotes: { // RepairOrderNotes: {
@@ -757,7 +769,6 @@ exports.default = async (req, res) => {
// }, // },
// }, // },
// }, // },
},
}; };
}); });
@@ -771,7 +782,42 @@ exports.default = async (req, res) => {
logger.log("arms-end-shop-extract", "DEBUG", "api", bodyshop.id, { logger.log("arms-end-shop-extract", "DEBUG", "api", bodyshop.id, {
shopname: bodyshop.shopname, shopname: bodyshop.shopname,
}); });
res.json(ret); const abc = ret[1];
deleteNullKeys(abc);
try {
const entegralSoapClient = await soap.createClientAsync(
entegralEndpoint,
{
ignoredNamespaces: true,
wsdl_options: {
useEmptyTag: true,
},
wsdl_headers: {
Authorization: `Basic ${new Buffer.from(
`${process.env.ENTEGRAL_USER}:${process.env.ENTEGRAL_PASSWORD}`
).toString("base64")}`,
},
}
);
entegralSoapClient.setSecurity(
new soap.BasicAuthSecurity(
process.env.ENTEGRAL_USER,
process.env.ENTEGRAL_PASSWORD
)
);
const entegralResponse =
await entegralSoapClient.RepairOrderFolderAddRqAsync(abc);
const [result, rawResponse, , rawRequest] = entegralResponse;
console.log("🚀 ~ file: arms.js ~ line 806 ~ result", result);
res.json(result);
} catch (error) {
console.log(error);
res.json(error);
}
} catch (error) { } catch (error) {
//Error at the shop level. //Error at the shop level.
logger.log("arms-error-shop", "ERROR", "api", bodyshop.id, { logger.log("arms-error-shop", "ERROR", "api", bodyshop.id, {
@@ -793,13 +839,14 @@ exports.default = async (req, res) => {
} }
} }
res.sendStatus(200); // res.sendStatus(200);
} catch (error) { } catch (error) {
res.status(200).json(error); res.status(200).json(error);
} }
}; };
function GetSupplementNumber(joblines) { function GetSupplementNumber(joblines) {
return 0;
return _.max(joblines.map((jl) => jl.line_ind)); return _.max(joblines.map((jl) => jl.line_ind));
} }
@@ -809,9 +856,37 @@ function GetDocumentstatus(job, bodyshop) {
return "V"; return "V";
case bodyshop.md_ro_statuses.default_invoiced: case bodyshop.md_ro_statuses.default_invoiced:
case bodyshop.md_ro_statuses.default_exported: case bodyshop.md_ro_statuses.default_exported:
return "V"; return "Z";
default: default:
return "0"; return "O";
}
}
function GetRepairStatusCode(job) {
return "25";
}
function GetProductionStageCode(job) {
return "33";
}
function isEmpty(obj) {
for (var key in obj) return false;
return true;
}
function deleteNullKeys(app) {
for (var key in app) {
if (app[key] !== null && typeof app[key] === "object") {
deleteNullKeys(app[key]);
if (isEmpty(app[key])) {
delete app[key];
}
}
if (app[key] === null) {
delete app[key];
}
} }
} }

View File

@@ -1254,6 +1254,7 @@ exports.GET_CDK_ALLOCATIONS = `query QUERY_JOB_CLOSE_DETAILS($id: uuid!) {
actual_delivery actual_delivery
scheduled_in scheduled_in
actual_in actual_in
ca_bc_pvrt
timetickets { timetickets {
id id
actualhrs actualhrs