QB/O Exporting Adjustments

This commit is contained in:
Patrick Fic
2023-09-28 09:31:32 -07:00
parent 805149daea
commit 68b4bc66ff
4 changed files with 39 additions and 31 deletions

View File

@@ -95,7 +95,6 @@ export function JobsAvailableContainer({
setOwnerModalVisible(false);
setInsertLoading(true);
console.log("Using this as the data.", lazyData || estDataRaw);
const estData = replaceEmpty(
lazyData?.available_jobs_by_pk || estDataRaw.data.available_jobs_by_pk
);
@@ -196,7 +195,7 @@ export function JobsAvailableContainer({
await deleteJob({
variables: { id: estData.id },
}).then((r) => {
if (!lazyData) refetch();
refetch();
setInsertLoading(false);
});
} catch (r) {
@@ -393,21 +392,25 @@ export function JobsAvailableContainer({
onCancel={onJobModalCancel}
modalSearchState={modalSearchState}
/>
<Button
onClick={async () => {
for (const record of data.available_jobs) {
//Query the data
console.log("Start Job", record.id);
const { data } = await loadEstData({
variables: { id: record.id },
});
console.log("Query has been awaited and is complete");
await onOwnerFindModalOk(data);
}
}}
>
Add all jobs as new.
</Button>
{currentUser.email.includes("@rome.") ||
currentUser.email.includes("@imex.") ? (
<Button
onClick={async () => {
for (const record of data.available_jobs) {
//Query the data
console.log("Start Job", record.id);
const { data } = await loadEstData({
variables: { id: record.id },
});
console.log("Query has been awaited and is complete");
await onOwnerFindModalOk(data);
}
}}
>
Add all jobs as new.
</Button>
) : null}
<Row gutter={[16, 16]}>
<Col span={24}>
<JobsAvailableTableComponent

View File

@@ -36,6 +36,8 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) {
ret.profitcenter_part = defaults.profits["MAPA"];
} else if (lineDesc.includes("ats amount")) {
ret.profitcenter_part = defaults.profits["ATS"];
} else if (jl.act_price > 0) {
ret.profitcenter_part = defaults.profits["PAO"];
} else {
ret.profitcenter_part = null;
}

View File

@@ -393,7 +393,7 @@ exports.default = function ({
//Add Towing, storage and adjustment lines.
if (jobs_by_pk.towing_payable && jobs_by_pk.towing_payable !== 0) {
if (jobs_by_pk.job_totals.additional.towing.amount > 0) {
if (qbo) {
//Going to always assume that we need to apply GST and PST for labor.
const taxAccountCode = findTaxCode(
@@ -417,9 +417,9 @@ exports.default = function ({
: taxCodes[taxAccountCode];
InvoiceLineAdd.push({
DetailType: "SalesItemLineDetail",
Amount: Dinero({
amount: Math.round((jobs_by_pk.towing_payable || 0) * 100),
}).toFormat(DineroQbFormat),
Amount: Dinero(jobs_by_pk.job_totals.additional.towing).toFormat(
DineroQbFormat
),
SalesItemLineDetail: {
...(jobs_by_pk.class
? { ClassRef: { value: classes[jobs_by_pk.class] } }
@@ -442,9 +442,9 @@ exports.default = function ({
},
Desc: "Towing",
Quantity: 1,
Amount: Dinero({
amount: Math.round((jobs_by_pk.towing_payable || 0) * 100),
}).toFormat(DineroQbFormat),
Amount: Dinero(jobs_by_pk.job_totals.additional.towing).toFormat(
DineroQbFormat
),
SalesTaxCodeRef: {
FullName:
bodyshop.md_responsibility_centers.taxes.itemexemptcode || "NON",
@@ -452,7 +452,7 @@ exports.default = function ({
});
}
}
if (jobs_by_pk.storage_payable && jobs_by_pk.storage_payable !== 0) {
if (jobs_by_pk.job_totals.additional.storage.amount > 0) {
if (qbo) {
//Going to always assume that we need to apply GST and PST for labor.
const taxAccountCode = findTaxCode(
@@ -476,9 +476,9 @@ exports.default = function ({
: taxCodes[taxAccountCode];
InvoiceLineAdd.push({
DetailType: "SalesItemLineDetail",
Amount: Dinero({
amount: Math.round((jobs_by_pk.storage_payable || 0) * 100),
}).toFormat(DineroQbFormat),
Amount: Dinero(
jobs_by_pk.job_totals.additional.storage.amount
).toFormat(DineroQbFormat),
SalesItemLineDetail: {
...(jobs_by_pk.class
? { ClassRef: { value: classes[jobs_by_pk.class] } }
@@ -501,9 +501,9 @@ exports.default = function ({
},
Desc: "Storage",
Quantity: 1,
Amount: Dinero({
amount: Math.round((jobs_by_pk.storage_payable || 0) * 100),
}).toFormat(DineroQbFormat),
Amount: Dinero(
jobs_by_pk.job_totals.additional.storage.amount
).toFormat(DineroQbFormat),
SalesTaxCodeRef: {
FullName:
bodyshop.md_responsibility_centers.taxes.itemexemptcode || "NON",
@@ -586,6 +586,7 @@ exports.default = function ({
const taxAmount = Dinero(
job_totals.totals.us_sales_tax_breakdown[`ty${tyCounter}Tax`]
);
console.log(`Tax ${tyCounter}`, taxAmount.toFormat());
if (taxAmount.getAmount() > 0) {
if (qbo) {
InvoiceLineAdd.push({

View File

@@ -972,6 +972,8 @@ const getAdditionalCostCenter = (jl, profitCenters) => {
return profitCenters["ATS"];
} else if (lineDesc.includes("towing")) {
return profitCenters["TOW"];
} else if (jl.act_price > 0) {
ret.profitcenter_part = defaults.profits["PAO"];
} else {
return null;
}