Compare commits
29 Commits
feature/IO
...
feature/IO
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98bff6d8f6 | ||
|
|
7959dc67ce | ||
|
|
a4116b6c28 | ||
|
|
0d2cdec75c | ||
|
|
269ef25ece | ||
|
|
575fbd5357 | ||
|
|
2ad887fb82 | ||
|
|
40a1a86f72 | ||
|
|
95d43d936c | ||
|
|
9f56568680 | ||
|
|
3428940c72 | ||
|
|
ea604a5e64 | ||
|
|
5b76473cbc | ||
|
|
db5359e086 | ||
|
|
35046f11c2 | ||
|
|
69d8d27ad3 | ||
|
|
f4c4005a2a | ||
|
|
755acd24f0 | ||
|
|
079d6cfee6 | ||
|
|
3e3b3c269a | ||
|
|
39f1af7d4b | ||
|
|
1ea4d616d7 | ||
|
|
fdf0ecf6f6 | ||
|
|
e5f7285253 | ||
|
|
e46c304f7c | ||
|
|
1aa570db90 | ||
|
|
1c2be3c890 | ||
|
|
05e4eacf34 | ||
|
|
e1417b03f9 |
@@ -1,7 +1,8 @@
|
||||
VITE_APP_GRAPHQL_ENDPOINT=https://db.dev.bodyshop.app/v1/graphql
|
||||
VITE_APP_GRAPHQL_ENDPOINT_WS=wss://db.dev.bodyshop.app/v1/graphql
|
||||
VITE_APP_GA_CODE=231099835
|
||||
VITE_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"}
|
||||
# VITE_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"}
|
||||
VITE_APP_FIREBASE_CONFIG={"apiKey":"AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc","authDomain":"imex-dev.firebaseapp.com","databaseURL":"https://imex-dev.firebaseio.com","projectId":"imex-dev","storageBucket":"imex-dev.appspot.com","messagingSenderId":"759548147434","appId":"1:759548147434:web:e8239868a48ceb36700993","measurementId":"G-K5XRBVVB4S"}
|
||||
VITE_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/io-test
|
||||
VITE_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/io-test
|
||||
VITE_APP_CLOUDINARY_API_KEY=957865933348715
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
VITE_APP_GRAPHQL_ENDPOINT=https://db.dev.bodyshop.app/v1/graphql
|
||||
VITE_APP_GRAPHQL_ENDPOINT_WS=wss://db.dev.bodyshop.app/v1/graphql
|
||||
VITE_APP_GA_CODE=231099835
|
||||
VITE_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"}
|
||||
# VITE_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"}
|
||||
VITE_APP_FIREBASE_CONFIG={"apiKey":"AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc","authDomain":"imex-dev.firebaseapp.com","databaseURL":"https://imex-dev.firebaseio.com","projectId":"imex-dev","storageBucket":"imex-dev.appspot.com","messagingSenderId":"759548147434","appId":"1:759548147434:web:e8239868a48ceb36700993","measurementId":"G-K5XRBVVB4S"}
|
||||
VITE_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/io-test
|
||||
VITE_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/io-test
|
||||
VITE_APP_CLOUDINARY_API_KEY=957865933348715
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
"admin": "cd admin && npm start",
|
||||
"client": "cd client && npm start",
|
||||
"server": "nodemon server.js",
|
||||
"server:imex": "nodemon server.js imex",
|
||||
"server:rome": "nodemon server.js rome",
|
||||
"server:promanager": "nodemon server.js promanager",
|
||||
"build": "cd client && npm run build",
|
||||
"dev": "concurrently --kill-others-on-fail \"npm run server\" \"npm run client\"",
|
||||
"deva": "concurrently --kill-others-on-fail \"npm run server\" \"npm run client\" \"npm run admin\"",
|
||||
|
||||
@@ -8,9 +8,11 @@ const cookieParser = require("cookie-parser");
|
||||
const http = require("http");
|
||||
const { Server } = require("socket.io");
|
||||
|
||||
const instanceName = process.argv[2];
|
||||
|
||||
// Load environment variables
|
||||
require("dotenv").config({
|
||||
path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`)
|
||||
path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}${instanceName ? `.${instanceName}` : ''}`)
|
||||
});
|
||||
|
||||
// Import custom utilities and handlers
|
||||
|
||||
@@ -71,16 +71,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
|
||||
{
|
||||
local: false,
|
||||
federal: InstanceManager({ imex: true, rome: false }),
|
||||
state:
|
||||
!jobs_by_pk.state_tax_rate || jobs_by_pk.state_tax_rate === 0
|
||||
? false
|
||||
: jobline.db_ref === "900511" ||
|
||||
jobline.db_ref === "900510" ||
|
||||
(jobline.mod_lb_hrs === 0 && //Extending IO-1375 as a part of IO-2023
|
||||
jobline.act_price > 0 &&
|
||||
jobline.lbr_op === "OP14")
|
||||
? true
|
||||
: jobline.tax_part
|
||||
state: checkStateTax(jobline, jobs_by_pk)
|
||||
},
|
||||
bodyshop.md_responsibility_centers.sales_tax_codes
|
||||
);
|
||||
@@ -156,7 +147,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
|
||||
{
|
||||
local: false,
|
||||
federal: InstanceManager({ imex: true, rome: false }),
|
||||
state: !jobs_by_pk.state_tax_rate || jobs_by_pk.state_tax_rate === 0 ? false : true
|
||||
state: jobs_by_pk.tax_lbr_rt === 0 ? false : true
|
||||
},
|
||||
bodyshop.md_responsibility_centers.sales_tax_codes
|
||||
);
|
||||
@@ -224,7 +215,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
|
||||
{
|
||||
local: false,
|
||||
federal: InstanceManager({ imex: true, rome: false }),
|
||||
state: !jobs_by_pk.state_tax_rate || jobs_by_pk.state_tax_rate === 0 ? false : true
|
||||
state: jobs_by_pk.tax_paint_mat_rt === 0 ? false : true
|
||||
},
|
||||
bodyshop.md_responsibility_centers.sales_tax_codes
|
||||
);
|
||||
@@ -293,7 +284,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
|
||||
{
|
||||
local: false,
|
||||
federal: InstanceManager({ imex: true, rome: false }),
|
||||
state: !jobs_by_pk.state_tax_rate || jobs_by_pk.state_tax_rate === 0 ? false : true
|
||||
state: jobs_by_pk.tax_shop_mat_rt === 0 ? false : true
|
||||
},
|
||||
bodyshop.md_responsibility_centers.sales_tax_codes
|
||||
);
|
||||
@@ -379,7 +370,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
|
||||
{
|
||||
local: false,
|
||||
federal: InstanceManager({ imex: true, rome: false }),
|
||||
state: !jobs_by_pk.state_tax_rate || jobs_by_pk.state_tax_rate === 0 ? false : true
|
||||
state: jobs_by_pk.tax_tow_rt === 0 ? false : true
|
||||
},
|
||||
bodyshop.md_responsibility_centers.sales_tax_codes
|
||||
);
|
||||
@@ -439,7 +430,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
|
||||
{
|
||||
local: false,
|
||||
federal: InstanceManager({ imex: true, rome: false }),
|
||||
state: !jobs_by_pk.state_tax_rate || jobs_by_pk.state_tax_rate === 0 ? false : true
|
||||
state: jobs_by_pk.tax_str_rt === 0 ? false : true
|
||||
},
|
||||
bodyshop.md_responsibility_centers.sales_tax_codes
|
||||
);
|
||||
@@ -499,7 +490,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
|
||||
{
|
||||
local: false,
|
||||
federal: InstanceManager({ imex: true, rome: false }),
|
||||
state: !jobs_by_pk.state_tax_rate || jobs_by_pk.state_tax_rate === 0 ? false : true
|
||||
state: jobs_by_pk.tax_lbr_rt === 0 ? false : true
|
||||
},
|
||||
bodyshop.md_responsibility_centers.sales_tax_codes
|
||||
);
|
||||
@@ -670,7 +661,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
|
||||
{
|
||||
local: false,
|
||||
federal: process.env.COUNTRY === "USA" ? false : true,
|
||||
state: !jobs_by_pk.state_tax_rate || jobs_by_pk.state_tax_rate === 0 ? false : true
|
||||
state: jobs_by_pk.state_tax_rate === 0 ? false : true
|
||||
},
|
||||
bodyshop.md_responsibility_centers.sales_tax_codes
|
||||
);
|
||||
@@ -879,6 +870,66 @@ exports.createMultiQbPayerLines = function ({ bodyshop, jobs_by_pk, qbo = false,
|
||||
return InvoiceLineAdd;
|
||||
};
|
||||
|
||||
function checkStateTax(jobline, jobs_by_pk) {
|
||||
const isPaintOrShopMat = jobline.db_ref === "936008" || jobline.db_ref === "936007";
|
||||
|
||||
if (isPaintOrShopMat) {
|
||||
if (jobline.db_ref === "936008") {
|
||||
if (jobs_by_pk.tax_paint_mat_rt === 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (jobline.db_ref === "936007") {
|
||||
if (jobs_by_pk.tax_shop_mat_rt === 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const isAdditionalCost =
|
||||
(jobline.lbr_op === "OP13" || (jobline.db_ref && jobline.db_ref.startsWith("9360"))) && !isPaintOrShopMat;
|
||||
|
||||
if (!jobline.part_type && isAdditionalCost) {
|
||||
if (jobs_by_pk.tax_lbr_rt === 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
jobline.db_ref === "900511" ||
|
||||
jobline.db_ref === "900510" ||
|
||||
(jobline.mod_lb_hrs === 0 && jobline.act_price > 0 && jobline.lbr_op === "OP14")
|
||||
)
|
||||
return true; //Extending IO-1375 as a part of IO-2023
|
||||
|
||||
if (jobline.tax_part === false) {
|
||||
return false;
|
||||
} else {
|
||||
if (jobline.part_type) {
|
||||
if (
|
||||
jobs_by_pk.parts_tax_rates[`${jobline.part_type.toUpperCase()}`].prt_tax_in === false ||
|
||||
jobs_by_pk.parts_tax_rates[`${jobline.part_type.toUpperCase()}`].prt_tax_rt === 0
|
||||
) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (jobs_by_pk.tax_lbr_rt === 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function CheckQBOUSATaxID({ jobline, job, type }) {
|
||||
//Replacing this to be all non-taxable items with the refactor of parts tax rates.
|
||||
return "NON";
|
||||
|
||||
@@ -206,8 +206,13 @@ query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($ids: [uuid!]!) {
|
||||
adjustment_bottom_line
|
||||
state_tax_rate
|
||||
qb_multiple_payers
|
||||
parts_tax_rates
|
||||
tax_paint_mat_rt
|
||||
tax_lbr_rt
|
||||
tax_shop_mat_rt
|
||||
tax_sub_rt
|
||||
tax_tow_rt
|
||||
tax_str_rt
|
||||
owner {
|
||||
accountingid
|
||||
}
|
||||
@@ -1534,6 +1539,7 @@ exports.QUERY_JOB_COSTING_DETAILS = ` query QUERY_JOB_COSTING_DETAILS($id: uuid!
|
||||
op_code_desc
|
||||
profitcenter_part
|
||||
profitcenter_labor
|
||||
act_price_before_ppc
|
||||
}
|
||||
bills {
|
||||
id
|
||||
|
||||
@@ -269,7 +269,7 @@ function GenerateCostingData(job) {
|
||||
job &&
|
||||
job.joblines.reduce(
|
||||
(acc, val) => {
|
||||
//Parts Lines
|
||||
//Shop or Paint Material Flags
|
||||
if (val.db_ref === "936008") {
|
||||
//If either of these DB REFs change, they also need to change in job-totals/job-costing calculations.
|
||||
hasMapaLine = true;
|
||||
@@ -277,6 +277,8 @@ function GenerateCostingData(job) {
|
||||
if (val.db_ref === "936007") {
|
||||
hasMashLine = true;
|
||||
}
|
||||
|
||||
//Labor Profit Center
|
||||
if (val.mod_lbr_ty) {
|
||||
const laborProfitCenter = val.profitcenter_labor || defaultProfits[val.mod_lbr_ty] || "Unknown";
|
||||
|
||||
@@ -307,6 +309,7 @@ function GenerateCostingData(job) {
|
||||
}
|
||||
}
|
||||
|
||||
// Part Profit Center
|
||||
if (val.part_type && val.part_type !== "PAE" && val.part_type !== "PAS" && val.part_type !== "PASL") {
|
||||
const partsProfitCenter = val.profitcenter_part || defaultProfits[val.part_type] || "Unknown";
|
||||
|
||||
@@ -315,7 +318,7 @@ function GenerateCostingData(job) {
|
||||
if (!partsProfitCenter)
|
||||
console.log("Unknown cost/profit center mapping for parts.", val.line_desc, val.part_type);
|
||||
const partsAmount = Dinero({
|
||||
amount: Math.round((val.act_price || 0) * 100)
|
||||
amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100)
|
||||
})
|
||||
.multiply(val.part_qty || 1)
|
||||
.add(
|
||||
@@ -324,7 +327,7 @@ function GenerateCostingData(job) {
|
||||
? val.prt_dsmk_m
|
||||
? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
|
||||
: Dinero({
|
||||
amount: Math.round(val.act_price * 100)
|
||||
amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100)
|
||||
})
|
||||
.multiply(val.part_qty || 0)
|
||||
.percentage(Math.abs(val.prt_dsmk_p || 0))
|
||||
@@ -334,6 +337,8 @@ function GenerateCostingData(job) {
|
||||
if (!acc.parts[partsProfitCenter]) acc.parts[partsProfitCenter] = Dinero();
|
||||
acc.parts[partsProfitCenter] = acc.parts[partsProfitCenter].add(partsAmount);
|
||||
}
|
||||
|
||||
//Sublet Profit Center
|
||||
if (val.part_type && val.part_type !== "PAE" && (val.part_type === "PAS" || val.part_type === "PASL")) {
|
||||
const partsProfitCenter = val.profitcenter_part || defaultProfits[val.part_type] || "Unknown";
|
||||
|
||||
@@ -362,8 +367,8 @@ function GenerateCostingData(job) {
|
||||
acc.sublet[partsProfitCenter] = acc.sublet[partsProfitCenter].add(partsAmount);
|
||||
}
|
||||
|
||||
//To deal with additional costs.
|
||||
if (!val.part_type && !val.mod_lbr_ty) {
|
||||
//Additional Profit Center
|
||||
if ((!val.part_type && !val.mod_lbr_ty) || (!val.part_type && val.mod_lbr_ty)) {
|
||||
//Does it already have a defined profit center?
|
||||
//If so, use it, otherwise try to use the same from the auto-allocate logic in IO app jobs-close-auto-allocate.
|
||||
const partsProfitCenter = val.profitcenter_part || getAdditionalCostCenter(val, defaultProfits) || "Unknown";
|
||||
|
||||
Reference in New Issue
Block a user