IO-256 Add PVRT handling for QBO.

This commit is contained in:
Patrick Fic
2021-09-24 17:17:23 -07:00
parent 8f2b1f0f78
commit dfa9592755
4 changed files with 34 additions and 28 deletions

View File

@@ -5,7 +5,6 @@ import React, { useEffect } from "react";
import { useCookies } from "react-cookie";
import { useHistory, useLocation } from "react-router-dom";
import QboSignIn from "../../assets/qbo/C2QB_green_btn_med_default.svg";
import "./qbo-authorize.scss";
export default function QboAuthorizeComponent() {
const location = useLocation();

View File

@@ -1,8 +0,0 @@
.qbo-sign-in {
background-image: url("../../assets/qbo/C2QB_green_btn_med_default.svg");
width: 274px;
height: 48px;
&:hover {
background-image: url("../../assets/qbo/C2QB_green_btn_med_hover.svg");
}
}

View File

@@ -521,7 +521,31 @@ module.exports = function ({
const { ca_bc_pvrt } = jobs_by_pk;
if (ca_bc_pvrt) {
if (qbo) {
// do qbo
InvoiceLineAdd.push({
DetailType: "SalesItemLineDetail",
Amount: Dinero({ amount: (ca_bc_pvrt || 0) * 100 }).toFormat(
DineroQbFormat
),
SalesItemLineDetail: {
ItemRef: {
value: items["PVRT"],
},
Qty: 1,
TaxCodeRef: {
value:
taxCodes[
findTaxCode(
{
local: false,
federal: false,
state: false,
},
bodyshop.md_responsibility_centers.sales_tax_codes
)
],
},
},
});
} else {
InvoiceLineAdd.push({
ItemRef: {

View File

@@ -15,6 +15,7 @@ const {
} = require("./qbo-callback");
const OAuthClient = require("intuit-oauth");
const CreateInvoiceLines = require("../qb-receivables-lines");
const moment = require("moment");
const GraphQLClient = require("graphql-request").GraphQLClient;
const { generateOwnerTier } = require("../qbxml/qbxml-utils");
@@ -364,28 +365,18 @@ async function InsertInvoice(oauthClient, req, job, bodyshop, parentTierRef) {
});
const invoiceObj = {
// Line: [
// {
// DetailType: "SalesItemLineDetail",
// Amount: 100,
// SalesItemLineDetail: {
// ItemRef: {
// // name: "Services",
// value: "1",
// },
// TaxCodeRef: {
// value: "2",
// },
// Qty: 1,
// UnitPrice: 100,
// },
// },
// ],
Line: InvoiceLineAdd,
TxnDate: moment(job.date_invoiced).format("YYYY-MM-DD"),
DocNumber: job.ro_number,
CustomerRef: {
value: parentTierRef.Id,
},
...(bodyshop.accountingconfig.printlater
? { PrintStatus: "NeedToPrint" }
: {}),
...(bodyshop.accountingconfig.emaillater
? { EmailStatus: "NeedToSend" }
: {}),
};
try {