Resolve dashboard/reporting discrepancy.

This commit is contained in:
Patrick Fic
2022-02-07 10:38:05 -08:00
parent 7ef8ef5f2f
commit eb05a746c4
3 changed files with 25 additions and 16 deletions

View File

@@ -31,16 +31,24 @@ export default function DashboardProjectedMonthlySales({ data, ...cardProps }) {
} }
export const DashboardProjectedMonthlySalesGql = ` export const DashboardProjectedMonthlySalesGql = `
projected_monthly_sales: jobs(where: {_or: [{_and: [{date_invoiced: {_gte: "${moment() projected_monthly_sales: jobs(where: {
.startOf("month") voided: {_eq: false},
.format("YYYY-MM-DD")}"}}, {date_invoiced: {_lte: "${moment() _or: [
.endOf("month") {_and: [{date_invoiced: {_gte: "${moment()
.format("YYYY-MM-DD")}"}}]}, {_and: [{scheduled_completion: {_gte: "${moment() .startOf("month").startOf('day').toISOString()}"}}, {date_invoiced: {_lte: "${moment()
.endOf("month").endOf('day').toISOString()}"}}]},
{_and: [
{date_invoiced: {_is_null: true}},
{scheduled_completion: {_gte: "${moment()
.startOf("month") .startOf("month")
.format("YYYY-MM-DD")}"}}, {scheduled_completion: {_lte: "${moment() .startOf('day').toISOString()}"}}, {scheduled_completion: {_lte: "${moment()
.endOf("month") .endOf("month").endOf('day').toISOString()}"}}]}
.format("YYYY-MM-DD")}"}}]}]}) {
]}) {
id id
ro_number
voided
date_invoiced date_invoiced
job_totals job_totals
} }

View File

@@ -280,12 +280,13 @@ const createDashboardQuery = (state) => {
return gql` return gql`
query QUERY_DASHBOARD_DETAILS { query QUERY_DASHBOARD_DETAILS {
${componentBasedAdditions || ""} ${componentBasedAdditions || ""}
monthly_sales: jobs(where: {_and: [{date_invoiced: {_gte: "${moment() monthly_sales: jobs(where: {_and: [
.startOf("month") { voided: {_eq: false}},
.format("YYYY-MM-DD")}"}}, {date_invoiced: {_lte: "${moment() {date_invoiced: {_gte: "${moment()
.endOf("month") .startOf("month").startOf('day').toISOString()}"}}, {date_invoiced: {_lte: "${moment()
.format("YYYY-MM-DD")}"}}]}) { .endOf("month").endOf('day').toISOString()}"}}]}) {
id id
ro_number
date_invoiced date_invoiced
job_totals job_totals
rate_la1 rate_la1
@@ -333,14 +334,14 @@ const createDashboardQuery = (state) => {
part_qty part_qty
part_type part_type
} }
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _neq: "LAR" } }) { labhrs: joblines_aggregate(where: { mod_lbr_ty: { _neq: "LAR" }, removed: { _eq: false } }) {
aggregate { aggregate {
sum { sum {
mod_lb_hrs mod_lb_hrs
} }
} }
} }
larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" } }) { larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" }, removed: { _eq: false } }) {
aggregate { aggregate {
sum { sum {
mod_lb_hrs mod_lb_hrs

View File

@@ -2230,7 +2230,7 @@
"gsr_by_csr": "Gross Sales by CSR", "gsr_by_csr": "Gross Sales by CSR",
"gsr_by_delivery_date": "Gross Sales by Delivery Date", "gsr_by_delivery_date": "Gross Sales by Delivery Date",
"gsr_by_estimator": "Gross Sales by Estimator", "gsr_by_estimator": "Gross Sales by Estimator",
"gsr_by_exported_date": "Gross Sales by Export Date", "gsr_by_exported_date": "Exported Gross Sales",
"gsr_by_ins_co": "Gross Sales by Insurance Company", "gsr_by_ins_co": "Gross Sales by Insurance Company",
"gsr_by_make": "Gross Sales by Vehicle Make", "gsr_by_make": "Gross Sales by Vehicle Make",
"gsr_by_referral": "Gross Sales by Referral Source", "gsr_by_referral": "Gross Sales by Referral Source",