Merged in feature/america (pull request #681)

feature/america

Approved-by: Patrick Fic
This commit is contained in:
Patrick Fic
2023-02-25 00:04:44 +00:00
65 changed files with 173 additions and 67 deletions

View File

@@ -66,8 +66,9 @@ jobs:
- aws-s3/sync:
from: build
to: "s3://rome-online-production/"
to: "s3://imex-online-production/"
- jira/notify
rome-api-deploy:
docker:
- image: "cimg/base:stable"
@@ -128,7 +129,7 @@ jobs:
- aws-s3/sync:
from: build
to: "s3://imex-online-production/"
to: "s3://rome-online-production/"
- jira/notify
test-hasura-migrate:

View File

@@ -1,14 +1,3 @@
Yarn Dependency Management:
To force upgrades for some packages:
yarn upgrade-interactive --latest
To Start Hasura CLI:
npx hasura console
Migrating to Staging:
npx hasura migrate apply --endpoint https://db.imex.online/ --admin-secret 'Production-ImEXOnline!@#'
npx hasura migrate apply --endpoint https://db.test.bodyshop.app/ --admin-secret 'Test-ImEXOnlineBySnaptSoftware!'
NGROK TEsting:
./ngrok.exe http http://localhost:4000 -host-header="localhost:4000"
@@ -21,4 +10,4 @@ hasura migrate apply --version "1620771761757" --skip-execution --endpoint https
hasura migrate status --endpoint https://db.imex.online/ --admin-secret 'Production-ImEXOnline!@#'
Generate the license file:
$ generate-license-file --input package.json --output third-party-licenses.txt --overwrite
$ generate-license-file --input package.json --output third-party-licenses.txt --overwrite

View File

@@ -1,13 +1,13 @@
REACT_APP_GRAPHQL_ENDPOINT=https://db.imex.online/v1/graphql
REACT_APP_GRAPHQL_ENDPOINT_WS=wss://db.imex.online/v1/graphql
REACT_APP_GRAPHQL_ENDPOINT=https://db.romeonline.io/v1/graphql
REACT_APP_GRAPHQL_ENDPOINT_WS=wss://db.romeonline.io/v1/graphql
REACT_APP_GA_CODE=231103507
REACT_APP_FIREBASE_CONFIG={"apiKey":"AIzaSyDSezy-jGJreo7ulgpLdlpOwAOrgcaEkhU","authDomain":"imex-prod.firebaseapp.com","databaseURL":"https://imex-prod.firebaseio.com","projectId":"imex-prod","storageBucket":"imex-prod.appspot.com","messagingSenderId":"253497221485","appId":"1:253497221485:web:3c81c483b94db84b227a64","measurementId":"G-NTWBKG2L0M"}
REACT_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"}
REACT_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/bodyshop
REACT_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/bodyshop
REACT_APP_CLOUDINARY_API_KEY=473322739956866
REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250
REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BMgZT1NZztW2DsJl8Mg2L04hgY9FzAg6b8fbzgNAfww2VDzH3VE63Ot9EaP_U7KWS2JT-7HPHaw0T_Tw_5vkZc8'
REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BP1B7ZTYpn-KMt6nOxlld6aS8Skt3Q7ZLEqP0hAvGHxG4UojPYiXZ6kPlzZkUC5jH-EcWXomTLtmadAIxurfcHo'
REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g
REACT_APP_AXIOS_BASE_API_URL=https://api.imex.online/
REACT_APP_REPORTS_SERVER_URL=https://reports.imex.online
REACT_APP_AXIOS_BASE_API_URL=https://api.romeonline.io/
REACT_APP_REPORTS_SERVER_URL=https://reports.romeonline.io
REACT_APP_SPLIT_API=et9pjkik6bn67he5evpmpr1agoo7gactphgk

View File

@@ -8,7 +8,7 @@ REACT_APP_CLOUDINARY_API_KEY=473322739956866
REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250
REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BN2GcDPjipR5MTEosO5dT4CfQ3cmrdBIsI4juoOQrRijn_5aRiHlwj1mlq0W145mOusx6xynEKl_tvYJhpCc9lo'
REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g
REACT_APP_AXIOS_BASE_API_URL=https://api.test.imex.online/
REACT_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online
REACT_APP_AXIOS_BASE_API_URL=https://api.romeonline.io/
REACT_APP_REPORTS_SERVER_URL=https://reports.romeonline.io
REACT_APP_IS_TEST=true
REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc

View File

@@ -289,7 +289,7 @@ export function JobLinesUpsertModalComponent({
name="prt_dsmk_p"
initialValue={0}
>
<InputNumber precision={0} min={0} max={100} />
<InputNumber precision={0} min={-100} max={100} />
</Form.Item>
<Form.Item
label={t("joblines.fields.tax_part")}

View File

@@ -13,6 +13,7 @@ import { selectJobLineEditModal } from "../../redux/modals/modals.selectors";
import UndefinedToNull from "../../utils/undefinedtonull";
import JobLinesUpdsertModal from "./job-lines-upsert-modal.component";
import Axios from "axios";
import Dinero from "dinero.js";
const mapStateToProps = createStructuredSelector({
jobLineEditModal: selectJobLineEditModal,
});
@@ -40,7 +41,15 @@ function JobLinesUpsertModalContainer({
manual_line: !(
jobLineEditModal.context && jobLineEditModal.context.id
),
...UndefinedToNull(values),
...UndefinedToNull({
...values,
prt_dsmk_m: Dinero({
amount: Math.round((values.act_price || 0) * 100),
})
.percentage(Math.abs(values.prt_dsmk_p || 0))
.multiply(values.prt_dsmk_p >= 0 ? 1 : -1)
.toFormat(0.0),
}),
},
],
},
@@ -68,7 +77,15 @@ function JobLinesUpsertModalContainer({
const r = await updateJobLine({
variables: {
lineId: jobLineEditModal.context.id,
line: values,
line: {
...values,
prt_dsmk_m: Dinero({
amount: Math.round(values.act_price * 100),
})
.percentage(Math.abs(values.prt_dsmk_p || 0))
.multiply(values.prt_dsmk_p >= 0 ? 1 : -1)
.toFormat(0.0),
},
},
refetchQueries: ["GET_LINE_TICKET_BY_PK"],
});

View File

@@ -67,7 +67,8 @@ export function JobsTotalsTableComponent({ jobRO, currentUser, job }) {
<JobTotalsTableTotals job={job} />
</Card>
</Col>
{currentUser.email.includes("@imex.") && (
{(currentUser.email.includes("@imex.") ||
currentUser.email.includes("@rome.")) && (
<Col span={24}>
<Card title="DEVELOPMENT USE ONLY">
<JobCalculateTotals job={job} disabled={jobRO} />

View File

@@ -497,7 +497,7 @@ async function CheckTaxRates(estData, bodyshop) {
//IO-1387 If a sublet line is NOT R&R, use the labor tax. If it is, use the sublet tax rate.
//Currently limited to SK shops only.
//if (bodyshop.region_config === "CA_SK") {
if (bodyshop.region_config === "CA_SK") {
estData.joblines.data.forEach((jl, index) => {
if (
(jl.part_type === "PASL" || jl.part_type === "PAS") &&
@@ -512,7 +512,7 @@ async function CheckTaxRates(estData, bodyshop) {
estData.joblines.data[index].tax_part = true;
}
});
//}
}
}
async function ResolveCCCLineIssues(estData, bodyshop) {
@@ -523,7 +523,7 @@ async function ResolveCCCLineIssues(estData, bodyshop) {
if (line.misc_amt && line.misc_amt !== 0) {
line.act_price = line.misc_amt;
line.part_type = "PAS";
line.tax_part = line.misc_tax;
line.tax_part = !!line.misc_tax;
}
});

View File

@@ -256,7 +256,7 @@ export function JobsDetailGeneral({ bodyshop, jobRO, job, form }) {
</FormRow>
<FormRow header={t("jobs.forms.other")}>
<Form.Item label={t("jobs.fields.category")} name="category">
<Select disabled={jobRO}>
<Select disabled={jobRO} allowClear>
{bodyshop.md_categories.map((s) => (
<Select.Option key={s} value={s}>
{s}

View File

@@ -1064,7 +1064,7 @@ export const Footer10DataSource = {
className: "copyright",
children: (
<span>
©2023 <a href="http://imexsystems.ca">ImEX Systems</a>
©2023 <a href="http://rometech.com">Rome Technologies</a>
</span>
),
},

View File

@@ -51,6 +51,7 @@ import JobAuditTrail from "../../components/job-audit-trail/job-audit-trail.comp
import AuditTrailMapping from "../../utils/AuditTrailMappings";
import { insertAuditTrail } from "../../redux/application/application.actions";
import JobsDocumentsLocalGallery from "../../components/jobs-documents-local-gallery/jobs-documents-local-gallery.container";
import UndefinedToNull from "../../utils/undefinedtonull";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
@@ -96,7 +97,7 @@ export function JobsDetailPage({
variables: {
jobId: job.id,
job: {
...values,
...UndefinedToNull(values, ["alt_transport", "category", "referral_source"]),
parts_tax_rates: {
...job.parts_tax_rates,
...values.parts_tax_rates,

View File

@@ -3,7 +3,7 @@ import EmailActionTypes from "./email.types";
const INITIAL_STATE = {
emailConfig: {
messageOptions: {
from: { name: "ShopName", address: "noreply@bodyshop.app" },
from: { name: "ShopName", address: "noreply@romeonline.io" },
to: null,
replyTo: null,
},

View File

@@ -2,7 +2,7 @@ import i18n from "i18next";
//import { store } from "../redux/store";
export const EmailSettings = {
fromNameDefault: "Rome Online",
fromAddress: "noreply@imex.online",
fromAddress: "noreply@rome.online",
};
export const TemplateList = (type, context) => {

View File

@@ -1,6 +1,10 @@
export default function UndefinedToNull(obj) {
export default function UndefinedToNull(obj, keys) {
Object.keys(obj).forEach((key) => {
if (keys && keys.indexOf(key) >= 0) {
if (obj[key] === undefined) obj[key] = null;
} else {
if (obj[key] === undefined) obj[key] = null;
}
});
return obj;
}

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."jobs_idx_date_open";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "jobs_idx_date_open" on
"public"."jobs" using btree ("date_open");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."jobs_idx_date_invoiced";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "jobs_idx_date_invoiced" on
"public"."jobs" using btree ("date_invoiced");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_bills_vendorid";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_bills_vendorid" on
"public"."bills" using btree ("vendorid");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_parts_orders_vendorid";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_parts_orders_vendorid" on
"public"."parts_orders" using btree ("vendorid");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_ccc_jobid";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_ccc_jobid" on
"public"."cccontracts" using btree ("jobid");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_ccc_courtesycarid";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_ccc_courtesycarid" on
"public"."cccontracts" using btree ("courtesycarid");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_jobs_actual_completion";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_jobs_actual_completion" on
"public"."jobs" using btree ("actual_completion");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_jobs_actual_in";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_jobs_actual_in" on
"public"."jobs" using btree ("actual_in");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_jobs_employee_csr";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_jobs_employee_csr" on
"public"."jobs" using btree ("employee_csr");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_jobs_body_csr";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_jobs_body_csr" on
"public"."jobs" using btree ("employee_body");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_jobs_employee_refinish";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_jobs_employee_refinish" on
"public"."jobs" using btree ("employee_refinish");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_timetickets_employeeid";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_timetickets_employeeid" on
"public"."timetickets" using btree ("employeeid");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_timetickets_cost_center";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_timetickets_cost_center" on
"public"."timetickets" using btree ("cost_center");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_scoreboard_jobid";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_scoreboard_jobid" on
"public"."scoreboard" using btree ("jobid");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_scoreboard_date";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_scoreboard_date" on
"public"."scoreboard" using btree ("date");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_payments_date";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_payments_date" on
"public"."payments" using btree ("date");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."exportlog_createdat";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "exportlog_createdat" on
"public"."exportlog" using btree ("created_at");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_transitions_jobid";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_transitions_jobid" on
"public"."transitions" using btree ("jobid");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_transitions_start";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_transitions_start" on
"public"."transitions" using btree ("start");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_transitions_end";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_transitions_end" on
"public"."transitions" using btree ("end");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_audit_bodyshopid";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_audit_bodyshopid" on
"public"."audit_trail" using btree ("bodyshopid");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_audit_jobid";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_audit_jobid" on
"public"."audit_trail" using btree ("jobid");

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS "public"."idx_audit_billid";

View File

@@ -0,0 +1,2 @@
CREATE INDEX "idx_audit_billid" on
"public"."audit_trail" using btree ("billid");

View File

@@ -0,0 +1,11 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- CREATE INDEX idx_phonebook_firstname ON public.phonebook USING gin (firstname public.gin_trgm_ops);
-- CREATE INDEX idx_phonebook_lastname ON public.phonebook USING gin (lastname public.gin_trgm_ops);
-- CREATE INDEX idx_phonebook_company ON public.phonebook USING gin (company public.gin_trgm_ops);
-- CREATE INDEX idx_phonebook_address1 ON public.phonebook USING gin (address1 public.gin_trgm_ops);
-- CREATE INDEX idx_phonebook_phone1 ON public.phonebook USING gin (phone1 public.gin_trgm_ops);
-- CREATE INDEX idx_phonebook_phone2 ON public.phonebook USING gin (phone2 public.gin_trgm_ops);
-- CREATE INDEX idx_phonebook_email ON public.phonebook USING gin (email public.gin_trgm_ops);
-- CREATE INDEX idx_phonebook_category ON public.phonebook USING gin (category public.gin_trgm_ops);
-- CREATE INDEX idx_vendor_name ON public.vendors USING gin (name public.gin_trgm_ops);

View File

@@ -0,0 +1,9 @@
CREATE INDEX idx_phonebook_firstname ON public.phonebook USING gin (firstname public.gin_trgm_ops);
CREATE INDEX idx_phonebook_lastname ON public.phonebook USING gin (lastname public.gin_trgm_ops);
CREATE INDEX idx_phonebook_company ON public.phonebook USING gin (company public.gin_trgm_ops);
CREATE INDEX idx_phonebook_address1 ON public.phonebook USING gin (address1 public.gin_trgm_ops);
CREATE INDEX idx_phonebook_phone1 ON public.phonebook USING gin (phone1 public.gin_trgm_ops);
CREATE INDEX idx_phonebook_phone2 ON public.phonebook USING gin (phone2 public.gin_trgm_ops);
CREATE INDEX idx_phonebook_email ON public.phonebook USING gin (email public.gin_trgm_ops);
CREATE INDEX idx_phonebook_category ON public.phonebook USING gin (category public.gin_trgm_ops);
CREATE INDEX idx_vendor_name ON public.vendors USING gin (name public.gin_trgm_ops);

View File

@@ -20,7 +20,7 @@ require("dotenv").config({
async function RunTheTest() {
const bodyshopids = ["6c63a820-542c-497e-8c82-0cc38fb2bbca"];
const bearerToken = `Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImQwNWI0MDljNmYyMmM0MDNlMWY5MWY5ODY3YWM0OTJhOTA2MTk1NTgiLCJ0eXAiOiJKV1QifQ.eyJuYW1lIjoiUGF0cmljayBGaWMgKERFVikiLCJodHRwczovL2hhc3VyYS5pby9qd3QvY2xhaW1zIjp7IngtaGFzdXJhLWRlZmF1bHQtcm9sZSI6InVzZXIiLCJ4LWhhc3VyYS1hbGxvd2VkLXJvbGVzIjpbInVzZXIiXSwieC1oYXN1cmEtdXNlci1pZCI6ImhOSjhBRHB0REhRQkRFcXNCOFFNWVRqaURuZjEifSwiaXNzIjoiaHR0cHM6Ly9zZWN1cmV0b2tlbi5nb29nbGUuY29tL2ltZXgtZGV2IiwiYXVkIjoiaW1leC1kZXYiLCJhdXRoX3RpbWUiOjE2NzQ1OTgwMTEsInVzZXJfaWQiOiJoTko4QURwdERIUUJERXFzQjhRTVlUamlEbmYxIiwic3ViIjoiaE5KOEFEcHRESFFCREVxc0I4UU1ZVGppRG5mMSIsImlhdCI6MTY3NDc3ODM3NCwiZXhwIjoxNjc0NzgxOTc0LCJlbWFpbCI6InBhdHJpY2tAaW1leC5kZXYiLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsImZpcmViYXNlIjp7ImlkZW50aXRpZXMiOnsiZW1haWwiOlsicGF0cmlja0BpbWV4LmRldiJdfSwic2lnbl9pbl9wcm92aWRlciI6InBhc3N3b3JkIn19.d6uLsEMeaG68m5jzageh5Wlesp-nPNARwic6QKZFoJbAk20Lr2nO7DOUQcsPlFQyFeoGTEG8mugkAfPAVkI76a7SlrgxsjesncO5DPfpKXPr3dIacmzW832ZYayMNZQFoWLmjYxI7WSEXhzxwaKOKdrjFYUQVo4urMyB1IiaNeZAUhIHhE6tTcxhbfHt7YYkMlWriKCTXfu-9L6EEkSXBOH1EaDOWLJ5bqjBdFjwgywalB8nShsmSi0F1AWoaXzXxVKb2RiPzRjByq2VbRhUXzV2EJIEG9Glxr1aQ7S8x-RlRkdgQgN1OHO3P3-SbMoz-7KZEjpc7H-FB1Dj5iXLhQ`;
const bearerToken = `Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImFlYjMxMjdiMjRjZTg2MDJjODEyNDUxZThmZTczZDU4MjkyMDg4N2MiLCJ0eXAiOiJKV1QifQ.eyJodHRwczovL2hhc3VyYS5pby9qd3QvY2xhaW1zIjp7IngtaGFzdXJhLWRlZmF1bHQtcm9sZSI6InVzZXIiLCJ4LWhhc3VyYS1hbGxvd2VkLXJvbGVzIjpbInVzZXIiXSwieC1oYXN1cmEtdXNlci1pZCI6InQ2WW0xTkRsQ0RPUFpyM0Y5Ymd1V0g0TGhTWDIifSwiaXNzIjoiaHR0cHM6Ly9zZWN1cmV0b2tlbi5nb29nbGUuY29tL3JvbWUtcHJvZC0xIiwiYXVkIjoicm9tZS1wcm9kLTEiLCJhdXRoX3RpbWUiOjE2NzY0ODIxOTYsInVzZXJfaWQiOiJ0NlltMU5EbENET1BacjNGOWJndVdINExoU1gyIiwic3ViIjoidDZZbTFORGxDRE9QWnIzRjliZ3VXSDRMaFNYMiIsImlhdCI6MTY3NjU4NzYxNSwiZXhwIjoxNjc2NTkxMjE1LCJlbWFpbCI6InBhdHJpY2tAcm9tZS5kZXYiLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsImZpcmViYXNlIjp7ImlkZW50aXRpZXMiOnsiZW1haWwiOlsicGF0cmlja0Byb21lLmRldiJdfSwic2lnbl9pbl9wcm92aWRlciI6InBhc3N3b3JkIn19.53cLDjRthvAWUOKjSmdMII78MxD1s-mkEbG9z9KVxLB18NsKS-iZMAfIZcYb-LXZGscH8O-jR0OSyMgXitc-mv6xYV6bAGcO7gUgxwMKqnbh9-pK_uyGQ5LQ-yxMG2F397ObJu3fyB1RZ1e8LRYkIpV9LwAm4XiHQdGAfYyFDA2fSOS-9x9k6im07hAYsEeIx2hNr-8vVaEpkCENF2JFpJ9qjtfp6pRnbwQY2VA8nsJly1oOz56GLhb5f1m2Ta22eVqAye9of5EXmNSTsvDkAv7Xs3NNuNbHu8fM76tAuKPniurMNV5VwJZX7RhsjFelmoUFFTVOj6JVL-Sw-vs65A`;
const { jobs } = await client.request(
gql`
query GET_JOBS($bodyshopids: [uuid!]!) {

View File

@@ -15,7 +15,7 @@ const queries = require("../graphql-client/queries");
const ses = new aws.SES({
apiVersion: "latest",
region: "ca-central-1",
region: "us-east-2",
});
let transporter = nodemailer.createTransport({
@@ -27,7 +27,7 @@ exports.sendServerEmail = async function ({ subject, text }) {
try {
transporter.sendMail(
{
from: `ImEX Online API - ${process.env.NODE_ENV} <noreply@imex.online>`,
from: `Rome Online API - ${process.env.NODE_ENV} <noreply@romeonline.io>`,
to: ["patrick@imexsystems.ca"],
subject: subject,
text: text,
@@ -55,7 +55,7 @@ exports.sendTaskEmail = async function ({ to, subject, text, attachments }) {
try {
transporter.sendMail(
{
from: `ImEX Online <noreply@imex.online>`,
from: `Rome Online <noreply@romeonline.io>`,
to: to,
subject: subject,
text: text,
@@ -227,7 +227,7 @@ exports.emailBounce = async function (req, res, next) {
}
});
messageId = message.mail.messageId;
if (replyTo === "noreply@imex.online") {
if (replyTo === "noreply@romeonline.io") {
res.sendStatus(200);
return;
}
@@ -239,10 +239,10 @@ exports.emailBounce = async function (req, res, next) {
});
transporter.sendMail(
{
from: `ImEX Online <noreply@imex.online>`,
from: `Rome Online <noreply@romeonline.io>`,
to: replyTo,
subject: `ImEX Online Bounced Email - RE: ${subject}`,
text: `ImEX Online has tried to deliver an email with the subject: ${subject} to the intended recipients but encountered an error.
subject: `Rome Online Bounced Email - RE: ${subject}`,
text: `Rome Online has tried to deliver an email with the subject: ${subject} to the intended recipients but encountered an error.
${body.bounce?.bouncedRecipients.map(
(r) =>

View File

@@ -687,13 +687,15 @@ function CalculateTaxesTotals(job, otherTotals) {
val.prt_dsmk_m &&
val.prt_dsmk_m !== 0 &&
DiscountNotAlreadyCounted(val, job.joblines)
? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
: Dinero({
amount: Math.round(val.act_price * 100),
})
.multiply(val.part_qty || 0)
.percentage(Math.abs(val.prt_dsmk_p || 0))
.multiply(val.prt_dsmk_p > 0 ? 1 : -1)
? val.prt_dsmk_m
? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
: Dinero({
amount: Math.round(val.act_price * 100),
})
.multiply(val.part_qty || 0)
.percentage(Math.abs(val.prt_dsmk_p || 0))
.multiply(val.prt_dsmk_p > 0 ? 1 : -1)
: Dinero()
)
.percentage(
((job.parts_tax_rates &&
@@ -711,8 +713,9 @@ function CalculateTaxesTotals(job, otherTotals) {
)
);
}
console.log(statePartsTax.toFormat(), val.line_desc);
});
console.log("State Parts Tax", statePartsTax.toFormat());
let ret = {
subtotal: subtotal,
federal_tax: subtotal
@@ -738,22 +741,22 @@ function CalculateTaxesTotals(job, otherTotals) {
.add(
otherTotals.additional.storage.percentage((job.tax_str_rt || 0) * 100)
)
.add(additionalItemsTax),
// .add(
// otherTotals.rates.mapa.hasMapaLine === false //If parts and materials were not added as lines, we must calculate the taxes on them.
// ? otherTotals.rates.mapa.total.percentage(
// (job.tax_paint_mat_rt || 0) * 100
// )
// : Dinero()
// )
// .add(
// otherTotals.rates.mash.hasMashLine === false //If parts and materials were not added as lines, we must calculate the taxes on them.
// ? otherTotals.rates.mash.total.percentage(
// (job.tax_paint_mat_rt || 0) * 100
// )
// : Dinero()
// ),
// .add(otherTotals.additional.pvrt),
.add(additionalItemsTax)
.add(
otherTotals.rates.mapa.hasMapaLine === false //If parts and materials were not added as lines, we must calculate the taxes on them.
? otherTotals.rates.mapa.total.percentage(
(job.tax_paint_mat_rt || 0) * 100
)
: Dinero()
)
.add(
otherTotals.rates.mash.hasMashLine === false //If parts and materials were not added as lines, we must calculate the taxes on them.
? otherTotals.rates.mash.total.percentage(
(job.tax_paint_mat_rt || 0) * 100
)
: Dinero()
),
local_tax: subtotal.percentage((job.local_tax_rate || 0) * 100),
};
ret.total_repairs = ret.subtotal
@@ -796,6 +799,7 @@ function DiscountNotAlreadyCounted(jobline, joblines) {
(jobline.prt_dsmk_m / (jobline.act_price - jobline.prt_dsmk_m)) * 100
) === Math.abs(jobline.prt_dsmk_p)
) {
console.log(jobline.line_desc, "Already had the discount counted.");
return false;
}