====== pears.NetReportTimesheetLines ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create procedure "pears"."NetReportTimesheetLines"( in "pWebUserID" char(20),in "pTimesheetID" char(20) )
result( "Pay_Type" char(100),"Unit" char(100),"Units__R" double,"Rate__MR" double,"Total__MR" double )
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 "temptimesheetline" as "l" key join "temppayband" as "b"
where "l"."temptimesheetid" = "pTimesheetID"
order by "b"."sortorder" asc,"b"."description" asc
end
go
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetReportTimesheetLines" IS
{create procedure pears.NetReportTimesheetLines(in pWebUserID char(20),in pTimesheetID char(20))
result(Pay_Type char(100),Unit char(100),Units__R double,Rate__MR double,Total__MR double)
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 temptimesheetline as l key join temppayband as b
where l.temptimesheetid = pTimesheetID order by
b.sortorder asc,b.description asc
end
}