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

View File

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

View File

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

View File

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