Compare commits
15 Commits
rrScratch1
...
feature/IO
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
521a7084b7 | ||
|
|
a3c71fdfc0 | ||
|
|
90edf94fee | ||
|
|
123066f1cd | ||
|
|
a153cca3c0 | ||
|
|
35c7c32c8e | ||
|
|
6d6b64ebc3 | ||
|
|
c954695d3c | ||
|
|
338d8e2136 | ||
|
|
6674206b4f | ||
|
|
c46ad521d1 | ||
|
|
66e5bec4d8 | ||
|
|
0d3161ef84 | ||
|
|
1cd11bdc18 | ||
|
|
9cce2696e2 |
@@ -26,6 +26,7 @@ import { CalculateBillTotal } from "../bill-form/bill-form.totals.utility";
|
|||||||
import { handleUpload as handleLocalUpload } from "../documents-local-upload/documents-local-upload.utility";
|
import { handleUpload as handleLocalUpload } from "../documents-local-upload/documents-local-upload.utility";
|
||||||
import { handleUpload } from "../documents-upload/documents-upload.utility";
|
import { handleUpload } from "../documents-upload/documents-upload.utility";
|
||||||
import { handleUpload as handleUploadToImageProxy } from "../documents-upload-imgproxy/documents-upload-imgproxy.utility";
|
import { handleUpload as handleUploadToImageProxy } from "../documents-upload-imgproxy/documents-upload-imgproxy.utility";
|
||||||
|
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
billEnterModal: selectBillEnterModal,
|
billEnterModal: selectBillEnterModal,
|
||||||
@@ -450,7 +451,9 @@ function BillEnterModalContainer({ billEnterModal, toggleModalVisible, bodyshop,
|
|||||||
setEnterAgain(false);
|
setEnterAgain(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<BillFormContainer form={form} disableInvNumber={billEnterModal.context.disableInvNumber} />
|
<RbacWrapper action="bills:enter">
|
||||||
|
<BillFormContainer form={form} disableInvNumber={billEnterModal.context.disableInvNumber} />
|
||||||
|
</RbacWrapper>
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const mapDispatchToProps = () => ({
|
|||||||
export function TechHeader({ technician }) {
|
export function TechHeader({ technician }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<Header style={{ textAlign: "center" }}>
|
<Header style={{ textAlign: "center", height: "auto", overflow: "visible" }}>
|
||||||
<Typography.Title style={{ color: "#fff" }}>
|
<Typography.Title style={{ color: "#fff" }}>
|
||||||
{technician
|
{technician
|
||||||
? t("tech.labels.loggedin", {
|
? t("tech.labels.loggedin", {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useMutation, useQuery } from "@apollo/client";
|
import { useMutation, useQuery } from "@apollo/client";
|
||||||
import { Button, Card, Col, Form, InputNumber, Popover, Row, Select } from "antd";
|
import { Button, Card, Form, InputNumber, Popover, Select, Space } from "antd";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -124,103 +124,12 @@ export function TechClockOffButton({
|
|||||||
cost_center: isShiftTicket ? "timetickets.labels.shift" : technician ? technician.cost_center : null
|
cost_center: isShiftTicket ? "timetickets.labels.shift" : technician ? technician.cost_center : null
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Row gutter={[16, 16]}>
|
<Space direction="vertical">
|
||||||
<Col span={!isShiftTicket ? 8 : 24}>
|
{!isShiftTicket ? (
|
||||||
{!isShiftTicket ? (
|
<div>
|
||||||
<div>
|
|
||||||
<Form.Item
|
|
||||||
label={t("timetickets.fields.actualhrs")}
|
|
||||||
name="actualhrs"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
}
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<InputNumber min={0} precision={1} />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label={t("timetickets.fields.productivehrs")}
|
|
||||||
name="productivehrs"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
({ getFieldValue }) => ({
|
|
||||||
validator(rule, value) {
|
|
||||||
if (!bodyshop.tt_enforce_hours_for_tech_console) {
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
if (!value || getFieldValue("cost_center") === null || !lineTicketData)
|
|
||||||
return Promise.resolve();
|
|
||||||
|
|
||||||
//Check the cost center,
|
|
||||||
const totals = CalculateAllocationsTotals(
|
|
||||||
bodyshop,
|
|
||||||
lineTicketData.joblines,
|
|
||||||
lineTicketData.timetickets,
|
|
||||||
lineTicketData.jobs_by_pk.lbr_adjustments
|
|
||||||
);
|
|
||||||
|
|
||||||
const fieldTypeToCheck =
|
|
||||||
bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber ? "mod_lbr_ty" : "cost_center";
|
|
||||||
|
|
||||||
const costCenterDiff =
|
|
||||||
Math.round(
|
|
||||||
totals.find((total) => total[fieldTypeToCheck] === getFieldValue("cost_center"))
|
|
||||||
?.difference * 10
|
|
||||||
) / 10;
|
|
||||||
|
|
||||||
if (value > costCenterDiff)
|
|
||||||
return Promise.reject(t("timetickets.validation.hoursenteredmorethanavailable"));
|
|
||||||
else {
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<InputNumber min={0} precision={1} />
|
|
||||||
</Form.Item>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
<Form.Item
|
|
||||||
name="cost_center"
|
|
||||||
label={t("timetickets.fields.cost_center")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
}
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Select disabled={isShiftTicket}>
|
|
||||||
{isShiftTicket ? (
|
|
||||||
<Select.Option value="timetickets.labels.shift">{t("timetickets.labels.shift")}</Select.Option>
|
|
||||||
) : (
|
|
||||||
emps &&
|
|
||||||
emps.rates.map((item) => (
|
|
||||||
<Select.Option key={item.cost_center}>
|
|
||||||
{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}
|
|
||||||
</Select.Option>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</Select>
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
{isShiftTicket ? (
|
|
||||||
<div></div>
|
|
||||||
) : (
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="status"
|
label={t("timetickets.fields.actualhrs")}
|
||||||
label={t("jobs.fields.status")}
|
name="actualhrs"
|
||||||
initialValue={lineTicketData && lineTicketData.jobs_by_pk.status}
|
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true
|
required: true
|
||||||
@@ -228,35 +137,117 @@ export function TechClockOffButton({
|
|||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Select>
|
<InputNumber min={0} precision={1} />
|
||||||
{bodyshop.md_ro_statuses.production_statuses.map((item) => (
|
|
||||||
<Select.Option key={item}></Select.Option>
|
|
||||||
))}
|
|
||||||
</Select>
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
<Form.Item
|
||||||
<Button type="primary" htmlType="submit" loading={loading}>
|
label={t("timetickets.fields.productivehrs")}
|
||||||
{t("general.actions.save")}
|
name="productivehrs"
|
||||||
</Button>
|
rules={[
|
||||||
<TechJobClockoutDelete completedCallback={completedCallback} timeTicketId={timeTicketId} />
|
{
|
||||||
</Col>
|
required: true
|
||||||
{!isShiftTicket && (
|
//message: t("general.validation.required"),
|
||||||
<Col span={16}>
|
},
|
||||||
<LaborAllocationContainer
|
({ getFieldValue }) => ({
|
||||||
jobid={jobId || null}
|
validator(rule, value) {
|
||||||
loading={queryLoading}
|
if (!bodyshop.tt_enforce_hours_for_tech_console) {
|
||||||
lineTicketData={lineTicketData}
|
return Promise.resolve();
|
||||||
/>
|
}
|
||||||
</Col>
|
if (!value || getFieldValue("cost_center") === null || !lineTicketData)
|
||||||
|
return Promise.resolve();
|
||||||
|
//Check the cost center,
|
||||||
|
const totals = CalculateAllocationsTotals(
|
||||||
|
bodyshop,
|
||||||
|
lineTicketData.joblines,
|
||||||
|
lineTicketData.timetickets,
|
||||||
|
lineTicketData.jobs_by_pk.lbr_adjustments
|
||||||
|
);
|
||||||
|
const fieldTypeToCheck =
|
||||||
|
bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber ? "mod_lbr_ty" : "cost_center";
|
||||||
|
const costCenterDiff =
|
||||||
|
Math.round(
|
||||||
|
totals.find((total) => total[fieldTypeToCheck] === getFieldValue("cost_center"))
|
||||||
|
?.difference * 10
|
||||||
|
) / 10;
|
||||||
|
if (value > costCenterDiff)
|
||||||
|
return Promise.reject(t("timetickets.validation.hoursenteredmorethanavailable"));
|
||||||
|
else {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<InputNumber min={0} precision={1} />
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
<Form.Item
|
||||||
|
name="cost_center"
|
||||||
|
label={t("timetickets.fields.cost_center")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Select disabled={isShiftTicket}>
|
||||||
|
{isShiftTicket ? (
|
||||||
|
<Select.Option value="timetickets.labels.shift">{t("timetickets.labels.shift")}</Select.Option>
|
||||||
|
) : (
|
||||||
|
emps &&
|
||||||
|
emps.rates.map((item) => (
|
||||||
|
<Select.Option key={item.cost_center}>
|
||||||
|
{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}
|
||||||
|
</Select.Option>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
{isShiftTicket ? (
|
||||||
|
<div></div>
|
||||||
|
) : (
|
||||||
|
<Form.Item
|
||||||
|
name="status"
|
||||||
|
label={t("jobs.fields.status")}
|
||||||
|
initialValue={lineTicketData && lineTicketData.jobs_by_pk.status}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Select>
|
||||||
|
{bodyshop.md_ro_statuses.production_statuses.map((item) => (
|
||||||
|
<Select.Option key={item}></Select.Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
</Row>
|
<Button type="primary" htmlType="submit" loading={loading}>
|
||||||
|
{t("general.actions.save")}
|
||||||
|
</Button>
|
||||||
|
<TechJobClockoutDelete completedCallback={completedCallback} timeTicketId={timeTicketId} />
|
||||||
|
{!isShiftTicket && (
|
||||||
|
<LaborAllocationContainer jobid={jobId || null} loading={queryLoading} lineTicketData={lineTicketData} />
|
||||||
|
)}
|
||||||
|
</Space>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover content={overlay} trigger="click">
|
<Popover
|
||||||
|
content={<div style={{ maxHeight: "75vh", overflowY: "auto" }}>{overlay}</div>}
|
||||||
|
trigger="click"
|
||||||
|
getPopupContainer={() => document.querySelector('#time-ticket-modal')}
|
||||||
|
>
|
||||||
<Button loading={loading} {...otherBtnProps}>
|
<Button loading={loading} {...otherBtnProps}>
|
||||||
{t("timetickets.actions.clockout")}
|
{t("timetickets.actions.clockout")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -3209,6 +3209,7 @@
|
|||||||
"parts_not_recieved_vendor": "Parts Not Received by Vendor",
|
"parts_not_recieved_vendor": "Parts Not Received by Vendor",
|
||||||
"parts_received_not_scheduled": "Parts Received for Jobs Not Scheduled",
|
"parts_received_not_scheduled": "Parts Received for Jobs Not Scheduled",
|
||||||
"payments_by_date": "Payments by Date",
|
"payments_by_date": "Payments by Date",
|
||||||
|
"payments_by_date_excel": "Payments by Date - Excel",
|
||||||
"payments_by_date_payment": "Payments by Date and Payment Type",
|
"payments_by_date_payment": "Payments by Date and Payment Type",
|
||||||
"payments_by_date_type": "Payments by Date and Customer Type",
|
"payments_by_date_type": "Payments by Date and Customer Type",
|
||||||
"production_by_category": "Production by Category",
|
"production_by_category": "Production by Category",
|
||||||
|
|||||||
@@ -3209,6 +3209,7 @@
|
|||||||
"parts_not_recieved_vendor": "",
|
"parts_not_recieved_vendor": "",
|
||||||
"parts_received_not_scheduled": "",
|
"parts_received_not_scheduled": "",
|
||||||
"payments_by_date": "",
|
"payments_by_date": "",
|
||||||
|
"payments_by_date_excel": "",
|
||||||
"payments_by_date_payment": "",
|
"payments_by_date_payment": "",
|
||||||
"payments_by_date_type": "",
|
"payments_by_date_type": "",
|
||||||
"production_by_category": "",
|
"production_by_category": "",
|
||||||
|
|||||||
@@ -3209,6 +3209,7 @@
|
|||||||
"parts_not_recieved_vendor": "",
|
"parts_not_recieved_vendor": "",
|
||||||
"parts_received_not_scheduled": "",
|
"parts_received_not_scheduled": "",
|
||||||
"payments_by_date": "",
|
"payments_by_date": "",
|
||||||
|
"payments_by_date_excel": "",
|
||||||
"payments_by_date_payment": "",
|
"payments_by_date_payment": "",
|
||||||
"payments_by_date_type": "",
|
"payments_by_date_type": "",
|
||||||
"production_by_category": "",
|
"production_by_category": "",
|
||||||
|
|||||||
@@ -1218,6 +1218,18 @@ export const TemplateList = (type, context) => {
|
|||||||
},
|
},
|
||||||
group: "customers"
|
group: "customers"
|
||||||
},
|
},
|
||||||
|
payments_by_date_excel: {
|
||||||
|
title: i18n.t("reportcenter.templates.payments_by_date_excel"),
|
||||||
|
subject: i18n.t("reportcenter.templates.payments_by_date_excel"),
|
||||||
|
key: "payments_by_date_excel",
|
||||||
|
reporttype: "excel",
|
||||||
|
disabled: false,
|
||||||
|
rangeFilter: {
|
||||||
|
object: i18n.t("reportcenter.labels.objects.payments"),
|
||||||
|
field: i18n.t("payments.fields.date")
|
||||||
|
},
|
||||||
|
group: "customers"
|
||||||
|
},
|
||||||
schedule: {
|
schedule: {
|
||||||
title: i18n.t("reportcenter.templates.schedule"),
|
title: i18n.t("reportcenter.templates.schedule"),
|
||||||
subject: i18n.t("reportcenter.templates.schedule"),
|
subject: i18n.t("reportcenter.templates.schedule"),
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- alter table "public"."media_analytics" add column "unique_documents" numeric
|
||||||
|
-- null;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."media_analytics" add column "unique_documents" numeric
|
||||||
|
null;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- alter table "public"."media_analytics" add column "duplicate_documents" numeric
|
||||||
|
-- null;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."media_analytics" add column "duplicate_documents" numeric
|
||||||
|
null;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- alter table "public"."media_analytics_detail" add column "unique_documents" numeric
|
||||||
|
-- null;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."media_analytics_detail" add column "unique_documents" numeric
|
||||||
|
null;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- alter table "public"."media_analytics_detail" add column "duplicate_documents" numeric
|
||||||
|
-- null;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."media_analytics_detail" add column "duplicate_documents" numeric
|
||||||
|
null;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table "public"."media_analytics_detail" rename column "unique_document_count" to "unique_documents";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table "public"."media_analytics_detail" rename column "unique_documents" to "unique_document_count";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table "public"."media_analytics_detail" rename column "duplicate_count" to "duplicate_documents";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table "public"."media_analytics_detail" rename column "duplicate_documents" to "duplicate_count";
|
||||||
@@ -234,11 +234,10 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
|||||||
const ret = {
|
const ret = {
|
||||||
ro_number: crypto.createHash("md5").update(job.id, "utf8").digest("hex"),
|
ro_number: crypto.createHash("md5").update(job.id, "utf8").digest("hex"),
|
||||||
v_vin: job.v_vin || "",
|
v_vin: job.v_vin || "",
|
||||||
v_year: job.v_model_yr
|
v_year: (() => {
|
||||||
? parseInt(job.v_model_yr.match(/\d/g))
|
const y = parseInt(job.v_model_yr);
|
||||||
? parseInt(job.v_model_yr.match(/\d/g).join(""), 10)
|
return isNaN(y) ? null : y < 100 ? y + (y >= (new Date().getFullYear() + 1) % 100 ? 1900 : 2000) : y;
|
||||||
: ""
|
})(),
|
||||||
: "",
|
|
||||||
v_make: job.v_makedesc || "",
|
v_make: job.v_makedesc || "",
|
||||||
v_model: job.v_model || "",
|
v_model: job.v_model || "",
|
||||||
|
|
||||||
|
|||||||
@@ -286,11 +286,10 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
|||||||
const ret = {
|
const ret = {
|
||||||
ro_number: crypto.createHash("md5").update(job.ro_number, "utf8").digest("hex"),
|
ro_number: crypto.createHash("md5").update(job.ro_number, "utf8").digest("hex"),
|
||||||
v_vin: job.v_vin || "",
|
v_vin: job.v_vin || "",
|
||||||
v_year: job.v_model_yr
|
v_year: (() => {
|
||||||
? parseInt(job.v_model_yr.match(/\d/g))
|
const y = parseInt(job.v_model_yr);
|
||||||
? parseInt(job.v_model_yr.match(/\d/g).join(""), 10)
|
return isNaN(y) ? null : y < 100 ? y + (y >= (new Date().getFullYear() + 1) % 100 ? 1900 : 2000) : y;
|
||||||
: ""
|
})(),
|
||||||
: "",
|
|
||||||
v_make: job.v_make_desc || "",
|
v_make: job.v_make_desc || "",
|
||||||
v_model: job.v_model_desc || "",
|
v_model: job.v_model_desc || "",
|
||||||
|
|
||||||
|
|||||||
@@ -219,8 +219,6 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const repairCosts = CreateCosts(job);
|
const repairCosts = CreateCosts(job);
|
||||||
const jobline = CreateJobLines(job.joblines);
|
|
||||||
const timeticket = CreateTimeTickets(job.timetickets);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const ret = {
|
const ret = {
|
||||||
@@ -290,8 +288,100 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
|||||||
(job.date_exported && moment(job.date_exported).tz(job.bodyshop.timezone).format(DateFormat)) || "",
|
(job.date_exported && moment(job.date_exported).tz(job.bodyshop.timezone).format(DateFormat)) || "",
|
||||||
DateVoid: (job.date_void && moment(job.date_void).tz(job.bodyshop.timezone).format(DateFormat)) || ""
|
DateVoid: (job.date_void && moment(job.date_void).tz(job.bodyshop.timezone).format(DateFormat)) || ""
|
||||||
},
|
},
|
||||||
JobLineDetails: { jobline },
|
JobLineDetails: (function () {
|
||||||
TimeTicketDetails: { timeticket },
|
const joblineSource = Array.isArray(job.joblines) ? job.joblines : job.joblines ? [job.joblines] : [];
|
||||||
|
if (joblineSource.length === 0) return { jobline: [] };
|
||||||
|
return {
|
||||||
|
jobline: joblineSource.map((jl = {}) => ({
|
||||||
|
line_description: jl.line_desc || jl.line_description || "",
|
||||||
|
oem_part_no: jl.oem_partno || jl.oem_part_no || "",
|
||||||
|
alt_part_no: jl.alt_partno || jl.alt_part_no || "",
|
||||||
|
op_code_desc: jl.op_code_desc || "",
|
||||||
|
part_type: jl.part_type || "",
|
||||||
|
part_qty: jl.part_qty ?? jl.quantity ?? 0,
|
||||||
|
part_price: jl.act_price ?? jl.part_price ?? 0,
|
||||||
|
labor_type: jl.mod_lbr_ty || jl.labor_type || "",
|
||||||
|
labor_hours: jl.mod_lb_hrs ?? jl.labor_hours ?? 0,
|
||||||
|
labor_sale: jl.lbr_amt ?? jl.labor_sale ?? 0
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
})(),
|
||||||
|
BillsDetails: (function () {
|
||||||
|
const billsSource = Array.isArray(job.bills) ? job.bills : job.bills ? [job.bills] : [];
|
||||||
|
if (billsSource.length === 0) return { BillDetails: [] };
|
||||||
|
return {
|
||||||
|
BillDetails: billsSource.map(
|
||||||
|
({
|
||||||
|
billlines = [],
|
||||||
|
date = "",
|
||||||
|
is_credit_memo = false,
|
||||||
|
invoice_number = "",
|
||||||
|
isinhouse = false,
|
||||||
|
vendor = {}
|
||||||
|
} = {}) => ({
|
||||||
|
BillLines: {
|
||||||
|
BillLine: billlines.map((bl = {}) => ({
|
||||||
|
line_description: bl.line_desc || bl.line_description || "",
|
||||||
|
part_price: bl.actual_price ?? bl.part_price ?? bl.act_price ?? 0,
|
||||||
|
actual_cost: bl.actual_cost ?? 0,
|
||||||
|
cost_center: bl.cost_center || "",
|
||||||
|
deductedfromlbr: bl.deductedfromlbr || false,
|
||||||
|
part_qty: bl.quantity ?? bl.part_qty ?? 0,
|
||||||
|
oem_part_no: bl.oem_partno || bl.oem_part_no || "",
|
||||||
|
alt_part_no: bl.alt_partno || bl.alt_part_no || ""
|
||||||
|
}))
|
||||||
|
},
|
||||||
|
date,
|
||||||
|
is_credit_memo,
|
||||||
|
invoice_number,
|
||||||
|
isinhouse,
|
||||||
|
vendorName: vendor.name || ""
|
||||||
|
})
|
||||||
|
)
|
||||||
|
};
|
||||||
|
})(),
|
||||||
|
JobNotes: (function () {
|
||||||
|
const notesSource = Array.isArray(job.notes) ? job.notes : job.notes ? [job.notes] : [];
|
||||||
|
if (notesSource.length === 0) return { JobNote: [] };
|
||||||
|
return {
|
||||||
|
JobNote: notesSource.map((note = {}) => ({
|
||||||
|
created_at: note.created_at || "",
|
||||||
|
created_by: note.created_by || "",
|
||||||
|
critical: note.critical || false,
|
||||||
|
private: note.private || false,
|
||||||
|
text: note.text || "",
|
||||||
|
type: note.type || ""
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
})(),
|
||||||
|
TimeTicketDetails: (function () {
|
||||||
|
const ticketSource = Array.isArray(job.timetickets)
|
||||||
|
? job.timetickets
|
||||||
|
: job.timetickets
|
||||||
|
? [job.timetickets]
|
||||||
|
: [];
|
||||||
|
if (ticketSource.length === 0) return { timeticket: [] };
|
||||||
|
return {
|
||||||
|
timeticket: ticketSource.map((ticket = {}) => ({
|
||||||
|
date: ticket.date || "",
|
||||||
|
employee:
|
||||||
|
ticket.employee && ticket.employee.employee_number
|
||||||
|
? ticket.employee.employee_number
|
||||||
|
.trim()
|
||||||
|
.concat(" - ", ticket.employee.first_name.trim(), " ", ticket.employee.last_name.trim())
|
||||||
|
.trim()
|
||||||
|
: "",
|
||||||
|
productive_hrs: ticket.productivehrs ?? 0,
|
||||||
|
actual_hrs: ticket.actualhrs ?? 0,
|
||||||
|
cost_center: ticket.cost_center || "",
|
||||||
|
flat_rate: ticket.flat_rate || false,
|
||||||
|
rate: ticket.rate ?? 0,
|
||||||
|
ticket_cost: ticket.flat_rate
|
||||||
|
? ticket.rate * (ticket.productivehrs || 0)
|
||||||
|
: ticket.rate * (ticket.actualhrs || 0)
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
})(),
|
||||||
Sales: {
|
Sales: {
|
||||||
Labour: {
|
Labour: {
|
||||||
Aluminum: Dinero(job.job_totals.rates.laa.total).toFormat(DineroFormat),
|
Aluminum: Dinero(job.job_totals.rates.laa.total).toFormat(DineroFormat),
|
||||||
@@ -636,42 +726,3 @@ const CreateCosts = (job) => {
|
|||||||
}, 0)
|
}, 0)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const CreateJobLines = (joblines) => {
|
|
||||||
const repairLines = [];
|
|
||||||
joblines.forEach((jobline) => {
|
|
||||||
repairLines.push({
|
|
||||||
line_description: jobline.line_desc,
|
|
||||||
oem_part_no: jobline.oem_partno,
|
|
||||||
alt_part_no: jobline.alt_partno,
|
|
||||||
op_code_desc: jobline.op_code_desc,
|
|
||||||
part_type: jobline.part_type,
|
|
||||||
part_qty: jobline.part_qty,
|
|
||||||
part_price: jobline.act_price,
|
|
||||||
labor_type: jobline.mod_lbr_ty,
|
|
||||||
labor_hours: jobline.mod_lb_hrs,
|
|
||||||
labor_sale: jobline.lbr_amt
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return repairLines;
|
|
||||||
};
|
|
||||||
|
|
||||||
const CreateTimeTickets = (timetickets) => {
|
|
||||||
const timeTickets = [];
|
|
||||||
timetickets.forEach((ticket) => {
|
|
||||||
timeTickets.push({
|
|
||||||
date: ticket.date,
|
|
||||||
employee: ticket.employee.employee_number
|
|
||||||
.trim()
|
|
||||||
.concat(" - ", ticket.employee.first_name.trim(), " ", ticket.employee.last_name.trim())
|
|
||||||
.trim(),
|
|
||||||
productive_hrs: ticket.productivehrs,
|
|
||||||
actual_hrs: ticket.actualhrs,
|
|
||||||
cost_center: ticket.cost_center,
|
|
||||||
flat_rate: ticket.flat_rate,
|
|
||||||
rate: ticket.rate,
|
|
||||||
ticket_cost: ticket.flat_rate ? ticket.rate * ticket.productive_hrs : ticket.rate * ticket.actual_hrs
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return timeTickets;
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ exports.default = async (req, res) => {
|
|||||||
"patrick.fic@convenient-brands.com",
|
"patrick.fic@convenient-brands.com",
|
||||||
"bradley.rhoades@convenient-brands.com",
|
"bradley.rhoades@convenient-brands.com",
|
||||||
"jrome@rometech.com",
|
"jrome@rometech.com",
|
||||||
"ivana@imexsystems.ca"
|
"ivana@imexsystems.ca",
|
||||||
|
"support@imexsystems.ca",
|
||||||
|
"sarah@rometech.com"
|
||||||
],
|
],
|
||||||
subject: `RO Usage Report - ${moment().format("MM/DD/YYYY")}`,
|
subject: `RO Usage Report - ${moment().format("MM/DD/YYYY")}`,
|
||||||
text: `
|
text: `
|
||||||
|
|||||||
@@ -1219,7 +1219,7 @@ query ENTEGRAL_EXPORT($bodyshopid: uuid!) {
|
|||||||
}`;
|
}`;
|
||||||
|
|
||||||
exports.KAIZEN_QUERY = `query KAIZEN_EXPORT($start: timestamptz, $bodyshopid: uuid!, $end: timestamptz) {
|
exports.KAIZEN_QUERY = `query KAIZEN_EXPORT($start: timestamptz, $bodyshopid: uuid!, $end: timestamptz) {
|
||||||
bodyshops_by_pk(id: $bodyshopid){
|
bodyshops_by_pk(id: $bodyshopid) {
|
||||||
id
|
id
|
||||||
shopname
|
shopname
|
||||||
address1
|
address1
|
||||||
@@ -1246,15 +1246,24 @@ exports.KAIZEN_QUERY = `query KAIZEN_EXPORT($start: timestamptz, $bodyshopid: uu
|
|||||||
bills {
|
bills {
|
||||||
billlines {
|
billlines {
|
||||||
actual_cost
|
actual_cost
|
||||||
|
actual_price
|
||||||
cost_center
|
cost_center
|
||||||
|
deductedfromlbr
|
||||||
id
|
id
|
||||||
|
line_desc
|
||||||
quantity
|
quantity
|
||||||
}
|
}
|
||||||
|
date
|
||||||
federal_tax_rate
|
federal_tax_rate
|
||||||
id
|
id
|
||||||
is_credit_memo
|
is_credit_memo
|
||||||
|
invoice_number
|
||||||
|
isinhouse
|
||||||
local_tax_rate
|
local_tax_rate
|
||||||
state_tax_rate
|
state_tax_rate
|
||||||
|
vendor {
|
||||||
|
name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
created_at
|
created_at
|
||||||
clm_no
|
clm_no
|
||||||
@@ -1296,7 +1305,7 @@ exports.KAIZEN_QUERY = `query KAIZEN_EXPORT($start: timestamptz, $bodyshopid: uu
|
|||||||
joblines(where: {removed: {_eq: false}}) {
|
joblines(where: {removed: {_eq: false}}) {
|
||||||
act_price
|
act_price
|
||||||
alt_partno
|
alt_partno
|
||||||
billlines(order_by: {bill: {date: desc_nulls_last}} limit: 1) {
|
billlines(order_by: {bill: {date: desc_nulls_last}}, limit: 1) {
|
||||||
actual_cost
|
actual_cost
|
||||||
actual_price
|
actual_price
|
||||||
quantity
|
quantity
|
||||||
@@ -1319,8 +1328,8 @@ exports.KAIZEN_QUERY = `query KAIZEN_EXPORT($start: timestamptz, $bodyshopid: uu
|
|||||||
mod_lbr_ty
|
mod_lbr_ty
|
||||||
oem_partno
|
oem_partno
|
||||||
op_code_desc
|
op_code_desc
|
||||||
parts_order_lines(order_by: {parts_order: {order_date: desc_nulls_last}} limit: 1){
|
parts_order_lines(order_by: {parts_order: {order_date: desc_nulls_last}}, limit: 1) {
|
||||||
parts_order{
|
parts_order {
|
||||||
id
|
id
|
||||||
order_date
|
order_date
|
||||||
}
|
}
|
||||||
@@ -1339,6 +1348,14 @@ exports.KAIZEN_QUERY = `query KAIZEN_EXPORT($start: timestamptz, $bodyshopid: uu
|
|||||||
jobid
|
jobid
|
||||||
totalliquidcost
|
totalliquidcost
|
||||||
}
|
}
|
||||||
|
notes {
|
||||||
|
created_at
|
||||||
|
created_by
|
||||||
|
critical
|
||||||
|
private
|
||||||
|
text
|
||||||
|
type
|
||||||
|
}
|
||||||
ownr_addr1
|
ownr_addr1
|
||||||
ownr_addr2
|
ownr_addr2
|
||||||
ownr_city
|
ownr_city
|
||||||
@@ -2204,16 +2221,18 @@ exports.UPDATE_OLD_TRANSITION = `mutation UPDATE_OLD_TRANSITION($jobid: uuid!, $
|
|||||||
|
|
||||||
exports.INSERT_NEW_TRANSITION = (
|
exports.INSERT_NEW_TRANSITION = (
|
||||||
includeOldTransition
|
includeOldTransition
|
||||||
) => `mutation INSERT_NEW_TRANSITION($newTransition: transitions_insert_input!, ${includeOldTransition ? `$oldTransitionId: uuid!, $duration: numeric` : ""
|
) => `mutation INSERT_NEW_TRANSITION($newTransition: transitions_insert_input!, ${
|
||||||
}) {
|
includeOldTransition ? `$oldTransitionId: uuid!, $duration: numeric` : ""
|
||||||
|
}) {
|
||||||
insert_transitions_one(object: $newTransition) {
|
insert_transitions_one(object: $newTransition) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
${includeOldTransition
|
${
|
||||||
? `update_transitions(where: {id: {_eq: $oldTransitionId}}, _set: {duration: $duration}) {
|
includeOldTransition
|
||||||
|
? `update_transitions(where: {id: {_eq: $oldTransitionId}}, _set: {duration: $duration}) {
|
||||||
affected_rows
|
affected_rows
|
||||||
}`
|
}`
|
||||||
: ""
|
: ""
|
||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
@@ -3152,11 +3171,10 @@ exports.DELETE_PHONE_NUMBER_OPT_OUT = `
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
||||||
exports.INSERT_MEDIA_ANALYTICS = `
|
exports.INSERT_MEDIA_ANALYTICS = `
|
||||||
mutation INSERT_MEDIA_ANALYTICS($mediaObject: media_analytics_insert_input!) {
|
mutation INSERT_MEDIA_ANALYTICS($mediaObject: media_analytics_insert_input!) {
|
||||||
insert_media_analytics_one(object: $mediaObject) {
|
insert_media_analytics_one(object: $mediaObject) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`;
|
||||||
|
|||||||
Reference in New Issue
Block a user