Commit 1a941b53 authored by ppatro's avatar ppatro

update function sqls


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106342 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4f9427e5
...@@ -244,3 +244,134 @@ values ('GST_SYNC_SERVER_URI','URL','http://192.168.0.225:9090/ibase/rest/servic ...@@ -244,3 +244,134 @@ values ('GST_SYNC_SERVER_URI','URL','http://192.168.0.225:9090/ibase/rest/servic
update system_event_services set service_uri ='http://52.221.100.13:9090/ibase/rest/service/insertdata' where service_code ='GST_SYNC_SERVER_URI'; update system_event_services set service_uri ='http://52.221.100.13:9090/ibase/rest/service/insertdata' where service_code ='GST_SYNC_SERVER_URI';
-------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------
create or replace function fn_get_gst_rate(as_trancode in taxtran.tran_code%type,as_tranid in taxtran.tran_id%type, al_lineno number)
return number is
lc_gstrate number(6,2) := 0;
ls_lineno char;
begin
begin
-- get IGST rate
select lpad(trim(to_char(al_lineno)),3, ' ') into ls_lineno from dual;
exception when others then
ls_lineno := ' ';
end;
begin
-- get IGST rate
select tax_perc into lc_gstrate 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;
exception when others then
lc_gstrate := 0;
end;
if lc_gstrate = 0 then
-- if IGST rate is 0 then get sum of SGST and CGST rate
begin
select sum(tax_perc) into lc_gstrate from taxtran tt, tax tm
where tm.tax_code = tt.tax_code
and tm.tax_type in ('G','H')
and tt.tran_code = as_trancode
and tt.tran_id = as_tranid
and tt.line_no = ls_lineno;
exception when others then
lc_gstrate := 0;
end;
end if;
return lc_gstrate;
end;
/
create or replace function fn_get_hsn_no(as_sitecode in site.site_code%type,as_itemcode in item.item_code%type)
return varchar is
ls_hsnno varchar2(20);
begin
begin
select hsn_no into ls_hsnno from siteitem
where site_code = as_sitecode
and item_code = as_itemcode;
exception when others then
ls_hsnno := '';
end;
if ls_hsnno is null or length(trim(ls_hsnno)) = 0 then
begin
select hsn_no into ls_hsnno from item
where item_code = as_itemcode;
exception when others then
ls_hsnno := '';
end;
end if;
return ls_hsnno;
end;
/
create or replace function fn_gst_rate_amt(as_trancode in taxtran.tran_code%type,as_tranid in taxtran.tran_id%type, al_lineno number, as_type in char, as_rateoramt in char)
return number is
lc_rateoramt number(16,2) := 0;
ls_lineno char;
-- as_type : G (sgst), H (cgst), I (igst) and J (cess)
-- as_rateoramt : R or A
begin
begin
-- get IGST rate
select lpad(trim(to_char(al_lineno)),3, ' ') into ls_lineno from dual;
exception when others then
ls_lineno := ' ';
end;
if as_rateoramt = 'T' then
begin
-- taxable amount
select taxable_amt into lc_rateoramt 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 taxable_amt <> 0
and rownum = 1;
exception when others then
lc_rateoramt := 0;
end;
else
if as_rateoramt = 'R' then
begin
-- rate
select tax_perc into lc_rateoramt from taxtran tt, tax tm
where tm.tax_code = tt.tax_code
and tm.tax_type = as_type
and tt.tran_code = as_trancode
and tt.tran_id = as_tranid
and tt.line_no = ls_lineno;
exception when others then
lc_rateoramt := 0;
end;
else
begin
-- rate
select sum(tax_amt) into lc_rateoramt from taxtran tt, tax tm
where tm.tax_code = tt.tax_code
and tm.tax_type = as_type
and tt.tran_code = as_trancode
and tt.tran_id = as_tranid
and tt.line_no = ls_lineno;
exception when others then
lc_rateoramt := 0;
end;
end if;
end if;
return lc_rateoramt;
end;
/
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