Merge branch 'feature/IO-1828-Front-End-Package-Updates' into test-beta
This commit is contained in:
@@ -106,85 +106,89 @@ export function ProductionListDetail({
|
|||||||
{error && <AlertComponent error={JSON.stringify(error)} />}
|
{error && <AlertComponent error={JSON.stringify(error)} />}
|
||||||
{!loading && data && (
|
{!loading && data && (
|
||||||
<div>
|
<div>
|
||||||
<Space direction="vertical">
|
<CardTemplate
|
||||||
<CardTemplate
|
title={t("jobs.labels.employeeassignments")}
|
||||||
title={t("jobs.labels.employeeassignments")}
|
loading={loading}
|
||||||
loading={loading}
|
>
|
||||||
>
|
<JobEmployeeAssignments job={data.jobs_by_pk} refetch={refetch} />
|
||||||
<JobEmployeeAssignments job={data.jobs_by_pk} refetch={refetch} />
|
</CardTemplate>
|
||||||
</CardTemplate>
|
<div style={{ height: "8px" }} />
|
||||||
<Descriptions bordered column={1}>
|
<Descriptions bordered column={1}>
|
||||||
<Descriptions.Item label={t("jobs.fields.ro_number")}>
|
<Descriptions.Item label={t("jobs.fields.ro_number")}>
|
||||||
{theJob.ro_number || ""}
|
{theJob.ro_number || ""}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label={t("jobs.fields.alt_transport")}>
|
<Descriptions.Item label={t("jobs.fields.alt_transport")}>
|
||||||
<Space>
|
<Space>
|
||||||
{data.jobs_by_pk.alt_transport || ""}
|
{data.jobs_by_pk.alt_transport || ""}
|
||||||
<JobAtChange job={data.jobs_by_pk} />
|
<JobAtChange job={data.jobs_by_pk} />
|
||||||
</Space>
|
</Space>
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label={t("jobs.fields.clm_no")}>
|
<Descriptions.Item label={t("jobs.fields.clm_no")}>
|
||||||
{theJob.clm_no || ""}
|
{theJob.clm_no || ""}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label={t("jobs.fields.ins_co_nm")}>
|
<Descriptions.Item label={t("jobs.fields.ins_co_nm")}>
|
||||||
{theJob.ins_co_nm || ""}
|
{theJob.ins_co_nm || ""}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label={t("jobs.fields.owner")}>
|
<Descriptions.Item label={t("jobs.fields.owner")}>
|
||||||
<Space>
|
<Space>
|
||||||
<OwnerNameDisplay ownerObject={theJob} />
|
<OwnerNameDisplay ownerObject={theJob} />
|
||||||
{!technician ? (
|
{!technician ? (
|
||||||
<>
|
<>
|
||||||
<StartChatButton
|
<StartChatButton
|
||||||
phone={data.jobs_by_pk.ownr_ph1}
|
phone={data.jobs_by_pk.ownr_ph1}
|
||||||
jobid={data.jobs_by_pk.id}
|
jobid={data.jobs_by_pk.id}
|
||||||
/>
|
/>
|
||||||
<StartChatButton
|
<StartChatButton
|
||||||
phone={data.jobs_by_pk.ownr_ph2}
|
phone={data.jobs_by_pk.ownr_ph2}
|
||||||
jobid={data.jobs_by_pk.id}
|
jobid={data.jobs_by_pk.id}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<PhoneNumberFormatter>
|
<PhoneNumberFormatter>
|
||||||
{data.jobs_by_pk.ownr_ph1}
|
{data.jobs_by_pk.ownr_ph1}
|
||||||
</PhoneNumberFormatter>
|
</PhoneNumberFormatter>
|
||||||
<PhoneNumberFormatter>
|
<PhoneNumberFormatter>
|
||||||
{data.jobs_by_pk.ownr_ph2}
|
{data.jobs_by_pk.ownr_ph2}
|
||||||
</PhoneNumberFormatter>
|
</PhoneNumberFormatter>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label={t("jobs.fields.vehicle")}>
|
<Descriptions.Item label={t("jobs.fields.vehicle")}>
|
||||||
{`${theJob.v_model_yr || ""} ${theJob.v_color || ""} ${
|
{`${theJob.v_model_yr || ""} ${theJob.v_color || ""} ${
|
||||||
theJob.v_make_desc || ""
|
theJob.v_make_desc || ""
|
||||||
} ${theJob.v_model_desc || ""}`}
|
} ${theJob.v_model_desc || ""}`}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label={t("jobs.fields.clm_total")}>
|
<Descriptions.Item label={t("jobs.fields.clm_total")}>
|
||||||
<CurrencyFormatter>{theJob.clm_total}</CurrencyFormatter>
|
<CurrencyFormatter>{theJob.clm_total}</CurrencyFormatter>
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label={t("jobs.fields.actual_in")}>
|
<Descriptions.Item label={t("jobs.fields.actual_in")}>
|
||||||
<DateFormatter>{theJob.actual_in}</DateFormatter>
|
<DateFormatter>{theJob.actual_in}</DateFormatter>
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label={t("jobs.fields.scheduled_completion")}>
|
<Descriptions.Item label={t("jobs.fields.scheduled_completion")}>
|
||||||
<DateFormatter>{theJob.scheduled_completion}</DateFormatter>
|
<DateFormatter>{theJob.scheduled_completion}</DateFormatter>
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
</Descriptions>
|
</Descriptions>
|
||||||
<JobDetailCardsPartsComponent
|
<div style={{ height: "8px" }} />
|
||||||
loading={loading}
|
<JobDetailCardsPartsComponent
|
||||||
data={data ? data.jobs_by_pk : null}
|
loading={loading}
|
||||||
/>
|
data={data ? data.jobs_by_pk : null}
|
||||||
<JobDetailCardsNotesComponent
|
/>
|
||||||
loading={loading}
|
<div style={{ height: "8px" }} />
|
||||||
data={data ? data.jobs_by_pk : null}
|
<JobDetailCardsNotesComponent
|
||||||
/>
|
loading={loading}
|
||||||
{!bodyshop.uselocalmediaserver && (
|
data={data ? data.jobs_by_pk : null}
|
||||||
|
/>
|
||||||
|
{!bodyshop.uselocalmediaserver && (
|
||||||
|
<>
|
||||||
|
<div style={{ height: "8px" }} />
|
||||||
<JobDetailCardsDocumentsComponent
|
<JobDetailCardsDocumentsComponent
|
||||||
loading={loading}
|
loading={loading}
|
||||||
data={data ? data.jobs_by_pk : null}
|
data={data ? data.jobs_by_pk : null}
|
||||||
/>
|
/>
|
||||||
)}
|
</>
|
||||||
</Space>
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Drawer>
|
</Drawer>
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
- function:
|
||||||
|
name: jobs_ar_summary
|
||||||
|
schema: public
|
||||||
- function:
|
- function:
|
||||||
name: search_bills
|
name: search_bills
|
||||||
schema: public
|
schema: public
|
||||||
|
|||||||
@@ -2673,6 +2673,9 @@
|
|||||||
- table:
|
- table:
|
||||||
name: ioevents
|
name: ioevents
|
||||||
schema: public
|
schema: public
|
||||||
|
- table:
|
||||||
|
name: job_ar_schema
|
||||||
|
schema: public
|
||||||
- table:
|
- table:
|
||||||
name: job_conversations
|
name: job_conversations
|
||||||
schema: public
|
schema: public
|
||||||
@@ -3812,6 +3815,7 @@
|
|||||||
- referral_source
|
- referral_source
|
||||||
- referral_source_extra
|
- referral_source_extra
|
||||||
- regie_number
|
- regie_number
|
||||||
|
- remove_from_ar
|
||||||
- ro_number
|
- ro_number
|
||||||
- scheduled_completion
|
- scheduled_completion
|
||||||
- scheduled_delivery
|
- scheduled_delivery
|
||||||
@@ -4093,6 +4097,7 @@
|
|||||||
- referral_source
|
- referral_source
|
||||||
- referral_source_extra
|
- referral_source_extra
|
||||||
- regie_number
|
- regie_number
|
||||||
|
- remove_from_ar
|
||||||
- ro_number
|
- ro_number
|
||||||
- scheduled_completion
|
- scheduled_completion
|
||||||
- scheduled_delivery
|
- scheduled_delivery
|
||||||
|
|||||||
33
hasura/migrations/1705693552101_run_sql_migration/down.sql
Normal file
33
hasura/migrations/1705693552101_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
-- RETURNS SETOF jobs
|
||||||
|
-- LANGUAGE plpgsql
|
||||||
|
-- STABLE
|
||||||
|
-- AS $function$
|
||||||
|
-- BEGIN
|
||||||
|
--
|
||||||
|
-- RETURN query
|
||||||
|
-- select
|
||||||
|
-- j.id,
|
||||||
|
-- j.shopid,
|
||||||
|
-- j.ro_number,
|
||||||
|
-- j.clm_total,
|
||||||
|
-- p.total_payments,
|
||||||
|
-- j.clm_total - p.total_payments as balance
|
||||||
|
-- from
|
||||||
|
-- jobs j
|
||||||
|
-- left join (
|
||||||
|
-- select
|
||||||
|
-- p.jobid,
|
||||||
|
-- sum(p.amount) as total_payments
|
||||||
|
-- from
|
||||||
|
-- payments p
|
||||||
|
-- group by
|
||||||
|
-- p.jobid
|
||||||
|
-- ) p on
|
||||||
|
-- j.id = p.jobid ;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- END
|
||||||
|
-- $function$;
|
||||||
31
hasura/migrations/1705693552101_run_sql_migration/up.sql
Normal file
31
hasura/migrations/1705693552101_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
RETURNS SETOF jobs
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
STABLE
|
||||||
|
AS $function$
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
RETURN query
|
||||||
|
select
|
||||||
|
j.id,
|
||||||
|
j.shopid,
|
||||||
|
j.ro_number,
|
||||||
|
j.clm_total,
|
||||||
|
p.total_payments,
|
||||||
|
j.clm_total - p.total_payments as balance
|
||||||
|
from
|
||||||
|
jobs j
|
||||||
|
left join (
|
||||||
|
select
|
||||||
|
p.jobid,
|
||||||
|
sum(p.amount) as total_payments
|
||||||
|
from
|
||||||
|
payments p
|
||||||
|
group by
|
||||||
|
p.jobid
|
||||||
|
) p on
|
||||||
|
j.id = p.jobid ;
|
||||||
|
|
||||||
|
|
||||||
|
END
|
||||||
|
$function$;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
DROP TABLE "public"."job_ar_schema";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
CREATE TABLE "public"."job_ar_schema" ("id" uuid NOT NULL, "ro_number" text, "clm_total" numeric NOT NULL, "total_payments" numeric NOT NULL DEFAULT 0, "balance" numeric NOT NULL DEFAULT 0, PRIMARY KEY ("id") );
|
||||||
34
hasura/migrations/1705693896379_run_sql_migration/down.sql
Normal file
34
hasura/migrations/1705693896379_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- DROP FUNCTION public.jobs_ar_summary;
|
||||||
|
--
|
||||||
|
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
-- RETURNS SETOF job_ar_schema
|
||||||
|
-- LANGUAGE plpgsql
|
||||||
|
-- STABLE
|
||||||
|
-- AS $function$
|
||||||
|
-- BEGIN
|
||||||
|
--
|
||||||
|
-- RETURN query
|
||||||
|
-- select
|
||||||
|
-- j.id,
|
||||||
|
-- j.ro_number,
|
||||||
|
-- j.clm_total,
|
||||||
|
-- p.total_payments,
|
||||||
|
-- j.clm_total - p.total_payments as balance
|
||||||
|
-- from
|
||||||
|
-- jobs j
|
||||||
|
-- left join (
|
||||||
|
-- select
|
||||||
|
-- p.jobid,
|
||||||
|
-- sum(p.amount) as total_payments
|
||||||
|
-- from
|
||||||
|
-- payments p
|
||||||
|
-- group by
|
||||||
|
-- p.jobid
|
||||||
|
-- ) p on
|
||||||
|
-- j.id = p.jobid ;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- END
|
||||||
|
-- $function$;
|
||||||
32
hasura/migrations/1705693896379_run_sql_migration/up.sql
Normal file
32
hasura/migrations/1705693896379_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
DROP FUNCTION public.jobs_ar_summary;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
RETURNS SETOF job_ar_schema
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
STABLE
|
||||||
|
AS $function$
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
RETURN query
|
||||||
|
select
|
||||||
|
j.id,
|
||||||
|
j.ro_number,
|
||||||
|
j.clm_total,
|
||||||
|
p.total_payments,
|
||||||
|
j.clm_total - p.total_payments as balance
|
||||||
|
from
|
||||||
|
jobs j
|
||||||
|
left join (
|
||||||
|
select
|
||||||
|
p.jobid,
|
||||||
|
sum(p.amount) as total_payments
|
||||||
|
from
|
||||||
|
payments p
|
||||||
|
group by
|
||||||
|
p.jobid
|
||||||
|
) p on
|
||||||
|
j.id = p.jobid ;
|
||||||
|
|
||||||
|
|
||||||
|
END
|
||||||
|
$function$;
|
||||||
32
hasura/migrations/1705694146809_run_sql_migration/down.sql
Normal file
32
hasura/migrations/1705694146809_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
-- RETURNS SETOF job_ar_schema
|
||||||
|
-- LANGUAGE plpgsql
|
||||||
|
-- STABLE
|
||||||
|
-- AS $function$
|
||||||
|
-- BEGIN
|
||||||
|
--
|
||||||
|
-- RETURN query
|
||||||
|
-- select
|
||||||
|
-- j.id,
|
||||||
|
-- j.ro_number,
|
||||||
|
-- j.clm_total,
|
||||||
|
-- p.total_payments,
|
||||||
|
-- j.clm_total - p.total_payments as balance
|
||||||
|
-- from
|
||||||
|
-- jobs j
|
||||||
|
-- left join (
|
||||||
|
-- select
|
||||||
|
-- p.jobid,
|
||||||
|
-- coalesce (sum(p.amount),0) as total_payments
|
||||||
|
-- from
|
||||||
|
-- payments p
|
||||||
|
-- group by
|
||||||
|
-- p.jobid
|
||||||
|
-- ) p on
|
||||||
|
-- j.id = p.jobid ;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- END
|
||||||
|
-- $function$;
|
||||||
30
hasura/migrations/1705694146809_run_sql_migration/up.sql
Normal file
30
hasura/migrations/1705694146809_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
RETURNS SETOF job_ar_schema
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
STABLE
|
||||||
|
AS $function$
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
RETURN query
|
||||||
|
select
|
||||||
|
j.id,
|
||||||
|
j.ro_number,
|
||||||
|
j.clm_total,
|
||||||
|
p.total_payments,
|
||||||
|
j.clm_total - p.total_payments as balance
|
||||||
|
from
|
||||||
|
jobs j
|
||||||
|
left join (
|
||||||
|
select
|
||||||
|
p.jobid,
|
||||||
|
coalesce (sum(p.amount),0) as total_payments
|
||||||
|
from
|
||||||
|
payments p
|
||||||
|
group by
|
||||||
|
p.jobid
|
||||||
|
) p on
|
||||||
|
j.id = p.jobid ;
|
||||||
|
|
||||||
|
|
||||||
|
END
|
||||||
|
$function$;
|
||||||
32
hasura/migrations/1705694176838_run_sql_migration/down.sql
Normal file
32
hasura/migrations/1705694176838_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
-- RETURNS SETOF job_ar_schema
|
||||||
|
-- LANGUAGE plpgsql
|
||||||
|
-- STABLE
|
||||||
|
-- AS $function$
|
||||||
|
-- BEGIN
|
||||||
|
--
|
||||||
|
-- RETURN query
|
||||||
|
-- select
|
||||||
|
-- j.id,
|
||||||
|
-- j.ro_number,
|
||||||
|
-- j.clm_total,
|
||||||
|
-- p.total_payments,
|
||||||
|
-- j.clm_total - p.total_payments as balance
|
||||||
|
-- from
|
||||||
|
-- jobs j
|
||||||
|
-- left join (
|
||||||
|
-- select
|
||||||
|
-- p.jobid,
|
||||||
|
-- coalesce (sum(p.amount),0) as total_payments
|
||||||
|
-- from
|
||||||
|
-- payments p
|
||||||
|
-- group by
|
||||||
|
-- p.jobid
|
||||||
|
-- ) p on
|
||||||
|
-- j.id = p.jobid ;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- END
|
||||||
|
-- $function$;
|
||||||
30
hasura/migrations/1705694176838_run_sql_migration/up.sql
Normal file
30
hasura/migrations/1705694176838_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
RETURNS SETOF job_ar_schema
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
STABLE
|
||||||
|
AS $function$
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
RETURN query
|
||||||
|
select
|
||||||
|
j.id,
|
||||||
|
j.ro_number,
|
||||||
|
j.clm_total,
|
||||||
|
p.total_payments,
|
||||||
|
j.clm_total - p.total_payments as balance
|
||||||
|
from
|
||||||
|
jobs j
|
||||||
|
left join (
|
||||||
|
select
|
||||||
|
p.jobid,
|
||||||
|
coalesce (sum(p.amount),0) as total_payments
|
||||||
|
from
|
||||||
|
payments p
|
||||||
|
group by
|
||||||
|
p.jobid
|
||||||
|
) p on
|
||||||
|
j.id = p.jobid ;
|
||||||
|
|
||||||
|
|
||||||
|
END
|
||||||
|
$function$;
|
||||||
32
hasura/migrations/1705696451631_run_sql_migration/down.sql
Normal file
32
hasura/migrations/1705696451631_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
-- RETURNS SETOF job_ar_schema
|
||||||
|
-- LANGUAGE plpgsql
|
||||||
|
-- STABLE
|
||||||
|
-- AS $function$
|
||||||
|
-- BEGIN
|
||||||
|
--
|
||||||
|
-- RETURN query
|
||||||
|
-- select
|
||||||
|
-- j.id,
|
||||||
|
-- j.ro_number,
|
||||||
|
-- j.clm_total,
|
||||||
|
-- coalesce (p.total_payments,0) as total_payments,
|
||||||
|
-- j.clm_total - coalesce (p.total_payments,0) as balance
|
||||||
|
-- from
|
||||||
|
-- jobs j
|
||||||
|
-- left join (
|
||||||
|
-- select
|
||||||
|
-- p.jobid,
|
||||||
|
-- coalesce (sum(p.amount),0) as total_payments
|
||||||
|
-- from
|
||||||
|
-- payments p
|
||||||
|
-- group by
|
||||||
|
-- p.jobid
|
||||||
|
-- ) p on
|
||||||
|
-- j.id = p.jobid ;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- END
|
||||||
|
-- $function$;
|
||||||
30
hasura/migrations/1705696451631_run_sql_migration/up.sql
Normal file
30
hasura/migrations/1705696451631_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
RETURNS SETOF job_ar_schema
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
STABLE
|
||||||
|
AS $function$
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
RETURN query
|
||||||
|
select
|
||||||
|
j.id,
|
||||||
|
j.ro_number,
|
||||||
|
j.clm_total,
|
||||||
|
coalesce (p.total_payments,0) as total_payments,
|
||||||
|
j.clm_total - coalesce (p.total_payments,0) as balance
|
||||||
|
from
|
||||||
|
jobs j
|
||||||
|
left join (
|
||||||
|
select
|
||||||
|
p.jobid,
|
||||||
|
coalesce (sum(p.amount),0) as total_payments
|
||||||
|
from
|
||||||
|
payments p
|
||||||
|
group by
|
||||||
|
p.jobid
|
||||||
|
) p on
|
||||||
|
j.id = p.jobid ;
|
||||||
|
|
||||||
|
|
||||||
|
END
|
||||||
|
$function$;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- alter table "public"."jobs" add column "remove_from_ar" boolean
|
||||||
|
-- not null default 'false';
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."jobs" add column "remove_from_ar" boolean
|
||||||
|
not null default 'false';
|
||||||
33
hasura/migrations/1705698426997_run_sql_migration/down.sql
Normal file
33
hasura/migrations/1705698426997_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
-- RETURNS SETOF job_ar_schema
|
||||||
|
-- LANGUAGE plpgsql
|
||||||
|
-- STABLE
|
||||||
|
-- AS $function$
|
||||||
|
-- BEGIN
|
||||||
|
--
|
||||||
|
-- RETURN query
|
||||||
|
-- select
|
||||||
|
-- j.id,
|
||||||
|
-- j.ro_number,
|
||||||
|
-- j.clm_total,
|
||||||
|
-- coalesce (p.total_payments,0) as total_payments,
|
||||||
|
-- j.clm_total - coalesce (p.total_payments,0) as balance
|
||||||
|
-- from
|
||||||
|
-- jobs j
|
||||||
|
-- left join (
|
||||||
|
-- select
|
||||||
|
-- p.jobid,
|
||||||
|
-- coalesce (sum(p.amount),0) as total_payments
|
||||||
|
-- from
|
||||||
|
-- payments p
|
||||||
|
-- group by
|
||||||
|
-- p.jobid
|
||||||
|
-- ) p on
|
||||||
|
-- j.id = p.jobid
|
||||||
|
-- where j.remove_from_ar = false;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- END
|
||||||
|
-- $function$;
|
||||||
31
hasura/migrations/1705698426997_run_sql_migration/up.sql
Normal file
31
hasura/migrations/1705698426997_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
RETURNS SETOF job_ar_schema
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
STABLE
|
||||||
|
AS $function$
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
RETURN query
|
||||||
|
select
|
||||||
|
j.id,
|
||||||
|
j.ro_number,
|
||||||
|
j.clm_total,
|
||||||
|
coalesce (p.total_payments,0) as total_payments,
|
||||||
|
j.clm_total - coalesce (p.total_payments,0) as balance
|
||||||
|
from
|
||||||
|
jobs j
|
||||||
|
left join (
|
||||||
|
select
|
||||||
|
p.jobid,
|
||||||
|
coalesce (sum(p.amount),0) as total_payments
|
||||||
|
from
|
||||||
|
payments p
|
||||||
|
group by
|
||||||
|
p.jobid
|
||||||
|
) p on
|
||||||
|
j.id = p.jobid
|
||||||
|
where j.remove_from_ar = false;
|
||||||
|
|
||||||
|
|
||||||
|
END
|
||||||
|
$function$;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- alter table "public"."job_ar_schema" add column "date_invoiced" timestamptz
|
||||||
|
-- null;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."job_ar_schema" add column "date_invoiced" timestamptz
|
||||||
|
null;
|
||||||
34
hasura/migrations/1705698534883_run_sql_migration/down.sql
Normal file
34
hasura/migrations/1705698534883_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
-- RETURNS SETOF job_ar_schema
|
||||||
|
-- LANGUAGE plpgsql
|
||||||
|
-- STABLE
|
||||||
|
-- AS $function$
|
||||||
|
-- BEGIN
|
||||||
|
--
|
||||||
|
-- RETURN query
|
||||||
|
-- select
|
||||||
|
-- j.id,
|
||||||
|
-- j.ro_number,
|
||||||
|
-- j.clm_total,
|
||||||
|
-- j.date_invoiced,
|
||||||
|
-- coalesce (p.total_payments,0) as total_payments,
|
||||||
|
-- j.clm_total - coalesce (p.total_payments,0) as balance
|
||||||
|
-- from
|
||||||
|
-- jobs j
|
||||||
|
-- left join (
|
||||||
|
-- select
|
||||||
|
-- p.jobid,
|
||||||
|
-- coalesce (sum(p.amount),0) as total_payments
|
||||||
|
-- from
|
||||||
|
-- payments p
|
||||||
|
-- group by
|
||||||
|
-- p.jobid
|
||||||
|
-- ) p on
|
||||||
|
-- j.id = p.jobid
|
||||||
|
-- where j.remove_from_ar = false and j.date_invoiced is not null;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- END
|
||||||
|
-- $function$;
|
||||||
32
hasura/migrations/1705698534883_run_sql_migration/up.sql
Normal file
32
hasura/migrations/1705698534883_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
RETURNS SETOF job_ar_schema
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
STABLE
|
||||||
|
AS $function$
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
RETURN query
|
||||||
|
select
|
||||||
|
j.id,
|
||||||
|
j.ro_number,
|
||||||
|
j.clm_total,
|
||||||
|
j.date_invoiced,
|
||||||
|
coalesce (p.total_payments,0) as total_payments,
|
||||||
|
j.clm_total - coalesce (p.total_payments,0) as balance
|
||||||
|
from
|
||||||
|
jobs j
|
||||||
|
left join (
|
||||||
|
select
|
||||||
|
p.jobid,
|
||||||
|
coalesce (sum(p.amount),0) as total_payments
|
||||||
|
from
|
||||||
|
payments p
|
||||||
|
group by
|
||||||
|
p.jobid
|
||||||
|
) p on
|
||||||
|
j.id = p.jobid
|
||||||
|
where j.remove_from_ar = false and j.date_invoiced is not null;
|
||||||
|
|
||||||
|
|
||||||
|
END
|
||||||
|
$function$;
|
||||||
34
hasura/migrations/1705698593644_run_sql_migration/down.sql
Normal file
34
hasura/migrations/1705698593644_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
-- RETURNS SETOF job_ar_schema
|
||||||
|
-- LANGUAGE plpgsql
|
||||||
|
-- STABLE
|
||||||
|
-- AS $function$
|
||||||
|
-- BEGIN
|
||||||
|
--
|
||||||
|
-- RETURN query
|
||||||
|
-- select
|
||||||
|
-- j.id,
|
||||||
|
-- j.ro_number,
|
||||||
|
-- j.clm_total,
|
||||||
|
-- coalesce (p.total_payments,0) as total_payments,
|
||||||
|
-- j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||||
|
-- j.date_invoiced
|
||||||
|
-- from
|
||||||
|
-- jobs j
|
||||||
|
-- left join (
|
||||||
|
-- select
|
||||||
|
-- p.jobid,
|
||||||
|
-- coalesce (sum(p.amount),0) as total_payments
|
||||||
|
-- from
|
||||||
|
-- payments p
|
||||||
|
-- group by
|
||||||
|
-- p.jobid
|
||||||
|
-- ) p on
|
||||||
|
-- j.id = p.jobid
|
||||||
|
-- where j.remove_from_ar = false and j.date_invoiced is not null;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- END
|
||||||
|
-- $function$;
|
||||||
32
hasura/migrations/1705698593644_run_sql_migration/up.sql
Normal file
32
hasura/migrations/1705698593644_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
RETURNS SETOF job_ar_schema
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
STABLE
|
||||||
|
AS $function$
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
RETURN query
|
||||||
|
select
|
||||||
|
j.id,
|
||||||
|
j.ro_number,
|
||||||
|
j.clm_total,
|
||||||
|
coalesce (p.total_payments,0) as total_payments,
|
||||||
|
j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||||
|
j.date_invoiced
|
||||||
|
from
|
||||||
|
jobs j
|
||||||
|
left join (
|
||||||
|
select
|
||||||
|
p.jobid,
|
||||||
|
coalesce (sum(p.amount),0) as total_payments
|
||||||
|
from
|
||||||
|
payments p
|
||||||
|
group by
|
||||||
|
p.jobid
|
||||||
|
) p on
|
||||||
|
j.id = p.jobid
|
||||||
|
where j.remove_from_ar = false and j.date_invoiced is not null;
|
||||||
|
|
||||||
|
|
||||||
|
END
|
||||||
|
$function$;
|
||||||
34
hasura/migrations/1705698876975_run_sql_migration/down.sql
Normal file
34
hasura/migrations/1705698876975_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
-- RETURNS SETOF job_ar_schema
|
||||||
|
-- LANGUAGE plpgsql
|
||||||
|
-- STABLE
|
||||||
|
-- AS $function$
|
||||||
|
-- BEGIN
|
||||||
|
--
|
||||||
|
-- RETURN query
|
||||||
|
-- select
|
||||||
|
-- j.id,
|
||||||
|
-- j.ro_number,
|
||||||
|
-- j.clm_total,
|
||||||
|
-- coalesce (p.total_payments,0) as total_payments,
|
||||||
|
-- j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||||
|
-- j.date_invoiced
|
||||||
|
-- from
|
||||||
|
-- jobs j
|
||||||
|
-- left join (
|
||||||
|
-- select
|
||||||
|
-- p.jobid,
|
||||||
|
-- coalesce (sum(p.amount),0) as total_payments
|
||||||
|
-- from
|
||||||
|
-- payments p
|
||||||
|
-- group by
|
||||||
|
-- p.jobid
|
||||||
|
-- ) p on
|
||||||
|
-- j.id = p.jobid
|
||||||
|
-- where j.remove_from_ar = false and j.date_invoiced is not null and balance > 0;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- END
|
||||||
|
-- $function$;
|
||||||
32
hasura/migrations/1705698876975_run_sql_migration/up.sql
Normal file
32
hasura/migrations/1705698876975_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
RETURNS SETOF job_ar_schema
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
STABLE
|
||||||
|
AS $function$
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
RETURN query
|
||||||
|
select
|
||||||
|
j.id,
|
||||||
|
j.ro_number,
|
||||||
|
j.clm_total,
|
||||||
|
coalesce (p.total_payments,0) as total_payments,
|
||||||
|
j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||||
|
j.date_invoiced
|
||||||
|
from
|
||||||
|
jobs j
|
||||||
|
left join (
|
||||||
|
select
|
||||||
|
p.jobid,
|
||||||
|
coalesce (sum(p.amount),0) as total_payments
|
||||||
|
from
|
||||||
|
payments p
|
||||||
|
group by
|
||||||
|
p.jobid
|
||||||
|
) p on
|
||||||
|
j.id = p.jobid
|
||||||
|
where j.remove_from_ar = false and j.date_invoiced is not null and balance > 0;
|
||||||
|
|
||||||
|
|
||||||
|
END
|
||||||
|
$function$;
|
||||||
34
hasura/migrations/1705700945994_run_sql_migration/down.sql
Normal file
34
hasura/migrations/1705700945994_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
-- RETURNS SETOF job_ar_schema
|
||||||
|
-- LANGUAGE plpgsql
|
||||||
|
-- STABLE
|
||||||
|
-- AS $function$
|
||||||
|
-- BEGIN
|
||||||
|
--
|
||||||
|
-- RETURN query
|
||||||
|
-- select
|
||||||
|
-- j.id,
|
||||||
|
-- j.ro_number,
|
||||||
|
-- j.clm_total,
|
||||||
|
-- coalesce (p.total_payments,0) as total_payments,
|
||||||
|
-- j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||||
|
-- j.date_invoiced
|
||||||
|
-- from
|
||||||
|
-- jobs j
|
||||||
|
-- left join (
|
||||||
|
-- select
|
||||||
|
-- p.jobid,
|
||||||
|
-- coalesce (sum(p.amount),0) as total_payments
|
||||||
|
-- from
|
||||||
|
-- payments p
|
||||||
|
-- group by
|
||||||
|
-- p.jobid
|
||||||
|
-- ) p on
|
||||||
|
-- j.id = p.jobid
|
||||||
|
-- where j.remove_from_ar = false and j.date_invoiced is not null and j.clm_total - coalesce (p.total_payments,0) > 0;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- END
|
||||||
|
-- $function$;
|
||||||
32
hasura/migrations/1705700945994_run_sql_migration/up.sql
Normal file
32
hasura/migrations/1705700945994_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||||
|
RETURNS SETOF job_ar_schema
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
STABLE
|
||||||
|
AS $function$
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
RETURN query
|
||||||
|
select
|
||||||
|
j.id,
|
||||||
|
j.ro_number,
|
||||||
|
j.clm_total,
|
||||||
|
coalesce (p.total_payments,0) as total_payments,
|
||||||
|
j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||||
|
j.date_invoiced
|
||||||
|
from
|
||||||
|
jobs j
|
||||||
|
left join (
|
||||||
|
select
|
||||||
|
p.jobid,
|
||||||
|
coalesce (sum(p.amount),0) as total_payments
|
||||||
|
from
|
||||||
|
payments p
|
||||||
|
group by
|
||||||
|
p.jobid
|
||||||
|
) p on
|
||||||
|
j.id = p.jobid
|
||||||
|
where j.remove_from_ar = false and j.date_invoiced is not null and j.clm_total - coalesce (p.total_payments,0) > 0;
|
||||||
|
|
||||||
|
|
||||||
|
END
|
||||||
|
$function$;
|
||||||
Reference in New Issue
Block a user