WIP PBS AP.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { SyncOutlined } from "@ant-design/icons";
|
||||
import { Button, Card, Table, Typography } from "antd";
|
||||
import { Button, Card, Form, Input, Table } from "antd";
|
||||
import Dinero from "dinero.js";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -29,52 +29,49 @@ export function DmsAllocationsSummaryAp({ socket, bodyshop, billids, title }) {
|
||||
if (socket.connected) {
|
||||
socket.emit("pbs-calculate-allocations-ap", billids, (ack) => {
|
||||
setAllocationsSummary(ack);
|
||||
|
||||
socket.allocationsSummary = ack;
|
||||
});
|
||||
}
|
||||
}, [socket, socket.connected, billids]);
|
||||
|
||||
console.log(allocationsSummary);
|
||||
const columns = [
|
||||
{
|
||||
title: t("jobs.fields.dms.center"),
|
||||
dataIndex: "center",
|
||||
key: "center",
|
||||
title: t("jobs.fields.ro_number"),
|
||||
dataIndex: ["Posting", "Reference"],
|
||||
key: "reference",
|
||||
},
|
||||
|
||||
{
|
||||
title: t("jobs.fields.dms.sale"),
|
||||
dataIndex: "sale",
|
||||
key: "sale",
|
||||
render: (text, record) => Dinero(record.sale).toFormat(),
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.dms.cost"),
|
||||
dataIndex: "cost",
|
||||
key: "cost",
|
||||
render: (text, record) => Dinero(record.cost).toFormat(),
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.dms.sale_dms_acctnumber"),
|
||||
dataIndex: "sale_dms_acctnumber",
|
||||
key: "sale_dms_acctnumber",
|
||||
render: (text, record) =>
|
||||
record.profitCenter && record.profitCenter.dms_acctnumber,
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.dms.cost_dms_acctnumber"),
|
||||
dataIndex: "cost_dms_acctnumber",
|
||||
key: "cost_dms_acctnumber",
|
||||
render: (text, record) =>
|
||||
record.costCenter && record.costCenter.dms_acctnumber,
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.dms.dms_wip_acctnumber"),
|
||||
dataIndex: "dms_wip_acctnumber",
|
||||
key: "dms_wip_acctnumber",
|
||||
render: (text, record) =>
|
||||
record.costCenter && record.costCenter.dms_wip_acctnumber,
|
||||
title: t("jobs.fields.dms.lines"),
|
||||
dataIndex: "Lines",
|
||||
key: "Lines",
|
||||
render: (text, record) => (
|
||||
<table style={{ tableLayout: "auto" }}>
|
||||
<tr>
|
||||
<th>{t("bills.fields.invoice_number")}</th>
|
||||
<th>{t("bodyshop.fields.dms.dms_acctnumber")}</th>
|
||||
<th>{t("jobs.fields.dms.amount")}</th>
|
||||
</tr>
|
||||
{record.Posting.Lines.map((l, idx) => (
|
||||
<tr key={idx}>
|
||||
<td>{l.InvoiceNumber}</td>
|
||||
<td>{l.Account}</td>
|
||||
<td>{Dinero(l.Amount).toFormat()}</td>
|
||||
</tr>
|
||||
))}
|
||||
</table>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
const handleFinish = async (values) => {
|
||||
socket.emit(`pbs-export-ap`, {
|
||||
billids,
|
||||
txEnvelope: values,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={title}
|
||||
@@ -93,46 +90,31 @@ export function DmsAllocationsSummaryAp({ socket, bodyshop, billids, title }) {
|
||||
<Table
|
||||
pagination={{ position: "top", defaultPageSize: 50 }}
|
||||
columns={columns}
|
||||
rowKey="center"
|
||||
rowKey={(record) => `${record.InvoiceNumber}${record.Account}`}
|
||||
dataSource={allocationsSummary}
|
||||
locale={{ emptyText: t("dms.labels.refreshallocations") }}
|
||||
summary={() => {
|
||||
const totals =
|
||||
allocationsSummary &&
|
||||
allocationsSummary.reduce(
|
||||
(acc, val) => {
|
||||
return {
|
||||
totalSale: acc.totalSale.add(Dinero(val.sale)),
|
||||
totalCost: acc.totalCost.add(Dinero(val.cost)),
|
||||
};
|
||||
},
|
||||
{
|
||||
totalSale: Dinero(),
|
||||
totalCost: Dinero(),
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<Table.Summary.Row>
|
||||
<Table.Summary.Cell>
|
||||
<Typography.Title level={4}>
|
||||
{t("general.labels.totals")}
|
||||
</Typography.Title>
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell>
|
||||
{totals && totals.totalSale.toFormat()}
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell>
|
||||
{
|
||||
// totals.totalCost.toFormat()
|
||||
}
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell></Table.Summary.Cell>
|
||||
<Table.Summary.Cell></Table.Summary.Cell>
|
||||
</Table.Summary.Row>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<Form layout="vertical" onFinish={handleFinish}>
|
||||
<Form.Item
|
||||
name="journal"
|
||||
label={t("jobs.fields.dms.journal")}
|
||||
initialValue={
|
||||
bodyshop.cdk_configuration &&
|
||||
bodyshop.cdk_configuration.default_journal
|
||||
}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Button disabled={!socket.allocationsSummary} htmlType="submit">
|
||||
{t("jobs.actions.dms.post")}
|
||||
</Button>
|
||||
</Form>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4536,68 +4536,71 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
||||
<Input />
|
||||
</Form.Item> */}
|
||||
</LayoutFormRow>
|
||||
{/* <LayoutFormRow>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenters.ap")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "ap", "name"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenter_accountnumber")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "ap", "accountnumber"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenter_accountname")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "ap", "accountname"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenter_accountdesc")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "ap", "accountdesc"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenter_accountitem")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "ap", "accountitem"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
</LayoutFormRow> */}
|
||||
|
||||
{DmsAp.treatment === "on" && (
|
||||
<LayoutFormRow header={t("bodyshop.fields.responsibilitycenters.ap")}>
|
||||
{/* <Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenters.ap")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "ap", "name"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item> */}
|
||||
{/* <Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenter_accountnumber")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "ap", "accountnumber"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item> */}
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenter_accountname")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "ap", "accountname"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenter_accountdesc")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "ap", "accountdesc"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.dms.dms_acctnumber")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "ap", "dms_acctnumber"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
)}
|
||||
<LayoutFormRow header={<div>Refund</div>}>
|
||||
{/* <Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenters.refund")}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { DeleteFilled } from "@ant-design/icons";
|
||||
import { useApolloClient } from "@apollo/client";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import {
|
||||
Button,
|
||||
Divider,
|
||||
@@ -20,7 +21,23 @@ import PhoneFormItem, {
|
||||
} from "../form-items-formatted/phone-form-item.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import VendorsPhonebookAdd from "../vendors-phonebook-add/vendors-phonebook-add.component";
|
||||
export default function VendorsFormComponent({
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(VendorsFormComponent);
|
||||
|
||||
export function VendorsFormComponent({
|
||||
bodyshop,
|
||||
form,
|
||||
formLoading,
|
||||
handleDelete,
|
||||
@@ -29,6 +46,12 @@ export default function VendorsFormComponent({
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const client = useApolloClient();
|
||||
const { DmsAp } = useTreatments(
|
||||
["DmsAp"],
|
||||
{},
|
||||
bodyshop && bodyshop.imexshopid
|
||||
);
|
||||
|
||||
const { getFieldValue } = form;
|
||||
return (
|
||||
<div>
|
||||
@@ -184,6 +207,12 @@ export default function VendorsFormComponent({
|
||||
// </Form.Item>
|
||||
}
|
||||
</LayoutFormRow>
|
||||
|
||||
{DmsAp.treatment === "on" && (
|
||||
<Form.Item label={t("vendors.fields.dmsid")} name="dmsid">
|
||||
<Input />
|
||||
</Form.Item>
|
||||
)}
|
||||
<Divider align="left">{t("vendors.labels.preferredmakes")}</Divider>
|
||||
<Form.List name="favorite">
|
||||
{(fields, { add, remove }) => {
|
||||
|
||||
@@ -18,6 +18,7 @@ export const QUERY_VENDOR_BY_ID = gql`
|
||||
street1
|
||||
active
|
||||
phone
|
||||
dmsid
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Button, Card, Col, notification, Row, Select, Space } from "antd";
|
||||
import queryString from "query-string";
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -7,9 +6,7 @@ import { useHistory, useLocation } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import SocketIO from "socket.io-client";
|
||||
import DmsAllocationsSummaryApComponent from "../../components/dms-allocations-summary-ap/dms-allocations-summary-ap.component";
|
||||
import DmsCustomerSelector from "../../components/dms-customer-selector/dms-customer-selector.component";
|
||||
import DmsLogEvents from "../../components/dms-log-events/dms-log-events.component";
|
||||
import DmsPostForm from "../../components/dms-post-form/dms-post-form.component";
|
||||
import { auth } from "../../firebase/firebase.utils";
|
||||
import {
|
||||
setBreadcrumbs,
|
||||
@@ -47,10 +44,9 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) {
|
||||
const [logLevel, setLogLevel] = useState("DEBUG");
|
||||
const history = useHistory();
|
||||
const [logs, setLogs] = useState([]);
|
||||
const search = queryString.parse(useLocation().search);
|
||||
|
||||
const { state } = useLocation();
|
||||
|
||||
const { jobId } = search;
|
||||
const logsRef = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -109,24 +105,13 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) {
|
||||
|
||||
return (
|
||||
<div>
|
||||
DMS PAYABLES SCREEN
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col md={24} lg={10}>
|
||||
<Col span={24}>
|
||||
<DmsAllocationsSummaryApComponent
|
||||
socket={socket}
|
||||
billids={state?.billids}
|
||||
/>
|
||||
</Col>
|
||||
<Col md={24} lg={14}>
|
||||
{/* <DmsPostForm
|
||||
socket={socket}
|
||||
jobId={jobId}
|
||||
// job={data && data.jobs_by_pk}
|
||||
logsRef={logsRef}
|
||||
/> */}
|
||||
</Col>
|
||||
|
||||
<DmsCustomerSelector />
|
||||
|
||||
<Col span={24}>
|
||||
<div ref={logsRef}>
|
||||
|
||||
@@ -1355,6 +1355,7 @@
|
||||
"depreciation_taxes": "Depreciation/Taxes",
|
||||
"dms": {
|
||||
"address": "Customer Address",
|
||||
"amount": "Amount",
|
||||
"center": "Center",
|
||||
"cost": "Cost",
|
||||
"cost_dms_acctnumber": "Cost DMS Acct #",
|
||||
@@ -1364,6 +1365,7 @@
|
||||
"id": "DMS ID",
|
||||
"inservicedate": "In Service Date",
|
||||
"journal": "Journal #",
|
||||
"lines": "Posting Lines",
|
||||
"name1": "Customer Name",
|
||||
"payer": {
|
||||
"amount": "Amount",
|
||||
@@ -2801,6 +2803,7 @@
|
||||
"country": "Country",
|
||||
"discount": "Discount % (as decimal)",
|
||||
"display_name": "Display Name",
|
||||
"dmsid": "DMS ID",
|
||||
"due_date": "Payment Due Date (# of days)",
|
||||
"email": "Contact Email",
|
||||
"favorite": "Favorite?",
|
||||
|
||||
@@ -1355,6 +1355,7 @@
|
||||
"depreciation_taxes": "Depreciación / Impuestos",
|
||||
"dms": {
|
||||
"address": "",
|
||||
"amount": "",
|
||||
"center": "",
|
||||
"cost": "",
|
||||
"cost_dms_acctnumber": "",
|
||||
@@ -1364,6 +1365,7 @@
|
||||
"id": "",
|
||||
"inservicedate": "",
|
||||
"journal": "",
|
||||
"lines": "",
|
||||
"name1": "",
|
||||
"payer": {
|
||||
"amount": "",
|
||||
@@ -2801,6 +2803,7 @@
|
||||
"country": "País",
|
||||
"discount": "% De descuento",
|
||||
"display_name": "Nombre para mostrar",
|
||||
"dmsid": "",
|
||||
"due_date": "Fecha de vencimiento del pago",
|
||||
"email": "Email de contacto",
|
||||
"favorite": "¿Favorito?",
|
||||
|
||||
@@ -1355,6 +1355,7 @@
|
||||
"depreciation_taxes": "Amortissement / taxes",
|
||||
"dms": {
|
||||
"address": "",
|
||||
"amount": "",
|
||||
"center": "",
|
||||
"cost": "",
|
||||
"cost_dms_acctnumber": "",
|
||||
@@ -1364,6 +1365,7 @@
|
||||
"id": "",
|
||||
"inservicedate": "",
|
||||
"journal": "",
|
||||
"lines": "",
|
||||
"name1": "",
|
||||
"payer": {
|
||||
"amount": "",
|
||||
@@ -2801,6 +2803,7 @@
|
||||
"country": "Pays",
|
||||
"discount": "Remise %",
|
||||
"display_name": "Afficher un nom",
|
||||
"dmsid": "",
|
||||
"due_date": "Date limite de paiement",
|
||||
"email": "Email du contact",
|
||||
"favorite": "Préféré?",
|
||||
|
||||
Reference in New Issue
Block a user