
create or replace function EXT.JC_FNC_LT_Bonus_Lookup(i_positionSeq bigint default null, i_periodSeq bigint default null) returns v_ret varchar(32000) as
begin
declare v_eot date := '2200-01-01';
declare v_mdlt varchar(255) := 'LT_Bonus_Lookup';
declare cursor c_mdlt for
select mdlt.name as mdlt_name, re.description as mdlt_desc,
dim0.name as dim0_name, ind0.minstring as dim0_value,
dim1.name as dim1_name, to_char(cast(ind1.minvalue as integer)) as dim1_value,
to_char(cast(cell.value as decimal(25,2))) as cell_value,
row_number() over (order by ind0.displayorder, ind1.displayorder) as rn
from cs_relationalmdlt mdlt
join cs_ruleelement re on mdlt.ruleelementseq = re.ruleelementseq and re.removedate = :v_eot and re.effectivestartdate = mdlt.effectivestartdate
join cs_mdltdimension dim0 on mdlt.ruleelementseq = dim0.ruleelementseq and dim0.removedate = :v_eot and dim0.dimensionslot = 0
join cs_mdltindex ind0 on mdlt.ruleelementseq = ind0.ruleelementseq and ind0.removedate = :v_eot and ind0.dimensionseq = dim0.dimensionseq
join cs_mdltdimension dim1 on mdlt.ruleelementseq = dim1.ruleelementseq and dim1.removedate = :v_eot and dim1.dimensionslot = 1
join cs_mdltindex ind1 on mdlt.ruleelementseq = ind1.ruleelementseq and ind1.removedate = :v_eot and ind1.dimensionseq = dim1.dimensionseq
left outer join cs_mdltcell cell on cell.mdltseq = mdlt.ruleelementseq and cell.removedate = :v_eot and cell.dim0index = ind0.ordinal and cell.dim1index = ind1.ordinal
where mdlt.removedate = :v_eot
and mdlt.name = :v_mdlt
order by ind0.displayorder, ind1.displayorder;
for x as c_mdlt
do
if :x.rn = 1 then
v_ret := '<p><b>'||:x.mdlt_name||' '||:x.mdlt_desc||'</b></p>'
|| '<table class="ruleElementTable table table-condensed">'
|| '<thead><tr><th>'||:x.dim0_name||'</th><th>'||:x.dim1_name||'</th><th>Value</th></tr></thead>';
end if;
v_ret := :v_ret || '<tr><td>'||:x.dim0_value||'</td><td>'||:x.dim1_value||'</td><td>'||:x.cell_value||'</td></tr>';
end for;
v_ret := ifnull(:v_ret || '</table>', 'MDLT "'||:v_mdlt||'" not found.');
end;
insert into CS_PluginQuery (tenantId, name, query) values (<TENANT_ID>, 'LT_Bonus_Lookup', 'select EXT.JC_FNC_LT_Bonus_Lookup(positionSeq, periodSeq) from (select $positionSeq as positionSeq, $periodSeq as periodSeq from dummy)');
commit;
Formula
Deposit Rule
Document
Result
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 |