Commit 157f559c authored by kdabholkar's avatar kdabholkar

Commit changes of invoice queries in GSTR1 for CUST_TAX_OPT.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@191632 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5727128f
...@@ -547,7 +547,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -547,7 +547,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " // GSTR1,GSTR2,etc. +" '1' as REC_TYPE, " // GSTR1,GSTR2,etc.
+" 'I' as GST_TYPE," +" 'I' as GST_TYPE,"
+" '01' as TRAN_TYPE," // b2b,b2c +" '01' as TRAN_TYPE," // b2b,b2c
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
+" '' as SUBMISSION_TYPE," // M-Modify, D-Delete, A-Accept, R-Reject +" '' as SUBMISSION_TYPE," // M-Modify, D-Delete, A-Accept, R-Reject
...@@ -565,26 +565,27 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -565,26 +565,27 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'N' as PROV_ASSMNT, " // not required +" 'N' as PROV_ASSMNT, " // not required
+" '' as ORDER_NO," //not required +" '' as ORDER_NO," //not required
// +" null as ORDER_DATE, "// not required commented by kaustubh 27 july 2017 // +" null as ORDER_DATE, "// not required commented by kaustubh 27 july 2017
//+" i.invoice_id as REMARKS, "
+" s.site_code as REMARKS, " +" s.site_code as REMARKS, "
+" i.invoice_id as REF_ID, " +" i.invoice_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, " +" ' ' as SUBMIT_STATUS, "
// +" null SUBMIT_DATE, " commented by kaustubh 27 july 2017
+" '' ADD_USER, " +" '' ADD_USER, "
// +" sysdate as ADD_DATE, " commented by kaustubh 27 july 2017 // +" sysdate as ADD_DATE, " commented by kaustubh 27 july 2017
+" '' ADD_TERM, " +" '' ADD_TERM, "
+" ' ' CHG_USER, " +" ' ' CHG_USER, "
+" i.TRAN_DATE as CHG_DATE, " +" i.TRAN_DATE as CHG_DATE, "
// +" sysdate CHG_DATE, " commented by kaustubh 27 july 2017
+" ' 'CHG_TERM, " +" ' 'CHG_TERM, "
+" case when trim(c.tax_reg_2) is null then 'UNREGISTR' else trim(c.tax_reg_2) end AS TAX_REG_NO, " +" case when trim(c.tax_reg_2) is null then 'UNREGISTR' else trim(c.tax_reg_2) end AS TAX_REG_NO, "
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state state" +" from invoice i,customer c, site s, state state, sordertype sot"
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and i.inv_type=sot.ORDER_TYPE"
+" and trim(c.tax_reg_2) <> 'UNREGISTER' " +" and trim(c.tax_reg_2) <> 'UNREGISTER' "
+" and i.inv_type <> 'EC' "; +" and i.inv_type <> 'EC' ";
if(SRET_FULL_TRANTYPE.length() > 0) if(SRET_FULL_TRANTYPE.length() > 0)
...@@ -1526,7 +1527,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -1526,7 +1527,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " // GSTR1,GSTR2,etc. +" '1' as REC_TYPE, " // GSTR1,GSTR2,etc.
+" 'I' as GST_TYPE," +" 'I' as GST_TYPE,"
+" '03' as TRAN_TYPE," // b2b,b2c +" '03' as TRAN_TYPE," // b2b,b2c
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
+" '' as SUBMISSION_TYPE," // M-Modify, D-Delete, A-Accept, R-Reject +" '' as SUBMISSION_TYPE," // M-Modify, D-Delete, A-Accept, R-Reject
...@@ -1553,10 +1554,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -1553,10 +1554,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" (select tax_reg_2 from sales_pers where sales_pers.sales_pers=i.sales_pers) AS ECOM_REG_NO," +" (select tax_reg_2 from sales_pers where sales_pers.sales_pers=i.sales_pers) AS ECOM_REG_NO,"
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, despatch d, site s, state state" +" from invoice i,customer c, despatch d, site s, state state, sordertype sot"
+" where c.cust_code = i.cust_code " //+" where c.cust_code = i.cust_code "
+" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" AND i.desp_id= d.desp_id " +" AND i.desp_id= d.desp_id "
+" and i.inv_type=sot.ORDER_TYPE"
+" and state.state_code = d.STATE_CODE__DLV " +" and state.state_code = d.STATE_CODE__DLV "
+" and trim(c.tax_reg_2) <> 'UNREGISTER' " +" and trim(c.tax_reg_2) <> 'UNREGISTER' "
+" and i.inv_type='EC' "; +" and i.inv_type='EC' ";
...@@ -1687,7 +1693,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -1687,7 +1693,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE,"// -- GSTR1,GSTR2,etc. +" '1' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'S' as GST_TYPE," +" 'S' as GST_TYPE,"
+" '04' as TRAN_TYPE," //-- b2cl +" '04' as TRAN_TYPE," //-- b2cl
+" i.cust_code as CUST_CODE," +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME," +" c.cust_name as CUST_NAME,"
//+" st_c.GST_CODE,"// -- 2 digit code //+" st_c.GST_CODE,"// -- 2 digit code
+"case when length(trim(st_c.GST_CODE)) is NULL then '00' else st_c.gst_code end as GST_CODE, " +"case when length(trim(st_c.GST_CODE)) is NULL then '00' else st_c.gst_code end as GST_CODE, "
...@@ -1722,9 +1728,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -1722,9 +1728,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS," +" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO," +" ' ' as ECOM_REG_NO,"
+" 'S-INV' as ref_ser" +" 'S-INV' as ref_ser"
+" from invoice i,customer c, site s, state st_c, state st_own " +" from invoice i,customer c, site s, state st_c, state st_own, sordertype sot "
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and i.inv_type=sot.ORDER_TYPE"
+" and st_c.state_code = c.STATE_CODE " +" and st_c.state_code = c.STATE_CODE "
+" and st_own.state_code = s.STATE_CODE " +" and st_own.state_code = s.STATE_CODE "
+" and st_c.gst_code <> st_own.gst_code " //-- inter-state only +" and st_c.gst_code <> st_own.gst_code " //-- inter-state only
...@@ -2008,10 +2018,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2008,10 +2018,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE,"// -- GSTR1,GSTR2,etc. +" '1' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'I' as GST_TYPE," +" 'I' as GST_TYPE,"
+" '05' as TRAN_TYPE," //-- b2cl +" '05' as TRAN_TYPE," //-- b2cl
+" i.cust_code as CUST_CODE," +" case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME," +" c.cust_name as CUST_NAME,"
// +" state.GST_CODE,"// -- 2 digit code // +" state.GST_CODE,"// -- 2 digit code
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +" case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject +" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM," +" ' ' as DOC_CHECKSUM,"
+" 'NA' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment +" 'NA' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
...@@ -2037,13 +2047,17 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2037,13 +2047,17 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
// +" ' ' as ECOM_REG_NO," // +" ' ' as ECOM_REG_NO,"
+"(select tax_reg_2 from sales_pers where sales_pers.sales_pers=i.sales_pers) AS ECOM_REG_NO," +"(select tax_reg_2 from sales_pers where sales_pers.sales_pers=i.sales_pers) AS ECOM_REG_NO,"
+" 'S-INV' as ref_ser" +" 'S-INV' as ref_ser"
+" from invoice i,customer c, site s,despatch d, state state" +" from invoice i,customer c, site s,despatch d, state state,sordertype sot "
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" AND i.desp_id= d.desp_id " +" AND i.desp_id= d.desp_id "
//+" AND st_c.state_code = d.STATE_CODE__DLV " //+" AND st_c.state_code = d.STATE_CODE__DLV "
+" AND state.state_code = d.STATE_CODE__DLV " +" AND state.state_code = d.STATE_CODE__DLV "
+" and trim(c.tax_reg_2) = 'UNREGISTER' " +" and trim(c.tax_reg_2) = 'UNREGISTER' "
+" and i.inv_type=sot.ORDER_TYPE"
+" AND i.inv_type ='EC' "; +" AND i.inv_type ='EC' ";
if(SRET_FULL_TRANTYPE.length() > 0) if(SRET_FULL_TRANTYPE.length() > 0)
{ {
...@@ -2175,7 +2189,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2175,7 +2189,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'E' as GST_TYPE," +" 'E' as GST_TYPE,"
+" '06' as TRAN_TYPE," +" '06' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" state.GST_CODE, " // +" state.GST_CODE, "
+" '00' as GST_CODE, " +" '00' as GST_CODE, "
...@@ -2209,8 +2223,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2209,8 +2223,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s " +" from invoice i,customer c, site s , sordertype sot"
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and i.inv_type=sot.ORDER_TYPE "
+" and s.site_code = i.site_code "; +" and s.site_code = i.site_code ";
if(SRET_FULL_TRANTYPE.length() > 0) if(SRET_FULL_TRANTYPE.length() > 0)
{ {
...@@ -2219,6 +2237,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2219,6 +2237,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = hdrSql hdrSql = hdrSql
+" and (select count(1) from taxtran ti,tax tm where tm.tax_code = ti.tax_code " +" and (select count(1) from taxtran ti,tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id " +" and ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id "
+" and tm.tax_type in ('G','H','I','J')" ; +" and tm.tax_type in ('G','H','I','J')" ;
if(GST_EXPWP_TAXCLASS.length() > 0) if(GST_EXPWP_TAXCLASS.length() > 0)
{ {
...@@ -2330,7 +2349,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2330,7 +2349,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'E' as GST_TYPE," +" 'E' as GST_TYPE,"
+" '07' as TRAN_TYPE," +" '07' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" state.GST_CODE, " commeneted on 22 sepn 2016 // +" state.GST_CODE, " commeneted on 22 sepn 2016
+" '00' as GST_CODE, " +" '00' as GST_CODE, "
...@@ -2369,8 +2388,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2369,8 +2388,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s " +" from invoice i,customer c, site s , sordertype sot"
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and i.inv_type=sot.ORDER_TYPE "
+" and s.site_code = i.site_code "; +" and s.site_code = i.site_code ";
if(SRET_FULL_TRANTYPE.length() > 0) if(SRET_FULL_TRANTYPE.length() > 0)
{ {
...@@ -2491,19 +2514,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2491,19 +2514,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'I' as GST_TYPE," +" 'I' as GST_TYPE,"
+" '08' as TRAN_TYPE," +" '08' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" state.GST_CODE, " // +" state.GST_CODE, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
+" '' as SUBMISSION_TYPE," +" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM," +" '' as DOC_CHECKSUM,"
+" 'SEWP' as DOC_TYPE, " +" 'SEWP' as DOC_TYPE, "
// +"case when i.GP_NO is null then i.invoice_id else i.GP_NO end as DOC_NO, "
+" i.invoice_id as DOC_NO, " +" i.invoice_id as DOC_NO, "
/*+" i.gp_date as DOC_DATE, "*/
// +"case when i.gp_date is null then i.tran_date else i.gp_date end as DOC_DATE,"
+" i.tran_date as DOC_DATE, " +" i.tran_date as DOC_DATE, "
// +" i.net_amt as AMOUNT, "
+" (i.NET_AMT * i.EXCH_RATE) as AMOUNT, " +" (i.NET_AMT * i.EXCH_RATE) as AMOUNT, "
+" 'N' as REVERSE_CHRG, " +" 'N' as REVERSE_CHRG, "
+" i.lr_no as LR_NO, " +" i.lr_no as LR_NO, "
...@@ -2530,10 +2549,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2530,10 +2549,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state state " +" from invoice i,customer c, site s, state state , sordertype sot "
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and i.inv_type=sot.ORDER_TYPE "
+" and trim(c.tax_reg_2) <> 'UNREGISTER' "; +" and trim(c.tax_reg_2) <> 'UNREGISTER' ";
if(SRET_FULL_TRANTYPE.length() > 0) if(SRET_FULL_TRANTYPE.length() > 0)
{ {
...@@ -2653,7 +2676,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2653,7 +2676,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'I' as GST_TYPE," +" 'I' as GST_TYPE,"
+" '09' as TRAN_TYPE," +" '09' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
+" '' as SUBMISSION_TYPE," +" '' as SUBMISSION_TYPE,"
...@@ -2685,10 +2708,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2685,10 +2708,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state state" +" from invoice i,customer c, site s, state state , sordertype sot "
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and i.inv_type=sot.ORDER_TYPE "
+" and trim(c.tax_reg_2) <> 'UNREGISTER' "; +" and trim(c.tax_reg_2) <> 'UNREGISTER' ";
if(SRET_FULL_TRANTYPE.length() > 0) if(SRET_FULL_TRANTYPE.length() > 0)
{ {
...@@ -2809,7 +2836,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2809,7 +2836,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'I' as GST_TYPE," +" 'I' as GST_TYPE,"
+" '10' as TRAN_TYPE," +" '10' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" state.GST_CODE, " // +" state.GST_CODE, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
...@@ -2818,7 +2845,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2818,7 +2845,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'DE' as DOC_TYPE, " +" 'DE' as DOC_TYPE, "
+" i.invoice_id as DOC_NO, " +" i.invoice_id as DOC_NO, "
+" i.tran_date as DOC_DATE, " +" i.tran_date as DOC_DATE, "
// +" i.net_amt as AMOUNT, "
+" (i.NET_AMT * i.EXCH_RATE) as AMOUNT, " +" (i.NET_AMT * i.EXCH_RATE) as AMOUNT, "
+" 'N' as REVERSE_CHRG, " +" 'N' as REVERSE_CHRG, "
+" i.lr_no as LR_NO, " +" i.lr_no as LR_NO, "
...@@ -2843,10 +2869,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2843,10 +2869,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state state " +" from invoice i,customer c, site s, state state, sordertype sot "
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and i.inv_type=sot.ORDER_TYPE "
+" and trim(c.tax_reg_2) <> 'UNREGISTER' "; +" and trim(c.tax_reg_2) <> 'UNREGISTER' ";
if(SRET_FULL_TRANTYPE.length() > 0) if(SRET_FULL_TRANTYPE.length() > 0)
{ {
...@@ -2967,7 +2997,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2967,7 +2997,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'S' as GST_TYPE," +" 'S' as GST_TYPE,"
+" '11' as TRAN_TYPE," +" '11' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" st_c.GST_CODE, " // +" st_c.GST_CODE, "
+"case when length(trim(st_c.GST_CODE)) is NULL then '00' else st_c.gst_code end as GST_CODE, " +"case when length(trim(st_c.GST_CODE)) is NULL then '00' else st_c.gst_code end as GST_CODE, "
...@@ -2998,9 +3028,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2998,9 +3028,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state st_c, state st_own" +" from invoice i,customer c, site s, state st_c, state st_own, sordertype sot "
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and i.inv_type=sot.ORDER_TYPE "
+" and st_c.state_code = c.state_code " +" and st_c.state_code = c.state_code "
+" and s.state_code = st_own.state_code " +" and s.state_code = st_own.state_code "
+" and st_own.gst_code = st_c.gst_code " //Intra-state supply. Site.GST_CODE = Customer's SITE.GST_CODE +" and st_own.gst_code = st_c.gst_code " //Intra-state supply. Site.GST_CODE = Customer's SITE.GST_CODE
...@@ -3137,7 +3171,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3137,7 +3171,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'I' as GST_TYPE," +" 'I' as GST_TYPE,"
+" '12' as TRAN_TYPE," +" '12' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" state.GST_CODE, " // +" state.GST_CODE, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
...@@ -3165,12 +3199,16 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3165,12 +3199,16 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" (select tax_reg_2 from sales_pers where sales_pers.sales_pers=i.sales_pers) AS ECOM_REG_NO," +" (select tax_reg_2 from sales_pers where sales_pers.sales_pers=i.sales_pers) AS ECOM_REG_NO,"
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, despatch d, state state " +" from invoice i,customer c, site s, despatch d, state state,sordertype sot "
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end) "
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" AND i.desp_id= d.desp_id " +" AND i.desp_id= d.desp_id "
+" AND state.state_code = d.STATE_CODE__DLV" +" AND state.state_code = d.STATE_CODE__DLV"
+" and trim(c.tax_reg_2) = 'UNREGISTER' " +" and trim(c.tax_reg_2) = 'UNREGISTER' "
+" and i.inv_type=sot.ORDER_TYPE "
+" and i.inv_type = 'EC' "; +" and i.inv_type = 'EC' ";
if(SRET_FULL_TRANTYPE.length() > 0) if(SRET_FULL_TRANTYPE.length() > 0)
{ {
...@@ -3300,7 +3338,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3300,7 +3338,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'S' as GST_TYPE," +" 'S' as GST_TYPE,"
+" '13' as TRAN_TYPE," +" '13' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " // +" i.cust_code as CUST_CODE, "
+"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" st_c.GST_CODE, " // +" st_c.GST_CODE, "
+"case when length(trim(st_c.GST_CODE)) is NULL then '00' else st_c.gst_code end as GST_CODE, " +"case when length(trim(st_c.GST_CODE)) is NULL then '00' else st_c.gst_code end as GST_CODE, "
...@@ -3335,13 +3374,17 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3335,13 +3374,17 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state st_c, state st_own " +" from invoice i,customer c, site s, state st_c, state st_own, sordertype sot "
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end) "
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and st_c.state_code = c.state_code " +" and st_c.state_code = c.state_code "
+" and s.state_code = st_own.state_code " +" and s.state_code = st_own.state_code "
+" and st_own.gst_code <> st_c.gst_code " //Site.GST_CODE<>Customer's SITE.GST_CODE +" and st_own.gst_code <> st_c.gst_code " //Site.GST_CODE<>Customer's SITE.GST_CODE
+" and trim(c.tax_reg_2) = 'UNREGISTER' " +" and trim(c.tax_reg_2) = 'UNREGISTER' "
+" and i.inv_type=sot.ORDER_TYPE "
+" and i.net_amt <= "+GST_B2CL_INV_VAL+" " +" and i.net_amt <= "+GST_B2CL_INV_VAL+" "
+" and i.inv_type <> 'EC' "; +" and i.inv_type <> 'EC' ";
if(SRET_FULL_TRANTYPE.length() > 0) if(SRET_FULL_TRANTYPE.length() > 0)
...@@ -3471,7 +3514,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3471,7 +3514,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'I' as GST_TYPE," +" 'I' as GST_TYPE,"
+" '14' as TRAN_TYPE," +" '14' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
//+" state.GST_CODE, " //+" state.GST_CODE, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
...@@ -3499,13 +3542,17 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3499,13 +3542,17 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" (select tax_reg_2 from sales_pers where sales_pers.sales_pers=i.sales_pers) AS ECOM_REG_NO," +" (select tax_reg_2 from sales_pers where sales_pers.sales_pers=i.sales_pers) AS ECOM_REG_NO,"
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s,despatch d, state state " +" from invoice i,customer c, site s,despatch d, state state, sordertype sot "
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" AND i.desp_id= d.desp_id " +" AND i.desp_id= d.desp_id "
+" AND state.state_code = d.STATE_CODE__DLV " +" AND state.state_code = d.STATE_CODE__DLV "
+" and trim(c.tax_reg_2) = 'UNREGISTER' " +" and trim(c.tax_reg_2) = 'UNREGISTER' "
+" AND i.inv_type ='EC' " +" AND i.inv_type ='EC' "
+" and i.inv_type=sot.ORDER_TYPE "
+" and i.net_amt < "+GST_B2CL_INV_VAL+" " +" and i.net_amt < "+GST_B2CL_INV_VAL+" "
+" AND S.state_code <> d.STATE_CODE__DLV " +" AND S.state_code <> d.STATE_CODE__DLV "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
...@@ -3631,7 +3678,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3631,7 +3678,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'L' as GST_TYPE," +" 'L' as GST_TYPE,"
+" '15' as TRAN_TYPE," +" '15' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" state.GST_CODE, " // +" state.GST_CODE, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
...@@ -3666,9 +3713,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3666,9 +3713,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state state " +" from invoice i,customer c, site s, state state , sordertype sot"
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and i.inv_type=sot.ORDER_TYPE "
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and s.state_code <> c.state_code " // site.state_CODE<>customer' state.state_code +" and s.state_code <> c.state_code " // site.state_CODE<>customer' state.state_code
+" and trim(c.tax_reg_2) <> 'UNREGISTER' "; +" and trim(c.tax_reg_2) <> 'UNREGISTER' ";
...@@ -3793,13 +3844,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3793,13 +3844,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = " select '' as TRAN_ID," hdrSql = " select '' as TRAN_ID,"
/*modified by kaustubh*/
/*+" to_date(i.GP_DATE) as TRAN_DATE,"*/
/*+" to_date(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end ) as TRAN_DATE," commented by kaustubh on 25 july 2017*/
+" '' as TRAN_ID__REF," +" '' as TRAN_ID__REF,"
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 aug
// +" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ," +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE," + " i.tran_date as PRD_CODE,"
+" '1' as REC_TYPE,"// -- GSTR1,GSTR2,etc. +" '1' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
...@@ -3807,19 +3852,11 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3807,19 +3852,11 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '18' as TRAN_TYPE,"// -- b2b,b2c +" '18' as TRAN_TYPE,"// -- b2b,b2c
+" i.site_code__dlv as CUST_CODE," +" i.site_code__dlv as CUST_CODE,"
+" c.descr as CUST_NAME," +" c.descr as CUST_NAME,"
// +" state.GST_CODE,"// -- 2 digit code
/* changed by kaustubh on 11 oct 2017 as per direction of devendra Sir */
//+" st.GST_CODE,"// -- 2 digit code
+"case when length(trim(st.GST_CODE)) is NULL then '00' else st.gst_code end as GST_CODE, " +"case when length(trim(st.GST_CODE)) is NULL then '00' else st.gst_code end as GST_CODE, "
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject +" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM," +" ' ' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment +" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
/*modified by kaustubh*/
/*+" i.GP_NO as DOC_NO,"*/
// +" case when i.GP_NO is null then i.tran_id else i.GP_NO end as DOC_NO, "
+" i.tran_id as DOC_NO, " +" i.tran_id as DOC_NO, "
/*+" i.gp_date as DOC_DATE,"*/
// +"case when i.gp_date is null then i.tran_date else i.gp_date end as DOC_DATE,"
+" i.tran_date as DOC_DATE," +" i.tran_date as DOC_DATE,"
+" i.net_amt as AMOUNT," +" i.net_amt as AMOUNT,"
+" 'N' as REVERSE_CHRG," +" 'N' as REVERSE_CHRG,"
...@@ -3847,7 +3884,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3847,7 +3884,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS," +" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO," +" ' ' as ECOM_REG_NO,"
+" 'D-ISS' as ref_ser" +" 'D-ISS' as ref_ser"
//+" from distord_iss i,site c, site s, state state"
+" from distord_iss i,site c, site s, site d, state state , state st" +" from distord_iss i,site c, site s, site d, state state , state st"
+" where c.site_code = i.site_code" +" where c.site_code = i.site_code"
+" and s.site_code = c.site_code" +" and s.site_code = c.site_code"
...@@ -3856,7 +3892,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3856,7 +3892,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and st.state_code = d.state_code " +"and st.state_code = d.state_code "
//+"and st.state_code = state.state_code " //+"and st.state_code = state.state_code "
+" and ((st.state_code = state.state_code) AND (s.fin_entity = d.fin_entity)) " +" and ((st.state_code = state.state_code) AND (s.fin_entity = d.fin_entity)) "
//+" and (select count(1) from taxtran ti where ti.tran_code = 'D-ISS' and ti.tran_id = i.tran_id ";
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'D-ISS' " +" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'D-ISS' "
+" and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') " +" and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') "
+" and ti.tax_perc = 0 "; +" and ti.tax_perc = 0 ";
...@@ -3867,7 +3902,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3867,7 +3902,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
} }
hdrSql = hdrSql +" ) > 0 " hdrSql = hdrSql +" ) > 0 "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
/*+" and i.conf_date between ? and ? " modified by kaustubh on 27 july */
+" and i.tran_date between ? and ? " +" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'D-ISS' and ref_id = i.tran_id and tran_type='18') = 0 "; +" and (select count(1) from gst_data_hdr where ref_ser = 'D-ISS' and ref_id = i.tran_id and tran_type='18') = 0 ";
...@@ -3991,30 +4025,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3991,30 +4025,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
*/ */
{ {
hdrSql = " select '' as TRAN_ID, " hdrSql = " select '' as TRAN_ID, "
/* modified by kaustubh*/
/* +" to_date(i.GP_DATE) as TRAN_DATE, "*/
/* +" to_date(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end) as TRAN_DATE, " commented by kaustubh on 25 july 2017*/
+" '' as TRAN_ID__REF, " +" '' as TRAN_ID__REF, "
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
// +" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ," +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE," + " i.tran_date as PRD_CODE,"
/* +" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, "*/
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME))
{
hdrSql = hdrSql +" cast(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE, ";
}
else
{
hdrSql = hdrSql +"to_char(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE,";
}
hdrSql=hdrSql*/
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'L' as GST_TYPE," +" 'L' as GST_TYPE,"
+" '18' as TRAN_TYPE," +" '18' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" state.GST_CODE, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
+" '' as SUBMISSION_TYPE," +" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM," +" '' as DOC_CHECKSUM,"
...@@ -4051,11 +4069,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4051,11 +4069,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state state " +" from invoice i,customer c, site s, state state, sordertype sot "
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and s.state_code = c.state_code " +" and s.state_code = c.state_code "
+" and i.inv_type=sot.ORDER_TYPE "
+" and trim(c.tax_reg_2) <> 'UNREGISTER' "; +" and trim(c.tax_reg_2) <> 'UNREGISTER' ";
if(SRET_FULL_TRANTYPE.length() > 0) if(SRET_FULL_TRANTYPE.length() > 0)
{ {
...@@ -4087,23 +4109,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4087,23 +4109,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'A' as STATUS, " +" 'A' as STATUS, "
+" 0 as SR_NO__OLD, " +" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,"; +" 'G' as LINE_TYPE,";
/*changed by kaustubh on 19-07-2017*/
/*+" si.hsn_no as GS_CODE, "
+" tx.TAXABLE_AMT as TAXABLE_AMT, "
+" case when t.tax_type = 'I' then tx.tax_perc else 0 end as IGST_PERC,"
+" (case when t.tax_type = 'I' then tx.tax_amt else 0 end) as IGST_AMT,"
+" case when t.tax_type = 'H' then tx.tax_perc else 0 end as CGST_PERC,"
+" (case when t.tax_type = 'H' then tx.tax_amt else 0 end) as CGST_AMT,"
+" case when t.tax_type = 'G' then tx.tax_perc else 0 end as SGST_PERC,"
+" (case when t.tax_type = 'G' then tx.tax_amt else 0 end) as SGST_AMT,"*/
/* + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'A') as SGST_AMT,"*/
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
...@@ -4131,23 +4136,11 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4131,23 +4136,11 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
} }
dtlSql = dtlSql dtlSql = dtlSql
//+" item.sh_descr GS_DESCR," commented by kaustubh on 28 july 2017
// +" item.descr as GS_DESCR,"
+" ' ' as GS_DESCR, " +" ' ' as GS_DESCR, "
/*changed by kaustubh on 19-07-2017*/
/*+" u.descr as UNIT,"*/
//+" item.UNIT as UNIT,"
//+"(select case when udf_str2 is null then descr else udf_str2 end as Unit from uom where unit=it.unit) as UNIT, "
+"(select case when udf_str2 is null then 'OTH' else udf_str2 end as Unit from uom where unit=it.unit) as UNIT, " +"(select case when udf_str2 is null then 'OTH' else udf_str2 end as Unit from uom where unit=it.unit) as UNIT, "
+" (it.quantity__stduom) as QUANTITY," +" (it.quantity__stduom) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ; +" 'OE' as SUPPLY_TYPE," ;
/*changed by kaustubh on 19-07-2017*/
/*+" case when t.tax_type = 'J' then tx.tax_perc else 0 end as CESS_PERC,"
+" (case when t.tax_type = 'J' then tx.tax_amt else 0 end) as CESS_AMT,"*/
/*+" fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'R') as CESS_PERC,"
+" fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'A') as CESS_AMT,"*/
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC," dtlSql = dtlSql + "fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
...@@ -4165,8 +4158,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4165,8 +4158,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '' as REMARKS ,"; +" '' as REMARKS ,";
/*added by kaustubh on 19-07-2017*/
//+"fn_get_gst_rate('S-INV',i.invoice_id, it.line_no) as gst_rate "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql +" fn_get_gst_rate('S-INV',i.invoice_id,CAST(it.line_no as char(3))) as gst_rate "; dtlSql = dtlSql +" fn_get_gst_rate('S-INV',i.invoice_id,CAST(it.line_no as char(3))) as gst_rate ";
...@@ -4180,15 +4172,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4180,15 +4172,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/*+" from invoice i,invoice_trace it,taxtran tx, siteitem si, tax t, item, uom u "*/ /*+" from invoice i,invoice_trace it,taxtran tx, siteitem si, tax t, item, uom u "*/
+" from invoice i,invoice_trace it,item " +" from invoice i,invoice_trace it,item "
+" where i.invoice_id = it.invoice_id " +" where i.invoice_id = it.invoice_id "
/*+" and si.site_code = i.site_code "
+" and si.item_code = it.item_code "*/
+" and item.item_code = it.item_code " +" and item.item_code = it.item_code "
/*changed by kaustubh on 19-07-2017*/
/*+" and t.tax_code = tx.tax_code "
+" and t.tax_type in ('G','H','I','J') "
+" and tx.tran_code = 'S-INV' "
+" and tx.tran_id = i.invoice_id ";*/
/*changed by kaustubh on 21-07-2017 / 3 aug */ /*changed by kaustubh on 21-07-2017 / 3 aug */
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'S-INV' " +"and ti.tran_code = 'S-INV' "
...@@ -4228,29 +4212,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4228,29 +4212,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
*/ */
{ {
hdrSql = " select '' as TRAN_ID, " hdrSql = " select '' as TRAN_ID, "
/*modified by kaustubh*/
/* +" to_date(i.GP_DATE) as TRAN_DATE, "*/
/* +" to_date(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end) as TRAN_DATE, " commented by kaustubh on 25 july 2017*/
+" '' as TRAN_ID__REF, " +" '' as TRAN_ID__REF, "
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
// +" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ," +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE," + " i.tran_date as PRD_CODE,"
/*+" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, "*/
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME)) commnmeted by kaustubh on 25 july 2017
{
hdrSql = hdrSql +" cast(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE, ";
}
else
{
hdrSql = hdrSql +"to_char(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE,";
}
hdrSql=hdrSql*/
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'L' as GST_TYPE," +" 'L' as GST_TYPE,"
+" '21' as TRAN_TYPE," +" '21' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
//+" state.GST_CODE, " //+" state.GST_CODE, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
...@@ -4290,11 +4258,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4290,11 +4258,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state state " +" from invoice i,customer c, site s, state state , sordertype sot"
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and s.state_code <> c.state_code " +" and s.state_code <> c.state_code "
+" and i.inv_type=sot.ORDER_TYPE "
+" and trim(c.tax_reg_2) = 'UNREGISTER' "; +" and trim(c.tax_reg_2) = 'UNREGISTER' ";
if(SRET_FULL_TRANTYPE.length() > 0) if(SRET_FULL_TRANTYPE.length() > 0)
{ {
...@@ -4325,24 +4297,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4325,24 +4297,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'A' as STATUS, " +" 'A' as STATUS, "
+" 0 as SR_NO__OLD, " +" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,"; +" 'G' as LINE_TYPE,";
/*changed by kaustubh on 19-07-2017*/
/*+" si.hsn_no as GS_CODE, "
+" tx.TAXABLE_AMT as TAXABLE_AMT, "
+" case when t.tax_type = 'I' then tx.tax_perc else 0 end as IGST_PERC,"
+" (case when t.tax_type = 'I' then tx.tax_amt else 0 end) as IGST_AMT,"
+" case when t.tax_type = 'H' then tx.tax_perc else 0 end as CGST_PERC,"
+" (case when t.tax_type = 'H' then tx.tax_amt else 0 end) as CGST_AMT,"
+" case when t.tax_type = 'G' then tx.tax_perc else 0 end as SGST_PERC,"
+" (case when t.tax_type = 'G' then tx.tax_amt else 0 end) as SGST_AMT,"*/
/* + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'A') as SGST_AMT,"*/
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
...@@ -4463,37 +4417,19 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4463,37 +4417,19 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{ {
hdrSql = " select '' as TRAN_ID, " hdrSql = " select '' as TRAN_ID, "
/*modified by kaustubh*/
/*+" to_date(i.GP_DATE) as TRAN_DATE, "*/
/* +" to_date(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end) as TRAN_DATE, " commented by kaustubh on 25 july 2017*/
+" '' as TRAN_ID__REF, " +" '' as TRAN_ID__REF, "
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
// +" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ," +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE," + " i.tran_date as PRD_CODE,"
/*+" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, "*/
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME))
{
hdrSql = hdrSql +" cast(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE, ";
}
else
{
hdrSql = hdrSql +"to_char(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE,";
}
hdrSql=hdrSql*/
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'L' as GST_TYPE," +" 'L' as GST_TYPE,"
+" '24' as TRAN_TYPE," +" '24' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" state.GST_CODE, " // +" state.GST_CODE, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
+" '' as SUBMISSION_TYPE," +" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM," +" '' as DOC_CHECKSUM,"
+" 'NRATD' as DOC_TYPE, " +" 'NRATD' as DOC_TYPE, "
/*modified by kaustubh*/
/*+" i.GP_NO as DOC_NO, "*/
// +"case when i.GP_NO is null then i.invoice_id else i.GP_NO end as DOC_NO, "
+" i.invoice_id as DOC_NO, " +" i.invoice_id as DOC_NO, "
/* +" i.gp_date as DOC_DATE, "*/ /* +" i.gp_date as DOC_DATE, "*/
// +"case when i.gp_date is null then i.tran_date else i.gp_date end as DOC_DATE," // +"case when i.gp_date is null then i.tran_date else i.gp_date end as DOC_DATE,"
...@@ -4524,11 +4460,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4524,11 +4460,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state state " +" from invoice i,customer c, site s, state state, sordertype sot "
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and s.state_code = c.state_code " +" and s.state_code = c.state_code "
+" and i.inv_type=sot.ORDER_TYPE "
+" and trim(c.tax_reg_2) = 'UNREGISTER' "; +" and trim(c.tax_reg_2) = 'UNREGISTER' ";
if(SRET_FULL_TRANTYPE.length() > 0) if(SRET_FULL_TRANTYPE.length() > 0)
{ {
...@@ -4697,28 +4637,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4697,28 +4637,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
* 9A(1) Header EXPA Export amendments with payment * * 9A(1) Header EXPA Export amendments with payment *
*/ */
hdrSql = " select '' as TRAN_ID, " hdrSql = " select '' as TRAN_ID, "
/* modfified by kaustubh*/
/* +" to_date(i.GP_DATE) as TRAN_DATE, "*/
/* +" to_date(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end) as TRAN_DATE, " commented by kaustubh on 25 july 2017*/
+" '' as TRAN_ID__REF, " +" '' as TRAN_ID__REF, "
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
// +" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ," +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE," + " i.tran_date as PRD_CODE,"
/* +" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, "*/
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME))
{
hdrSql = hdrSql +" cast(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE, ";
}
else
{
hdrSql = hdrSql +"to_char(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE,";
}
hdrSql=hdrSql*/
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'E' as GST_TYPE," +" 'E' as GST_TYPE,"
+" '27' as TRAN_TYPE," +" '27' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then i.cust_code__bil else i.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" state.GST_CODE, " // +" state.GST_CODE, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
...@@ -4758,11 +4683,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4758,11 +4683,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state, invoice_amendment a " +" from invoice i,customer c, site s, state, invoice_amendment a , sordertype sot"
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" i.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and i.invoice_id = a.invoice_id " +" and i.invoice_id = a.invoice_id "
+" and i.inv_type=sot.ORDER_TYPE "
+" and trim(c.tax_reg_2) <> 'UNREGISTER' "; +" and trim(c.tax_reg_2) <> 'UNREGISTER' ";
if(SRET_FULL_TRANTYPE.length() > 0) if(SRET_FULL_TRANTYPE.length() > 0)
{ {
...@@ -6083,7 +6012,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6083,7 +6012,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'C' as GST_TYPE," +" 'C' as GST_TYPE,"
+" '11' as TRAN_TYPE," +" '11' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " // +" i.cust_code as CUST_CODE, "
+"case when trim(sot.CUST_TAX_OPT) = '1' then inv.cust_code__bil else inv.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" st_c.GST_CODE, " // +" st_c.GST_CODE, "
+"case when length(trim(st_c.GST_CODE)) is NULL then '00' else st_c.gst_code end as GST_CODE, " +"case when length(trim(st_c.GST_CODE)) is NULL then '00' else st_c.gst_code end as GST_CODE, "
...@@ -6112,11 +6042,16 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6112,11 +6042,16 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'CRNRCP' as ref_ser " +" 'CRNRCP' as ref_ser "
+" FROM drcr_rcp i, customer c, site s, state st_c, state st_own, invoice inv " +" FROM drcr_rcp i, customer c, site s, state st_c, state st_own, invoice inv , sordertype sot"
+" WHERE c.cust_code = i.cust_code " //+" WHERE c.cust_code = i.cust_code "
+" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+"(case when trim(sot.CUST_TAX_OPT) = '1' then "
+" inv.CUST_CODE__BIL else i.cust_code end)"
+" AND s.site_code = i.site_code " +" AND s.site_code = i.site_code "
+" AND st_c.state_code = c.state_code " +" AND st_c.state_code = c.state_code "
+" AND inv.invoice_id = i.invoice_id " +" AND inv.invoice_id = i.invoice_id "
+" and inv.inv_type=sot.ORDER_TYPE "
+" and i.drcr_flag ='C'" +" and i.drcr_flag ='C'"
+" AND s.state_code = st_own.state_code " +" AND s.state_code = st_own.state_code "
+" AND st_own.gst_code = st_c.gst_code "; +" AND st_own.gst_code = st_c.gst_code ";
...@@ -6232,7 +6167,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6232,7 +6167,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'C' as GST_TYPE," +" 'C' as GST_TYPE,"
+" '13' as TRAN_TYPE," +" '13' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " // +" i.cust_code as CUST_CODE, "
+"case when trim(sot.CUST_TAX_OPT) = '1' then inv.cust_code__bil else inv.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" st_c.GST_CODE, " // +" st_c.GST_CODE, "
+"case when length(trim(st_c.GST_CODE)) is NULL then '00' else st_c.gst_code end as GST_CODE, " +"case when length(trim(st_c.GST_CODE)) is NULL then '00' else st_c.gst_code end as GST_CODE, "
...@@ -6261,11 +6197,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6261,11 +6197,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'CRNRCP' as ref_ser " +" 'CRNRCP' as ref_ser "
+" FROM drcr_rcp i, customer c, site s, state st_c, state st_own, invoice inv " +" FROM drcr_rcp i, customer c, site s, state st_c, state st_own, invoice inv , sordertype sot"
+" WHERE c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+" (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" inv.CUST_CODE__BIL else i.cust_code end)"
+" AND s.site_code = i.site_code " +" AND s.site_code = i.site_code "
+" AND st_c.state_code = c.state_code " +" AND st_c.state_code = c.state_code "
+" AND inv.invoice_id = i.invoice_id " +" AND inv.invoice_id = i.invoice_id "
+" and inv.inv_type=sot.ORDER_TYPE "
+" and i.drcr_flag ='C'" +" and i.drcr_flag ='C'"
+" AND s.state_code = st_own.state_code " +" AND s.state_code = st_own.state_code "
+" AND st_own.gst_code <> st_c.gst_code " +" AND st_own.gst_code <> st_c.gst_code "
...@@ -6382,7 +6322,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6382,7 +6322,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'D' as GST_TYPE," +" 'D' as GST_TYPE,"
+" '13' as TRAN_TYPE," +" '13' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then inv.cust_code__bil else inv.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" st_c.GST_CODE, " // +" st_c.GST_CODE, "
+"case when length(trim(st_c.GST_CODE)) is NULL then '00' else st_c.gst_code end as GST_CODE, " +"case when length(trim(st_c.GST_CODE)) is NULL then '00' else st_c.gst_code end as GST_CODE, "
...@@ -6411,9 +6351,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6411,9 +6351,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'DRNRCP' as ref_ser " +" 'DRNRCP' as ref_ser "
+" FROM drcr_rcp i, customer c, site s, state st_c, state st_own, invoice inv " +" FROM drcr_rcp i, customer c, site s, state st_c, state st_own, invoice inv ,sordertype sot "
+" WHERE c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+"(case when trim(sot.CUST_TAX_OPT) = '1' then "
+" inv.CUST_CODE__BIL else i.cust_code end)"
+" AND s.site_code = i.site_code " +" AND s.site_code = i.site_code "
+" and inv.inv_type=sot.ORDER_TYPE "
+" AND st_c.state_code = c.state_code " +" AND st_c.state_code = c.state_code "
+" AND inv.invoice_id = i.invoice_id " +" AND inv.invoice_id = i.invoice_id "
+" and i.drcr_flag ='D'" +" and i.drcr_flag ='D'"
...@@ -6527,7 +6471,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6527,7 +6471,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'D' as GST_TYPE," +" 'D' as GST_TYPE,"
+" '11' as TRAN_TYPE," +" '11' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then inv.cust_code__bil else inv.cust_code end AS CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" st_c.GST_CODE, " // +" st_c.GST_CODE, "
+"case when length(trim(st_c.GST_CODE)) is NULL then '00' else st_c.gst_code end as GST_CODE, " +"case when length(trim(st_c.GST_CODE)) is NULL then '00' else st_c.gst_code end as GST_CODE, "
...@@ -6556,12 +6500,16 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6556,12 +6500,16 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'DRNRCP' as ref_ser " +" 'DRNRCP' as ref_ser "
+" FROM drcr_rcp i, customer c, site s, state st_c, state st_own, invoice inv " +" FROM drcr_rcp i, customer c, site s, state st_c, state st_own, invoice inv, sordertype sot "
+" WHERE c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+"(case when trim(sot.CUST_TAX_OPT) = '1' then "
+" inv.CUST_CODE__BIL else i.cust_code end)"
+" AND s.site_code = i.site_code " +" AND s.site_code = i.site_code "
+" AND st_c.state_code = c.state_code " +" AND st_c.state_code = c.state_code "
+" AND inv.invoice_id = i.invoice_id " +" AND inv.invoice_id = i.invoice_id "
+" and i.drcr_flag ='D'" +" and i.drcr_flag ='D'"
+" and inv.inv_type=sot.ORDER_TYPE "
+" AND s.state_code = st_own.state_code " +" AND s.state_code = st_own.state_code "
+" AND st_own.gst_code = st_c.gst_code " +" AND st_own.gst_code = st_c.gst_code "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
...@@ -9137,31 +9085,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -9137,31 +9085,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
* 9B(1) Header CDNR Credit Note registered (CRNRCP)* * 9B(1) Header CDNR Credit Note registered (CRNRCP)*
*/ */
hdrSql = " select '' as TRAN_ID, " hdrSql = " select '' as TRAN_ID, "
/*modified by kaustubh*/
/* +" to_date(i.GP_DATE) as TRAN_DATE, "*/
/* +" to_date(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end) as TRAN_DATE, "*/
+" '' as TRAN_ID__REF, " +" '' as TRAN_ID__REF, "
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
// +" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ," +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE," + " i.tran_date as PRD_CODE,"
/* +" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, "*/
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME)) commented by kaustubh on 25 july 2017
{
hdrSql = hdrSql +" cast(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE, ";
}
else
{
hdrSql = hdrSql +"to_char(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE,";
}
hdrSql=hdrSql*/
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'C' as GST_TYPE," +" 'C' as GST_TYPE,"
+" '29' as TRAN_TYPE," +" '29' as TRAN_TYPE,"
/*commented by kaustubh*/ +"case when trim(sot.CUST_TAX_OPT) = '1' then inv.cust_code__bil else inv.cust_code end AS CUST_CODE, "
// +" case when i.drcr_flag = 'C' then '29' else '30' end as TRAN_TYPE, "
+" i.cust_code as CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" state.GST_CODE, " // +" state.GST_CODE, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
...@@ -9207,10 +9137,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -9207,10 +9137,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/*chnaged by kaustubh*/ /*chnaged by kaustubh*/
+" 'CRNRCP' as ref_ser " +" 'CRNRCP' as ref_ser "
// +" case when i.drcr_flag = 'C' then 'CRNRCP' else 'DRNRCP' end as ref_ser " // +" case when i.drcr_flag = 'C' then 'CRNRCP' else 'DRNRCP' end as ref_ser "
+" from drcr_rcp i,customer c, site s, state, invoice inv " +" from drcr_rcp i,customer c, site s, state, invoice inv, sordertype sot "
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+"(case when trim(sot.CUST_TAX_OPT) = '1' then "
+" inv.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE " +" and state.state_code = c.STATE_CODE "
+" and inv.inv_type=sot.ORDER_TYPE "
+" and inv.invoice_id = i.invoice_id "; +" and inv.invoice_id = i.invoice_id ";
if(SRET_FULL_TRANTYPE.length() > 0) if(SRET_FULL_TRANTYPE.length() > 0)
{ {
...@@ -9388,30 +9322,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -9388,30 +9322,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
*/ */
{ {
hdrSql = " select '' as TRAN_ID, " hdrSql = " select '' as TRAN_ID, "
/*modified by kaustubh*/
/* +" to_date(i.GP_DATE) as TRAN_DATE, "*/
/* +" to_date(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end) as TRAN_DATE, "*/
+" '' as TRAN_ID__REF, " +" '' as TRAN_ID__REF, "
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
// +" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ," +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE," + " i.tran_date as PRD_CODE,"
/* +" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, "*/
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME)) commented by kaustubh on 25 july 2017
{
hdrSql = hdrSql +" cast(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE, ";
}
else
{
hdrSql = hdrSql +"to_char(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE,";
}
hdrSql=hdrSql*/
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'D' as GST_TYPE," +" 'D' as GST_TYPE,"
+" '30' as TRAN_TYPE," +" '30' as TRAN_TYPE,"
/*commented by kaustubh*/ //+" i.cust_code as CUST_CODE, "
// +" case when i.drcr_flag = 'C' then '29' else '30' end as TRAN_TYPE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then inv.cust_code__bil else inv.cust_code end AS CUST_CODE, "
+" i.cust_code as CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" state.GST_CODE, " // +" state.GST_CODE, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
...@@ -9457,30 +9375,19 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -9457,30 +9375,19 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/*chnaged by kaustubh*/ /*chnaged by kaustubh*/
+" 'DRNRCP' as ref_ser " +" 'DRNRCP' as ref_ser "
// +" case when i.drcr_flag = 'C' then 'CRNRCP' else 'DRNRCP' end as ref_ser " // +" case when i.drcr_flag = 'C' then 'CRNRCP' else 'DRNRCP' end as ref_ser "
+" from drcr_rcp i,customer c, site s, state, invoice inv " +" from drcr_rcp i,customer c, site s, state, invoice inv, sordertype sot "
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+"(case when trim(sot.CUST_TAX_OPT) = '1' then "
+" inv.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE " +" and state.state_code = c.STATE_CODE "
+" and inv.invoice_id = i.invoice_id " +" and inv.invoice_id = i.invoice_id "
+" and inv.inv_type=sot.ORDER_TYPE "
+" and i.drcr_flag ='D'" //added by kaustubh on 26 july to seperate Debit and credit note data +" and i.drcr_flag ='D'" //added by kaustubh on 26 july to seperate Debit and credit note data
+" and trim(i.tran_type) != 'PR' " +" and trim(i.tran_type) != 'PR' "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'DRNRCP' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP +" and (select count(1) from taxtran ti where ti.tran_code = 'DRNRCP' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP
/* +" and to_date(inv.conf_date) < '"+currMonthStartDate+"' " commented by kaustubh on 26 july remove to_date for DB2*/
// +" and inv.conf_date < '"+currMonthStartDate+"' " commented by kaustubh on 27 july 2017
//+" and inv.tran_date < '"+currMonthStartDate+"' " changed by kaustubh on 31 july 2017
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
// hdrSql = hdrSql +" and inv.tran_date < '"+currMonthStartDate+"' ";
hdrSql = hdrSql +" and inv.tran_date between '"+fromDate+"'and '" +toDate+"'";
}
else
{
hdrSql = hdrSql +" and inv.tran_date between '"+strDate+"'and '" +endDate+"'";
}
hdrSql = hdrSql */
// +" and inv.tran_date between ? and ? "
+" and trim(c.tax_reg_2) <> 'UNREGISTER' " +" and trim(c.tax_reg_2) <> 'UNREGISTER' "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
// +" and i.conf_date between ? and ? " commented by kaustubh on 27 july 2017 // +" and i.conf_date between ? and ? " commented by kaustubh on 27 july 2017
...@@ -9633,122 +9540,23 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -9633,122 +9540,23 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/** /**
* 9B(2) Header CDNR Credit Note unregistered (CRNRCP)* * 9B(2) Header CDNR Credit Note unregistered (CRNRCP)*
*/ */
/* hdrSql = " select '' as TRAN_ID, "
modified by kaustubh
+" to_date(i.GP_DATE) as TRAN_DATE, "
+" to_date(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end) as TRAN_DATE, " commented by kaustubh on 25 july 2017
+" '' as TRAN_ID__REF, "
+" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
+ "case when i.GP_DATE is null then i.tran_date else i.GP_DATE end as PRD_CODE,"
+" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME))
{
hdrSql = hdrSql +" cast(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE, ";
}
else
{
hdrSql = hdrSql +"to_char(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE,";
}
hdrSql=hdrSql
+" '1' as REC_TYPE, "
+" 'C' as GST_TYPE,"
changed by kaustubh
+" '29' as TRAN_TYPE,"
// +" case when i.drcr_flag = 'C' then '29' else '30' end as TRAN_TYPE, "
+" i.cust_code as CUST_CODE, "
+" c.cust_name as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" i.drcr_flag as DOC_TYPE, "
+" i.tran_id as DOC_NO, "
changed by kaustubh
+" i.conf_date as DOC_DATE, "
// +"case when i.conf_date is null then i.tran_date else i.conf_date end as DOC_DATE," commented by kaustubh on 27 july
+" i.tran_date as DOC_DATE, "
+" i.amount as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
// +" null as LR_DATE," commented by kaustubh 27 july 2017
+" ' ' as REAS_CODE, "
+" i.invoice_id as REF_ID__INV, "
+" case when inv.gp_date is null then inv.tran_date else inv.gp_date end as REF_DATE__INV, "
+" 'N' as PROV_ASSMNT, "
+" ' ' as ORDER_NO,"
// +" null as ORDER_DATE, " commented by kaustubh 27 july 2017
//+" i.invoice_id as REMARKS, "
+" '' as REMARKS, "
+" i.invoice_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
// +" null SUBMIT_DATE, " commented by kaustubh 27 july 2017
+" '' ADD_USER, "
// +" sysdate as ADD_DATE, " commented by kaustubh 27 july 2017
+" '' ADD_TERM, "
+" ' ' CHG_USER, "
// +" sysdate CHG_DATE, " commented by kaustubh 27 july 2017
+" ' 'CHG_TERM, "
+" c.tax_reg_2 as TAX_REG_NO, "
+" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, "
+" 'CRNRCP' as ref_ser "
changed by kaustubh
+" case when i.drcr_flag = 'C' then 'CRNRCP' else 'DRNRCP' end as ref_ser "
+" from drcr_rcp i,customer c, site s, state, invoice inv "
+" where c.cust_code = i.cust_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and inv.invoice_id = i.invoice_id "
+" and i.drcr_flag ='C' " //added by kaustubh on 26 july to seperate Debit and credit note data
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'CRNRCP' ) > 0 " //changed by kaustubh on 26 july 2017 add CRNRCP
+" and to_date(inv.conf_date) < '"+currMonthStartDate+"' " modified by kaustubh on 26 july 2017 remove to_date for DB2
// +" and inv.conf_date < '"+currMonthStartDate+"' "
+" and inv.tran_date < '"+currMonthStartDate+"' "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and i.conf_date between ? and ? "
+" and i.tran_date between ? and ? "
changed by kaustubh
+" and (select count(1) from gst_data_hdr where ref_ser = 'S-INV' and ref_id = i.invoice_id ) = 0 ";
+" and (select count(1) from gst_data_hdr where ref_ser = 'CRNRCP' and ref_id = i.invoice_id ) = 0 ";*/
hdrSql = " select '' as TRAN_ID, " hdrSql = " select '' as TRAN_ID, "
/*modified by kaustubh*/
/* +" to_date(i.GP_DATE) as TRAN_DATE, "*/
/* +" to_date(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end) as TRAN_DATE, "*/
+" '' as TRAN_ID__REF, " +" '' as TRAN_ID__REF, "
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
// +" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ," +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE," + " i.tran_date as PRD_CODE,"
/* +" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, "*/
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME)) commented by kaustubh on 25 july 2017
{
hdrSql = hdrSql +" cast(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE, ";
}
else
{
hdrSql = hdrSql +"to_char(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE,";
}
hdrSql=hdrSql*/
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'C' as GST_TYPE," +" 'C' as GST_TYPE,"
+" '31' as TRAN_TYPE," +" '31' as TRAN_TYPE,"
/*commented by kaustubh*/ // +" i.cust_code as CUST_CODE, "
// +" case when i.drcr_flag = 'C' then '29' else '30' end as TRAN_TYPE, " +"case when trim(sot.CUST_TAX_OPT) = '1' then inv.cust_code__bil else inv.cust_code end AS CUST_CODE, "
+" i.cust_code as CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
// +" state.GST_CODE, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
+" '' as SUBMISSION_TYPE," +" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM," +" '' as DOC_CHECKSUM,"
+" i.drcr_flag as DOC_TYPE, " +" i.drcr_flag as DOC_TYPE, "
+" i.tran_id as DOC_NO, " +" i.tran_id as DOC_NO, "
// +" i.invoice_id as DOC_NO, "
/*modified by kaustubh on 25 july 2017*/
/*+" i.conf_date as DOC_DATE, "*/
// +"case when i.conf_date is null then i.tran_date else i.conf_date end as DOC_DATE,"
+" i.tran_date as DOC_DATE," +" i.tran_date as DOC_DATE,"
// +" i.amount as AMOUNT, " // +" i.amount as AMOUNT, "
+" (i.amount * i.EXCH_RATE) as AMOUNT, " +" (i.amount * i.EXCH_RATE) as AMOUNT, "
...@@ -9783,9 +9591,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -9783,9 +9591,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/*chnaged by kaustubh*/ /*chnaged by kaustubh*/
+" 'CRNRCP' as ref_ser " +" 'CRNRCP' as ref_ser "
// +" case when i.drcr_flag = 'C' then 'CRNRCP' else 'DRNRCP' end as ref_ser " // +" case when i.drcr_flag = 'C' then 'CRNRCP' else 'DRNRCP' end as ref_ser "
+" from drcr_rcp i,customer c, site s, state, invoice inv " +" from drcr_rcp i,customer c, site s, state, invoice inv , sordertype sot"
+" where c.cust_code = i.cust_code " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" c.CUST_CODE__BIL else c.cust_code end) = "
+"(case when trim(sot.CUST_TAX_OPT) = '1' then "
+" inv.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and inv.inv_type=sot.ORDER_TYPE "
+" and state.state_code = c.STATE_CODE " +" and state.state_code = c.STATE_CODE "
+" and inv.invoice_id = i.invoice_id "; +" and inv.invoice_id = i.invoice_id ";
if(SRET_FULL_TRANTYPE.length() > 0) if(SRET_FULL_TRANTYPE.length() > 0)
...@@ -9797,8 +9609,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -9797,8 +9609,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and trim(i.tran_type) != 'PR' " +" and trim(i.tran_type) != 'PR' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'CRNRCP' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP +" and (select count(1) from taxtran ti where ti.tran_code = 'CRNRCP' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP
/* +" and to_date(inv.conf_date) < '"+currMonthStartDate+"' " commented by kaustubh on 26 july remove to_date for DB2*/
// +" and inv.conf_date < '"+currMonthStartDate+"' " commented by kaustubh on 27 july
+" and trim(c.tax_reg_2) = 'UNREGISTER' " +" and trim(c.tax_reg_2) = 'UNREGISTER' "
+" AND (SELECT COUNT(1) FROM taxtran ti WHERE ti.tran_code = 'CRNRCP' AND ti.tran_id = i.tran_id AND ti.tax_perc <> 0"; +" AND (SELECT COUNT(1) FROM taxtran ti WHERE ti.tran_code = 'CRNRCP' AND ti.tran_id = i.tran_id AND ti.tax_perc <> 0";
...@@ -9807,14 +9617,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -9807,14 +9617,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = hdrSql +" and ti.tax_class not in ("+GST_NIL_TAXCLASS+") or ti.tax_chap not in ("+ TAX_CHAP_STR +" ) ) > 0"; hdrSql = hdrSql +" and ti.tax_class not in ("+GST_NIL_TAXCLASS+") or ti.tax_chap not in ("+ TAX_CHAP_STR +" ) ) > 0";
} }
hdrSql = hdrSql hdrSql = hdrSql
// + " AND (ti.tax_class not IN ('NIL') OR ti.tax_chap not IN ('GST-NIL','SER-NIL') ) ) > 0"
+" and (i.cust_code not in (select distinct invoice.cust_code from invoice,customer " +" and (i.cust_code not in (select distinct invoice.cust_code from invoice,customer "
+" where invoice.cust_code = customer.cust_code and invoice.net_amt <= "+GST_B2CL_INV_VAL+" and trim(c.TAX_REG_2) = 'UNREGISTER'))" +" where invoice.cust_code = customer.cust_code and invoice.net_amt <= "+GST_B2CL_INV_VAL+" and trim(c.TAX_REG_2) = 'UNREGISTER'))"
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
// +" and i.conf_date between ? and ? " commented by kaustubh on 27 july 2017
+" and i.tran_date between ? and ? " +" and i.tran_date between ? and ? "
/*changed by kaustubh*/
//+" and (select count(1) from gst_data_hdr where ref_ser = 'S-INV' and ref_id = i.invoice_id ) = 0 ";
+" and (select count(1) from gst_data_hdr where ref_ser = 'CRNRCP' and ref_id = i.tran_id ) = 0 "; +" and (select count(1) from gst_data_hdr where ref_ser = 'CRNRCP' and ref_id = i.tran_id ) = 0 ";
/** /**
...@@ -9961,54 +9767,27 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -9961,54 +9767,27 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
*/ */
{ {
hdrSql = " select '' as TRAN_ID, " hdrSql = " select '' as TRAN_ID, "
/*modified by kaustubh*/
/* +" to_date(i.GP_DATE) as TRAN_DATE, "*/
/* +" to_date(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end) as TRAN_DATE, "*/
+" '' as TRAN_ID__REF, " +" '' as TRAN_ID__REF, "
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
// +" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ," +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE," + " i.tran_date as PRD_CODE,"
/* +" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, "*/
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME)) commented by kaustubh on 25 july 2017
{
hdrSql = hdrSql +" cast(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE, ";
}
else
{
hdrSql = hdrSql +"to_char(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE,";
}
hdrSql=hdrSql*/
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'D' as GST_TYPE," +" 'D' as GST_TYPE,"
+" '32' as TRAN_TYPE," +" '32' as TRAN_TYPE,"
/*commented by kaustubh*/ +"case when trim(sot.CUST_TAX_OPT) = '1' then inv.cust_code__bil else inv.cust_code end AS CUST_CODE, "
// +" case when i.drcr_flag = 'C' then '29' else '30' end as TRAN_TYPE, "
+" i.cust_code as CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
//+" state.GST_CODE, "
+"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, " +"case when length(trim(state.GST_CODE)) is NULL then '00' else state.gst_code end as GST_CODE, "
+" '' as SUBMISSION_TYPE," +" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM," +" '' as DOC_CHECKSUM,"
+" i.drcr_flag as DOC_TYPE, " +" i.drcr_flag as DOC_TYPE, "
+" i.tran_id as DOC_NO, " +" i.tran_id as DOC_NO, "
//+" i.invoice_id as DOC_NO, "
/*modified by kaustubh on 25 july 2017*/
/*+" i.conf_date as DOC_DATE, "*/
// +"case when i.conf_date is null then i.tran_date else i.conf_date end as DOC_DATE,"
+" i.tran_date as DOC_DATE," +" i.tran_date as DOC_DATE,"
// +" i.amount as AMOUNT, "
+" (i.amount * i.EXCH_RATE) as AMOUNT, " +" (i.amount * i.EXCH_RATE) as AMOUNT, "
+" 'N' as REVERSE_CHRG, " +" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, " +" ' ' as LR_NO, "
// +" null as LR_DATE," commented by kaustubh 27 july 2017 // +" null as LR_DATE," commented by kaustubh 27 july 2017
+" ' ' as REAS_CODE, " +" ' ' as REAS_CODE, "
// +" i.invoice_id as REF_ID__INV, "
// +" case when inv.gp_no is null then inv.invoice_id else inv.gp_no end AS REF_ID__INV, "
+" inv.invoice_id as REF_ID__INV," +" inv.invoice_id as REF_ID__INV,"
// +" (select case when udf_str2 is null then descr else udf_str2 end as Unit from uom where unit=it.unit) as UNIT,"
+" 'OTH' as UNIT, " +" 'OTH' as UNIT, "
// +"case when inv.gp_date is null then inv.tran_date else inv.gp_date end as REF_DATE__INV, "
+" inv.tran_date as REF_DATE__INV, " +" inv.tran_date as REF_DATE__INV, "
+" 'N' as PROV_ASSMNT, " +" 'N' as PROV_ASSMNT, "
+" ' ' as ORDER_NO," +" ' ' as ORDER_NO,"
...@@ -10029,21 +9808,20 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -10029,21 +9808,20 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" case when trim(c.tax_reg_2) is null then 'UNREGISTR' else trim(c.tax_reg_2) end AS TAX_REG_NO, " +" case when trim(c.tax_reg_2) is null then 'UNREGISTR' else trim(c.tax_reg_2) end AS TAX_REG_NO, "
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
/*chnaged by kaustubh*/
+" 'DRNRCP' as ref_ser " +" 'DRNRCP' as ref_ser "
// +" case when i.drcr_flag = 'C' then 'CRNRCP' else 'DRNRCP' end as ref_ser " +" from drcr_rcp i,customer c, site s, state, invoice inv , sordertype sot"
+" from drcr_rcp i,customer c, site s, state, invoice inv " +" where (case when trim(sot.CUST_TAX_OPT) = '1' then "
+" where c.cust_code = i.cust_code " +" c.CUST_CODE__BIL else c.cust_code end) = "
+"(case when trim(sot.CUST_TAX_OPT) = '1' then "
+" inv.CUST_CODE__BIL else i.cust_code end)"
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE " +" and state.state_code = c.STATE_CODE "
+" and inv.inv_type=sot.ORDER_TYPE "
+" and inv.invoice_id = i.invoice_id " +" and inv.invoice_id = i.invoice_id "
+" and i.drcr_flag ='D'" //added by kaustubh on 26 july to seperate Debit and credit note data +" and i.drcr_flag ='D'" //added by kaustubh on 26 july to seperate Debit and credit note data
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and trim(i.tran_type) != 'PR' " +" and trim(i.tran_type) != 'PR' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'DRNRCP' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP +" and (select count(1) from taxtran ti where ti.tran_code = 'DRNRCP' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP
/* +" and to_date(inv.conf_date) < '"+currMonthStartDate+"' " commented by kaustubh on 26 july remove to_date for DB2*/
// +" and inv.conf_date < '"+currMonthStartDate+"' " commented by kaustubh on 27 july 2017
//+" and inv.tran_date < '"+currMonthStartDate+"' " changed by kaustubh on 31 july 2017
+" and trim(c.tax_reg_2) = 'UNREGISTER' " +" and trim(c.tax_reg_2) = 'UNREGISTER' "
+" AND (SELECT COUNT(1) FROM taxtran ti WHERE ti.tran_code = 'DRNRCP' AND ti.tran_id = i.tran_id AND ti.tax_perc <> 0"; +" AND (SELECT COUNT(1) FROM taxtran ti WHERE ti.tran_code = 'DRNRCP' AND ti.tran_id = i.tran_id AND ti.tax_perc <> 0";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
...@@ -10051,14 +9829,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -10051,14 +9829,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = hdrSql +" and ti.tax_class not in ("+GST_NIL_TAXCLASS+") or ti.tax_chap not in ("+ TAX_CHAP_STR +" ) ) > 0"; hdrSql = hdrSql +" and ti.tax_class not in ("+GST_NIL_TAXCLASS+") or ti.tax_chap not in ("+ TAX_CHAP_STR +" ) ) > 0";
} }
hdrSql = hdrSql hdrSql = hdrSql
// " AND (ti.tax_class not IN ('NIL') OR ti.tax_chap not IN ('GST-NIL','SER-NIL') ) ) > 0"
+" and (i.cust_code not in (select distinct invoice.cust_code from invoice,customer " +" and (i.cust_code not in (select distinct invoice.cust_code from invoice,customer "
+" where invoice.cust_code = customer.cust_code and invoice.net_amt <= "+GST_B2CL_INV_VAL+"and trim(c.TAX_REG_2) = 'UNREGISTER'))" +" where invoice.cust_code = customer.cust_code and invoice.net_amt <= "+GST_B2CL_INV_VAL+"and trim(c.TAX_REG_2) = 'UNREGISTER'))"
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
// +" and i.conf_date between ? and ? " commented by kaustubh on 27 july 2017
+" and i.tran_date between ? and ? " +" and i.tran_date between ? and ? "
/*changed by kaustubh*/
//+" and (select count(1) from gst_data_hdr where ref_ser = 'S-INV' and ref_id = i.invoice_id ) = 0 ";
+" and (select count(1) from gst_data_hdr where ref_ser = 'DRNRCP' and ref_id = i.tran_id ) = 0 "; +" and (select count(1) from gst_data_hdr where ref_ser = 'DRNRCP' and ref_id = i.tran_id ) = 0 ";
/** /**
* Detail CDNR Debit Note registered 9B(1) (DRNRCP)* * Detail CDNR Debit Note registered 9B(1) (DRNRCP)*
...@@ -16425,7 +16199,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -16425,7 +16199,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and i.tran_id = ? "; +" and i.tran_id = ? ";
//+ " and it.APPLY_TAX = 'Y' "; Commented on 19 july 2018 temporary purpose need to confirm and enble in future //+ " and it.APPLY_TAX = 'Y' "; Commented on 19 july 2018 temporary purpose need to confirm and enble in future
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"M-VOUC-CNR"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"M-VOUC-CNR(REG)");
/*** /***
...@@ -16581,7 +16355,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -16581,7 +16355,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and i.tran_id = ? "; +" and i.tran_id = ? ";
//+ " and it.APPLY_TAX = 'Y' "; Commented on 19 july 2018 temporary purpose need to confirm and enble in future //+ " and it.APPLY_TAX = 'Y' "; Commented on 19 july 2018 temporary purpose need to confirm and enble in future
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"M-VOUC-CNR"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"M-VOUC-CNR(UNREG)");
/** /**
...@@ -16894,7 +16668,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -16894,7 +16668,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = dtlSql dtlSql = dtlSql
+" and i.tran_id = ? "; +" and i.tran_id = ? ";
//+ " and it.APPLY_TAX = 'Y' "; Commented on 19 july 2018 temporary purpose need to confirm and enble in future //+ " and it.APPLY_TAX = 'Y' "; Commented on 19 july 2018 temporary purpose need to confirm and enble in future
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"M-VOUC-TP-CNR"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"M-VOUC-TP-CNUR");
}// ending of Credit Note for suplier/transporter query }// ending of Credit Note for suplier/transporter query
...@@ -27617,7 +27391,7 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -27617,7 +27391,7 @@ dtlSql = " select '' as TRAN_ID, "
+" and i.tran_id = ? "; +" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"SEWOP-M-VOUC(REG)-TRAN"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"SEWOP-M-VOUC(REG)-SUPP");
} }
...@@ -27791,7 +27565,7 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -27791,7 +27565,7 @@ dtlSql = " select '' as TRAN_ID, "
dtlSql = dtlSql dtlSql = dtlSql
+" and i.tran_id = ? "; +" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"SEWP-M-VOUC(UNREG)TRAN"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"SEWOP-M-VOUC(REG)TRAN");
} }
...@@ -27963,7 +27737,7 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -27963,7 +27737,7 @@ dtlSql = " select '' as TRAN_ID, "
dtlSql = dtlSql dtlSql = dtlSql
+" and i.tran_id = ? "; +" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"SEWP-M-VOUC(UNREG)CUST"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"SEWOP-M-VOUC(REG)CUST");
} }
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