Merged in release/2021-12-10 (pull request #298)
release/2021-12-10 Approved-by: Patrick Fic
This commit is contained in:
@@ -15,7 +15,6 @@ import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
||||
import { useHistory } from "react-router-dom";
|
||||
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
currentUser: selectCurrentUser,
|
||||
@@ -30,7 +29,7 @@ export function JobsCloseExportButton({
|
||||
}) {
|
||||
const history = useHistory();
|
||||
const { t } = useTranslation();
|
||||
const [updateJob] = useMutation(UPDATE_JOB);
|
||||
const [updateJob] = useMutation(UPDATE_JOB, {});
|
||||
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
@@ -46,13 +45,9 @@ export function JobsCloseExportButton({
|
||||
//Check if it's a QBO Setup.
|
||||
let PartnerResponse;
|
||||
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) {
|
||||
PartnerResponse = await axios.post(
|
||||
`/qbo/receivables`,
|
||||
{
|
||||
jobIds: [jobId],
|
||||
},
|
||||
|
||||
);
|
||||
PartnerResponse = await axios.post(`/qbo/receivables`, {
|
||||
jobIds: [jobId],
|
||||
});
|
||||
} else {
|
||||
//Default is QBD
|
||||
|
||||
@@ -155,6 +150,7 @@ export function JobsCloseExportButton({
|
||||
date_exported: new Date(),
|
||||
},
|
||||
},
|
||||
refetchQueries: ["QUERY_JOBS_FOR_EXPORT "],
|
||||
});
|
||||
|
||||
if (!jobUpdateResponse.errors) {
|
||||
|
||||
@@ -28,7 +28,9 @@ export function JobsExportAllButton({
|
||||
completedCallback,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [updateJob] = useMutation(UPDATE_JOBS);
|
||||
const [updateJob] = useMutation(UPDATE_JOBS, {
|
||||
refetchQueries: ["QUERY_JOBS_FOR_EXPORT "],
|
||||
});
|
||||
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
@@ -29,7 +29,9 @@ export function PayableExportAll({
|
||||
completedCallback,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [updateBill] = useMutation(UPDATE_BILLS);
|
||||
const [updateBill] = useMutation(UPDATE_BILLS, {
|
||||
refetchQueries: ["QUERY_BILLS_FOR_EXPORT "],
|
||||
});
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
|
||||
|
||||
|
||||
@@ -28,7 +28,9 @@ export function PayableExportButton({
|
||||
setSelectedBills,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [updateBill] = useMutation(UPDATE_BILLS);
|
||||
const [updateBill] = useMutation(UPDATE_BILLS, {
|
||||
refetchQueries: ["QUERY_BILLS_FOR_EXPORT "],
|
||||
});
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
|
||||
|
||||
|
||||
@@ -28,7 +28,9 @@ export function PaymentExportButton({
|
||||
setSelectedPayments,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [updatePayment] = useMutation(UPDATE_PAYMENTS);
|
||||
const [updatePayment] = useMutation(UPDATE_PAYMENTS, {
|
||||
refetchQueries: ["QUERY_PAYMENTS_FOR_EXPORT "],
|
||||
});
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
|
||||
|
||||
|
||||
@@ -27,7 +27,9 @@ export function PaymentsExportAllButton({
|
||||
completedCallback,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [updatePayments] = useMutation(UPDATE_PAYMENTS);
|
||||
const [updatePayments] = useMutation(UPDATE_PAYMENTS, {
|
||||
refetchQueries: ["QUERY_PAYMENTS_FOR_EXPORT "],
|
||||
});
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
|
||||
|
||||
|
||||
@@ -146,11 +146,13 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
||||
{t("general.actions.close")}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
<Link to={`/manage/dms?jobId=${job.id}`}>
|
||||
<Button disabled={job.date_exported || !jobRO}>
|
||||
{t("jobs.actions.sendtodms")}
|
||||
</Button>
|
||||
</Link>
|
||||
{(bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid) && (
|
||||
<Link to={`/manage/dms?jobId=${job.id}`}>
|
||||
<Button disabled={job.date_exported || !jobRO}>
|
||||
{t("jobs.actions.sendtodms")}
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
<JobsScoreboardAdd job={job} disabled={false} />
|
||||
</Space>
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ const CalculateAllocations =
|
||||
require("../../cdk/cdk-calculate-allocations").default;
|
||||
const CdkBase = require("../../web-sockets/web-socket");
|
||||
const moment = require("moment");
|
||||
|
||||
const Dinero = require("dinero.js");
|
||||
const axios = AxiosLib.create();
|
||||
axios.interceptors.request.use((x) => {
|
||||
const socket = x.socket;
|
||||
@@ -116,8 +116,9 @@ exports.PbsSelectedCustomer = async function PbsSelectedCustomer(
|
||||
);
|
||||
await UpsertVehicleData(socket, ownerRef.ReferenceId);
|
||||
CdkBase.createLogEvent(socket, "DEBUG", `Inserting account data.`);
|
||||
return;
|
||||
|
||||
await InsertAccountPostingData(socket);
|
||||
|
||||
CdkBase.createLogEvent(socket, "DEBUG", `Marking job as exported.`);
|
||||
await MarkJobExported(socket, socket.JobData.id);
|
||||
|
||||
@@ -535,7 +536,7 @@ async function InsertAccountPostingData(socket) {
|
||||
const item = {
|
||||
Account: alloc.profitCenter.dms_acctnumber,
|
||||
ControlNumber: socket.JobData.ro_number,
|
||||
Amount: alloc.sale.multiply(-1).toFormat("0.0"),
|
||||
Amount: alloc.sale.multiply(-1).toFormat("0.00"),
|
||||
//Comment: "String",
|
||||
//AdditionalInfo: "String",
|
||||
InvoiceNumber: socket.JobData.ro_number,
|
||||
@@ -549,7 +550,7 @@ async function InsertAccountPostingData(socket) {
|
||||
const item = {
|
||||
Account: alloc.costCenter.dms_acctnumber,
|
||||
ControlNumber: socket.JobData.ro_number,
|
||||
Amount: alloc.cost.toFormat("0.0"),
|
||||
Amount: alloc.cost.toFormat("0.00"),
|
||||
//Comment: "String",
|
||||
//AdditionalInfo: "String",
|
||||
InvoiceNumber: socket.JobData.ro_number,
|
||||
@@ -560,7 +561,7 @@ async function InsertAccountPostingData(socket) {
|
||||
const itemWip = {
|
||||
Account: alloc.costCenter.dms_wip_acctnumber,
|
||||
ControlNumber: socket.JobData.ro_number,
|
||||
Amount: alloc.cost.multiply(-1).toFormat("0.0"),
|
||||
Amount: alloc.cost.multiply(-1).toFormat("0.00"),
|
||||
//Comment: "String",
|
||||
//AdditionalInfo: "String",
|
||||
InvoiceNumber: socket.JobData.ro_number,
|
||||
@@ -575,7 +576,7 @@ async function InsertAccountPostingData(socket) {
|
||||
const item2 = {
|
||||
Account: alloc.profitCenter.dms_acctnumber,
|
||||
ControlNumber: socket.JobData.ro_number,
|
||||
Amount: alloc.sale.multiply(-1).toFormat("0.0"),
|
||||
Amount: alloc.sale.multiply(-1).toFormat("0.00"),
|
||||
//Comment: "String",
|
||||
//AdditionalInfo: "String",
|
||||
InvoiceNumber: socket.JobData.ro_number,
|
||||
@@ -585,6 +586,21 @@ async function InsertAccountPostingData(socket) {
|
||||
}
|
||||
}
|
||||
});
|
||||
socket.txEnvelope.payers.forEach((payer) => {
|
||||
const item = {
|
||||
Account: payer.dms_acctnumber,
|
||||
ControlNumber: payer.controlnumber,
|
||||
Amount: Dinero({ amount: Math.round(payer.amount * 100) }).toFormat(
|
||||
"0.0"
|
||||
),
|
||||
//Comment: "String",
|
||||
//AdditionalInfo: "String",
|
||||
InvoiceNumber: socket.JobData.ro_number,
|
||||
InvoiceDate: moment(socket.JobData.date_invoiced).toISOString(),
|
||||
};
|
||||
|
||||
wips.push(item);
|
||||
});
|
||||
|
||||
const { data: AccountPostingChange } = await axios.post(
|
||||
PBS_ENDPOINTS.AccountingPostingChange,
|
||||
|
||||
Reference in New Issue
Block a user