Update logic to ensure removed lines are always ignored. IO-733

This commit is contained in:
Patrick Fic
2021-03-05 09:34:18 -08:00
parent c4555f7441
commit 22f3f20882
5 changed files with 54 additions and 24 deletions

View File

@@ -1,7 +1,7 @@
import { gql } from "@apollo/client";
export const GET_JOB_LINES_BY_PK = gql`
query GET_JOB_LINES_BY_PK($id: uuid!) {
export const GET_ALL_JOBLINES_BY_PK = gql`
query GET_ALL_JOBLINES_BY_PK($id: uuid!) {
joblines(where: { jobid: { _eq: $id } }, order_by: { line_no: asc }) {
id
line_no
@@ -46,7 +46,7 @@ export const GET_LINE_TICKET_BY_PK = gql`
id
lbr_adjustments
}
joblines(where: { jobid: { _eq: $id } }) {
joblines(where: { jobid: { _eq: $id }, removed: { _eq: false } }) {
id
line_desc
part_type
@@ -126,6 +126,7 @@ export const UPDATE_JOB_LINE = gql`
notes
location
status
removed
}
}
}
@@ -133,7 +134,7 @@ export const UPDATE_JOB_LINE = gql`
export const GET_JOB_LINES_TO_ENTER_BILL = gql`
query GET_JOB_LINES_TO_ENTER_BILL($id: uuid!) {
joblines(where: { jobid: { _eq: $id } }) {
joblines(where: { jobid: { _eq: $id }, removed: { _eq: false } }) {
id
line_desc
part_type

View File

@@ -115,7 +115,6 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
id
status
ro_number
ownr_fn
ownr_ln
v_model_yr
@@ -157,20 +156,27 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
first_name
last_name
}
partcount: joblines_aggregate {
partcount: joblines_aggregate(where: { removed: { _eq: false } }) {
nodes {
status
}
}
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _neq: "LAR" } }) {
labhrs: joblines_aggregate(
where: {
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate {
sum {
mod_lb_hrs
}
}
}
larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" } }) {
larhrs: joblines_aggregate(
where: {
_and: [{ mod_lbr_ty: { _eq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate {
sum {
mod_lb_hrs
@@ -196,14 +202,22 @@ export const QUERY_LBR_HRS_BY_PK = gql`
query QUERY_LBR_HRS_BY_PK($id: uuid!) {
jobs_by_pk(id: $id) {
id
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _neq: "LAR" } }) {
labhrs: joblines_aggregate(
where: {
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate {
sum {
mod_lb_hrs
}
}
}
larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" } }) {
larhrs: joblines_aggregate(
where: {
_and: [{ mod_lbr_ty: { _eq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate {
sum {
mod_lb_hrs
@@ -484,7 +498,7 @@ export const GET_JOB_BY_PK = gql`
deliverchecklist
voided
ca_bc_pvrt
joblines(where: { jobid: { _eq: $id } }, order_by: { line_no: asc }) {
joblines(where: { removed: { _eq: false } }, order_by: { line_no: asc }) {
id
line_no
unq_seq
@@ -1072,7 +1086,7 @@ export const QUERY_ALL_JOB_FIELDS = gql`
v_model_yr
v_vin
vehicleid
joblines {
joblines(where: { removed: { _eq: false } }) {
act_price
alt_co_id
alt_overrd
@@ -1136,7 +1150,6 @@ export const QUERY_JOBS_IN_PRODUCTION = gql`
) {
id
ro_number
ownr_co_nm
ownr_fn
ownr_ln
@@ -1144,15 +1157,22 @@ export const QUERY_JOBS_IN_PRODUCTION = gql`
v_make_desc
v_model_desc
scheduled_completion
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _neq: "LAR" } }) {
labhrs: joblines_aggregate(
where: {
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate {
sum {
mod_lb_hrs
}
}
}
larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" } }) {
larhrs: joblines_aggregate(
where: {
_and: [{ mod_lbr_ty: { _eq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate {
sum {
mod_lb_hrs