IO-1316 Add flat_rate to time tickets & resolve issues in job costing calculations.
This commit is contained in:
@@ -35796,6 +35796,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>flat_rate</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>memo</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useQuery } from "@apollo/client";
|
||||
import { Form, Input, InputNumber, Select } from "antd";
|
||||
import { Form, Input, InputNumber, Select, Switch } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -113,7 +113,17 @@ export function TimeTicketModalComponent({
|
||||
},
|
||||
]}
|
||||
>
|
||||
<EmployeeSearchSelect options={employeeAutoCompleteOptions} />
|
||||
<EmployeeSearchSelect
|
||||
options={employeeAutoCompleteOptions}
|
||||
onSelect={(value) => {
|
||||
console.log(value);
|
||||
const emps =
|
||||
employeeAutoCompleteOptions &&
|
||||
employeeAutoCompleteOptions.filter((e) => e.id === value)[0];
|
||||
console.log(emps);
|
||||
form.setFieldsValue({ flat_rate: emps && emps.flat_rate });
|
||||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
shouldUpdate={(prev, cur) => prev.employeeid !== cur.employeeid}
|
||||
@@ -140,6 +150,14 @@ export function TimeTicketModalComponent({
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="flat_rate"
|
||||
label={t("timetickets.fields.flat_rate")}
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
|
||||
<LayoutFormRow>
|
||||
|
||||
@@ -58,6 +58,7 @@ export const GET_LINE_TICKET_BY_PK = gql`
|
||||
jobid
|
||||
employeeid
|
||||
memo
|
||||
flat_rate
|
||||
employee {
|
||||
id
|
||||
first_name
|
||||
|
||||
@@ -318,6 +318,7 @@ export const QUERY_JOB_COSTING_DETAILS = gql`
|
||||
cost_center
|
||||
actualhrs
|
||||
productivehrs
|
||||
flat_rate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ export const QUERY_TICKETS_BY_JOBID = gql`
|
||||
id
|
||||
memo
|
||||
jobid
|
||||
flat_rate
|
||||
employee {
|
||||
employee_number
|
||||
first_name
|
||||
@@ -42,6 +43,7 @@ export const QUERY_TIME_TICKETS_IN_RANGE = gql`
|
||||
productivehrs
|
||||
memo
|
||||
jobid
|
||||
flat_rate
|
||||
job {
|
||||
id
|
||||
ro_number
|
||||
@@ -72,6 +74,7 @@ export const INSERT_NEW_TIME_TICKET = gql`
|
||||
ciecacode
|
||||
date
|
||||
memo
|
||||
flat_rate
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,6 +101,7 @@ export const UPDATE_TIME_TICKET = gql`
|
||||
updated_at
|
||||
jobid
|
||||
date
|
||||
flat_rate
|
||||
memo
|
||||
}
|
||||
}
|
||||
@@ -121,6 +125,7 @@ export const QUERY_ACTIVE_TIME_TICKETS = gql`
|
||||
clockon
|
||||
memo
|
||||
cost_center
|
||||
flat_rate
|
||||
jobid
|
||||
job {
|
||||
id
|
||||
|
||||
@@ -2160,6 +2160,7 @@
|
||||
"date": "Ticket Date",
|
||||
"efficiency": "Efficiency",
|
||||
"employee": "Employee",
|
||||
"flat_rate": "Flat Rate?",
|
||||
"memo": "Memo",
|
||||
"productivehrs": "Productive Hours",
|
||||
"ro_number": "Job to Post Against"
|
||||
|
||||
@@ -2160,6 +2160,7 @@
|
||||
"date": "",
|
||||
"efficiency": "",
|
||||
"employee": "",
|
||||
"flat_rate": "",
|
||||
"memo": "",
|
||||
"productivehrs": "",
|
||||
"ro_number": ""
|
||||
|
||||
@@ -2160,6 +2160,7 @@
|
||||
"date": "",
|
||||
"efficiency": "",
|
||||
"employee": "",
|
||||
"flat_rate": "",
|
||||
"memo": "",
|
||||
"productivehrs": "",
|
||||
"ro_number": ""
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: ALTER TABLE "public"."timetickets" DROP COLUMN "flat_rate";
|
||||
type: run_sql
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: ALTER TABLE "public"."timetickets" ADD COLUMN "flat_rate" boolean NULL DEFAULT
|
||||
false;
|
||||
type: run_sql
|
||||
@@ -0,0 +1,39 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: timetickets
|
||||
schema: public
|
||||
type: drop_insert_permission
|
||||
- args:
|
||||
permission:
|
||||
check:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
columns:
|
||||
- actualhrs
|
||||
- bodyshopid
|
||||
- ciecacode
|
||||
- clockoff
|
||||
- clockon
|
||||
- cost_center
|
||||
- created_at
|
||||
- date
|
||||
- employeeid
|
||||
- id
|
||||
- jobid
|
||||
- memo
|
||||
- productivehrs
|
||||
- rate
|
||||
- updated_at
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: timetickets
|
||||
schema: public
|
||||
type: create_insert_permission
|
||||
@@ -0,0 +1,40 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: timetickets
|
||||
schema: public
|
||||
type: drop_insert_permission
|
||||
- args:
|
||||
permission:
|
||||
check:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
columns:
|
||||
- actualhrs
|
||||
- bodyshopid
|
||||
- ciecacode
|
||||
- clockoff
|
||||
- clockon
|
||||
- cost_center
|
||||
- created_at
|
||||
- date
|
||||
- employeeid
|
||||
- flat_rate
|
||||
- id
|
||||
- jobid
|
||||
- memo
|
||||
- productivehrs
|
||||
- rate
|
||||
- updated_at
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: timetickets
|
||||
schema: public
|
||||
type: create_insert_permission
|
||||
@@ -0,0 +1,40 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: timetickets
|
||||
schema: public
|
||||
type: drop_select_permission
|
||||
- args:
|
||||
permission:
|
||||
allow_aggregations: false
|
||||
columns:
|
||||
- actualhrs
|
||||
- bodyshopid
|
||||
- ciecacode
|
||||
- clockoff
|
||||
- clockon
|
||||
- cost_center
|
||||
- created_at
|
||||
- date
|
||||
- employeeid
|
||||
- id
|
||||
- jobid
|
||||
- memo
|
||||
- productivehrs
|
||||
- rate
|
||||
- updated_at
|
||||
computed_fields: []
|
||||
filter:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
role: user
|
||||
table:
|
||||
name: timetickets
|
||||
schema: public
|
||||
type: create_select_permission
|
||||
@@ -0,0 +1,41 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: timetickets
|
||||
schema: public
|
||||
type: drop_select_permission
|
||||
- args:
|
||||
permission:
|
||||
allow_aggregations: false
|
||||
columns:
|
||||
- actualhrs
|
||||
- bodyshopid
|
||||
- ciecacode
|
||||
- clockoff
|
||||
- clockon
|
||||
- cost_center
|
||||
- created_at
|
||||
- date
|
||||
- employeeid
|
||||
- flat_rate
|
||||
- id
|
||||
- jobid
|
||||
- memo
|
||||
- productivehrs
|
||||
- rate
|
||||
- updated_at
|
||||
computed_fields: []
|
||||
filter:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
role: user
|
||||
table:
|
||||
name: timetickets
|
||||
schema: public
|
||||
type: create_select_permission
|
||||
@@ -0,0 +1,39 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: timetickets
|
||||
schema: public
|
||||
type: drop_update_permission
|
||||
- args:
|
||||
permission:
|
||||
columns:
|
||||
- actualhrs
|
||||
- bodyshopid
|
||||
- ciecacode
|
||||
- clockoff
|
||||
- clockon
|
||||
- cost_center
|
||||
- created_at
|
||||
- date
|
||||
- employeeid
|
||||
- id
|
||||
- jobid
|
||||
- memo
|
||||
- productivehrs
|
||||
- rate
|
||||
- updated_at
|
||||
filter:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: timetickets
|
||||
schema: public
|
||||
type: create_update_permission
|
||||
@@ -0,0 +1,40 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: timetickets
|
||||
schema: public
|
||||
type: drop_update_permission
|
||||
- args:
|
||||
permission:
|
||||
columns:
|
||||
- actualhrs
|
||||
- bodyshopid
|
||||
- ciecacode
|
||||
- clockoff
|
||||
- clockon
|
||||
- cost_center
|
||||
- created_at
|
||||
- date
|
||||
- employeeid
|
||||
- flat_rate
|
||||
- id
|
||||
- jobid
|
||||
- memo
|
||||
- productivehrs
|
||||
- rate
|
||||
- updated_at
|
||||
filter:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: timetickets
|
||||
schema: public
|
||||
type: create_update_permission
|
||||
@@ -4097,6 +4097,7 @@ tables:
|
||||
- created_at
|
||||
- date
|
||||
- employeeid
|
||||
- flat_rate
|
||||
- id
|
||||
- jobid
|
||||
- memo
|
||||
@@ -4116,6 +4117,7 @@ tables:
|
||||
- created_at
|
||||
- date
|
||||
- employeeid
|
||||
- flat_rate
|
||||
- id
|
||||
- jobid
|
||||
- memo
|
||||
@@ -4144,6 +4146,7 @@ tables:
|
||||
- created_at
|
||||
- date
|
||||
- employeeid
|
||||
- flat_rate
|
||||
- id
|
||||
- jobid
|
||||
- memo
|
||||
|
||||
@@ -791,6 +791,7 @@ exports.QUERY_JOB_COSTING_DETAILS = ` query QUERY_JOB_COSTING_DETAILS($id: uuid!
|
||||
cost_center
|
||||
actualhrs
|
||||
productivehrs
|
||||
flat_rate
|
||||
}
|
||||
bodyshop{
|
||||
id
|
||||
@@ -893,6 +894,7 @@ exports.QUERY_JOB_COSTING_DETAILS_MULTI = ` query QUERY_JOB_COSTING_DETAILS_MULT
|
||||
cost_center
|
||||
actualhrs
|
||||
productivehrs
|
||||
flat_rate
|
||||
}
|
||||
bodyshop {
|
||||
id
|
||||
|
||||
@@ -446,7 +446,11 @@ function GenerateCostingData(job) {
|
||||
].add(
|
||||
Dinero({
|
||||
amount: Math.round((ticket_val.rate || 0) * 100),
|
||||
}).multiply(ticket_val.actualhrs || ticket_val.productivehrs || 0)
|
||||
}).multiply(
|
||||
ticket_val.flat_rate
|
||||
? ticket_val.productivehrs || ticket_val.actualhrs || 0
|
||||
: ticket_val.actualhrs || ticket_val.productivehrs || 0
|
||||
) //Should base this on the employee.
|
||||
);
|
||||
|
||||
return ticket_acc;
|
||||
|
||||
Reference in New Issue
Block a user