diff --git a/_reference/OEC/Audatex.xsl b/_reference/OEC/Audatex.xsl new file mode 100644 index 000000000..5a5d61e78 --- /dev/null +++ b/_reference/OEC/Audatex.xsl @@ -0,0 +1,586 @@ + + + + + + + + + + + + + + + OECTrans.ImportTrans + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CHEV + CHEV + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 0 + + + + + + + Audatex.xml + Audatex.xsl + + + + + + + + + + + + + + + + + -- + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + + + + + + + : + + + + + + + + : + + + + + + + + : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Salvage or Assembly + + + + + + + + + + + + + + PAN + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 0 + + + + + 1 + 2 + 3 + 4 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + False + + + + + False + + + + False + False + False + False + False + False + False + False + False + False + False + False + False + False + True + + + + + False + + + False + + + + + + + \ No newline at end of file diff --git a/_reference/OEC/AudatexMapping.xml b/_reference/OEC/AudatexMapping.xml new file mode 100644 index 000000000..0068c7229 --- /dev/null +++ b/_reference/OEC/AudatexMapping.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Audatex.xsl + + diff --git a/_reference/OEC/CCC.xsl b/_reference/OEC/CCC.xsl new file mode 100644 index 000000000..96e58c428 --- /dev/null +++ b/_reference/OEC/CCC.xsl @@ -0,0 +1,607 @@ + + + + + + + + + + + + + + + + OECTrans.ImportTrans + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 0 + + + + + + + CCC.xml + CCC.xsl + + + + + + + + + + + + + + + + + -- + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + + + + + + + : + + + + + + + + : + + + + + + + + : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PAN + + + + + + + + + + + + + + + + + + + + + + Salvage or Assembly + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PAN + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 4 + 0 + + + + + 1 + 2 + 3 + 4 + 4 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 0 + + + + + + + + + + + + + + + + + + False + + + + + + False + + + False + + False + False + False + False + False + False + False + False + False + False + + + False + False + False + False + True + + + + + False + + + False + + + + + + + \ No newline at end of file diff --git a/_reference/OEC/CCCMapping.xml b/_reference/OEC/CCCMapping.xml new file mode 100644 index 000000000..ab4d3b4a1 --- /dev/null +++ b/_reference/OEC/CCCMapping.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ccc.xsl + + diff --git a/_reference/OEC/Mitchell.xsl b/_reference/OEC/Mitchell.xsl new file mode 100644 index 000000000..48fbd5d65 --- /dev/null +++ b/_reference/OEC/Mitchell.xsl @@ -0,0 +1,580 @@ + + + + + + + + + + + + + + + + OECTrans.ImportTrans + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + Mitchell.xml + Mitchell.xsl + + + + + + + + + + + + + + + + + -- + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + + + + + + + : + + + + + + + + : + + + + + + + + : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Salvage or Assembly + + + + + + + + + + + + + + PAN + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 4 + 4 + 0 + + + + + 1 + 2 + 3 + 4 + 4 + 4 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + False + + + + + False + + + False + False + False + False + False + False + False + False + False + False + False + False + False + False + False + True + + + + + False + + + False + + + + + + + \ No newline at end of file diff --git a/_reference/OEC/MitchellMapping.xml b/_reference/OEC/MitchellMapping.xml new file mode 100644 index 000000000..91ba33d17 --- /dev/null +++ b/_reference/OEC/MitchellMapping.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Mitchell.xsl + + diff --git a/_reference/Test_CDK_Acct Config.json b/_reference/Test_CDK_Acct Config.json new file mode 100644 index 000000000..2689c8b78 --- /dev/null +++ b/_reference/Test_CDK_Acct Config.json @@ -0,0 +1 @@ +{"ar":{"accountname":"ACCOUNTS RECEIVABLE"},"costs":[{"name":"Sublet","accountdesc":"C/S SUBLET REPAIRS/BODY SHOP","accountitem":"Aftermarketi","accountname":"C/S SUBLET REPAIRS/BODY SHOP","accountnumber":"Aftermarket","dms_acctnumber":"676","dms_wip_acctnumber":"247B"},{"name":"Shop Materials","accountdesc":"C/S PAINT & BODY SHOP MATERI","accountname":"C/S PAINT & BODY SHOP MATERI","dms_acctnumber":"679","dms_wip_acctnumber":"245"},{"name":"Paint Materials","accountdesc":"C/S PAINT & BODY SHOP MATERI","accountname":"C/S PAINT & BODY SHOP MATERI","dms_acctnumber":"679","dms_wip_acctnumber":"245"},{"name":"Glass","accountdesc":"C/S BS BODY LABOR C&T","accountname":"C/S BS BODY LABOR C&T","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"Aftermarket","accountdesc":"C/S P&A-CUST C&T REPAIRS-B/S","accountname":"C/S P&A-CUST C&T REPAIRS-B/S","dms_acctnumber":"677","dms_wip_acctnumber":"247B"},{"name":"Body","accountdesc":"BS BODY (LAB)","accountname":"BS BODY (LAB)","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"Refinish","accountdesc":"BS BODY (REF)","accountname":"BS BODY (REF)","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"OEM","accountdesc":"OEM","accountname":"OEM","dms_acctnumber":"677","dms_wip_acctnumber":"247B"},{"name":"Mechanical","accountdesc":"BS BODY (LAM)","accountname":"BS BODY (LAM)","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"LA1","accountdesc":"BS BODY (LAM)","accountname":"BS BODY (LAM)","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"LA2","accountdesc":"BS BODY (LAM)","accountname":"BS BODY (LAM)","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"LA3","accountdesc":"BS BODY (LAM)","accountname":"BS BODY (LAM)","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"LA4","accountdesc":"BS BODY (LAM)","accountname":"BS BODY (LAM)","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"Aluminum","accountdesc":"BS BODY (LAA)","accountname":"BS BODY (LAA)","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"Diagnostic","accountdesc":"BS BODY (LAB)","accountname":"BS BODY (LAB)","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"Electrical","accountdesc":"BS BODY (LAB)","accountname":"BS BODY (LAB)","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"Frame","accountdesc":"BS BODY (LAB)","accountname":"BS BODY (LAB)","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"Structural","accountdesc":"BS BODY (LAB)","accountname":"BS BODY (LAB)","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"Detail","accountdesc":"BS BODY (LAB)","accountname":"BS BODY (LAB)","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"ATS","accountdesc":"C/S INTERNAL LABOR-BODY SHOP","accountname":"C/S INTERNAL LABOR-BODY SHOP","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"Towing","accountdesc":"C/S SUBLET REPAIRS/BODY SHOP","accountname":"C/S SUBLET REPAIRS/BODY SHOP","dms_acctnumber":"671","dms_wip_acctnumber":"247B"},{"name":"Sublet (L)","accountdesc":"C/S SUBLET REPAIRS/BODY SHOP","accountname":"C/S SUBLET REPAIRS/BODY SHOP","dms_acctnumber":"676","dms_wip_acctnumber":"247B"},{"name":"Chrome","accountdesc":"C/S P&A-CUST C&T REPAIRS-B/S","accountname":"C/S P&A-CUST C&T REPAIRS-B/S","dms_acctnumber":"677","dms_wip_acctnumber":"247B"},{"name":"LKQ","accountdesc":"C/S P&A-CUST C&T REPAIRS-B/S","accountname":"C/S P&A-CUST C&T REPAIRS-B/S","dms_acctnumber":"677","dms_wip_acctnumber":"247B"},{"name":"Remanufactured","accountdesc":"C/S P&A-CUST C&T REPAIRS-B/S","accountname":"C/S P&A-CUST C&T REPAIRS-B/S","dms_acctnumber":"677","dms_wip_acctnumber":"247B"},{"name":"OEM Partial","accountdesc":"C/S P&A-CUST C&T REPAIRS-B/S","accountname":"C/S P&A-CUST C&T REPAIRS-B/S","dms_acctnumber":"677","dms_wip_acctnumber":"247B"},{"name":"Recored","accountdesc":"C/S P&A-CUST C&T REPAIRS-B/S","accountname":"C/S P&A-CUST C&T REPAIRS-B/S","dms_acctnumber":"677","dms_wip_acctnumber":"247B"},{"name":"Other","accountdesc":"C/S P&A-CUST C&T REPAIRS-B/S","accountname":"C/S P&A-CUST C&T REPAIRS-B/S","dms_acctnumber":"677","dms_wip_acctnumber":"247B"}],"taxes":{"local":{"name":"n","rate":0,"accountdesc":"n","accountitem":"n","dms_acctnumber":"aa"},"state":{"name":"PST PAYABLE","rate":7,"accountdesc":"Ministry of Finance (BC)","accountitem":"PST On Sales","dms_acctnumber":"324"},"federal":{"name":"GST/HST PAYABLE","rate":5,"accountdesc":"Receiver General - GST","accountitem":"GST On Sales","dms_acctnumber":"324"}},"refund":{"accountitem":"BODY SHOP_CUSTPAY"},"profits":[{"name":"Paint Materials","accountdesc":"PAINT & BODY SHOP MATERIALS","accountitem":"PAINT & BODY SHOP MATERIALS","accountname":"Aftermarket","accountnumber":"Aftermarket","dms_acctnumber":"479"},{"name":"INTERNAL LABOR/BODY SHOP","accountdesc":"INTERNAL LABOR/BODY SHOP","accountitem":"INTERNAL LABOR/BODY SHOP","dms_acctnumber":"473"},{"name":"SUBLET REPAIRS/BODY SHOP","accountdesc":"SUBLET REPAIRS/BODY SHOP","accountitem":"SUBLET REPAIRS/BODY SHOP","dms_acctnumber":"476"},{"name":"PARTS-CUST C&T R O-BODY SHOP","accountdesc":"PARTS-CUST C&T R O-BODY SHOP","accountitem":"PARTS-CUST C&T R O-BODY SHOP","dms_acctnumber":"477"},{"name":"ATS","accountdesc":"ATS","accountitem":"ATS","dms_acctnumber":"477"},{"name":"BS LABOR (LAB)","accountdesc":"LAB","accountitem":"LAB","dms_acctnumber":"470"},{"name":"BS LABOR (LAD)","accountdesc":"LAD","accountitem":"LAD","dms_acctnumber":"470"},{"name":"BS LABOR (LAE)","accountdesc":"LAE","accountitem":"LAE","dms_acctnumber":"470"},{"name":"BS LABOR (LAF)","accountdesc":"LAF","accountitem":"LAF","dms_acctnumber":"470"},{"name":"BS LABOR (LAG)","accountdesc":"LAG","accountitem":"LAG","dms_acctnumber":"470"},{"name":"BS LABOR (LAM)","accountdesc":"LAM","accountitem":"LAM","dms_acctnumber":"470"},{"name":"BS LABOR (LAR)","accountdesc":"LAR","accountitem":"LAR","dms_acctnumber":"470"},{"name":"BS LABOR (LAS)","accountdesc":"LAS","accountitem":"LAS","dms_acctnumber":"470"},{"name":"BS LABOR (LAU)","accountdesc":"LAU","accountitem":"LAU","dms_acctnumber":"470"},{"name":"BS LABOR (LA1)","accountdesc":"LA1","accountitem":"LA1","dms_acctnumber":"470"},{"name":"BS LABOR (LA2)","accountdesc":"LA2","accountitem":"LA2","dms_acctnumber":"470"},{"name":"BS LABOR (LA3)","accountdesc":"LA3","accountitem":"LA4","dms_acctnumber":"470"},{"name":"BS LABOR (LA4)","accountdesc":"LA4","accountitem":"LA4","dms_acctnumber":"470"},{"name":"OEM","accountdesc":"OEM","accountitem":"OEM","dms_acctnumber":"477"},{"name":"AFTERMARKET","accountdesc":"AFTERMARKET","accountitem":"AFTERMARKET","dms_acctnumber":"477"},{"name":"CHROME","accountdesc":"CHROME","accountitem":"CHROME","dms_acctnumber":"477"},{"name":"LKQ","accountdesc":"LKQ","accountitem":"LKQ","dms_acctnumber":"477"},{"name":"REMAN","accountdesc":"REMAN","accountitem":"REMAN","dms_acctnumber":"477"},{"name":"OTHER","accountdesc":"OTHER","accountitem":"OTHER","dms_acctnumber":"477"},{"name":"OE PARTIAL","accountdesc":"OE","accountitem":"OE","dms_acctnumber":"477"},{"name":"RECORED","accountdesc":"RECORED","accountitem":"RECORED","dms_acctnumber":"477"},{"name":"SUBLET","accountdesc":"SUBLET","accountitem":"SUBLET","dms_acctnumber":"476"},{"name":"SUBLET L","accountdesc":"SUBLET L","accountitem":"SUBLET L","dms_acctnumber":"476"},{"name":"TOWING","accountdesc":"TOWING","accountitem":"TOWING","dms_acctnumber":"476"},{"name":"Aluminum","accountdesc":"LAA","accountitem":"LAA","dms_acctnumber":"470"},{"name":"Shop Materials","accountdesc":"PAINT & BODY SHOP MATERIALS","accountitem":"PAINT & BODY SHOP MATERIALS","dms_acctnumber":"479"}],"defaults":{"costs":{"ATS":"ATS","LA1":"LA1","LA2":"LA2","LA3":"LA3","LA4":"LA4","LAA":"Aluminum","LAB":"Body","LAD":"Diagnostic","LAE":"Electrical","LAF":"Frame","LAG":"Glass","LAM":"Mechanical","LAR":"Refinish","LAS":"Structural","LAU":"Detail","PAA":"Aftermarket","PAC":"Chrome","PAL":"LKQ","PAM":"Remanufactured","PAN":"OEM","PAO":"Other","PAP":"OEM Partial","PAR":"Recored","PAS":"Sublet","TOW":"Towing","MAPA":"Paint Materials","MASH":"Shop Materials","PASL":"Sublet (L)"},"profits":{"ATS":"ATS","LA1":"BS LABOR (LA1)","LA2":"BS LABOR (LA2)","LA3":"BS LABOR (LA3)","LA4":"BS LABOR (LA4)","LAA":"Aluminum","LAB":"BS LABOR (LAB)","LAD":"BS LABOR (LAD)","LAE":"BS LABOR (LAE)","LAF":"BS LABOR (LAF)","LAG":"BS LABOR (LAG)","LAM":"BS LABOR (LAM)","LAR":"BS LABOR (LAR)","LAS":"BS LABOR (LAS)","LAU":"BS LABOR (LAU)","PAA":"AFTERMARKET","PAC":"CHROME","PAL":"LKQ","PAM":"REMAN","PAN":"OEM","PAO":"OTHER","PAP":"OE PARTIAL","PAR":"RECORED","PAS":"SUBLET","TOW":"TOWING","MAPA":"Paint Materials","MASH":"Shop Materials","PASL":"SUBLET L"}},"dms_defaults":[{"name":"BS WORK","costs":{"ATS":"ATS","LA1":"LA1","LA2":"LA2","LA3":"LA3","LA4":"LA4","LAA":"Aluminum","LAB":"Body","LAD":"Diagnostic","LAE":"Electrical","LAF":"Frame","LAG":"Glass","LAM":"Mechanical","LAR":"Refinish","LAS":"Structural","LAU":"Detail","PAA":"Aftermarket","PAC":"Chrome","PAL":"LKQ","PAM":"Remanufactured","PAN":"OEM","PAO":"Other","PAP":"OEM Partial","PAR":"Recored","PAS":"Sublet","TOW":"Towing","MAPA":"Paint Materials","MASH":"Shop Materials","PASL":"Sublet (L)"},"profits":{"ATS":"ATS","LA1":"BS LABOR (LA1)","LA2":"BS LABOR (LA2)","LA3":"BS LABOR (LA3)","LA4":"BS LABOR (LA4)","LAA":"Aluminum","LAB":"BS LABOR (LAB)","LAD":"BS LABOR (LAD)","LAE":"BS LABOR (LAE)","LAF":"BS LABOR (LAF)","LAG":"BS LABOR (LAG)","LAM":"BS LABOR (LAM)","LAR":"BS LABOR (LAR)","LAS":"BS LABOR (LAS)","LAU":"BS LABOR (LAU)","PAA":"AFTERMARKET","PAC":"CHROME","PAL":"LKQ","PAM":"REMAN","PAN":"OEM","PAO":"OTHER","PAP":"OE PARTIAL","PAR":"RECORED","PAS":"SUBLET","TOW":"TOWING","MAPA":"Paint Materials","MASH":"Shop Materials","PASL":"SUBLET L"}}],"sales_tax_codes":[{"code":"G","local":false,"state":false,"federal":true,"description":"GST Only"},{"code":"S","state":true,"federal":true,"description":"Both"},{"code":"E","local":false,"state":false,"federal":false,"description":"Exempt"}]} \ No newline at end of file diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index c49f9a9da..61610950f 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -6092,6 +6092,27 @@ + + gst_override + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + la1 false @@ -6491,6 +6512,27 @@ + + pag + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + pal false @@ -7994,6 +8036,27 @@ cdk + + controllist + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + payers false @@ -8038,6 +8101,27 @@ + + pbs_serialnumber + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + title false @@ -12104,6 +12188,63 @@ + + dms + + + errors + + + alreadyexported + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + labels + + + refreshallocations + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + documents @@ -17767,6 +17908,32 @@ + + labels + + + refreshallocations + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + post false @@ -18273,6 +18440,27 @@ + + sendtodms + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + sync false @@ -20377,6 +20565,27 @@ + + dms_allocation + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + driveable false @@ -22109,6 +22318,27 @@ + + po_number + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + policy_no false @@ -30837,6 +31067,27 @@ + + oec + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + @@ -31330,6 +31581,27 @@ + + oec + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + orderhistory false diff --git a/client/src/App/App.container.jsx b/client/src/App/App.container.jsx index 42091e595..a5616a726 100644 --- a/client/src/App/App.container.jsx +++ b/client/src/App/App.container.jsx @@ -34,7 +34,7 @@ export const tracker = new Tracker({ // trackerAssist({ confirmText: "Technical support is about to assist you." }) // ); // check the list of available options below export const recordGraphQL = tracker.use(trackerGraphQL()); -tracker.start(); +//tracker.start(); if (process.env.NODE_ENV === "production") LogRocket.init("gvfvfw/bodyshopapp"); export const factory = SplitSdk({ diff --git a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx index e617cf3b5..d7adeb4fe 100644 --- a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx +++ b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx @@ -251,7 +251,10 @@ function BillEnterModalContainer({ keyboard="false" onOk={() => form.submit()} onCancel={handleCancel} - afterClose={() => form.resetFields()} + afterClose={() => { + form.resetFields(); + setLoading(false); + }} footer={ diff --git a/client/src/components/bill-form/bill-form.lines.component.jsx b/client/src/components/bill-form/bill-form.lines.component.jsx index 22aa62f23..3f78412cd 100644 --- a/client/src/components/bill-form/bill-form.lines.component.jsx +++ b/client/src/components/bill-form/bill-form.lines.component.jsx @@ -7,13 +7,14 @@ import { Select, Space, Switch, - Table, + Table } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; +import CiecaSelect from "../../utils/Ciecaselect"; import BillLineSearchSelect from "../bill-line-search-select/bill-line-search-select.component"; import CurrencyInput from "../form-items-formatted/currency-form-item.component"; @@ -72,11 +73,13 @@ export function BillEnterModalLinesComponent({ quantity: opt.part_qty || 1, actual_price: opt.cost, cost_center: opt.part_type - ? responsibilityCenters.defaults && - (responsibilityCenters.defaults.costs[ - opt.part_type - ] || - null) + ? bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid + ? opt.part_type + : responsibilityCenters.defaults && + (responsibilityCenters.defaults.costs[ + opt.part_type + ] || + null) : null, }; } @@ -224,6 +227,7 @@ export function BillEnterModalLinesComponent({ key: `${field.index}cost_center`, name: [field.name, "cost_center"], label: t("billlines.fields.cost_center"), + valuePropName: "value", rules: [ { required: true, @@ -233,10 +237,12 @@ export function BillEnterModalLinesComponent({ }; }, formInput: (record, index) => ( - + {bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber + ? CiecaSelect(true, false) + : responsibilityCenters.costs.map((item) => ( + {item.name} + ))} ), }, diff --git a/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx b/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx index acfd796df..65357295b 100644 --- a/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx +++ b/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx @@ -95,6 +95,7 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId, title }) { columns={columns} rowKey="center" dataSource={allocationsSummary} + locale={{ emptyText: t("dms.labels.refreshallocations") }} summary={() => { const totals = allocationsSummary.reduce( (acc, val) => { diff --git a/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx b/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx index 06201284b..262d1720c 100644 --- a/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx +++ b/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx @@ -48,7 +48,7 @@ export function DmsCdkVehicles({ bodyshop, form, socket, job }) { ]; return ( -
+ <> {t("jobs.actions.dms.findmakemodelcode")} -
+ ); } diff --git a/client/src/components/dms-cdk-makes/dms-cdk-makes.refetch.component.jsx b/client/src/components/dms-cdk-makes/dms-cdk-makes.refetch.component.jsx index 11327fb01..f0d9ba970 100644 --- a/client/src/components/dms-cdk-makes/dms-cdk-makes.refetch.component.jsx +++ b/client/src/components/dms-cdk-makes/dms-cdk-makes.refetch.component.jsx @@ -1,12 +1,15 @@ import { Button } from "antd"; import axios from "axios"; import React, { useState } from "react"; +import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { selectBodyshop } from "../../redux/user/user.selectors"; -import { useTranslation } from "react-i18next"; +import { + selectBodyshop, + selectCurrentUser, +} from "../../redux/user/user.selectors"; const mapStateToProps = createStructuredSelector({ - //currentUser: selectCurrentUser + currentUser: selectCurrentUser, bodyshop: selectBodyshop, }); const mapDispatchToProps = (dispatch) => ({ @@ -14,9 +17,12 @@ const mapDispatchToProps = (dispatch) => ({ }); export default connect(mapStateToProps, mapDispatchToProps)(DmsCdkMakesRefetch); -export function DmsCdkMakesRefetch({ bodyshop, form, socket }) { +export function DmsCdkMakesRefetch({ currentUser, bodyshop, form, socket }) { const [loading, setLoading] = useState(false); const { t } = useTranslation(); + + if (!currentUser.email.includes("@imex.")) return null; + const handleRefetch = async () => { setLoading(true); await axios.post("/cdk/getvehicles", { diff --git a/client/src/components/dms-customer-selector/dms-customer-selector.component.jsx b/client/src/components/dms-customer-selector/dms-customer-selector.component.jsx index c22cbe108..a8baa4b0b 100644 --- a/client/src/components/dms-customer-selector/dms-customer-selector.component.jsx +++ b/client/src/components/dms-customer-selector/dms-customer-selector.component.jsx @@ -34,10 +34,6 @@ export function DmsCustomerSelector({ bodyshop }) { setVisible(true); setDmsType("pbs"); setcustomerList(customerList); - console.log( - "🚀 ~ file: dms-customer-selector.component.jsx ~ line 37 ~ socket.on ~ customerList", - customerList - ); }); const onUseSelected = () => { @@ -49,7 +45,7 @@ export function DmsCustomerSelector({ bodyshop }) { const onUseGeneric = () => { setVisible(false); socket.emit( - "cdk-selected-customer", + `${dmsType}selected-customer`, bodyshop.cdk_configuration.generic_customer_number ); setSelectedCustomer(null); @@ -57,7 +53,7 @@ export function DmsCustomerSelector({ bodyshop }) { const onCreateNew = () => { setVisible(false); - socket.emit("cdk-selected-customer", null); + socket.emit(`${dmsType}-selected-customer`, null); setSelectedCustomer(null); }; @@ -102,12 +98,6 @@ export function DmsCustomerSelector({ bodyshop }) { dataIndex: "ContactId", key: "ContactId", }, - { - title: t("jobs.fields.dms.vinowner"), - dataIndex: "vinOwner", - key: "vinOwner", - render: (text, record) => , - }, { title: t("jobs.fields.dms.name1"), key: "name1", diff --git a/client/src/components/dms-post-form/dms-post-form.component.jsx b/client/src/components/dms-post-form/dms-post-form.component.jsx index 6d1d1a03d..44b1f86fb 100644 --- a/client/src/components/dms-post-form/dms-post-form.component.jsx +++ b/client/src/components/dms-post-form/dms-post-form.component.jsx @@ -1,11 +1,13 @@ -import { DeleteFilled } from "@ant-design/icons"; +import { DeleteFilled, DownOutlined } from "@ant-design/icons"; import { Button, Card, Divider, + Dropdown, Form, Input, InputNumber, + Menu, Select, Space, Statistic, @@ -19,9 +21,9 @@ import { createStructuredSelector } from "reselect"; import { determineDmsType } from "../../pages/dms/dms.container"; import { selectBodyshop } from "../../redux/user/user.selectors"; import DmsCdkMakes from "../dms-cdk-makes/dms-cdk-makes.component"; +import DmsCdkMakesRefetch from "../dms-cdk-makes/dms-cdk-makes.refetch.component"; import CurrencyInput from "../form-items-formatted/currency-form-item.component"; import LayoutFormRow from "../layout-form-row/layout-form-row.component"; -import DmsCdkMakesRefetch from "../dms-cdk-makes/dms-cdk-makes.refetch.component"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -31,7 +33,7 @@ const mapDispatchToProps = (dispatch) => ({ }); export default connect(mapStateToProps, mapDispatchToProps)(DmsPostForm); -export function DmsPostForm({ bodyshop, socket, job }) { +export function DmsPostForm({ bodyshop, socket, job, logsRef }) { const [form] = Form.useForm(); const { t } = useTranslation(); @@ -59,6 +61,14 @@ export function DmsPostForm({ bodyshop, socket, job }) { jobid: job.id, txEnvelope: values, }); + console.log(logsRef); + if (logsRef) { + console.log("executing", logsRef); + logsRef.curent && + logsRef.current.scrollIntoView({ + behavior: "smooth", + }); + } }; return ( @@ -120,33 +130,36 @@ export function DmsPostForm({ bodyshop, socket, job }) { {bodyshop.cdk_dealerid && ( - - - - - - - - - - - +
+ + + + + + + + + + + + +
)} + {t("jobs.fields.dms.payer.controlnumber")}{" "} + + {bodyshop.cdk_configuration.controllist && + bodyshop.cdk_configuration.controllist.map( + (key, idx) => ( + { + form.setFieldsValue({ + payers: form + .getFieldValue("payers") + .map((row, mapIndex) => { + if (index !== mapIndex) + return row; + + return { + ...row, + controlnumber: + key.controlnumber, + }; + }), + }); + }} + > + {key.name} + + ) + )} + + } + > + e.preventDefault()}> + + + + + } key={`${index}controlnumber`} name={[field.name, "controlnumber"]} rules={[ diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx index 7cb63f152..8d37c6041 100644 --- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx +++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx @@ -100,7 +100,7 @@ export function JobsAvailableContainer({ } //IO-539 Check for Parts Rate on PAL for SGI use case. await CheckTaxRates(estData.est_data, bodyshop); - console.log(estData); + const newTotals = ( await Axios.post("/job/totals", { job: { diff --git a/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx index 6d766f9e6..b9d787433 100644 --- a/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx +++ b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx @@ -54,6 +54,7 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) { const handleMenuClick = ({ item, key, keyPath, domEvent }) => { logImEXEvent("jobs_close_allocate_auto_dms"); + form.setFieldsValue({ dms_allocation: key }); handleAllocate( bodyshop.md_responsibility_centers.dms_defaults.find( (x) => x.name === key @@ -64,7 +65,9 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) { const overlay = (bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && ( {bodyshop.md_responsibility_centers.dms_defaults.map((mapping) => ( - {mapping.name} + + {mapping.name} + ))} ); diff --git a/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx b/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx index 5bb74b8c8..cecc22795 100644 --- a/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx +++ b/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx @@ -38,12 +38,7 @@ export function LaborAllocationsTable({ useEffect(() => { if (!!joblines && !!timetickets && !!bodyshop); setTotals( - CalculateAllocationsTotals( - bodyshop.md_responsibility_centers, - joblines, - timetickets, - adjustments - ) + CalculateAllocationsTotals(bodyshop, joblines, timetickets, adjustments) ); if (!jobId) setTotals([]); }, [joblines, timetickets, bodyshop, adjustments, jobId]); diff --git a/client/src/components/labor-allocations-table/labor-allocations-table.utility.js b/client/src/components/labor-allocations-table/labor-allocations-table.utility.js index 29f8001f7..78d5aa2c6 100644 --- a/client/src/components/labor-allocations-table/labor-allocations-table.utility.js +++ b/client/src/components/labor-allocations-table/labor-allocations-table.utility.js @@ -1,9 +1,12 @@ +import i18next from "i18next"; + export const CalculateAllocationsTotals = ( - responsibilitycenters, + bodyshop, joblines, timetickets, adjustments = [] ) => { + const responsibilitycenters = bodyshop.md_responsibility_centers; const jobCodes = joblines.map((item) => item.mod_lbr_ty); //.filter((value, index, self) => self.indexOf(value) === index && !!value); const ticketCodes = timetickets.map((item) => item.ciecacode); @@ -15,7 +18,12 @@ export const CalculateAllocationsTotals = ( const r = allCodes.reduce((acc, value) => { const r = { opcode: value, - cost_center: responsibilitycenters.defaults.costs[value], + cost_center: + bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber + ? i18next.t( + `joblines.fields.lbr_types.${value && value.toUpperCase()}` + ) + : responsibilitycenters.defaults.costs[value], mod_lbr_ty: value, total: joblines.reduce((acc2, val2) => { return val2.mod_lbr_ty === value ? acc2 + val2.mod_lb_hrs : acc2; diff --git a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx index 4264f4272..2a2701d6e 100644 --- a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx +++ b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx @@ -10,7 +10,7 @@ import { PageHeader, Popconfirm, Space, - Table, + Table } from "antd"; import queryString from "query-string"; import React, { useState } from "react"; @@ -165,10 +165,15 @@ export function PartsOrderListTableComponent({ quantity: pol.quantity, actual_price: pol.act_price, + cost_center: pol.jobline?.part_type - ? responsibilityCenters.defaults.costs[ - pol.jobline.part_type - ] || null + ? bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid + ? pol.jobline.part_type + : responsibilityCenters.defaults && + (responsibilityCenters.defaults.costs[ + pol.jobline.part_type + ] || + null) : null, }; }), diff --git a/client/src/components/parts-order-modal/parts-order-modal.component.jsx b/client/src/components/parts-order-modal/parts-order-modal.component.jsx index 08973075d..cd79fe81f 100644 --- a/client/src/components/parts-order-modal/parts-order-modal.component.jsx +++ b/client/src/components/parts-order-modal/parts-order-modal.component.jsx @@ -1,14 +1,30 @@ import { DeleteFilled, WarningFilled } from "@ant-design/icons"; +import { useTreatments } from "@splitsoftware/splitio-react"; import { Divider, Form, Input, InputNumber, Radio, Space, Tag } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { selectBodyshop } from "../../redux/user/user.selectors"; import FormDatePicker from "../form-date-picker/form-date-picker.component"; import CurrencyInput from "../form-items-formatted/currency-form-item.component"; import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component"; import LayoutFormRow from "../layout-form-row/layout-form-row.component"; import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component"; -export default function PartsOrderModalComponent({ +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop, +}); +const mapDispatchToProps = (dispatch) => ({ + //setUserLanguage: language => dispatch(setUserLanguage(language)) +}); +export default connect( + mapStateToProps, + mapDispatchToProps +)(PartsOrderModalComponent); + +export function PartsOrderModalComponent({ + bodyshop, vendorList, sendTypeState, isReturn, @@ -16,7 +32,11 @@ export default function PartsOrderModalComponent({ job, }) { const [sendType, setSendType] = sendTypeState; - + const { OEConnection } = useTreatments( + ["OEConnection"], + {}, + bodyshop.imexshopid + ); const { t } = useTranslation(); return ( @@ -164,6 +184,9 @@ export default function PartsOrderModalComponent({ {t("general.labels.none")} {t("parts_orders.labels.email")} {t("parts_orders.labels.print")} + {OEConnection.treatment === "on" && ( + {t("parts_orders.labels.oec")} + )} ); diff --git a/client/src/components/parts-order-modal/parts-order-modal.container.jsx b/client/src/components/parts-order-modal/parts-order-modal.container.jsx index ad9efeb72..34121c2ed 100644 --- a/client/src/components/parts-order-modal/parts-order-modal.container.jsx +++ b/client/src/components/parts-order-modal/parts-order-modal.container.jsx @@ -1,13 +1,16 @@ -import { useMutation, useQuery } from "@apollo/client"; +import { useMutation, useQuery, useApolloClient } from "@apollo/client"; import { Form, Modal, notification } from "antd"; import moment from "moment"; import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { logImEXEvent } from "../../firebase/firebase.utils"; +import { logImEXEvent, auth } from "../../firebase/firebase.utils"; import { UPDATE_JOB_LINE_STATUS } from "../../graphql/jobs-lines.queries"; -import { INSERT_NEW_PARTS_ORDERS } from "../../graphql/parts-orders.queries"; +import { + INSERT_NEW_PARTS_ORDERS, + QUERY_PARTS_ORDER_OEC, +} from "../../graphql/parts-orders.queries"; import { QUERY_ALL_VENDORS_FOR_ORDER } from "../../graphql/vendors.queries"; import { insertAuditTrail } from "../../redux/application/application.actions"; import { setEmailOptions } from "../../redux/email/email.actions"; @@ -26,6 +29,7 @@ import { TemplateList } from "../../utils/TemplateConstants"; import AlertComponent from "../alert/alert.component"; import LoadingSpinner from "../loading-spinner/loading-spinner.component"; import PartsOrderModalComponent from "./parts-order-modal.component"; +import axios from "axios"; const mapStateToProps = createStructuredSelector({ currentUser: selectCurrentUser, @@ -52,7 +56,7 @@ export function PartsOrderModalContainer({ insertAuditTrail, }) { const { t } = useTranslation(); - + const client = useApolloClient(); const { visible, context, actions } = partsOrderModal; const { jobId, @@ -175,7 +179,7 @@ export function PartsOrderModalContainer({ } if (refetch) refetch(); - toggleModalVisible(); + const Templates = TemplateList("partsorder", context); if (sendType === "e") { @@ -215,7 +219,50 @@ export function PartsOrderModalContainer({ {}, "p" ); + } else if (sendType === "oec") { + //Send to Partner OEC. + try { + const partsOrder = await client.query({ + query: QUERY_PARTS_ORDER_OEC, + variables: { + id: insertResult.data.insert_parts_orders.returning[0].id, + }, + }); + + const oecResponse = await axios.post( + "http://localhost:1337/oec/", + + partsOrder.data.parts_orders_by_pk, + { + headers: { + Authorization: `Bearer ${await auth.currentUser.getIdToken()}`, + }, + } + ); + + if (oecResponse.data && oecResponse.data.success === false) { + notification.open({ + type: "error", + message: t("parts_orders.errors.oec", { + error: oecResponse.data.error, + }), + }); + } + + + } catch (error) { + console.log("Error OEC.", error); + notification["error"]({ + message: t("parts_orders.errors.oec", { + error: JSON.stringify(error.message), + }), + }); + + return; + } } + + toggleModalVisible(); }; const initialValues = { diff --git a/client/src/components/shop-employees/shop-employees-form.component.jsx b/client/src/components/shop-employees/shop-employees-form.component.jsx index 02289e356..acfadbcde 100644 --- a/client/src/components/shop-employees/shop-employees-form.component.jsx +++ b/client/src/components/shop-employees/shop-employees-form.component.jsx @@ -14,6 +14,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors"; import FormDatePicker from "../form-date-picker/form-date-picker.component"; import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component"; import LayoutFormRow from "../layout-form-row/layout-form-row.component"; +import CiecaSelect from "../../utils/Ciecaselect"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -218,6 +219,7 @@ export function ShopEmployeesFormComponent({ label={t("employees.fields.cost_center")} key={`${index}`} name={[field.name, "cost_center"]} + valuePropName="value" rules={[ { required: true, @@ -232,11 +234,16 @@ export function ShopEmployeesFormComponent({ > {t("timetickets.labels.shift")} - {bodyshop.md_responsibility_centers.costs.map((c) => ( - - {c.name} - - ))} + + {bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber + ? CiecaSelect(false, true) + : bodyshop.md_responsibility_centers.costs.map( + (c) => ( + + {c.name} + + ) + )} - {bodyshop.cdk_dealerid && ( + {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && ( <> {form.getFieldValue("cdk_dealerid")} @@ -164,7 +164,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { }, ]} > - {t("jobs.fields.ro_number")} @@ -201,6 +201,63 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { }} + + + {(fields, { add, remove }) => { + return ( +
+ {fields.map((field, index) => ( + + + + + + + + + + { + remove(field.name); + }} + /> + + + ))} + + + +
+ ); + }} +
+
)} @@ -293,7 +350,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
*/} - {bodyshop.cdk_dealerid && ( + {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && ( )} - {bodyshop.cdk_dealerid && ( + {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && ( - {bodyshop.cdk_dealerid && ( + {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && ( - {bodyshop.cdk_dealerid && ( + {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && ( <> {(fields, { add, remove }) => { @@ -493,6 +550,14 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { > + + + { remove(field.name); @@ -525,7 +590,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-ats`} name={[field.name, "costs", "ATS"]} > - {costOptions.map((item, idx) => ( {item} @@ -556,7 +621,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAA`} name={[field.name, "costs", "LAA"]} > - {costOptions.map((item, idx) => ( {item} @@ -587,7 +652,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAB`} name={[field.name, "costs", "LAB"]} > - {costOptions.map((item, idx) => ( {item} @@ -618,7 +683,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAD`} name={[field.name, "costs", "LAD"]} > - {costOptions.map((item, idx) => ( {item} @@ -649,7 +714,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAE`} name={[field.name, "costs", "LAE"]} > - {costOptions.map((item, idx) => ( {item} @@ -680,7 +745,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAF`} name={[field.name, "costs", "LAF"]} > - {costOptions.map((item, idx) => ( {item} @@ -711,7 +776,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAG`} name={[field.name, "costs", "LAG"]} > - {costOptions.map((item, idx) => ( {item} @@ -742,7 +807,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAM`} name={[field.name, "costs", "LAM"]} > - {costOptions.map((item, idx) => ( {item} @@ -773,7 +838,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAR`} name={[field.name, "costs", "LAR"]} > - {costOptions.map((item, idx) => ( {item} @@ -804,7 +869,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAS`} name={[field.name, "costs", "LAS"]} > - {costOptions.map((item, idx) => ( {item} @@ -835,7 +900,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAU`} name={[field.name, "costs", "LAU"]} > - {costOptions.map((item, idx) => ( {item} @@ -866,7 +931,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LA1`} name={[field.name, "costs", "LA1"]} > - {costOptions.map((item, idx) => ( {item} @@ -897,7 +962,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LA2`} name={[field.name, "costs", "LA2"]} > - {costOptions.map((item, idx) => ( {item} @@ -928,7 +993,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LA3`} name={[field.name, "costs", "LA3"]} > - {costOptions.map((item, idx) => ( {item} @@ -959,7 +1024,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LA4`} name={[field.name, "costs", "LA4"]} > - {costOptions.map((item, idx) => ( {item} @@ -990,7 +1055,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-PAA`} name={[field.name, "costs", "PAA"]} > - {costOptions.map((item, idx) => ( {item} @@ -1021,7 +1086,38 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-PAC`} name={[field.name, "costs", "PAC"]} > - + {costOptions.map((item, idx) => ( + + {item} + + ))} + +
+ ({ + validator(rule, value) { + if (costOptions.includes(value)) { + return Promise.resolve(); + } + return Promise.reject( + t("bodyshop.validation.centermustexist") + ); + }, + }), + ]} + key={`${index}costs-PAG`} + name={[field.name, "costs", "PAG"]} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ({ + validator(rule, value) { + if (profitOptions.includes(value)) { + return Promise.resolve(); + } + return Promise.reject( + t("bodyshop.validation.centermustexist") + ); + }, + }), + ]} + key={`${index}profits-PAG`} + name={[field.name, "profits", "PAG"]} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ({ + validator(rule, value) { + if (costOptions.includes(value)) { + return Promise.resolve(); + } + return Promise.reject( + t("bodyshop.validation.centermustexist") + ); + }, + }), + ]} + name={["md_responsibility_centers", "defaults", "costs", "PAG"]} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ({ + validator(rule, value) { + if (profitOptions.includes(value)) { + return Promise.resolve(); + } + return Promise.reject( + t("bodyshop.validation.centermustexist") + ); + }, + }), + ]} + name={["md_responsibility_centers", "defaults", "profits", "PAG"]} + > + + + + + + + + + + + + - {bodyshop.cdk_dealerid && ( + {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && ( - {bodyshop.cdk_dealerid && ( + {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && ( - {bodyshop.cdk_dealerid && ( + {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && ( {emps && emps.rates.map((item) => ( - + {item.cost_center === "timetickets.labels.shift" ? t(item.cost_center) + : bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber + ? t( + `joblines.fields.lbr_types.${item.cost_center.toUpperCase()}` + ) : item.cost_center} ))} @@ -137,6 +141,7 @@ export function TimeTicketModalComponent({ - bodyshop.md_responsibility_centers.defaults.costs[key] === - changedFields.cost_center - ), + ciecacode: + bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber + ? changedFields.cost_center + : Object.keys( + bodyshop.md_responsibility_centers.defaults.costs + ).find( + (key) => + bodyshop.md_responsibility_centers.defaults.costs[key] === + changedFields.cost_center + ), }); } }; diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index c3edbd04f..cad9a6a1f 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -1695,6 +1695,7 @@ export const QUERY_JOB_CLOSE_DETAILS = gql` ro_number invoice_allocation ins_co_id + dms_allocation id ded_amt ded_status @@ -1918,6 +1919,7 @@ export const QUERY_JOB_EXPORT_DMS = gql` v_model_yr v_model_desc area_of_damage + date_exported } } `; diff --git a/client/src/graphql/parts-orders.queries.js b/client/src/graphql/parts-orders.queries.js index 7cd4427c9..c85922bd9 100644 --- a/client/src/graphql/parts-orders.queries.js +++ b/client/src/graphql/parts-orders.queries.js @@ -11,6 +11,278 @@ export const INSERT_NEW_PARTS_ORDERS = gql` } `; +export const QUERY_PARTS_ORDER_OEC = gql` + query QUERY_PARTS_ORDER_OEC($id: uuid!) { + parts_orders_by_pk(id: $id) { + parts_order_lines { + jobline { + tran_code + act_price + db_ref + db_price + db_hrs + glass_flag + id + lbr_amt + lbr_hrs_j + lbr_inc + lbr_op + lbr_op_j + lbr_tax + lbr_typ_j + line_desc + line_ind + line_no + line_ref + location + misc_amt + misc_sublt + misc_tax + mod_lb_hrs + mod_lbr_ty + oem_partno + op_code_desc + paint_stg + paint_tone + part_qty + part_type + price_inc + price_j + prt_dsmk_m + prt_dsmk_p + tax_part + unq_seq + alt_co_id + alt_overrd + alt_part_i + alt_partm + alt_partno + bett_amt + bett_pctg + bett_tax + bett_type + cert_part + est_seq + } + act_price + id + db_price + line_desc + quantity + } + job { + bodyshop{ + shopname + bill_tax_rates + } + ro_number + clm_no + asgn_no + asgn_date + state_tax_rate + area_of_damage + asgn_no + asgn_type + ciecaid + clm_addr1 + clm_city + clm_addr2 + clm_ct_fn + clm_ct_ln + clm_ct_ph + clm_ct_phx + clm_ctry + clm_ea + clm_fax + clm_faxx + clm_ofc_id + clm_ofc_nm + clm_ph1 + clm_ph1x + clm_ph2 + clm_ph2x + clm_st + clm_title + clm_total + clm_zip + ded_amt + est_addr1 + est_addr2 + est_city + est_co_nm + est_ct_fn + est_ctry + est_ct_ln + est_ea + est_ph1 + est_st + est_zip + g_bett_amt + id + ins_addr1 + ins_city + ins_addr2 + ins_co_id + ins_co_nm + ins_ct_fn + ins_ct_ln + ins_ct_ph + ins_ct_phx + ins_ctry + ins_ea + ins_fax + ins_faxx + ins_memo + ins_ph1 + ins_ph1x + ins_ph2 + ins_ph2x + ins_st + ins_title + ins_zip + insd_addr1 + insd_addr2 + insd_city + insd_co_nm + insd_ctry + insd_ea + insd_fax + insd_faxx + insd_fn + insd_ln + insd_ph1 + insd_ph1x + insd_ph2 + insd_ph2x + insd_st + insd_title + insd_zip + job_totals + loss_cat + loss_date + loss_desc + loss_of_use + loss_type + ownr_addr1 + ownr_addr2 + ownr_city + ownr_co_nm + ownr_ctry + ownr_ea + ownr_fax + ownr_faxx + ownr_ph1 + ownr_fn + ownr_ln + ownr_ph1x + ownr_ph2 + ownr_ph2x + ownr_st + ownr_title + ownr_zip + parts_tax_rates + pay_amt + pay_date + pay_type + pay_chknm + payee_nms + plate_no + plate_st + po_number + policy_no + tax_lbr_rt + tax_levies_rt + tax_paint_mat_rt + tax_predis + tax_prethr + tax_pstthr + tax_registration_number + tax_str_rt + tax_shop_mat_rt + tax_sub_rt + tax_thramt + tax_tow_rt + theft_ind + tlos_ind + towin + v_color + v_make_desc + v_model_desc + v_model_yr + v_vin + vehicle { + v_bstyle + v_type + v_trimcode + v_tone + v_stage + v_prod_dt + v_options + v_paint_codes + v_model_yr + v_model_desc + v_mldgcode + v_makecode + v_make_desc + v_engine + v_cond + v_color + trim_color + shopid + plate_no + plate_st + db_v_code + v_vin + } + agt_zip + agt_st + agt_ph2x + agt_ph2 + agt_ph1x + agt_ph1 + agt_lic_no + agt_faxx + agt_fax + agt_ea + agt_ctry + agt_ct_phx + agt_ct_ph + agt_ct_ln + agt_ct_fn + agt_co_nm + agt_co_id + agt_city + agt_addr1 + agt_addr2 + adj_g_disc + rate_matd + rate_mash + rate_mapa + rate_mahw + rate_macs + rate_mabl + rate_ma3s + rate_ma2t + rate_ma2s + rate_lau + rate_las + rate_lar + rate_lam + rate_lag + rate_laf + rate_lae + rate_lad + rate_lab + rate_laa + rate_la4 + rate_la3 + rate_la2 + rate_la1 + } + } + } +`; + export const DELETE_PARTS_ORDER = gql` mutation DELETE_PARTS_ORDER($partsOrderId: uuid!) { delete_parts_orders_by_pk(id: $partsOrderId) { diff --git a/client/src/pages/dms/dms.container.jsx b/client/src/pages/dms/dms.container.jsx index 223c4e231..5fc7f1166 100644 --- a/client/src/pages/dms/dms.container.jsx +++ b/client/src/pages/dms/dms.container.jsx @@ -7,13 +7,13 @@ import { Result, Row, Select, - Space, + Space } from "antd"; import queryString from "query-string"; -import React, { useEffect, useState } from "react"; +import React, { useEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useLocation, useHistory } from "react-router-dom"; +import { useHistory, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import SocketIO from "socket.io-client"; import AlertComponent from "../../components/alert/alert.component"; @@ -26,7 +26,7 @@ import { auth } from "../../firebase/firebase.utils"; import { QUERY_JOB_EXPORT_DMS } from "../../graphql/jobs.queries"; import { setBreadcrumbs, - setSelectedHeader, + setSelectedHeader } from "../../redux/application/application.actions"; import { selectBodyshop } from "../../redux/user/user.selectors"; @@ -66,6 +66,7 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) { variables: { id: jobId }, skip: !jobId, }); + const logsRef = useRef(null); useEffect(() => { document.title = t("titles.dms"); @@ -125,12 +126,15 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) { !(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) || !(data && data.jobs_by_pk) ) - return ; + return ; + + if (data.jobs_by_pk && data.jobs_by_pk.date_exported) + return ; return (
- + - + - - - - - - - } - > - - - +
+ + + + + + + } + > + + + +
); diff --git a/client/src/pages/jobs-close/jobs-close.component.jsx b/client/src/pages/jobs-close/jobs-close.component.jsx index 50ccae32e..058e9be74 100644 --- a/client/src/pages/jobs-close/jobs-close.component.jsx +++ b/client/src/pages/jobs-close/jobs-close.component.jsx @@ -9,6 +9,7 @@ import { Divider, PageHeader, InputNumber, + Input, } from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; @@ -26,6 +27,8 @@ import { selectBodyshop } from "../../redux/user/user.selectors"; import LayoutFormRow from "../../components/layout-form-row/layout-form-row.component"; import DateTimePicker from "../../components/form-date-time-picker/form-date-time-picker.component"; import moment from "moment"; +import { Link } from "react-router-dom"; + const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, jobRO: selectJobReadOnly, @@ -59,6 +62,7 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) { actual_delivery: values.actual_delivery, kmin: values.kmin, kmout: values.kmout, + dms_allocation: values.dms_allocation, }, }, refetchQueries: ["QUERY_JOB_CLOSE_DETAILS"], @@ -117,6 +121,7 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) { : job.scheduled_delivery && moment(job.scheduled_delivery), kmin: job.kmin, kmout: job.kmout, + dms_allocation: job.dms_allocation, }} scrollToFirstError > @@ -141,7 +146,11 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) { {t("general.actions.close")} - + + +
} @@ -247,6 +256,19 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) { )} + {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && ( + + + + )} diff --git a/client/src/pages/mobile-payment/mobile-payment.container.jsx b/client/src/pages/mobile-payment/mobile-payment.container.jsx index 18c36a1cb..7c44dd12d 100644 --- a/client/src/pages/mobile-payment/mobile-payment.container.jsx +++ b/client/src/pages/mobile-payment/mobile-payment.container.jsx @@ -1,7 +1,7 @@ -import React from "react"; -import MobilePaymentComponent from "./mobile-payment.component"; import { Elements } from "@stripe/react-stripe-js"; import { loadStripe } from "@stripe/stripe-js"; +import React from "react"; +import MobilePaymentComponent from "./mobile-payment.component"; const stripePromise = new Promise((resolve, reject) => { resolve( diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 7d021e5f6..a290fe4e7 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -394,6 +394,7 @@ "ar": "Accounts Receivable", "ats": "ATS", "federal_tax": "Federal Tax", + "gst_override": "GST Override Account #", "la1": "LA1", "la2": "LA2", "la3": "LA3", @@ -413,6 +414,7 @@ "mash": "Shop Materials", "paa": "Aftermarket", "pac": "Chrome", + "pag": "Glass", "pal": "LKQ", "pam": "Remanufactured", "pan": "OEM", @@ -496,9 +498,11 @@ "deliverchecklist": "Delivery Checklist", "dms": { "cdk": { + "controllist": "Control Number List", "payers": "CDK Payers" }, "cdk_dealerid": "CDK Dealer ID", + "pbs_serialnumber": "PBS Serial Number", "title": "DMS" }, "emaillater": "Email Later", @@ -757,6 +761,14 @@ "projectedmonthlysales": "Projected Monthly Sales" } }, + "dms": { + "errors": { + "alreadyexported": "This job has already been sent to the DMS. If you need to resend it, please use admin permissions to mark the job for re-export." + }, + "labels": { + "refreshallocations": "Refresh to see DMS Allocataions." + } + }, "documents": { "actions": { "delete": "Delete Selected Documents", @@ -1105,6 +1117,9 @@ "createnewcustomer": "Create New Customer", "findmakemodelcode": "Find Make/Model Code", "getmakes": "", + "labels": { + "refreshallocations": "Refresh this component to see the DMS allocations." + }, "post": "Post", "refetchmakesmodels": "Refetch Make and Model Codes", "usegeneric": "Use Generic Customer", @@ -1130,6 +1145,7 @@ "removefromproduction": "Remove from Production", "schedule": "Schedule", "sendcsi": "Send CSI", + "sendtodms": "Send to DMS", "sync": "Sync", "uninvoice": "Uninvoice", "unvoid": "Unvoid Job", @@ -1239,6 +1255,7 @@ "story": "Story", "vinowner": "VIN Owner" }, + "dms_allocation": "DMS Allocation", "driveable": "Driveable", "employee_body": "Body", "employee_csr": "Customer Service Rep.", @@ -1325,6 +1342,7 @@ "pas": "Sublet", "pay_date": "Pay Date", "phoneshort": "PH", + "po_number": "PO Number", "policy_no": "Policy #", "ponumber": "PO Number", "production_vars": { @@ -1833,7 +1851,8 @@ "errors": { "associatedbills": "This parts order cannot", "backordering": "Error backordering part {{message}}.", - "creating": "Error encountered when creating parts order. " + "creating": "Error encountered when creating parts order. ", + "oec": "Error creating EMS files for OEC. {{error}}" }, "fields": { "act_price": "Price", @@ -1861,6 +1880,7 @@ "email": "Send by Email", "inthisorder": "Parts in this Order", "newpartsorder": "New Parts Order", + "oec": "Order via OEC", "orderhistory": "Order History", "parts_orders": "Parts Orders", "print": "Show Printed Form", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index f12163cea..55aada7d9 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -394,6 +394,7 @@ "ar": "", "ats": "", "federal_tax": "", + "gst_override": "", "la1": "", "la2": "", "la3": "", @@ -413,6 +414,7 @@ "mash": "", "paa": "", "pac": "", + "pag": "", "pal": "", "pam": "", "pan": "", @@ -496,9 +498,11 @@ "deliverchecklist": "", "dms": { "cdk": { + "controllist": "", "payers": "" }, "cdk_dealerid": "", + "pbs_serialnumber": "", "title": "" }, "emaillater": "", @@ -757,6 +761,14 @@ "projectedmonthlysales": "" } }, + "dms": { + "errors": { + "alreadyexported": "" + }, + "labels": { + "refreshallocations": "" + } + }, "documents": { "actions": { "delete": "", @@ -1105,6 +1117,9 @@ "createnewcustomer": "", "findmakemodelcode": "", "getmakes": "", + "labels": { + "refreshallocations": "" + }, "post": "", "refetchmakesmodels": "", "usegeneric": "", @@ -1130,6 +1145,7 @@ "removefromproduction": "", "schedule": "Programar", "sendcsi": "", + "sendtodms": "", "sync": "", "uninvoice": "", "unvoid": "", @@ -1239,6 +1255,7 @@ "story": "", "vinowner": "" }, + "dms_allocation": "", "driveable": "", "employee_body": "", "employee_csr": "Representante de servicio al cliente.", @@ -1325,6 +1342,7 @@ "pas": "", "pay_date": "Fecha de Pay", "phoneshort": "PH", + "po_number": "", "policy_no": "Política #", "ponumber": "numero postal", "production_vars": { @@ -1833,7 +1851,8 @@ "errors": { "associatedbills": "", "backordering": "", - "creating": "Se encontró un error al crear el pedido de piezas." + "creating": "Se encontró un error al crear el pedido de piezas.", + "oec": "" }, "fields": { "act_price": "", @@ -1861,6 +1880,7 @@ "email": "Enviar por correo electrónico", "inthisorder": "Partes en este pedido", "newpartsorder": "", + "oec": "", "orderhistory": "Historial de pedidos", "parts_orders": "", "print": "Mostrar formulario impreso", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index beba794af..5f17415dc 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -394,6 +394,7 @@ "ar": "", "ats": "", "federal_tax": "", + "gst_override": "", "la1": "", "la2": "", "la3": "", @@ -413,6 +414,7 @@ "mash": "", "paa": "", "pac": "", + "pag": "", "pal": "", "pam": "", "pan": "", @@ -496,9 +498,11 @@ "deliverchecklist": "", "dms": { "cdk": { + "controllist": "", "payers": "" }, "cdk_dealerid": "", + "pbs_serialnumber": "", "title": "" }, "emaillater": "", @@ -757,6 +761,14 @@ "projectedmonthlysales": "" } }, + "dms": { + "errors": { + "alreadyexported": "" + }, + "labels": { + "refreshallocations": "" + } + }, "documents": { "actions": { "delete": "", @@ -1105,6 +1117,9 @@ "createnewcustomer": "", "findmakemodelcode": "", "getmakes": "", + "labels": { + "refreshallocations": "" + }, "post": "", "refetchmakesmodels": "", "usegeneric": "", @@ -1130,6 +1145,7 @@ "removefromproduction": "", "schedule": "Programme", "sendcsi": "", + "sendtodms": "", "sync": "", "uninvoice": "", "unvoid": "", @@ -1239,6 +1255,7 @@ "story": "", "vinowner": "" }, + "dms_allocation": "", "driveable": "", "employee_body": "", "employee_csr": "représentant du service à la clientèle", @@ -1325,6 +1342,7 @@ "pas": "", "pay_date": "Date d'Pay", "phoneshort": "PH", + "po_number": "", "policy_no": "Politique #", "ponumber": "Numéro de bon de commande", "production_vars": { @@ -1833,7 +1851,8 @@ "errors": { "associatedbills": "", "backordering": "", - "creating": "Erreur rencontrée lors de la création de la commande de pièces." + "creating": "Erreur rencontrée lors de la création de la commande de pièces.", + "oec": "" }, "fields": { "act_price": "", @@ -1861,6 +1880,7 @@ "email": "Envoyé par email", "inthisorder": "Pièces dans cette commande", "newpartsorder": "", + "oec": "", "orderhistory": "Historique des commandes", "parts_orders": "", "print": "Afficher le formulaire imprimé", diff --git a/client/src/utils/Ciecaselect.jsx b/client/src/utils/Ciecaselect.jsx new file mode 100644 index 000000000..3b22deb5a --- /dev/null +++ b/client/src/utils/Ciecaselect.jsx @@ -0,0 +1,103 @@ +import React from "react"; +import { Select } from "antd"; +import i18n from "../translations/i18n"; + +export default function CiecaSelect(parts = true, labor = true) { + return ( + <> + {labor && ( + <> + + {i18n.t("joblines.fields.lbr_types.LAA")} + + + {i18n.t("joblines.fields.lbr_types.LAB")} + + + {i18n.t("joblines.fields.lbr_types.LAD")} + + + {i18n.t("joblines.fields.lbr_types.LAE")} + + + {i18n.t("joblines.fields.lbr_types.LAF")} + + + {i18n.t("joblines.fields.lbr_types.LAG")} + + + {i18n.t("joblines.fields.lbr_types.LAM")} + + + {i18n.t("joblines.fields.lbr_types.LAR")} + + + {i18n.t("joblines.fields.lbr_types.LAS")} + + + {i18n.t("joblines.fields.lbr_types.LAU")} + + + {i18n.t("joblines.fields.lbr_types.LA1")} + + + {i18n.t("joblines.fields.lbr_types.LA2")} + + + {i18n.t("joblines.fields.lbr_types.LA3")} + + + {i18n.t("joblines.fields.lbr_types.LA4")} + + + )} + {parts && ( + <> + + {i18n.t("joblines.fields.part_types.PAA")} + + + {i18n.t("joblines.fields.part_types.PAC")} + + + + {i18n.t("joblines.fields.part_types.PAL")} + + + {i18n.t("joblines.fields.part_types.PAG")} + + + {i18n.t("joblines.fields.part_types.PAM")} + + + {i18n.t("joblines.fields.part_types.PAP")} + + + {i18n.t("joblines.fields.part_types.PAN")} + + + {i18n.t("joblines.fields.part_types.PAO")} + + + {i18n.t("joblines.fields.part_types.PAR")} + + + {i18n.t("joblines.fields.part_types.PAS")} + + + )} + + ); +} + +export function GetPartTypeName(part_type) { + console.log(part_type); + if (!part_type) return null; + return i18n.t(`joblines.fields.part_types.${part_type.toUpperCase()}`); +} + +export function Get(part_type) { + console.log(part_type); + if (!part_type) return null; + return i18n.t(`joblines.fields.part_types.${part_type.toUpperCase()}`); +} diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index b0bd5e897..9bdea1b51 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -2160,6 +2160,7 @@ - sublet_completed - sublet_ignored - tax_part + - tran_code - unq_seq - updated_at select_permissions: @@ -2221,6 +2222,7 @@ - sublet_completed - sublet_ignored - tax_part + - tran_code - unq_seq - updated_at filter: @@ -2293,6 +2295,7 @@ - sublet_completed - sublet_ignored - tax_part + - tran_code - unq_seq - updated_at filter: @@ -2305,7 +2308,16 @@ _eq: X-Hasura-User-Id - active: _eq: true - check: null + check: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true delete_permissions: - role: user permission: @@ -2604,6 +2616,7 @@ - ded_status - deliverchecklist - depreciation_taxes + - dms_allocation - driveable - employee_body - employee_csr @@ -2856,6 +2869,7 @@ - ded_status - deliverchecklist - depreciation_taxes + - dms_allocation - driveable - employee_body - employee_csr @@ -3118,6 +3132,7 @@ - ded_status - deliverchecklist - depreciation_taxes + - dms_allocation - driveable - employee_body - employee_csr diff --git a/hasura/migrations/1638223143109_alter_table_public_joblines_add_column_tran_code/down.sql b/hasura/migrations/1638223143109_alter_table_public_joblines_add_column_tran_code/down.sql new file mode 100644 index 000000000..c71f50406 --- /dev/null +++ b/hasura/migrations/1638223143109_alter_table_public_joblines_add_column_tran_code/down.sql @@ -0,0 +1,4 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- alter table "public"."joblines" add column "tran_code" text +-- null; diff --git a/hasura/migrations/1638223143109_alter_table_public_joblines_add_column_tran_code/up.sql b/hasura/migrations/1638223143109_alter_table_public_joblines_add_column_tran_code/up.sql new file mode 100644 index 000000000..9d4cb989e --- /dev/null +++ b/hasura/migrations/1638223143109_alter_table_public_joblines_add_column_tran_code/up.sql @@ -0,0 +1,2 @@ +alter table "public"."joblines" add column "tran_code" text + null; diff --git a/hasura/migrations/1638467360308_alter_table_public_jobs_add_column_dms_allocation/down.sql b/hasura/migrations/1638467360308_alter_table_public_jobs_add_column_dms_allocation/down.sql new file mode 100644 index 000000000..c434a9935 --- /dev/null +++ b/hasura/migrations/1638467360308_alter_table_public_jobs_add_column_dms_allocation/down.sql @@ -0,0 +1,4 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- alter table "public"."jobs" add column "dms_allocation" text +-- null; diff --git a/hasura/migrations/1638467360308_alter_table_public_jobs_add_column_dms_allocation/up.sql b/hasura/migrations/1638467360308_alter_table_public_jobs_add_column_dms_allocation/up.sql new file mode 100644 index 000000000..34284d636 --- /dev/null +++ b/hasura/migrations/1638467360308_alter_table_public_jobs_add_column_dms_allocation/up.sql @@ -0,0 +1,2 @@ +alter table "public"."jobs" add column "dms_allocation" text + null; diff --git a/server/accounting/pbs/pbs-job-export.js b/server/accounting/pbs/pbs-job-export.js index dd0c264a7..056c84d0f 100644 --- a/server/accounting/pbs/pbs-job-export.js +++ b/server/accounting/pbs/pbs-job-export.js @@ -85,7 +85,7 @@ exports.PbsSelectedCustomer = async function PbsSelectedCustomer( CdkBase.createLogEvent(socket, "DEBUG", `Inserting account data.`); await InsertAccountPostingData(socket); 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); } catch (error) { diff --git a/server/cdk/cdk-calculate-allocations.js b/server/cdk/cdk-calculate-allocations.js index b4709bd67..0b7d84912 100644 --- a/server/cdk/cdk-calculate-allocations.js +++ b/server/cdk/cdk-calculate-allocations.js @@ -106,10 +106,23 @@ exports.default = async function (socket, jobid) { return acc; }, {}); + const selectedDmsAllocationConfig = + bodyshop.md_responsibility_centers.dms_defaults.find( + (d) => d.name === job.dms_allocation + ); + CdkBase.createLogEvent( + socket, + "DEBUG", + `Using DMS Allocation ${ + selectedDmsAllocationConfig && selectedDmsAllocationConfig.name + } for cost export.` + ); + const costCenterHash = job.bills.reduce((bill_acc, bill_val) => { bill_val.billlines.map((line_val) => { - if (!bill_acc[line_val.cost_center]) - bill_acc[line_val.cost_center] = Dinero(); + if (!bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]]) + bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]] = + Dinero(); let lineDinero = Dinero({ amount: Math.round((line_val.actual_cost || 0) * 100), @@ -117,8 +130,10 @@ exports.default = async function (socket, jobid) { .multiply(line_val.quantity) .multiply(bill_val.is_credit_memo ? -1 : 1); - bill_acc[line_val.cost_center] = - bill_acc[line_val.cost_center].add(lineDinero); + bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]] = + bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]].add( + lineDinero + ); return null; }); return bill_acc; @@ -136,17 +151,19 @@ exports.default = async function (socket, jobid) { ), }); //Add it to the right cost center. - if (!costCenterHash[ticket.cost_center]) - costCenterHash[ticket.cost_center] = Dinero(); + if (!costCenterHash[selectedDmsAllocationConfig.costs[ticket.ciecacode]]) + costCenterHash[selectedDmsAllocationConfig.costs[ticket.ciecacode]] = + Dinero(); - costCenterHash[ticket.cost_center] = - costCenterHash[ticket.cost_center].add(TicketTotal); + costCenterHash[selectedDmsAllocationConfig.costs[ticket.ciecacode]] = + costCenterHash[selectedDmsAllocationConfig.costs[ticket.ciecacode]].add( + TicketTotal + ); }); if (!hasMapaLine && job.job_totals.rates.mapa.total.amount > 0) { // console.log("Adding MAPA Line Manually."); - const mapaAccountName = - bodyshop.md_responsibility_centers.defaults.profits.MAPA; + const mapaAccountName = selectedDmsAllocationConfig.profits.MAPA; const mapaAccount = bodyshop.md_responsibility_centers.profits.find( (c) => c.name === mapaAccountName @@ -167,8 +184,7 @@ exports.default = async function (socket, jobid) { if (!hasMashLine && job.job_totals.rates.mash.total.amount > 0) { // console.log("Adding MASH Line Manually."); - const mashAccountName = - bodyshop.md_responsibility_centers.defaults.profits.MASH; + const mashAccountName = selectedDmsAllocationConfig.profits.MASH; const mashAccount = bodyshop.md_responsibility_centers.profits.find( (c) => c.name === mashAccountName @@ -192,13 +208,12 @@ exports.default = async function (socket, jobid) { // ); taxAllocations.state.sale = taxAllocations.state.sale.add( - Dinero({ amount: (ca_bc_pvrt || 0) * 100 }) + Dinero({ amount: Math.round((ca_bc_pvrt || 0) * 100) }) ); } if (job.towing_payable && job.towing_payable !== 0) { - const towAccountName = - bodyshop.md_responsibility_centers.defaults.profits.TOW; + const towAccountName = selectedDmsAllocationConfig.profits.TOW; const towAccount = bodyshop.md_responsibility_centers.profits.find( (c) => c.name === towAccountName @@ -218,8 +233,7 @@ exports.default = async function (socket, jobid) { } } if (job.storage_payable && job.storage_payable !== 0) { - const storageAccountName = - bodyshop.md_responsibility_centers.defaults.profits.TOW; + const storageAccountName = selectedDmsAllocationConfig.profits.TOW; const towAccount = bodyshop.md_responsibility_centers.profits.find( (c) => c.name === storageAccountName @@ -242,8 +256,7 @@ exports.default = async function (socket, jobid) { } if (job.adjustment_bottom_line && job.adjustment_bottom_line !== 0) { - const otherAccountName = - bodyshop.md_responsibility_centers.defaults.profits.PAO; + const otherAccountName = selectedDmsAllocationConfig.profits.PAO; const otherAccount = bodyshop.md_responsibility_centers.profits.find( (c) => c.name === otherAccountName @@ -294,7 +307,20 @@ exports.default = async function (socket, jobid) { taxAllocations[key].cost.getAmount() > 0 ) .map((key) => { - return { ...taxAllocations[key], tax: key }; + if ( + key === "federal" && + selectedDmsAllocationConfig.gst_override && + selectedDmsAllocationConfig.gst_override !== "" + ) { + const ret = { ...taxAllocations[key], tax: key }; + ret.costCenter.dms_acctnumber = + selectedDmsAllocationConfig.gst_override; + ret.profitCenter.dms_acctnumber = + selectedDmsAllocationConfig.gst_override; + return ret; + } else { + return { ...taxAllocations[key], tax: key }; + } }), ]; } catch (error) { diff --git a/server/cdk/cdk-job-export.js b/server/cdk/cdk-job-export.js index 96c7335b9..14e39a3c1 100644 --- a/server/cdk/cdk-job-export.js +++ b/server/cdk/cdk-job-export.js @@ -784,7 +784,7 @@ async function UpdateDmsVehicle(socket) { return { id: { assigningPartyId: - o.id.value === socket.dmsCust.id.value ? "CURRENT" : "PREVIOUS", + o.id.value === socket.DMSCust.id.value ? "CURRENT" : "PREVIOUS", value: o.id.value, }, }; diff --git a/server/cdk/cdk-wsdl.js b/server/cdk/cdk-wsdl.js index 0cdb862b9..fedf33a9a 100644 --- a/server/cdk/cdk-wsdl.js +++ b/server/cdk/cdk-wsdl.js @@ -15,10 +15,10 @@ const CDK_CREDENTIALS = { }; exports.CDK_CREDENTIALS = CDK_CREDENTIALS; -// const cdkDomain = -// process.env.NODE_ENV === "production" -// ? "https://3pa.dmotorworks.com" -// : "https://uat-3pa.dmotorworks.com"; +const cdkDomain = + process.env.NODE_ENV === "production" + ? "https://3pa.dmotorworks.com" + : "https://uat-3pa.dmotorworks.com"; function CheckCdkResponseForError(socket, soapResponse) { if (!soapResponse[0]) { @@ -75,7 +75,7 @@ function checkIndividualResult(socket, ResultToCheck) { exports.checkIndividualResult = checkIndividualResult; -const cdkDomain = "https://uat-3pa.dmotorworks.com"; +//const cdkDomain = "https://uat-3pa.dmotorworks.com"; exports.default = { // VehicleSearch: `${cdkDomain}/pip-vehicle/services/VehicleSearch?wsdl`, HelpDataBase: `${cdkDomain}/pip-help-database-location/services/HelpDatabaseLocation?wsdl`, diff --git a/server/data/arms.js b/server/data/arms.js index b90fd66ba..81235f850 100644 --- a/server/data/arms.js +++ b/server/data/arms.js @@ -2,7 +2,7 @@ const path = require("path"); const queries = require("../graphql-client/queries"); const Dinero = require("dinero.js"); const moment = require("moment"); -var builder = require("xmlbuilder2"); + const _ = require("lodash"); const logger = require("../utils/logger"); require("dotenv").config({ @@ -11,9 +11,18 @@ require("dotenv").config({ `.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 uuid = require("uuid").v4; + +const momentFormat = "yyyy-MM-DDTHH:mm:ss.SSSSSSSZ"; + exports.default = async (req, res) => { //Query for the List of Bodyshop Clients. logger.log("arms-start", "DEBUG", "api", null, null); @@ -33,731 +42,733 @@ exports.default = async (req, res) => { }); const ret = jobs.map((job) => { const transId = uuid(); // Can this actually be the job id? - return { - RepairOrderFolderAddRq: { - RqUID: transId, - DocumentInfo: { - BMSVer: "4.0.0", - DocumentType: "Repair Order", - DocumentVerCode: "EM", - DocumentVerNum: GetSupplementNumber(job.joblines), //TODO Get Supplement Number - DocumentStatus: GetDocumentstatus(job, bodyshop), - CreateDateTime: moment().format(), - // TransmitDateTime: "2009-03-11T11:58:31.0404914-07:00", Omitted from ARMS docs - }, - EventInfo: { - AssignmentEvent: { - CreateDateTime: - job.asgn_date && moment(job.asgn_date).format(), - }, - EstimateEvent: { - UploadDateTime: "2009-03-02T17:00:00.0000000-08:00", //TODO Figure out what this actually is. 'Date Estimate was uploaded' - }, - RepairEvent: { - ArrivalDateTime: - job.date_open && moment(job.date_open).format(), - ArrivalOdometerReading: job.kmin, - TargetCompletionDateTime: - job.scheduled_completion && - moment(job.scheduled_completion).format(), - ActualCompletionDateTime: - job.actual_completion && - moment(job.actual_completion).format(), - ActualPickUpDateTime: - job.actual_delivery && moment(job.actual_delivery).format(), - CloseDateTime: - job.date_exported && moment(job.date_exported).format(), - }, - }, - RepairOrderHeader: { - AdminInfo: { - InsuranceCompany: { - Party: { - OrgInfo: { - CompanyName: job.ins_co_nm, - IDInfo: { - IDQualifierCode: "US", - IDNum: 44, // ** Not sure where to get this entegral ID from? - }, - Communications: [ - { - CommQualifier: "WA", - Address: { - Address1: job.ins_addr1, - Address2: job.ins_addr2, - City: job.ins_city, - StateProvince: job.ins_st, - PostalCode: job.ins_zip, - CountryCode: job.ins_ctry, - }, - }, - { - CommQualifier: "WP", - CommPhone: job.ins_ph1, - }, - { - CommQualifier: "WF", - CommPhone: job.ins_ph2, - }, - ], - }, - ContactInfo: { - ContactJobTitle: "Adjuster", - ContactName: { - FirstName: job.est_ct_fn, - LastName: job.est_ct_ln, - }, - }, - }, - }, - // InsuranceAgent: { - // Party: { - // OrgInfo: { - // CompanyName: "Nationwide Insurance", - // Communications: { - // CommQualifier: "WP", - // CommPhone: "714-5551212", - // }, - // }, - // ContactInfo: { - // ContactJobTitle: "Insurance Agent", - // ContactName: { - // FirstName: "Paul", - // LastName: "White", - // }, - // }, - // }, - // }, - Insured: { - Party: { - PersonInfo: { - PersonName: { - FirstName: job.insd_fn, - LastName: job.insd_ln, - }, - }, - }, - }, - Owner: { - Party: { - PersonInfo: { - PersonName: { - FirstName: job.ownr_fn, - LastName: job.ownr_ln, - }, - Communications: [ - { - CommQualifier: "HA", - Address: { - Address1: job.ownr_addr1, - City: job.ownr_city, - StateProvince: job.ownr_st, - PostalCode: job.ownr_zip, - CountryCode: job.ownr_ctry, - }, - }, - { - CommQualifier: "HP", - CommPhone: job.ownr_ph1, - }, - { - CommQualifier: "WP", - CommPhone: job.ownr_ph2, - }, - { - CommQualifier: "CP", - CommPhone: job.ownr_ph1, - }, - { - CommQualifier: "EM", - CommEmail: job.ownr_ea, - }, - ], - }, - }, - }, - Claimant: { - Party: { - PersonInfo: { - PersonName: { - FirstName: job.clm_ct_fn, - LastName: job.clm_ct_ln, - }, - }, - }, - OwnerInd: true, - }, - Estimator: { - Party: { - PersonInfo: { - PersonName: { - FirstName: job.est_ct_fn, - LastName: job.est_ct_ln, - }, - // IDInfo: { - // IDQualifierCode: "US", - // IDNum: 2941, - // }, - }, - }, - }, - RepairFacility: { - //This section not in documentation. - Party: { - OrgInfo: { - CompanyName: bodyshop.shopname, - IDInfo: { - IDQualifierCode: "US", - IDNum: bodyshop.entegral_id, - }, - }, - }, - }, - }, - RepairOrderIDs: { - RepairOrderNum: job.ro_number, - // VendorCode: "C", - // EstimateDocumentID: "1223HJ76", - }, - //RepairOrderType: "DRP", - //ReferralSourceType: "Yellow Pages", - VehicleInfo: { - VINInfo: { - VIN: { - VINNum: job.v_vin, - }, - }, - License: { - LicensePlateNum: job.plate_no, - }, - VehicleDesc: { - //ProductionDate: "2009-10", - ModelYear: job.v_model_yr, - MakeDesc: job.v_make_desc, - ModelName: job.v_model_desc, - }, - Paint: { - Exterior: { - Color: { - ColorName: job.v_color, - // OEMColorCode: "1M3", - }, - }, - }, - // Body: { - // BodyStyle: "2 Door Convertible", - // Trim: { - // TrimCode: "1B3", - // }, - // }, - Condition: { - DrivableInd: job.driveable ? "Y" : "N", - }, - }, - ClaimInfo: { - ClaimNum: job.clm_no, - PolicyInfo: { - PolicyNum: job.policy_no, - }, - LossInfo: { - Facts: { - LossDateTime: - job.loss_date && moment(job.loss_date).format(), - LossDescCode: "Collision", - PrimaryPOI: { - POICode: job.area_of_damage.impact1, - }, - SecondaryPOI: { - POICode: job.area_of_damage.impact2, - }, - }, - TotalLossInd: job.tlos_ind, - }, - }, - }, - ProfileInfo: { - //ProfileName: "Shop Standard Rates", - RateInfo: [ - { - RateType: "PA", - RateDesc: "Parts Tax", - TaxInfo: { - TaxType: "LS", - TaxableInd: true, - TaxTierInfo: { - TierNum: 1, - Percentage: 0, //TODO Find the best place to take the tax rates for parts. - }, - }, - }, - { - RateType: "LA", - RateDesc: "Labor Tax", - TaxInfo: { - TaxType: "LS", - TaxableInd: true, - TaxTierInfo: { - TierNum: 1, - Percentage: 0, //TODO Find the best place to take the tax rates for labor. - }, - }, - }, - { - RateType: "LAB", - RateDesc: "Body Labor", - RateTierInfo: { - TierNum: 1, - Rate: job.rate_lab, - }, - }, - { - RateType: "LAS", - RateDesc: "Structural Labor", - RateTierInfo: { - TierNum: 1, - Rate: job.rate_las, - }, - }, - { - RateType: "LAR", - RateDesc: "Refinish Labor", - RateTierInfo: { - TierNum: 1, - Rate: job.rate_lar, - }, - }, - { - RateType: "LAG", - RateDesc: "Glass Labor", - RateTierInfo: { - TierNum: 1, - Rate: job.rate_lag, - }, - }, - { - RateType: "LAF", - RateDesc: "Frame Labor", - RateTierInfo: { - TierNum: 1, - Rate: job.rate_laf, - }, - }, - { - RateType: "LAM", - RateDesc: "Mechancial Labor", - RateTierInfo: { - TierNum: 1, - Rate: job.rate_lam, - }, - }, - { - RateType: "LAU", - RateDesc: "User Defined Labor", - RateTierInfo: { - TierNum: 1, - Rate: job.rate_lau, - }, - }, - { - RateType: "MAPA", - RateDesc: "Paint Materials", - RateTierInfo: { - TierNum: 1, - Rate: job.rate_mapa, - ThresholdAmt: 0, - }, - MaterialCalcSettings: { - CalcMethodCode: 2, - CalcMaxAmt: 9999.99, //TODO Find threshold amts. - }, - }, - { - RateType: "MASH", - RateDesc: "Shop Materials", - RateTierInfo: { - TierNum: 1, - Rate: job.rate_mash, - }, - MaterialCalcSettings: { - CalcMethodCode: 4, - CalcMaxAmt: 9999.99, //TODO Find threshold amounts. - }, - }, - { - RateType: "MAHW", - RateDesc: "Hazardous Wastes Removal", - RateTierInfo: { - TierNum: 1, - Rate: job.rate_mahw, - }, - MaterialCalcSettings: { - //Todo Capture Calc Settings - CalcMethodCode: 2, - CalcMaxAmt: 10, - }, - }, - { - RateType: "MA2S", - RateDesc: "Two Stage Paint", - RateTierInfo: { - TierNum: 1, - Rate: job.rate_ma2s, - }, - MaterialCalcSettings: { - CalcMethodCode: 1, - CalcMaxAmt: 999999.99, - }, - }, - { - RateType: "MA2T", - RateDesc: "Two Tone Paint", - RateTierInfo: { - TierNum: 1, - Rate: job.rate_ma2t, - }, - MaterialCalcSettings: { - CalcMethodCode: 1, - CalcMaxAmt: 999999.99, - }, - }, - { - RateType: "MA3S", - RateDesc: "Three Stage Paint", - RateTierInfo: { - TierNum: 1, - Rate: job.rate_ma3s, - }, - MaterialCalcSettings: { - CalcMethodCode: 1, - CalcMaxAmt: 999999.99, - }, - }, - ], - }, - //StorageDuration: 17, - RepairTotalsInfo: { - LaborTotalsInfo: [ - { - TotalType: "LAB", - TotalTypeDesc: "Body Labor", - TotalHours: job.job_totals.rates.lab.hours, - TotalAmt: Dinero(job.job_totals.rates.lab.total).toFormat( - 0.0 - ), - }, - { - TotalType: "LAF", - TotalTypeDesc: "Frame Labor", - TotalHours: job.job_totals.rates.laf.hours, - TotalAmt: Dinero(job.job_totals.rates.laf.total).toFormat( - 0.0 - ), - }, - { - TotalType: "LAM", - TotalTypeDesc: "Mechanical Labor", - TotalHours: job.job_totals.rates.lam.hours, - TotalAmt: Dinero(job.job_totals.rates.lam.total).toFormat( - 0.0 - ), - }, - { - TotalType: "LAR", - TotalTypeDesc: "Refinish Labor", - TotalHours: job.job_totals.rates.lar.hours, - TotalAmt: Dinero(job.job_totals.rates.lar.total).toFormat( - 0.0 - ), - }, - ], - PartsTotalsInfo: [ - { - TotalType: "PAA", - TotalTypeDesc: "Aftermarket Parts", - TotalAmt: Dinero( - job.job_totals.parts.parts.list.paa && - job.job_totals.parts.parts.list.paa.total - ).toFormat("0.0"), - }, - { - TotalType: "PAC", - TotalTypeDesc: "Re-Chromed Parts", - TotalAmt: Dinero( - job.job_totals.parts.parts.list.pac && - job.job_totals.parts.parts.list.pac.total - ).toFormat("0.0"), - }, - { - TotalType: "PAG", - TotalTypeDesc: "Glass Parts", - TotalAmt: Dinero( - job.job_totals.parts.parts.list.pag && - job.job_totals.parts.parts.list.pag.total - ).toFormat("0.0"), - }, - { - TotalType: "PAL", - TotalTypeDesc: "LKQ/Used Parts", - TotalAmt: Dinero( - job.job_totals.parts.parts.list.pal && - job.job_totals.parts.parts.list.pal.total - ).toFormat("0.0"), - }, - { - TotalType: "PAM", - TotalTypeDesc: "Remanufactured Parts", - TotalAmt: Dinero( - job.job_totals.parts.parts.list.pam && - job.job_totals.parts.parts.list.pam.total - ).toFormat("0.0"), - }, - { - TotalType: "PAN", - TotalTypeDesc: "New Parts", - TotalAmt: Dinero( - job.job_totals.parts.parts.list.pan && - job.job_totals.parts.parts.list.pan.total - ).toFormat("0.0"), - }, - { - TotalType: "PAR", - TotalTypeDesc: "Recored Parts", - TotalAmt: Dinero( - job.job_totals.parts.parts.list.par && - job.job_totals.parts.parts.list.par.total - ).toFormat("0.0"), - }, - ], - OtherChargesTotalsInfo: [ - { - TotalType: "OTSL", - TotalTypeDesc: "Sublet", - TotalAmt: Dinero( - job.job_totals.parts.sublets.total - ).toFormat("0.0"), - }, - { - TotalType: "MAPA", - TotalTypeDesc: "Paint Materials", - TotalAmt: Dinero(job.job_totals.rates.mapa.total).toFormat( - 0.0 - ), - }, - { - TotalType: "MASH", - TotalTypeDesc: "Shop Materials", - TotalAmt: Dinero(job.job_totals.rates.mash.total).toFormat( - 0.0 - ), - }, - // { - // TotalType: "MAHW", - // TotalTypeDesc: "Hazardous Wastes Removal", - // TotalAmt: Dinero(job.job_totals.rates.mahw.total).toFormat( - // 0.0 - // ), - // }, - { - TotalType: "OTST", - TotalTypeDesc: "Storage", - TotalAmt: Dinero( - job.job_totals.additional.storage - ).toFormat("0.0"), - }, - { - TotalType: "OTTW", - TotalTypeDesc: "Towing", - TotalAmt: Dinero(job.job_totals.additional.towing).toFormat( - 0.0 - ), - }, - { - TotalType: "OTAC", - TotalTypeDesc: "Additional Charges", - TotalAmt: Dinero( - job.job_totals.additional.additionalCosts - ).toFormat("0.0"), - }, - ], - SummaryTotalsInfo: [ - { - TotalType: "TOT", - TotalSubType: "T2", - TotalTypeDesc: "Net Total", - TotalAmt: Dinero(job.job_totals.totals.subtotal).toFormat( - 0.0 - ), - }, - { - TotalType: "TOT", - TotalSubType: "F7", - TotalTypeDesc: "Sales Tax", - TotalAmt: Dinero(job.job_totals.totals.state_tax).toFormat( - 0.0 - ), - }, - { - TotalType: "TOT", - TotalSubType: "GST", - TotalTypeDesc: "GST Tax", - TotalAmt: Dinero( - job.job_totals.totals.federal_tax - ).toFormat("0.0"), - }, - { - TotalType: "TOT", - TotalSubType: "TT", - TotalTypeDesc: "Gross Total", - TotalAmt: Dinero( - job.job_totals.totals.total_repairs - ).toFormat("0.0"), - }, - // { - // TotalType: "TOT", - // TotalSubType: "SM", - // TotalTypeDesc: "Supplement Total", - // TotalAmt: 0, - // }, - { - TotalType: "TOT", - TotalSubType: "D2", - TotalTypeDesc: "Deductible", - TotalAmt: Dinero({ - amount: Math.round((job.ded_amt || 0) * 100), - }).toFormat("0.0"), - }, - { - TotalType: "TOT", - TotalSubType: "BTR", - TotalTypeDesc: "Betterment", - TotalAmt: Dinero( - job.job_totals.totals.custPayable.dep_taxes - ).toFormat("0.0"), - }, - { - TotalType: "TOT", - TotalSubType: "AA", - TotalTypeDesc: "Appearance Allowance", - TotalAmt: 0, - }, - { - TotalType: "TOT", - TotalSubType: "D8", - TotalTypeDesc: "Bottom Line Discount", - TotalAmt: Dinero( - job.job_totals.additional.adjustments - ).toFormat("0.0"), - }, - { - TotalType: "TOT", - TotalSubType: "INS", - TotalTypeDesc: "Insurance Pay", - TotalAmt: Dinero(job.job_totals.totals.total_repairs) - .subtract(Dinero(job.job_totals.totals.custPayable.total)) - .toFormat("0.0"), - }, - // { - // TotalType: "TOT", - // TotalSubType: "DEPOSIT", - // TotalTypeDesc: "Deposit", - // TotalAmt: 0, - // }, - { - TotalType: "TOT", - TotalSubType: "CUST", - TotalTypeDesc: "Customer Pay", - TotalAmt: Dinero( - job.job_totals.totals.custPayable.total - ).toFormat("0.0"), - }, - ], - RepairTotalsType: 1, - }, - // RepairLabor: { - // LaborAllocations: { - // LaborAllocation: [ - // { - // LaborAllocationUUID: - // "426cce3a-efa7-44d9-b76e-50b9102c4198", - // LaborType: "LAB", - // Technician: { - // Employee: { - // PersonInfo: { - // PersonName: { - // FirstName: "Jose", - // LastName: "Gonzalez", - // }, - // IDInfo: { - // IDQualifierCode: "US", - // IDNum: 2987, - // }, - // }, - // }, - // }, - // AllocatedHours: 3.5, - // }, - // { - // LaborAllocationUUID: - // "426cce3a-efa7-44d9-b76e-50b9102c4199", - // LaborType: "LAR", - // Technician: { - // Employee: { - // PersonInfo: { - // PersonName: { - // FirstName: "Rcardo", - // LastName: "Himenez", - // }, - // IDInfo: { - // IDQualifierCode: "US", - // IDNum: 2989, - // }, - // }, - // }, - // }, - // AllocatedHours: 5.5, - // }, - // ], - // }, - // }, - ProductionStatus: { - ProductionStage: { - ProductionStageCode: 4, - ProductionStageDateTime: "2009-03-11T11:58:32.1898319-07:00", - ProductionStageStatusComment: - "Going to be painted this afternoon", - }, - RepairStatus: { - RepairStatusCode: 2, - RepairStatusDateTime: "2009-03-11T11:58:32.1898319-07:00", - RepairStatusMemo: "Waiting on back ordered parts", - }, - }, - // RepairOrderNotes: { - // RepairOrderNote: { - // LineSequenceNum: 1, - // Note: "Revision Requested : approved--but needs est separated.8/22/2008 11:58:53 AM", - // CreateDateTime: "2008-08-22T11:58:53", - // AuthoredBy: { - // FirstName: { - // "#text": "Elizabeth/FirstName>", - // LastName: "Unis", - // }, - // }, - // RepairOrderNote: { - // LineSequenceNum: 2, - // Note: "Approved : 8/26/2008 12:21:08 PM", - // CreateDateTime: "2008-08-26T12:21:08", - // AuthoredBy: { - // FirstName: { - // "#text": "Elizabeth/FirstName>", - // LastName: "Unis", - // }, - // }, - // }, - // }, - // }, + return { + RqUID: transId, + DocumentInfo: { + BMSVer: "4.0.0", + DocumentType: "Repair Order", + DocumentVerCode: "EM", + DocumentVerNum: GetSupplementNumber(job.joblines), //TODO Get Supplement Number + DocumentStatus: GetDocumentstatus(job, bodyshop), + CreateDateTime: moment().format(momentFormat), + TransmitDateTime: moment().format(momentFormat), // Omitted from ARMS docs }, + EventInfo: { + AssignmentEvent: { + CreateDateTime: + job.asgn_date && moment(job.asgn_date).format(momentFormat), + }, + EstimateEvent: { + UploadDateTime: moment().format(momentFormat), + }, + RepairEvent: { + ArrivalDateTime: + job.date_open && moment(job.date_open).format(momentFormat), + ArrivalOdometerReading: job.kmin, + TargetCompletionDateTime: + job.scheduled_completion && + moment(job.scheduled_completion).format(momentFormat), + ActualCompletionDateTime: + job.actual_completion && + moment(job.actual_completion).format(momentFormat), + ActualPickUpDateTime: + job.actual_delivery && + moment(job.actual_delivery).format(momentFormat), + CloseDateTime: + job.date_exported && + moment(job.date_exported).format(momentFormat), + }, + }, + RepairOrderHeader: { + AdminInfo: { + InsuranceCompany: { + Party: { + OrgInfo: { + CompanyName: job.ins_co_nm, + IDInfo: { + IDQualifierCode: "US", + IDNum: 44, // ** Not sure where to get this entegral ID from? + }, + Communications: [ + { + CommQualifier: "WA", + Address: { + Address1: job.ins_addr1, + Address2: job.ins_addr2, + City: job.ins_city, + StateProvince: job.ins_st, + PostalCode: job.ins_zip, + CountryCode: job.ins_ctry, + }, + }, + { + CommQualifier: "WP", + CommPhone: job.ins_ph1, + }, + { + CommQualifier: "WF", + CommPhone: job.ins_ph2, + }, + ], + }, + ContactInfo: { + ContactJobTitle: "Adjuster", + ContactName: { + FirstName: job.est_ct_fn, + LastName: job.est_ct_ln, + }, + }, + }, + }, + // InsuranceAgent: { + // Party: { + // OrgInfo: { + // CompanyName: "Nationwide Insurance", + // Communications: { + // CommQualifier: "WP", + // CommPhone: "714-5551212", + // }, + // }, + // ContactInfo: { + // ContactJobTitle: "Insurance Agent", + // ContactName: { + // FirstName: "Paul", + // LastName: "White", + // }, + // }, + // }, + // }, + Insured: { + Party: { + PersonInfo: { + PersonName: { + FirstName: job.insd_fn, + LastName: job.insd_ln, + }, + }, + }, + }, + Owner: { + Party: { + PersonInfo: { + PersonName: { + FirstName: job.ownr_fn, + LastName: job.ownr_ln, + }, + Communications: [ + { + CommQualifier: "HA", + Address: { + Address1: job.ownr_addr1, + + City: job.ownr_city, + StateProvince: job.ownr_st, + PostalCode: job.ownr_zip, + CountryCode: job.ownr_ctry, + }, + }, + { + CommQualifier: "HP", + CommPhone: job.ownr_ph1, + }, + { + CommQualifier: "WP", + CommPhone: job.ownr_ph2, + }, + { + CommQualifier: "CP", + CommPhone: job.ownr_ph1, + }, + { + CommQualifier: "EM", + CommEmail: job.ownr_ea, + }, + ], + }, + }, + }, + Claimant: { + Party: { + PersonInfo: { + PersonName: { + FirstName: job.clm_ct_fn, + LastName: job.clm_ct_ln, + }, + }, + }, + OwnerInd: true, + }, + Estimator: { + Party: { + PersonInfo: { + PersonName: { + FirstName: job.est_ct_fn, + LastName: job.est_ct_ln, + }, + // IDInfo: { + // IDQualifierCode: "US", + // IDNum: 2941, + // }, + }, + }, + }, + RepairFacility: { + //This section not in documentation. + Party: { + OrgInfo: { + CompanyName: bodyshop.shopname, + IDInfo: { + IDQualifierCode: "US", + IDNum: bodyshop.entegral_id, + }, + }, + }, + }, + }, + RepairOrderIDs: { + RepairOrderNum: job.ro_number, + // VendorCode: "C", + // EstimateDocumentID: "1223HJ76", + }, + //RepairOrderType: "DRP", + //ReferralSourceType: "Yellow Pages", + VehicleInfo: { + VINInfo: { + VIN: { + VINNum: job.v_vin, + }, + }, + License: { + LicensePlateNum: job.plate_no, + }, + VehicleDesc: { + //ProductionDate: "2009-10", + ModelYear: job.v_model_yr, + MakeDesc: job.v_make_desc, + ModelName: job.v_model_desc, + }, + Paint: { + Exterior: { + Color: { + ColorName: job.v_color, + // OEMColorCode: "1M3", + }, + }, + }, + // Body: { + // BodyStyle: "2 Door Convertible", + // Trim: { + // TrimCode: "1B3", + // }, + // }, + Condition: { + DrivableInd: job.driveable ? "Y" : "N", + }, + }, + ClaimInfo: { + ClaimNum: job.clm_no, + PolicyInfo: { + PolicyNum: job.policy_no, + }, + LossInfo: { + Facts: { + LossDateTime: + job.loss_date && + moment(job.loss_date).format(momentFormat), + LossDescCode: "Collision", + PrimaryPOI: { + POICode: job.area_of_damage && job.area_of_damage.impact1, + }, + SecondaryPOI: { + POICode: job.area_of_damage && job.area_of_damage.impact2, + }, + }, + TotalLossInd: job.tlos_ind, + }, + }, + }, + ProfileInfo: { + //ProfileName: "Shop Standard Rates", + RateInfo: [ + { + RateType: "PA", + RateDesc: "Parts Tax", + TaxInfo: { + TaxType: "LS", + TaxableInd: true, + TaxTierInfo: { + TierNum: 1, + Percentage: 0, //TODO Find the best place to take the tax rates for parts. + }, + }, + }, + { + RateType: "LA", + RateDesc: "Labor Tax", + TaxInfo: { + TaxType: "LS", + TaxableInd: true, + TaxTierInfo: { + TierNum: 1, + Percentage: 0, //TODO Find the best place to take the tax rates for labor. + }, + }, + }, + { + RateType: "LAB", + RateDesc: "Body Labor", + RateTierInfo: { + TierNum: 1, + Rate: job.rate_lab, + }, + }, + { + RateType: "LAS", + RateDesc: "Structural Labor", + RateTierInfo: { + TierNum: 1, + Rate: job.rate_las, + }, + }, + { + RateType: "LAR", + RateDesc: "Refinish Labor", + RateTierInfo: { + TierNum: 1, + Rate: job.rate_lar, + }, + }, + { + RateType: "LAG", + RateDesc: "Glass Labor", + RateTierInfo: { + TierNum: 1, + Rate: job.rate_lag, + }, + }, + { + RateType: "LAF", + RateDesc: "Frame Labor", + RateTierInfo: { + TierNum: 1, + Rate: job.rate_laf, + }, + }, + { + RateType: "LAM", + RateDesc: "Mechancial Labor", + RateTierInfo: { + TierNum: 1, + Rate: job.rate_lam, + }, + }, + { + RateType: "LAU", + RateDesc: "User Defined Labor", + RateTierInfo: { + TierNum: 1, + Rate: job.rate_lau, + }, + }, + { + RateType: "MAPA", + RateDesc: "Paint Materials", + RateTierInfo: { + TierNum: 1, + Rate: job.rate_mapa, + ThresholdAmt: 0, + }, + MaterialCalcSettings: { + CalcMethodCode: 2, + CalcMaxAmt: 9999.99, //TODO Find threshold amts. + }, + }, + { + RateType: "MASH", + RateDesc: "Shop Materials", + RateTierInfo: { + TierNum: 1, + Rate: job.rate_mash, + }, + MaterialCalcSettings: { + CalcMethodCode: 4, + CalcMaxAmt: 9999.99, //TODO Find threshold amounts. + }, + }, + { + RateType: "MAHW", + RateDesc: "Hazardous Wastes Removal", + RateTierInfo: { + TierNum: 1, + Rate: job.rate_mahw, + }, + MaterialCalcSettings: { + //Todo Capture Calc Settings + CalcMethodCode: 2, + CalcMaxAmt: 10, + }, + }, + { + RateType: "MA2S", + RateDesc: "Two Stage Paint", + RateTierInfo: { + TierNum: 1, + Rate: job.rate_ma2s, + }, + MaterialCalcSettings: { + CalcMethodCode: 1, + CalcMaxAmt: 999999.99, + }, + }, + { + RateType: "MA2T", + RateDesc: "Two Tone Paint", + RateTierInfo: { + TierNum: 1, + Rate: job.rate_ma2t, + }, + MaterialCalcSettings: { + CalcMethodCode: 1, + CalcMaxAmt: 999999.99, + }, + }, + { + RateType: "MA3S", + RateDesc: "Three Stage Paint", + RateTierInfo: { + TierNum: 1, + Rate: job.rate_ma3s, + }, + MaterialCalcSettings: { + CalcMethodCode: 1, + CalcMaxAmt: 999999.99, + }, + }, + ], + }, + //StorageDuration: 17, + RepairTotalsInfo: { + LaborTotalsInfo: [ + { + TotalType: "LAB", + TotalTypeDesc: "Body Labor", + TotalHours: job.job_totals.rates.lab.hours, + TotalAmt: Dinero(job.job_totals.rates.lab.total).toFormat( + "0.0" + ), + }, + { + TotalType: "LAF", + TotalTypeDesc: "Frame Labor", + TotalHours: job.job_totals.rates.laf.hours, + TotalAmt: Dinero(job.job_totals.rates.laf.total).toFormat( + "0.0" + ), + }, + { + TotalType: "LAM", + TotalTypeDesc: "Mechanical Labor", + TotalHours: job.job_totals.rates.lam.hours, + TotalAmt: Dinero(job.job_totals.rates.lam.total).toFormat( + "0.0" + ), + }, + { + TotalType: "LAR", + TotalTypeDesc: "Refinish Labor", + TotalHours: job.job_totals.rates.lar.hours, + TotalAmt: Dinero(job.job_totals.rates.lar.total).toFormat( + "0.0" + ), + }, + ], + PartsTotalsInfo: [ + { + TotalType: "PAA", + TotalTypeDesc: "Aftermarket Parts", + TotalAmt: Dinero( + job.job_totals.parts.parts.list.paa && + job.job_totals.parts.parts.list.paa.total + ).toFormat("0.0"), + }, + { + TotalType: "PAC", + TotalTypeDesc: "Re-Chromed Parts", + TotalAmt: Dinero( + job.job_totals.parts.parts.list.pac && + job.job_totals.parts.parts.list.pac.total + ).toFormat("0.0"), + }, + { + TotalType: "PAG", + TotalTypeDesc: "Glass Parts", + TotalAmt: Dinero( + job.job_totals.parts.parts.list.pag && + job.job_totals.parts.parts.list.pag.total + ).toFormat("0.0"), + }, + { + TotalType: "PAL", + TotalTypeDesc: "LKQ/Used Parts", + TotalAmt: Dinero( + job.job_totals.parts.parts.list.pal && + job.job_totals.parts.parts.list.pal.total + ).toFormat("0.0"), + }, + { + TotalType: "PAM", + TotalTypeDesc: "Remanufactured Parts", + TotalAmt: Dinero( + job.job_totals.parts.parts.list.pam && + job.job_totals.parts.parts.list.pam.total + ).toFormat("0.0"), + }, + { + TotalType: "PAN", + TotalTypeDesc: "New Parts", + TotalAmt: Dinero( + job.job_totals.parts.parts.list.pan && + job.job_totals.parts.parts.list.pan.total + ).toFormat("0.0"), + }, + { + TotalType: "PAR", + TotalTypeDesc: "Recored Parts", + TotalAmt: Dinero( + job.job_totals.parts.parts.list.par && + job.job_totals.parts.parts.list.par.total + ).toFormat("0.0"), + }, + ], + OtherChargesTotalsInfo: [ + { + TotalType: "OTSL", + TotalTypeDesc: "Sublet", + TotalAmt: Dinero(job.job_totals.parts.sublets.total).toFormat( + "0.0" + ), + }, + { + TotalType: "MAPA", + TotalTypeDesc: "Paint Materials", + TotalAmt: Dinero(job.job_totals.rates.mapa.total).toFormat( + "0.0" + ), + }, + { + TotalType: "MASH", + TotalTypeDesc: "Shop Materials", + TotalAmt: Dinero(job.job_totals.rates.mash.total).toFormat( + "0.0" + ), + }, + // { + // TotalType: "MAHW", + // TotalTypeDesc: "Hazardous Wastes Removal", + // TotalAmt: Dinero(job.job_totals.rates.mahw.total).toFormat( + // 0.0 + // ), + // }, + { + TotalType: "OTST", + TotalTypeDesc: "Storage", + TotalAmt: Dinero(job.job_totals.additional.storage).toFormat( + "0.0" + ), + }, + { + TotalType: "OTTW", + TotalTypeDesc: "Towing", + TotalAmt: Dinero(job.job_totals.additional.towing).toFormat( + "0.0" + ), + }, + { + TotalType: "OTAC", + TotalTypeDesc: "Additional Charges", + TotalAmt: Dinero( + job.job_totals.additional.additionalCosts + ).toFormat("0.0"), + }, + ], + SummaryTotalsInfo: [ + { + TotalType: "TOT", + TotalSubType: "T2", + TotalTypeDesc: "Net Total", + TotalAmt: Dinero(job.job_totals.totals.subtotal).toFormat( + "0.0" + ), + }, + { + TotalType: "TOT", + TotalSubType: "F7", + TotalTypeDesc: "Sales Tax", + TotalAmt: Dinero(job.job_totals.totals.state_tax).toFormat( + "0.0" + ), + }, + { + TotalType: "TOT", + TotalSubType: "GST", + TotalTypeDesc: "GST Tax", + TotalAmt: Dinero(job.job_totals.totals.federal_tax).toFormat( + "0.0" + ), + }, + { + TotalType: "TOT", + TotalSubType: "TT", + TotalTypeDesc: "Gross Total", + TotalAmt: Dinero( + job.job_totals.totals.total_repairs + ).toFormat("0.0"), + }, + // { + // TotalType: "TOT", + // TotalSubType: "SM", + // TotalTypeDesc: "Supplement Total", + // TotalAmt: 0, + // }, + { + TotalType: "TOT", + TotalSubType: "D2", + TotalTypeDesc: "Deductible", + TotalAmt: Dinero({ + amount: Math.round((job.ded_amt || 0) * 100), + }).toFormat("0.0"), + }, + { + TotalType: "TOT", + TotalSubType: "BTR", + TotalTypeDesc: "Betterment", + TotalAmt: Dinero( + job.job_totals.totals.custPayable.dep_taxes + ).toFormat("0.0"), + }, + { + TotalType: "TOT", + TotalSubType: "AA", + TotalTypeDesc: "Appearance Allowance", + TotalAmt: 0, + }, + { + TotalType: "TOT", + TotalSubType: "D8", + TotalTypeDesc: "Bottom Line Discount", + TotalAmt: Dinero( + job.job_totals.additional.adjustments + ).toFormat("0.0"), + }, + { + TotalType: "TOT", + TotalSubType: "INS", + TotalTypeDesc: "Insurance Pay", + TotalAmt: Dinero(job.job_totals.totals.total_repairs) + .subtract(Dinero(job.job_totals.totals.custPayable.total)) + .toFormat("0.0"), + }, + // { + // TotalType: "TOT", + // TotalSubType: "DEPOSIT", + // TotalTypeDesc: "Deposit", + // TotalAmt: 0, + // }, + { + TotalType: "TOT", + TotalSubType: "CUST", + TotalTypeDesc: "Customer Pay", + TotalAmt: Dinero( + job.job_totals.totals.custPayable.total + ).toFormat("0.0"), + }, + ], + RepairTotalsType: 1, + }, + // RepairLabor: { + // LaborAllocations: { + // LaborAllocation: [ + // { + // LaborAllocationUUID: + // "426cce3a-efa7-44d9-b76e-50b9102c4198", + // LaborType: "LAB", + // Technician: { + // Employee: { + // PersonInfo: { + // PersonName: { + // FirstName: "Jose", + // LastName: "Gonzalez", + // }, + // IDInfo: { + // IDQualifierCode: "US", + // IDNum: 2987, + // }, + // }, + // }, + // }, + // AllocatedHours: 3.5, + // }, + // { + // LaborAllocationUUID: + // "426cce3a-efa7-44d9-b76e-50b9102c4199", + // LaborType: "LAR", + // Technician: { + // Employee: { + // PersonInfo: { + // PersonName: { + // FirstName: "Rcardo", + // LastName: "Himenez", + // }, + // IDInfo: { + // IDQualifierCode: "US", + // IDNum: 2989, + // }, + // }, + // }, + // }, + // AllocatedHours: 5.5, + // }, + // ], + // }, + // }, + ProductionStatus: { + ProductionStage: { + ProductionStageCode: GetProductionStageCode(job), + ProductionStageDateTime: moment().format(momentFormat), + // ProductionStageStatusComment: + // "Going to be painted this afternoon", + }, + RepairStatus: { + RepairStatusCode: GetRepairStatusCode(job), + RepairStatusDateTime: moment().format(momentFormat), + // RepairStatusMemo: "Waiting on back ordered parts", + }, + }, + // RepairOrderNotes: { + // RepairOrderNote: { + // LineSequenceNum: 1, + // Note: "Revision Requested : approved--but needs est separated.8/22/2008 11:58:53 AM", + // CreateDateTime: "2008-08-22T11:58:53", + // AuthoredBy: { + // FirstName: { + // "#text": "Elizabeth/FirstName>", + // LastName: "Unis", + // }, + // }, + // RepairOrderNote: { + // LineSequenceNum: 2, + // Note: "Approved : 8/26/2008 12:21:08 PM", + // CreateDateTime: "2008-08-26T12:21:08", + // AuthoredBy: { + // FirstName: { + // "#text": "Elizabeth/FirstName>", + // LastName: "Unis", + // }, + // }, + // }, + // }, + // }, }; }); @@ -771,7 +782,42 @@ exports.default = async (req, res) => { logger.log("arms-end-shop-extract", "DEBUG", "api", bodyshop.id, { 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) { //Error at the shop level. 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) { res.status(200).json(error); } }; function GetSupplementNumber(joblines) { + return 0; return _.max(joblines.map((jl) => jl.line_ind)); } @@ -809,9 +856,37 @@ function GetDocumentstatus(job, bodyshop) { return "V"; case bodyshop.md_ro_statuses.default_invoiced: case bodyshop.md_ro_statuses.default_exported: - return "V"; + return "Z"; 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]; + } } } diff --git a/server/graphql-client/queries.js b/server/graphql-client/queries.js index 99d4c6545..fd30f7242 100644 --- a/server/graphql-client/queries.js +++ b/server/graphql-client/queries.js @@ -253,6 +253,7 @@ query QUERY_JOBS_FOR_PBS_EXPORT($id: uuid!) { ro_number clm_total clm_no + dms_allocation invoice_allocation ownerid ownr_ln @@ -1200,6 +1201,7 @@ exports.GET_CDK_ALLOCATIONS = `query QUERY_JOB_CLOSE_DETAILS($id: uuid!) { cdk_configuration } ro_number + dms_allocation invoice_allocation ins_co_id id @@ -1254,12 +1256,14 @@ exports.GET_CDK_ALLOCATIONS = `query QUERY_JOB_CLOSE_DETAILS($id: uuid!) { actual_delivery scheduled_in actual_in + ca_bc_pvrt timetickets { id actualhrs cost_center productivehrs rate + ciecacode employee { flat_rate }