IO-1316 Add flat_rate to time tickets & resolve issues in job costing calculations.
This commit is contained in:
@@ -35796,6 +35796,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</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>
|
<concept_node>
|
||||||
<name>memo</name>
|
<name>memo</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useQuery } from "@apollo/client";
|
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 React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
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>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
shouldUpdate={(prev, cur) => prev.employeeid !== cur.employeeid}
|
shouldUpdate={(prev, cur) => prev.employeeid !== cur.employeeid}
|
||||||
@@ -140,6 +150,14 @@ export function TimeTicketModalComponent({
|
|||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
name="flat_rate"
|
||||||
|
label={t("timetickets.fields.flat_rate")}
|
||||||
|
valuePropName="checked"
|
||||||
|
>
|
||||||
|
<Switch />
|
||||||
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
|
||||||
<LayoutFormRow>
|
<LayoutFormRow>
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export const GET_LINE_TICKET_BY_PK = gql`
|
|||||||
jobid
|
jobid
|
||||||
employeeid
|
employeeid
|
||||||
memo
|
memo
|
||||||
|
flat_rate
|
||||||
employee {
|
employee {
|
||||||
id
|
id
|
||||||
first_name
|
first_name
|
||||||
|
|||||||
@@ -318,6 +318,7 @@ export const QUERY_JOB_COSTING_DETAILS = gql`
|
|||||||
cost_center
|
cost_center
|
||||||
actualhrs
|
actualhrs
|
||||||
productivehrs
|
productivehrs
|
||||||
|
flat_rate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export const QUERY_TICKETS_BY_JOBID = gql`
|
|||||||
id
|
id
|
||||||
memo
|
memo
|
||||||
jobid
|
jobid
|
||||||
|
flat_rate
|
||||||
employee {
|
employee {
|
||||||
employee_number
|
employee_number
|
||||||
first_name
|
first_name
|
||||||
@@ -42,6 +43,7 @@ export const QUERY_TIME_TICKETS_IN_RANGE = gql`
|
|||||||
productivehrs
|
productivehrs
|
||||||
memo
|
memo
|
||||||
jobid
|
jobid
|
||||||
|
flat_rate
|
||||||
job {
|
job {
|
||||||
id
|
id
|
||||||
ro_number
|
ro_number
|
||||||
@@ -72,6 +74,7 @@ export const INSERT_NEW_TIME_TICKET = gql`
|
|||||||
ciecacode
|
ciecacode
|
||||||
date
|
date
|
||||||
memo
|
memo
|
||||||
|
flat_rate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,6 +101,7 @@ export const UPDATE_TIME_TICKET = gql`
|
|||||||
updated_at
|
updated_at
|
||||||
jobid
|
jobid
|
||||||
date
|
date
|
||||||
|
flat_rate
|
||||||
memo
|
memo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,6 +125,7 @@ export const QUERY_ACTIVE_TIME_TICKETS = gql`
|
|||||||
clockon
|
clockon
|
||||||
memo
|
memo
|
||||||
cost_center
|
cost_center
|
||||||
|
flat_rate
|
||||||
jobid
|
jobid
|
||||||
job {
|
job {
|
||||||
id
|
id
|
||||||
|
|||||||
@@ -2160,6 +2160,7 @@
|
|||||||
"date": "Ticket Date",
|
"date": "Ticket Date",
|
||||||
"efficiency": "Efficiency",
|
"efficiency": "Efficiency",
|
||||||
"employee": "Employee",
|
"employee": "Employee",
|
||||||
|
"flat_rate": "Flat Rate?",
|
||||||
"memo": "Memo",
|
"memo": "Memo",
|
||||||
"productivehrs": "Productive Hours",
|
"productivehrs": "Productive Hours",
|
||||||
"ro_number": "Job to Post Against"
|
"ro_number": "Job to Post Against"
|
||||||
|
|||||||
@@ -2160,6 +2160,7 @@
|
|||||||
"date": "",
|
"date": "",
|
||||||
"efficiency": "",
|
"efficiency": "",
|
||||||
"employee": "",
|
"employee": "",
|
||||||
|
"flat_rate": "",
|
||||||
"memo": "",
|
"memo": "",
|
||||||
"productivehrs": "",
|
"productivehrs": "",
|
||||||
"ro_number": ""
|
"ro_number": ""
|
||||||
|
|||||||
@@ -2160,6 +2160,7 @@
|
|||||||
"date": "",
|
"date": "",
|
||||||
"efficiency": "",
|
"efficiency": "",
|
||||||
"employee": "",
|
"employee": "",
|
||||||
|
"flat_rate": "",
|
||||||
"memo": "",
|
"memo": "",
|
||||||
"productivehrs": "",
|
"productivehrs": "",
|
||||||
"ro_number": ""
|
"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
|
- created_at
|
||||||
- date
|
- date
|
||||||
- employeeid
|
- employeeid
|
||||||
|
- flat_rate
|
||||||
- id
|
- id
|
||||||
- jobid
|
- jobid
|
||||||
- memo
|
- memo
|
||||||
@@ -4116,6 +4117,7 @@ tables:
|
|||||||
- created_at
|
- created_at
|
||||||
- date
|
- date
|
||||||
- employeeid
|
- employeeid
|
||||||
|
- flat_rate
|
||||||
- id
|
- id
|
||||||
- jobid
|
- jobid
|
||||||
- memo
|
- memo
|
||||||
@@ -4144,6 +4146,7 @@ tables:
|
|||||||
- created_at
|
- created_at
|
||||||
- date
|
- date
|
||||||
- employeeid
|
- employeeid
|
||||||
|
- flat_rate
|
||||||
- id
|
- id
|
||||||
- jobid
|
- jobid
|
||||||
- memo
|
- memo
|
||||||
|
|||||||
@@ -791,6 +791,7 @@ exports.QUERY_JOB_COSTING_DETAILS = ` query QUERY_JOB_COSTING_DETAILS($id: uuid!
|
|||||||
cost_center
|
cost_center
|
||||||
actualhrs
|
actualhrs
|
||||||
productivehrs
|
productivehrs
|
||||||
|
flat_rate
|
||||||
}
|
}
|
||||||
bodyshop{
|
bodyshop{
|
||||||
id
|
id
|
||||||
@@ -893,6 +894,7 @@ exports.QUERY_JOB_COSTING_DETAILS_MULTI = ` query QUERY_JOB_COSTING_DETAILS_MULT
|
|||||||
cost_center
|
cost_center
|
||||||
actualhrs
|
actualhrs
|
||||||
productivehrs
|
productivehrs
|
||||||
|
flat_rate
|
||||||
}
|
}
|
||||||
bodyshop {
|
bodyshop {
|
||||||
id
|
id
|
||||||
|
|||||||
@@ -446,7 +446,11 @@ function GenerateCostingData(job) {
|
|||||||
].add(
|
].add(
|
||||||
Dinero({
|
Dinero({
|
||||||
amount: Math.round((ticket_val.rate || 0) * 100),
|
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;
|
return ticket_acc;
|
||||||
|
|||||||
Reference in New Issue
Block a user