Commit c382533f authored by pgole's avatar pgole

Updated sql


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@104378 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3cb933e3
......@@ -169,4 +169,57 @@ begin
Return ROUND(lc_netsale);
end;
------------------------------------------------FN_GET_CUST_SORDER_VAL----------------------------------
create or replace
function FN_GET_CUST_SORDER_VAL
(as_custcode in char ,as_itemcode char ,lc_sales number, lc_clstock number , lc_transQty number ,lc_rate number)
return number is lc_netrate number(14,3);
lc_sbal number(14,3);
lc_netsale number(14,3);
replfactor char(3);
replperiod number(3);
itemser char(5);
begin
select repl_factor into replfactor from customeritem where cust_code = as_custcode and item_code = as_itemcode ;
if replfactor is null then
Select item_ser into itemser from item where item_code = as_itemcode ;
select repl_factor into replfactor from customer_series where cust_code = as_custcode and item_ser = itemser ;
if replfactor is null then
select repl_factor into replfactor from customer where cust_code = as_custcode ;
if replfactor is null then
select var_value into replfactor from disparm where prd_code = '999999' and var_name = 'REPL_FACTOR';
end if;
end if;
end if;
select repl_period into replperiod from customeritem where cust_code = as_custcode and item_code = as_itemcode ;
if replperiod is null then
Select item_ser into itemser from item where item_code = as_itemcode ;
select repl_period into replperiod from customer_series where cust_code = as_custcode and item_ser = itemser ;
if replperiod is null then
select repl_period into replperiod from customer where cust_code = as_custcode ;
if replperiod is null then
select var_value into replperiod from disparm where prd_code = '999999' and var_name = 'REPL_PERIOD';
end if;
end if;
end if;
lc_netsale := ROUND(lc_sales /replperiod) * replfactor;
lc_netsale := lc_netsale - lc_clstock - lc_transQty ;
lc_netrate := lc_netsale * lc_rate ;
Return ROUND(lc_netsale);
end;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment