Commit b571809c authored by kdabholkar's avatar kdabholkar

commited to update changes of DB2 functions


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106375 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 05dc61ce
......@@ -376,8 +376,10 @@ end;
/
-------------------------------------------------------------------------------------------------------------
/* updated by kaustubh on 25-07-2017*/
--- db2 function
create function fn_get_gst_rate(as_trancode varchar(6),as_tranid varchar(10), al_lineno decimal(3,0))
returns decimal(14,3)
deterministic
......@@ -385,19 +387,15 @@ begin atomic
declare lc_gstrate decimal(6,2);
declare ls_lineno char(3);
begin
-- get IGST rate
set ls_lineno = right(' '|| rtrim(cast(al_lineno as char(3))),3);
-- get IGST rate
lc_gstrate = (select tax_perc from taxtran tt, tax tm
set ls_lineno = (select right(' '|| rtrim(cast(al_lineno as char(3))),3) from dual);
set lc_gstrate = (select tax_perc from taxtran tt, tax tm
where tm.tax_code = tt.tax_code
and tm.tax_type = 'I'
and tt.tran_code = as_trancode
and tt.tran_id = as_tranid
and tt.line_no = ls_lineno );
if lc_gstrate = 0 then
-- if IGST rate is 0 then get sum of SGST and CGST rate
set lc_gstrate = (select sum(tax_perc) from taxtran tt, tax tm
where tm.tax_code = tt.tax_code
and tm.tax_type in ('G','H')
......@@ -410,24 +408,31 @@ begin
end
@
drop function fn_get_hsn_no@
create function fn_get_hsn_no(as_sitecode varchar(5),as_itemcode varchar(10))
returns varchar(20)
deterministic
begin atomic
declare ls_hsnno varchar(20);
begin
set ls_hsnno = (select hsn_no from siteitem
where site_code = as_sitecode
and item_code = as_itemcode);
if ls_hsnno is null or length(trim(ls_hsnno)) = 0 then
ls_hsnno = (select hsn_no from item
set ls_hsnno = (select hsn_no from item
where item_code = as_itemcode);
end if;
return ls_hsnno;
end
@
drop function fn_gst_rate_amt@
create function fn_gst_rate_amt(as_trancode varchar(6),as_tranid varchar(10), al_lineno decimal(3,0), as_type char(1), as_rateoramt char(1))
returns decimal(14,3)
deterministic
......@@ -435,25 +440,18 @@ begin atomic
declare lc_rateoramt decimal(16,2);
declare ls_lineno char(3);
-- as_type : G (sgst), H (cgst), I (igst) and J (cess)
-- as_rateoramt : R or A
begin
set ls_lineno = right(' '|| rtrim(cast(al_lineno as char(3))),3);
if as_rateoramt = 'T' then
set lc_rateoramt = (select taxable_amt from taxtran tt, tax tm
where tm.tax_code = tt.tax_code
and tm.tax_type in ('G','H','I')
and tt.tran_code = as_trancode
and tt.tran_id = as_tranid
and tt.line_no = ls_lineno
and tt.tran_id = as_tranid
and tt.line_no = ls_lineno
and tt.taxable_amt <> 0 fetch first row only );
else
if as_rateoramt = 'R' then
else
set lc_rateoramt = (select tax_perc from taxtran tt, tax tm
where tm.tax_code = tt.tax_code
and tm.tax_type = as_type
......@@ -461,7 +459,6 @@ begin
and tt.tran_id = as_tranid
and tt.line_no = ls_lineno);
else
-- rate
set lc_rateoramt = (select sum(tax_amt) from taxtran tt, tax tm
where tm.tax_code = tt.tax_code
and tm.tax_type = as_type
......@@ -473,5 +470,4 @@ begin
return lc_rateoramt;
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