Commit da6df3b9 authored by kdabholkar's avatar kdabholkar

update in GST Data Population functions

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@190076 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a9fd3ff1
......@@ -244,8 +244,12 @@ 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';
--------------------------------------------------------------------------------------------------------------------------------------------------
/***
* Updated by Kaustubh to correct the function
*/
/*
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;
......@@ -287,7 +291,60 @@ begin
return lc_gstrate;
end;
/
*/
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(3);
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 tm.EFFECT = '+'
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 tm.EFFECT = '+'
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;
/***
* Changed By Kaustubh to set defult value for HSN No
* */
/*
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);
......@@ -313,8 +370,44 @@ begin
return ls_hsnno;
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;
if ls_hsnno is null or length(trim(ls_hsnno)) = 0 then
ls_hsnno := '99999999';
end if;
return ls_hsnno;
end;
/***
* Changed By Kaustubh to set deault value
*/
/*
create or replace function fn_get_hsn_sac(as_sitecode in site.site_code%type,as_itemcode in item.item_code%type,as_acctcode in accounts.acct_code%type)
return varchar is
ls_hsnno varchar2(20);
......@@ -351,11 +444,57 @@ begin
return ls_hsnno;
end;
/
*/
create or replace
function fn_get_hsn_sac(as_sitecode in site.site_code%type,as_itemcode in item.item_code%type,as_acctcode in accounts.acct_code%type)
return varchar is
ls_hsnno varchar2(20);
begin
if as_itemcode is null or length(trim(as_itemcode)) =0 then
begin
select sac_no into ls_hsnno from accounts
where acct_code = as_acctcode;
exception when others then
ls_hsnno := '';
end;
if ls_hsnno is null or length(trim(ls_hsnno)) = 0 then
ls_hsnno := '99999999';
end if;
return ls_hsnno;
else
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;
end if;
return ls_hsnno;
end;
/**
* Changed By Kaustubh to correct the function
*/
/*
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;
......@@ -416,6 +555,74 @@ begin
return lc_rateoramt;
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(3);
-- 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 tm.EFFECT = '+'
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.EFFECT = '+'
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;
/* added by kaustubh on 6 sep
*
......
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