====== pears.NetReportProvTimesheetLines ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create procedure "pears"."NetReportProvTimesheetLines"( in "pWebUserID" char(20),in "pProvTimesheetID" char(20) )
result( "Pay_Type" char(100),"Unit" char(100),"Units__R" double,"Rate__MR" double,"Total__MR" double )
-- 20121003 NetReportTimesheets modified for Current timesheets
begin
declare "userClass" char(20);
set "userClass" = (select first "iqxnetuserclassid" from "iqxnetuser" where "iqxnetuserid" = "pWebUserID");
select "b"."description",
"b"."unit",
(if "userclass" = 'CLIENT' then "l"."unitscharged" else "l"."unitspaid" endif),
(if "userclass" = 'CLIENT' then "l"."chargerate" else "l"."payrate" endif),
(if "userclass" = 'CLIENT' then "l"."unitscharged"*"l"."chargerate" else "l"."unitspaid"*"l"."payrate" endif)
from "tempprovtimesheetline" as "l" key join "temppayband" as "b"
where "l"."tempprovtimesheetid" = "pProvTimesheetID"
order by "b"."sortorder" asc,"b"."description" asc
end
go
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetReportProvTimesheetLines" IS
{create procedure pears."NetReportProvTimesheetLines"( in "pWebUserID" char(20),in "pProvTimesheetID" char(20) )
result( "Pay_Type" char(100),"Unit" char(100),"Units__R" double,"Rate__MR" double,"Total__MR" double )
-- 20121003 NetReportTimesheets modified for Current timesheets
begin
declare "userClass" char(20);
set "userClass" = (select first "iqxnetuserclassid" from "iqxnetuser" where "iqxnetuserid" = "pWebUserID");
select "b"."description",
"b"."unit",
(if "userclass" = 'CLIENT' then "l"."unitscharged" else "l"."unitspaid" endif),
(if "userclass" = 'CLIENT' then "l"."chargerate" else "l"."payrate" endif),
(if "userclass" = 'CLIENT' then "l"."unitscharged"*"l"."chargerate" else "l"."unitspaid"*"l"."payrate" endif)
from "tempprovtimesheetline" as "l" key join "temppayband" as "b"
where "l"."tempprovtimesheetid" = "pProvTimesheetID"
order by "b"."sortorder" asc,"b"."description" asc
end
}