MAJOR CHANGE: Renamed invoices to bills BOD-410

This commit is contained in:
Patrick Fic
2020-09-22 17:01:03 -07:00
parent 95ee3ae2bc
commit f84520c260
91 changed files with 2510 additions and 2624 deletions

View File

@@ -0,0 +1,214 @@
import gql from "graphql-tag";
export const INSERT_NEW_BILL = gql`
mutation INSERT_NEW_BILL($bill: [bills_insert_input!]!) {
insert_bills(objects: $bill) {
returning {
id
}
}
}
`;
export const QUERY_ALL_BILLS_PAGINATED = gql`
query QUERY_ALL_BILLS_PAGINATED(
$search: String
$offset: Int
$limit: Int
$order: [bills_order_by!]!
) {
search_bills(
args: { search: $search }
offset: $offset
limit: $limit
order_by: $order
) {
id
vendor {
id
name
}
federal_tax_rate
local_tax_rate
state_tax_rate
is_credit_memo
total
invoice_number
date
job {
id
ro_number
}
billlines {
actual_price
quantity
actual_cost
cost_center
id
line_desc
}
}
search_bills_aggregate(args: { search: $search }) {
aggregate {
count(distinct: true)
}
}
}
`;
export const QUERY_BILLS_BY_JOBID = gql`
query QUERY_PARTS_BILLS_BY_JOBID($jobid: uuid!) {
parts_orders(
where: { jobid: { _eq: $jobid } }
order_by: { order_date: desc }
) {
id
vendor {
id
name
}
order_date
deliver_by
parts_order_lines {
id
act_price
db_price
line_desc
oem_partno
status
line_remarks
quantity
job_line_id
jobline {
id
part_type
}
backordered_eta
backordered_on
}
order_number
user_email
}
bills(where: { jobid: { _eq: $jobid } }, order_by: { date: desc }) {
id
vendorid
vendor {
id
name
}
total
invoice_number
date
federal_tax_rate
state_tax_rate
local_tax_rate
is_credit_memo
billlines {
actual_price
quantity
actual_cost
cost_center
id
joblineid
line_desc
applicable_taxes
}
}
}
`;
// export const QUERY_INVOICES_BY_VENDOR_PAGINATED = gql`
// query QUERY_INVOICES_BY_VENDOR_PAGINATED(
// $vendorId: uuid!
// $offset: Int
// $limit: Int
// $order: [invoices_order_by!]!
// ) {
// invoices(
// where: { vendorid: { _eq: $vendorId } }
// offset: $offset
// limit: $limit
// order_by: $order
// ) {
// id
// job {
// id
// ro_number
// }
// total
// invoice_number
// date
// }
// invoices_aggregate(where: { vendorid: { _eq: $vendorId } }) {
// aggregate {
// count(distinct: true)
// }
// }
// }
// `;
export const QUERY_BILL_BY_PK = gql`
query QUERY_BILL_BY_PK($billid: uuid!) {
bills_by_pk(id: $billid) {
due_date
exported
exported_at
id
invoice_number
date
is_credit_memo
jobid
total
updated_at
vendorid
local_tax_rate
state_tax_rate
federal_tax_rate
vendor {
id
name
discount
}
billlines {
id
line_desc
actual_price
actual_cost
cost_center
quantity
joblineid
applicable_taxes
}
documents {
id
key
name
type
}
}
}
`;
export const UPDATE_BILL = gql`
mutation UPDATE_BILL($billId: uuid!, $bill: bills_set_input!) {
update_bills(where: { id: { _eq: $billId } }, _set: $bill) {
returning {
id
exported
exported_at
}
}
}
`;
export const UPDATE_BILLS = gql`
mutation UPDATE_BILLS($billIdList: [uuid!]!, $bill: bills_set_input!) {
update_bills(where: { id: { _in: $billIdList } }, _set: $bill) {
returning {
id
exported
exported_at
}
}
}
`;