Commit da18effc authored by ssurve's avatar ssurve

POD function updated as per mail by Sudeesh on 17 Feb 2014


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94262 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7a365139
......@@ -126,55 +126,19 @@ BEGIN
return 0;
end;
-- @ Sandesh : Following logic will decide invoice table conf_date range for which POD entry needs to checked
-- If current date is 31 then it will read invoices from previous month's 1st day to 30th day of previous month
-- For e.g. assuming current date is 31-Dec-2013 then invoices will between 1-Nov-2013 to 30-Nov-2013
-- If current date is between 1 to 30 then it will read invoices from 2 previous month's 1st day to 30th day of that month
-- For e.g. assuming current date is 30-Dec-2013 then invoices will between 1-Oct-2013 to 30-Oct-2013
begin
select to_char(sysdate, 'DD'),to_char(sysdate, 'MM'),to_char(sysdate, 'YY') into curr_date,curr_mon,curr_yr FROM DUAL;
if curr_date = '31' then
select to_char(sysdate, 'MM')-1 into invoice_mnth FROM DUAL;
if curr_mon = '01' then
select to_char(sysdate, 'YY')-1 into curr_yr FROM DUAL;
invoice_mnth := '12';
else
invoice_mnth := ''|| curr_mon -1 ;
end if;
elsif curr_date >= '1' and curr_date <='30' then
select to_char(sysdate, 'MM')-2 into invoice_mnth FROM DUAL;
if curr_mon = '01' then
select to_char(sysdate, 'YY')-1 into curr_yr FROM DUAL;
invoice_mnth := '11';
elsif curr_mon = '02' then
select to_char(sysdate, 'YY')-1 into curr_yr FROM DUAL;
invoice_mnth := '12';
else
invoice_mnth := ''||curr_mon -2 ;
end if;
end if;
begin_date := '1-'||invoice_mnth||'-'||curr_yr;
end_date := '30-'||invoice_mnth||'-'||curr_yr;
exception when others then
return -1;
end;
--ls_sql_stmt := 'select invoice_id from invoice where cust_code__bil = ''' || ls_custCodeBill ||''' and site_code = ''' || ls_siteCode ||''' and inv_type in ('||inv_type_list||') and sysdate - conf_date > 29';
-- commented as per new requirement
--ls_sql_stmt := 'select invoice_id from invoice where cust_code__bil = :ls_custCodeBill and site_code = :ls_siteCode and inv_type in ('||inv_type_list||') and sysdate - conf_date > 29';
--ls_sql_stmt := 'select invoice_id from invoice where cust_code__bil = :ls_custCodeBill and site_code = :ls_siteCode and inv_type in ('||inv_type_list||') and conf_date between '''|| to_date(begin_date) ||''' and '''|| to_date(end_date) ;
--ls_sql_stmt := 'select invoice_id from invoice where cust_code__bil = :ls_custCodeBill and site_code = :ls_siteCode and inv_type in (''DM '') and conf_date between '''|| to_date(begin_date) ||''' and '''|| to_date(end_date) ||'''' ;
ls_sql_stmt := 'select invoice_id from invoice where cust_code__bil = '''||ls_custCodeBill||''' and site_code = '''||ls_siteCode||''' and inv_type in (''DM '',''IS '') and conf_date between '''|| to_date(begin_date) ||''' and '''|| to_date(end_date) ||'''' ;
ls_sql_stmt := 'select invoice_id from invoice where cust_code__bil = ''' || ls_custCodeBill || ''' and site_code = ''' || ls_siteCode || ''' and inv_type in (''DM '',''IS '') and (sysdate - last_day(conf_date)) > 30';
begin
begin
-- cursor for multiple invoices against passed cust_code
OPEN inv_cur FOR ls_sql_stmt ;--USING ls_custCodeBill, ls_siteCode;
......@@ -196,7 +160,7 @@ BEGIN
return cnumber;
--exit
else
else
-- Logic for partial POD entries starts here
hdr_sql_stmt := 'select tran_id from spl_sales_por_hdr where invoice_id = '''||ls_invoiceid||''' and confirmed = ''Y'' and wf_status <> ''R'' ';
......
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