From 79a90bb9ee669c848eaacd4929da193d1a5bada1 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Thu, 27 Apr 2023 17:13:37 -0700 Subject: [PATCH 1/5] IO-2257 PBS Export of Credits Amounts less then 0 (ie all credits) would not get pushed to transactionObject. Expand to be both sides of zero to allow for credits within transactionObject --- server/accounting/pbs/pbs-ap-allocations.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"), From adf8cf9e8d00d7273bf797e00fec3b3e14821dae Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 1 May 2023 13:05:59 -0700 Subject: [PATCH 2/5] Additional hasura indexes. --- hasura/migrations/1682703406197_run_sql_migration/down.sql | 3 +++ hasura/migrations/1682703406197_run_sql_migration/up.sql | 1 + .../down.sql | 1 + .../up.sql | 2 ++ 4 files changed, 7 insertions(+) create mode 100644 hasura/migrations/1682703406197_run_sql_migration/down.sql create mode 100644 hasura/migrations/1682703406197_run_sql_migration/up.sql create mode 100644 hasura/migrations/1682703475365_create_index_idx_associations_shopid_user/down.sql create mode 100644 hasura/migrations/1682703475365_create_index_idx_associations_shopid_user/up.sql 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"); From 2eb4e142ffea1ff768dd8249b4084226dfbc1ef0 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Mon, 1 May 2023 13:48:18 -0700 Subject: [PATCH 3/5] IO-2190 Correct lookup location for MAPA Hrs --- server/data/autohouse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/data/autohouse.js b/server/data/autohouse.js index b4e29b086..94090c0f2 100644 --- a/server/data/autohouse.js +++ b/server/data/autohouse.js @@ -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) ); } } From 5660de42afedcaa3e77d7dd4b4d2db650873d8bd Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 2 May 2023 12:31:18 -0700 Subject: [PATCH 4/5] Add support email to server side emails. --- server/email/sendemail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: { From f66d9b8c099ebd4e136b4cbf80ec0ab1fdd53947 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Tue, 2 May 2023 14:51:47 -0700 Subject: [PATCH 5/5] IO-2190 Autohouse & Job Costing Insure that amount going into Dinero is Integer --- server/data/autohouse.js | 2 +- server/job/job-costing.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/data/autohouse.js b/server/data/autohouse.js index 94090c0f2..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[ 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[