diff --git a/hasura/migrations/1682703406197_run_sql_migration/down.sql b/hasura/migrations/1682703406197_run_sql_migration/down.sql new file mode 100644 index 000000000..2143bd5a5 --- /dev/null +++ b/hasura/migrations/1682703406197_run_sql_migration/down.sql @@ -0,0 +1,3 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- CREATE INDEX idx_associations_active_true ON associations(active) WHERE active = true; diff --git a/hasura/migrations/1682703406197_run_sql_migration/up.sql b/hasura/migrations/1682703406197_run_sql_migration/up.sql new file mode 100644 index 000000000..3b4be2f4e --- /dev/null +++ b/hasura/migrations/1682703406197_run_sql_migration/up.sql @@ -0,0 +1 @@ +CREATE INDEX idx_associations_active_true ON associations(active) WHERE active = true; diff --git a/hasura/migrations/1682703475365_create_index_idx_associations_shopid_user/down.sql b/hasura/migrations/1682703475365_create_index_idx_associations_shopid_user/down.sql new file mode 100644 index 000000000..cd3c0d006 --- /dev/null +++ b/hasura/migrations/1682703475365_create_index_idx_associations_shopid_user/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_associations_shopid_user"; diff --git a/hasura/migrations/1682703475365_create_index_idx_associations_shopid_user/up.sql b/hasura/migrations/1682703475365_create_index_idx_associations_shopid_user/up.sql new file mode 100644 index 000000000..21b9ca11b --- /dev/null +++ b/hasura/migrations/1682703475365_create_index_idx_associations_shopid_user/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_associations_shopid_user" on + "public"."associations" using btree ("shopid", "useremail", "active"); diff --git a/server/accounting/pbs/pbs-ap-allocations.js b/server/accounting/pbs/pbs-ap-allocations.js index 8c4ebad11..10b11cb9b 100644 --- a/server/accounting/pbs/pbs-ap-allocations.js +++ b/server/accounting/pbs/pbs-ap-allocations.js @@ -164,7 +164,7 @@ async function PbsCalculateAllocationsAp(socket, billids) { let APAmount = Dinero(); Object.keys(billHash).map((key) => { - if (billHash[key].Amount.getAmount() > 0) { + if (billHash[key].Amount.getAmount() > 0 || billHash[key].Amount.getAmount() < 0) { transactionObject.Posting.Lines.push({ ...billHash[key], Amount: billHash[key].Amount.toFormat("0.00"), diff --git a/server/data/autohouse.js b/server/data/autohouse.js index b4e29b086..5e32c81de 100644 --- a/server/data/autohouse.js +++ b/server/data/autohouse.js @@ -772,7 +772,7 @@ const CreateCosts = (job) => { billTotalsByCostCenters[ job.bodyshop.md_responsibility_centers.defaults.costs.MAPA ] = Dinero({ - amount: (job.mixdata[0] && job.mixdata[0].totalliquidcost * 100) || 0, + amount: Math.round((job.mixdata[0] && job.mixdata[0].totalliquidcost || 0) * 100) }); } else { billTotalsByCostCenters[ @@ -799,7 +799,7 @@ const CreateCosts = (job) => { (job.bodyshop.jc_hourly_rates && job.bodyshop.jc_hourly_rates.mapa * 100) || 0, - }).multiply(materialsHours.mapaHrs) + }).multiply(job.job_totals.rates.mapa.hours) ); } } diff --git a/server/email/sendemail.js b/server/email/sendemail.js index 046ca16ee..cbe80c2a0 100644 --- a/server/email/sendemail.js +++ b/server/email/sendemail.js @@ -28,7 +28,7 @@ exports.sendServerEmail = async function ({ subject, text }) { transporter.sendMail( { from: `ImEX Online API - ${process.env.NODE_ENV} `, - to: ["patrick@imexsystems.ca"], + to: ["patrick@imexsystems.ca", "support@thinkimex.com"], subject: subject, text: text, ses: { diff --git a/server/job/job-costing.js b/server/job/job-costing.js index 935d37661..94af28402 100644 --- a/server/job/job-costing.js +++ b/server/job/job-costing.js @@ -626,7 +626,7 @@ function GenerateCostingData(job) { billTotalsByCostCenters.additionalCosts[ job.bodyshop.md_responsibility_centers.defaults.costs.MAPA ] = Dinero({ - amount: (job.mixdata[0] && job.mixdata[0].totalliquidcost * 100) || 0, + amount: Math.round((job.mixdata[0] && job.mixdata[0].totalliquidcost || 0) * 100) }); } else { billTotalsByCostCenters.additionalCosts[