IO-745 Add ins co and class to ccc conversion.
This commit is contained in:
@@ -1,25 +1,26 @@
|
|||||||
import React, { useState } from "react";
|
import { useMutation } from "@apollo/client";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
|
Form,
|
||||||
|
InputNumber,
|
||||||
notification,
|
notification,
|
||||||
Popover,
|
Popover,
|
||||||
Radio,
|
Radio,
|
||||||
Form,
|
Select,
|
||||||
InputNumber,
|
|
||||||
Space,
|
Space,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import { useTranslation } from "react-i18next";
|
import axios from "axios";
|
||||||
import { useMutation } from "@apollo/client";
|
|
||||||
import { INSERT_NEW_JOB } from "../../graphql/jobs.queries";
|
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
import { useHistory } from "react-router-dom";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { INSERT_NEW_JOB } from "../../graphql/jobs.queries";
|
||||||
import {
|
import {
|
||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
selectCurrentUser,
|
selectCurrentUser,
|
||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
import { useHistory } from "react-router-dom";
|
|
||||||
import axios from "axios";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
@@ -49,8 +50,9 @@ export function ContractConvertToRo({
|
|||||||
moment(contract.start),
|
moment(contract.start),
|
||||||
"days"
|
"days"
|
||||||
);
|
);
|
||||||
const billingLines = [
|
const billingLines = [];
|
||||||
{
|
if (contractLength > 0)
|
||||||
|
billingLines.push({
|
||||||
unq_seq: 1,
|
unq_seq: 1,
|
||||||
line_no: 1,
|
line_no: 1,
|
||||||
line_ref: 1,
|
line_ref: 1,
|
||||||
@@ -63,9 +65,7 @@ export function ContractConvertToRo({
|
|||||||
mod_lb_hrs: 0,
|
mod_lb_hrs: 0,
|
||||||
db_ref: "io-ccdr",
|
db_ref: "io-ccdr",
|
||||||
// mod_lbr_ty: "PAL",
|
// mod_lbr_ty: "PAL",
|
||||||
},
|
});
|
||||||
];
|
|
||||||
|
|
||||||
const mileageDiff =
|
const mileageDiff =
|
||||||
contract.kmend - contract.kmstart - contract.dailyfreekm * contractLength;
|
contract.kmend - contract.kmstart - contract.dailyfreekm * contractLength;
|
||||||
if (mileageDiff > 0) {
|
if (mileageDiff > 0) {
|
||||||
@@ -139,7 +139,8 @@ export function ContractConvertToRo({
|
|||||||
federal_tax_rate: bodyshop.bill_tax_rates.federal_tax_rate / 100,
|
federal_tax_rate: bodyshop.bill_tax_rates.federal_tax_rate / 100,
|
||||||
state_tax_rate: bodyshop.bill_tax_rates.state_tax_rate / 100,
|
state_tax_rate: bodyshop.bill_tax_rates.state_tax_rate / 100,
|
||||||
local_tax_rate: bodyshop.bill_tax_rates.local_tax_rate / 100,
|
local_tax_rate: bodyshop.bill_tax_rates.local_tax_rate / 100,
|
||||||
ins_co_nm: "CC",
|
ins_co_nm: values.ins_co_nm,
|
||||||
|
class: values.class,
|
||||||
converted: true,
|
converted: true,
|
||||||
clm_no: contract.job.clm_no ? `${contract.job.clm_no}-CC` : null,
|
clm_no: contract.job.clm_no ? `${contract.job.clm_no}-CC` : null,
|
||||||
ownr_fn: contract.job.owner.ownr_fn,
|
ownr_fn: contract.job.owner.ownr_fn,
|
||||||
@@ -307,6 +308,42 @@ export function ContractConvertToRo({
|
|||||||
const popContent = (
|
const popContent = (
|
||||||
<div>
|
<div>
|
||||||
<Form onFinish={handleFinish}>
|
<Form onFinish={handleFinish}>
|
||||||
|
<Form.Item
|
||||||
|
name={["ins_co_nm"]}
|
||||||
|
label={t("jobs.fields.ins_co_nm")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Select>
|
||||||
|
{bodyshop.md_ins_cos.map((s) => (
|
||||||
|
<Select.Option key={s.name} value={s.name}>
|
||||||
|
{s.name}
|
||||||
|
</Select.Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name={"class"}
|
||||||
|
label={t("jobs.fields.class")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: bodyshop.enforce_class,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Select>
|
||||||
|
{bodyshop.md_classes.map((s) => (
|
||||||
|
<Select.Option key={s} value={s}>
|
||||||
|
{s}
|
||||||
|
</Select.Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("contracts.labels.convertform.applycleanupcharge")}
|
label={t("contracts.labels.convertform.applycleanupcharge")}
|
||||||
rules={[
|
rules={[
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Form, Input, InputNumber } from "antd";
|
import { Form, Input, InputNumber, Space } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import ContractLicenseDecodeButton from "../contract-license-decode-button/contract-license-decode-button.component";
|
import ContractLicenseDecodeButton from "../contract-license-decode-button/contract-license-decode-button.component";
|
||||||
@@ -102,15 +102,17 @@ export default function ContractFormComponent({
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
{selectedJobState && (
|
<Space wrap>
|
||||||
<div>
|
{selectedJobState && (
|
||||||
<ContractFormJobPrefill
|
<div>
|
||||||
jobId={selectedJobState && selectedJobState[0]}
|
<ContractFormJobPrefill
|
||||||
form={form}
|
jobId={selectedJobState && selectedJobState[0]}
|
||||||
/>
|
form={form}
|
||||||
</div>
|
/>
|
||||||
)}
|
</div>
|
||||||
<ContractLicenseDecodeButton form={form} />
|
)}
|
||||||
|
<ContractLicenseDecodeButton form={form} />
|
||||||
|
</Space>
|
||||||
<LayoutFormRow>
|
<LayoutFormRow>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("contracts.fields.driver_dlnumber")}
|
label={t("contracts.fields.driver_dlnumber")}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import "./utils/CleanAxios";
|
|||||||
import "antd/dist/antd.less";
|
import "antd/dist/antd.less";
|
||||||
require("dotenv").config();
|
require("dotenv").config();
|
||||||
|
|
||||||
Dinero.defaultCurrency = "CAD";
|
// Dinero.defaultCurrency = "CAD";
|
||||||
Dinero.globalLocale = "en-CA";
|
// Dinero.globalLocale = "en-CA";
|
||||||
Dinero.globalRoundingMode = "HALF_UP";
|
Dinero.globalRoundingMode = "HALF_UP";
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== "development") {
|
if (process.env.NODE_ENV !== "development") {
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ const Dinero = require("dinero.js");
|
|||||||
const queries = require("../graphql-client/queries");
|
const queries = require("../graphql-client/queries");
|
||||||
const GraphQLClient = require("graphql-request").GraphQLClient;
|
const GraphQLClient = require("graphql-request").GraphQLClient;
|
||||||
|
|
||||||
Dinero.defaultCurrency = "USD";
|
// Dinero.defaultCurrency = "USD";
|
||||||
Dinero.globalLocale = "en-CA";
|
// Dinero.globalLocale = "en-CA";
|
||||||
Dinero.globalRoundingMode = "HALF_UP";
|
Dinero.globalRoundingMode = "HALF_UP";
|
||||||
|
|
||||||
exports.totalsSsu = async function (req, res) {
|
exports.totalsSsu = async function (req, res) {
|
||||||
@@ -336,6 +336,7 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
0) * 100
|
0) * 100
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
console.log("A", additionalItemsTax.toJSON());
|
||||||
} else {
|
} else {
|
||||||
statePartsTax = statePartsTax.add(
|
statePartsTax = statePartsTax.add(
|
||||||
Dinero({ amount: Math.round((val.act_price || 0) * 100) })
|
Dinero({ amount: Math.round((val.act_price || 0) * 100) })
|
||||||
@@ -347,6 +348,7 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
0) * 100
|
0) * 100
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
console.log("S", statePartsTax.toJSON());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user