385 lines
6.5 KiB
JavaScript
385 lines
6.5 KiB
JavaScript
exports.FIND_BODYSHOP_BY_MESSAGING_SERVICE_SID = `
|
|
query FIND_BODYSHOP_BY_MESSAGING_SERVICE_SID(
|
|
$mssid: String!
|
|
$phone: String!
|
|
) {
|
|
bodyshops(where: { messagingservicesid: { _eq: $mssid } }) {
|
|
id
|
|
conversations(where: { phone_num: { _eq: $phone } }) {
|
|
id
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
exports.INSERT_MESSAGE = `
|
|
mutation INSERT_MESSAGE($msg: [messages_insert_input!]!) {
|
|
insert_messages(objects: $msg) {
|
|
returning {
|
|
conversation {
|
|
bodyshop {
|
|
associations(where: {active: {_eq: true}}) {
|
|
user {
|
|
fcmtokens
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
exports.UPDATE_MESSAGE_STATUS = `
|
|
mutation UPDATE_MESSAGE($msid: String!, $fields: messages_set_input!) {
|
|
update_messages(where: { msid: { _eq: $msid } }, _set: $fields) {
|
|
returning {
|
|
id
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
exports.QUERY_JOBS_FOR_RECEIVABLES_EXPORT = `
|
|
query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($ids: [uuid!]!) {
|
|
jobs(where: {id: {_in: $ids}}) {
|
|
id
|
|
job_totals
|
|
date_invoiced
|
|
ro_number
|
|
clm_total
|
|
clm_no
|
|
invoice_allocation
|
|
ownerid
|
|
ownr_ln
|
|
ownr_fn
|
|
ownr_addr1
|
|
ownr_addr2
|
|
ownr_zip
|
|
ownr_city
|
|
ownr_st
|
|
ins_co_nm
|
|
job_totals
|
|
rate_la1
|
|
rate_la2
|
|
rate_la3
|
|
rate_la4
|
|
rate_laa
|
|
rate_lab
|
|
rate_lad
|
|
rate_lae
|
|
rate_laf
|
|
rate_lag
|
|
rate_lam
|
|
rate_lar
|
|
rate_las
|
|
rate_lau
|
|
rate_ma2s
|
|
rate_ma2t
|
|
rate_ma3s
|
|
rate_mabl
|
|
rate_macs
|
|
rate_mahw
|
|
rate_mapa
|
|
rate_mash
|
|
rate_matd
|
|
class
|
|
owner {
|
|
accountingid
|
|
}
|
|
joblines(where:{removed: {_eq:false}}) {
|
|
id
|
|
line_desc
|
|
part_type
|
|
act_price
|
|
mod_lb_hrs
|
|
mod_lbr_ty
|
|
part_qty
|
|
op_code_desc
|
|
profitcenter_labor
|
|
profitcenter_part
|
|
}
|
|
}
|
|
bodyshops(where: {associations: {active: {_eq: true}}}) {
|
|
id
|
|
md_responsibility_centers
|
|
accountingconfig
|
|
}
|
|
}
|
|
`;
|
|
|
|
exports.QUERY_BILLS_FOR_PAYABLES_EXPORT = `
|
|
query QUERY_BILLS_FOR_PAYABLES_EXPORT($bills: [uuid!]!) {
|
|
bills(where: {id: {_in: $bills}}) {
|
|
id
|
|
date
|
|
due_date
|
|
federal_tax_rate
|
|
invoice_number
|
|
is_credit_memo
|
|
job {
|
|
id
|
|
ro_number
|
|
clm_no
|
|
ownr_fn
|
|
ownr_ln
|
|
ownr_co_nm
|
|
bodyshop{
|
|
md_responsibility_centers
|
|
}
|
|
}
|
|
billlines{
|
|
id
|
|
cost_center
|
|
actual_cost
|
|
applicable_taxes
|
|
}
|
|
state_tax_rate
|
|
local_tax_rate
|
|
total
|
|
vendor{
|
|
id
|
|
name
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
exports.QUERY_PAYMENTS_FOR_EXPORT = `
|
|
query QUERY_PAYMENTS_FOR_EXPORT($payments: [uuid!]!)
|
|
{ bodyshops(where: {associations: {active: {_eq: true}}}) {
|
|
id
|
|
md_responsibility_centers
|
|
accountingconfig
|
|
}
|
|
payments(where: {id: {_in: $payments}}) {
|
|
id
|
|
created_at
|
|
jobid
|
|
job {
|
|
id
|
|
ro_number
|
|
ownerid
|
|
ownr_ln
|
|
ownr_fn
|
|
ownr_addr1
|
|
ownr_addr2
|
|
ownr_zip
|
|
ownr_city
|
|
ownr_st
|
|
|
|
ins_co_nm
|
|
owner{
|
|
accountingid
|
|
}
|
|
ownr_fn
|
|
ownr_ln
|
|
ownr_co_nm
|
|
bodyshop{
|
|
accountingconfig
|
|
md_responsibility_centers
|
|
}
|
|
}
|
|
transactionid
|
|
memo
|
|
amount
|
|
stripeid
|
|
exportedat
|
|
stripeid
|
|
type
|
|
payer
|
|
paymentnum
|
|
date
|
|
}
|
|
}
|
|
`;
|
|
|
|
exports.QUERY_UPCOMING_APPOINTMENTS = `
|
|
query QUERY_UPCOMING_APPOINTMENTS($now: timestamptz!, $jobId: uuid!) {
|
|
jobs_by_pk(id: $jobId) {
|
|
bodyshop {
|
|
ssbuckets
|
|
target_touchtime
|
|
workingdays
|
|
}
|
|
jobhrs: joblines_aggregate {
|
|
aggregate {
|
|
sum {
|
|
mod_lb_hrs
|
|
}
|
|
}
|
|
}
|
|
}
|
|
appointments(where: {_and: {canceled: {_eq: false}, start: {_gte: $now}}}) {
|
|
start
|
|
isintake
|
|
id
|
|
block
|
|
job {
|
|
joblines_aggregate {
|
|
aggregate {
|
|
sum {
|
|
mod_lb_hrs
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
jobs(where: {inproduction: {_eq: true}}) {
|
|
id
|
|
scheduled_completion
|
|
labhrs: joblines_aggregate(where: {mod_lbr_ty: {_neq: "LAR"}}) {
|
|
aggregate {
|
|
sum {
|
|
mod_lb_hrs
|
|
}
|
|
}
|
|
}
|
|
larhrs: joblines_aggregate(where: {mod_lbr_ty: {_eq: "LAR"}}) {
|
|
aggregate {
|
|
sum {
|
|
mod_lb_hrs
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
exports.QUERY_EMPLOYEE_PIN = `query QUERY_EMPLOYEE_PIN($shopId: uuid!, $employeeId: String!) {
|
|
employees(where: {_and: {shopid: {_eq: $shopId}, employee_number: {_eq: $employeeId}}}) {
|
|
last_name
|
|
first_name
|
|
employee_number
|
|
id
|
|
cost_center
|
|
pin
|
|
}
|
|
}`;
|
|
|
|
exports.AUTOHOUSE_QUERY = `query AUTOHOUSE_EXPORT($start: timestamptz) {
|
|
jobs(where: {_and: [{updated_at: {_gt: $start}}, {bodyshop: {autohouseid: {_is_null: false}}}]}) {
|
|
id
|
|
ro_number
|
|
status
|
|
est_ct_fn
|
|
est_ct_ln
|
|
ownr_zip
|
|
referral_source
|
|
v_model_yr
|
|
v_model_desc
|
|
v_make_desc
|
|
v_vin
|
|
plate_no
|
|
plate_st
|
|
kmin
|
|
v_color
|
|
tlos_ind
|
|
ins_co_nm
|
|
ins_addr1
|
|
ins_city
|
|
ins_st
|
|
ins_zip
|
|
ins_ph1
|
|
loss_type
|
|
policy_no
|
|
clm_no
|
|
loss_date
|
|
asgn_date
|
|
date_estimated
|
|
date_open
|
|
scheduled_in
|
|
actual_in
|
|
scheduled_completion
|
|
actual_completion
|
|
scheduled_delivery
|
|
actual_delivery
|
|
date_invoiced
|
|
date_exported
|
|
rate_la1
|
|
rate_la2
|
|
rate_la3
|
|
rate_la4
|
|
rate_laa
|
|
rate_lab
|
|
rate_lad
|
|
rate_lae
|
|
rate_laf
|
|
rate_lag
|
|
rate_lam
|
|
rate_lar
|
|
rate_las
|
|
rate_lau
|
|
rate_ma2s
|
|
rate_ma2t
|
|
rate_ma3s
|
|
rate_mabl
|
|
rate_macs
|
|
rate_mahw
|
|
rate_matd
|
|
rate_mapa
|
|
rate_mash
|
|
job_totals
|
|
bodyshop {
|
|
id
|
|
shopname
|
|
address1
|
|
city
|
|
state
|
|
zip_post
|
|
country
|
|
phone
|
|
md_ro_statuses
|
|
md_order_statuses
|
|
autohouseid
|
|
}
|
|
joblines (where:{removed: {_eq:false}}){
|
|
id
|
|
line_no
|
|
status
|
|
line_ind
|
|
db_price
|
|
act_price
|
|
mod_lb_hrs
|
|
mod_lbr_ty
|
|
line_desc
|
|
prt_dsmk_m
|
|
prt_dsmk_p
|
|
part_qty
|
|
part_type
|
|
oem_partno
|
|
billlines (order_by:{bill:{date:desc_nulls_last}}) {
|
|
actual_cost
|
|
actual_price
|
|
quantity
|
|
bill {
|
|
vendor{
|
|
name
|
|
}
|
|
invoice_number
|
|
}
|
|
}
|
|
}
|
|
area_of_damage
|
|
employee_prep_rel {
|
|
first_name
|
|
last_name
|
|
employee_number
|
|
id
|
|
}
|
|
employee_refinish_rel {
|
|
first_name
|
|
last_name
|
|
employee_number
|
|
id
|
|
}
|
|
employee_body_rel {
|
|
first_name
|
|
last_name
|
|
employee_number
|
|
id
|
|
}
|
|
}
|
|
}
|
|
`;
|