Commit 34c52578 authored by kdabholkar's avatar kdabholkar

Adding new queries for e-commerce and update condition for invoice nill rated query.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@180097 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c1797cfb
......@@ -43,7 +43,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
String taxClassAllStr = "", taxEnvAllStr = "",GST_EXPWP_TAXCLASS = "",GST_EXPWOP_TAXCLASS = "",GST_SEZWP_TAXCLASS = "",
GST_SEZWOP_TAXCLASS = "",GST_DE_TAXCLASS = "",
GST_NIL_TAXCLASS = "",GST_EXE_TAXCLASS = "",GST_EXPWP_TAXENV = "",GST_EXPWOP_TAXENV = "",GST_SEZWP_TAXENV = "",
GST_SEZWOP_TAXENV = "",GST_DE_TAXENV = "",GST_NIL_TAXENV = "",GST_EXE_TAXENV = "",gstB2CLInvValStr = "";
GST_SEZWOP_TAXENV = "",GST_DE_TAXENV = "",GST_NIL_TAXENV = "",GST_EXE_TAXENV = "",gstB2CLInvValStr = "",taxChapAllStr="",TAX_CHAP_STR="";
/*disparm of purchase 4C */
......@@ -51,7 +51,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
GST_PUREXE_TAXCLASS="",GST_PUREXE_TAXENV="",GST_PURNIL_TAXCLASS="",GST_PURNIL_TAXENV="",GST_PURNON_TAXCLASS="",
GST_PURNON_TAXENV="",GST_IMPSER_TAXCLASS="",GST_IMPSER_TAXENV="",GST_IMPGD_TAXCLASS="",GST_IMPGD_TAXENV="",
GST_IMPGDSEZ_TAXCLASS="",GST_IMPGDSEZ_TAXENV="",GST_PURSEZWP_TAXENV="",GST_PURSEZWP_TAXCLASS="",GST_PURSEZWOP_TAXENV="",GST_PURSEZWOP_TAXCLASS="",
GST_PURDE_TAXENV="",GST_PURDE_TAXCLASS="",GST_RCM_TAXCLASS="",GST_RCM_TAXENV="",SALES_DATA_MISC="",PURCHASE_DATA_PORCP="",MISC_VOUC_TYPE="",INV_ACCT_PORCP="",IMPL_MIN_RATE_HISTORY="";
GST_PURDE_TAXENV="",GST_PURDE_TAXCLASS="",GST_RCM_TAXCLASS="",GST_RCM_TAXENV="",SALES_DATA_MISC="",PURCHASE_DATA_PORCP="",MISC_VOUC_TYPE="",INV_ACCT_PORCP="",IMPL_MIN_RATE_HISTORY="",TRANSFER_TOSHOW_INNILRATED="";
Timestamp fromDate = null, toDate = null , fromdateOracle = null, todateOracle=null;
......@@ -344,6 +344,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
if("P".equalsIgnoreCase(prcType))
{
TRANSFER_TOSHOW_INNILRATED = distCommon.getDisparams("999999", "TRANSFER_TOSHOW_INNILRATED", connGST);
if ("S".equalsIgnoreCase(type))
{
//modified by kaustubh on 18-07-2017 to resolve missing expression issue start
......@@ -377,6 +379,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
GST_NIL_TAXENV = distCommon.getDisparams("999999", "GST_NIL_TAXENV", connGST);
GST_EXE_TAXENV = distCommon.getDisparams("999999", "GST_EXE_TAXENV", connGST);
SALES_DATA_MISC = distCommon.getDisparams("999999", "SALES_DATA_MISC", connGST);
TAX_CHAP_STR = distCommon.getDisparams("999999", "TAX_CHAP_STR", connGST);
IMPL_MIN_RATE_HISTORY = distCommon.getDisparams("999999", "IMPL_MIN_RATE_HISTORY", connGST);
......@@ -444,7 +449,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
GST_EXE_TAXENV=GST_EXE_TAXENV.replace(",", "','");
GST_EXE_TAXENV="'"+GST_EXE_TAXENV+"'";
TAX_CHAP_STR=TAX_CHAP_STR.replace(",", "','");
TAX_CHAP_STR="'"+TAX_CHAP_STR+"'";
taxClassAllStr = GST_EXPWP_TAXCLASS +","+ GST_EXPWOP_TAXCLASS +","+ GST_SEZWP_TAXCLASS +","+ GST_SEZWOP_TAXCLASS +","+ GST_DE_TAXCLASS +","+
......@@ -2203,19 +2209,21 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' 'CHG_TERM, "
+" c.tax_reg_2 as TAX_REG_NO, "
+" ' ' as RECO_STATUS, "
+" (select Tax_REG_2 from sales_pers where sales_pers=(select Sales_Pers from invoice where invoice_id=i.invoice_id)) AS ECOM_REG_NO, "
// +" (select Tax_REG_2 from sales_pers where sales_pers=(select Sales_Pers from invoice where invoice_id=i.invoice_id)) 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 "
+" from invoice i,customer c, site s, state state"
+" from invoice i,customer c, despatch d, site s, state state"
+" where c.cust_code = i.cust_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.state_code "
+" AND i.desp_id= d.desp_id "
+" and state.state_code = d.STATE_CODE__DLV "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.inv_type='EC' "
+" 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 tm.tax_type in ('G','H','I','J') ";
if(taxClassAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStr+") ";
hdrSql = hdrSql +" and (ti.tax_class not in ("+taxClassAllStr+") or ti.tax_chap not in ("+TAX_CHAP_STR+") ) ";
}
if(taxEnvAllStr.length() > 0)
{
......@@ -2779,14 +2787,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE,"
+" '1' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'S' as GST_TYPE,"
+" 'I' as GST_TYPE,"
+" '05' as TRAN_TYPE," //-- b2cl
+" i.cust_code as CUST_CODE,"
+" c.cust_name as CUST_NAME,"
+" st_c.GST_CODE,"// -- 2 digit code
+" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'R' 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
+" i.invoice_id as DOC_NO, "
+" i.tran_date as DOC_DATE,"
+" i.net_amt as AMOUNT,"
......@@ -2806,22 +2814,28 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
// +" ' ' as ECOM_REG_NO,"
+"(select Tax_REG_2 from sales_pers where sales_pers=(select Sales_Pers from invoice where invoice_id=i.invoice_id)) as ECOM_REG_NO, "
// +"(select Tax_REG_2 from sales_pers where sales_pers=(select Sales_Pers from invoice where invoice_id=i.invoice_id)) 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"
+" from invoice i,customer c, site s, state st_c, state st_own "
+" from invoice i,customer c, site s,despatch d, state state"
+" where c.cust_code = i.cust_code "
+" and s.site_code = i.site_code "
+" and st_c.state_code = c.STATE_CODE "
+" and st_own.state_code = s.STATE_CODE "
+" and st_c.gst_code <> st_own.gst_code " //-- inter-state only
+" and i.net_amt > "+GST_B2CL_INV_VAL+" " //-- amount is more than 2.5 lakh "
+" AND i.desp_id= d.desp_id "
//+" AND st_c.state_code = d.STATE_CODE__DLV "
+" AND state.state_code = d.STATE_CODE__DLV "
+" and c.tax_reg_2 = 'UNREGISTER' "
+" and i.inv_type = 'EC' "
+" AND i.inv_type ='EC' "
+" and i.net_amt > "+GST_B2CL_INV_VAL+" " //-- amount is more than 2.5 lakh "
+ "AND s.state_code = d.STATE_CODE__DLV "
+" 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 tm.tax_type in ('I','J') ";
+" and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') ";
if(taxClassAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStr+") ";
hdrSql = hdrSql +" and (ti.tax_class not in ("+taxClassAllStr+") OR ti.tax_chap not in ("+TAX_CHAP_STR+") ) ";
}
if(taxEnvAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env not in ("+taxEnvAllStr+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
......@@ -4281,14 +4295,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE,"
+" '1' as REC_TYPE, "
+" 'S' as GST_TYPE,"
+" 'I' as GST_TYPE,"
+" '12' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, "
+" c.cust_name as CUST_NAME, "
+" st_c.GST_CODE, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE, "
+" 'INTRA' as DOC_TYPE, "
+" i.invoice_id as DOC_NO, "
+" i.tran_date as DOC_DATE, "
+" i.net_amt as AMOUNT, "
......@@ -4297,7 +4311,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, "
+" 'N' as PROV_ASSMNT, "
+" i.stan_code__init as ORDER_NO,"
+" '' as ORDER_NO,"
+" s.site_code as REMARKS, "
+" i.invoice_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
......@@ -4308,22 +4322,30 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" c.tax_reg_2 as TAX_REG_NO, "
+" ' ' as RECO_STATUS, "
// +" ' ' as ECOM_REG_NO, "
+" (select Tax_REG_2 from sales_pers where sales_pers=(select Sales_Pers from invoice where invoice_id=i.invoice_id)) as ECOM_REG_NO, "
// +" (select Tax_REG_2 from sales_pers where sales_pers=(select Sales_Pers from invoice where invoice_id=i.invoice_id)) 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 "
+" from invoice i,customer c, site s, state st_c, state st_own"
+" from invoice i,customer c, site s, despatch d, state state "
+" where c.cust_code = i.cust_code "
+" and s.site_code = i.site_code "
+" and st_c.state_code = c.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 i.desp_id= d.desp_id "
+" AND state.state_code = d.STATE_CODE__DLV"
+" and c.tax_reg_2 = 'UNREGISTER' "
+" and i.inv_type = 'EC' "
+" and i.net_amt > "+GST_B2CL_INV_VAL+" " //-- amount is more than 2.5 lakh "
+" AND S.state_code = d.STATE_CODE__DLV "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" 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 tm.tax_type in ('G','H','I','J') ";
if(taxClassAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStr+") ";
hdrSql = hdrSql +" and (ti.tax_class not in ("+taxClassAllStr+") or ti.tax_chap not in ("+TAX_CHAP_STR+") )";
}
if(taxEnvAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env not in ("+taxEnvAllStr+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? "
......@@ -4636,14 +4658,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE,"
+" '1' as REC_TYPE, "
+" 'S' as GST_TYPE,"
+" 'I' as GST_TYPE,"
+" '14' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, "
+" c.cust_name as CUST_NAME, "
+" st_c.GST_CODE, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE, "
+" 'INTER' as DOC_TYPE, "
+" i.invoice_id as DOC_NO, "
+" i.tran_date as DOC_DATE,"
+" i.net_amt as AMOUNT, "
......@@ -4652,7 +4674,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, "
+" 'N' as PROV_ASSMNT, "
+" i.stan_code__init as ORDER_NO," //
+" '' as ORDER_NO," //
+" s.site_code as REMARKS, "
+" i.invoice_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
......@@ -4663,23 +4685,28 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" c.tax_reg_2 as TAX_REG_NO, "
+" ' ' as RECO_STATUS, "
// +" ' ' as ECOM_REG_NO, "
+"( select Tax_REG_2 from sales_pers where sales_pers=(select Sales_Pers from invoice where invoice_id=i.invoice_id)) as ECOM_REG_NO ,"
// +"( select Tax_REG_2 from sales_pers where sales_pers=(select Sales_Pers from invoice where invoice_id=i.invoice_id)) 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 "
+" from invoice i,customer c, site s, state st_c, state st_own "
+" from invoice i,customer c, site s,despatch d, state state "
+" where c.cust_code = i.cust_code "
+" and s.site_code = i.site_code "
+" and st_c.state_code = c.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 i.desp_id= d.desp_id "
+" AND state.state_code = d.STATE_CODE__DLV "
+" and c.tax_reg_2 = 'UNREGISTER' "
+" AND i.inv_type ='EC' "
+" and i.net_amt <= "+GST_B2CL_INV_VAL+" "
+" and i.inv_type = 'EC' "
+" AND S.state_code <> d.STATE_CODE__DLV "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" 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 tm.tax_type in ('G','H','I','J') ";
if(taxClassAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStr+") ";
hdrSql = hdrSql +" and (ti.tax_class not in ("+taxClassAllStr+") or ti.tax_chap not in ("+TAX_CHAP_STR+")) ";
}
if(taxEnvAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env not in ("+taxEnvAllStr+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? "
......@@ -4842,7 +4869,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
if(GST_NIL_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL')) ";
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap not in ("+TAX_CHAP_STR+") ) ";
}
if(GST_NIL_TAXENV.length() > 0)
{
......@@ -5273,7 +5300,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_NIL_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL')) ";
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap not in ("+TAX_CHAP_STR+")) ";
}
if(GST_NIL_TAXENV.length() > 0)
{
......@@ -5419,6 +5446,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"8A(3) NIL");
if("Y".equalsIgnoreCase(TRANSFER_TOSHOW_INNILRATED))
{
/************* 8B DIS Nill rated ditribution issue (intra-state register suppliers) *****************************/
......@@ -5618,6 +5648,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"8B DIS");
}//End of Nill rated ditribution issue
/******* 8B started ********/
/**
......@@ -5691,7 +5724,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_NIL_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL'))";
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap not in ("+GST_NIL_TAXCLASS+") )";
}
if(GST_NIL_TAXENV.length() > 0)
{
......@@ -6119,7 +6152,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_NIL_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL')) ";
// hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL')) ";
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap not in ("+GST_NIL_TAXCLASS+") )";
}
if(GST_NIL_TAXENV.length() > 0)
{
......@@ -6337,7 +6371,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_NIL_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL') )";
// hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL') )";
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap not in ("+GST_NIL_TAXCLASS+") )";
}
if(GST_NIL_TAXENV.length() > 0)
{
......@@ -6769,7 +6804,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_NIL_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL') )";
// hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL') )";
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap not in ("+GST_NIL_TAXCLASS+") )";
}
if(GST_NIL_TAXENV.length() > 0)
{
......@@ -6989,7 +7025,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_NIL_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and ( ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL') )";
// hdrSql = hdrSql +" and ( ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL') )";
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap not in ("+GST_NIL_TAXCLASS+") )";
}
if(GST_NIL_TAXENV.length() > 0)
{
......@@ -7420,7 +7457,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_NIL_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and ( ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL') )";
//hdrSql = hdrSql +" and ( ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL') )";
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap not in ("+GST_NIL_TAXCLASS+") )";
}
if(GST_NIL_TAXENV.length() > 0)
{
......@@ -14378,7 +14416,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as DOC_CHECKSUM,"
+" ' ' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" i.tran_id as DOC_NO,"
+" i.invoice_date as DOC_DATE,"
+" i.tran_date as DOC_DATE,"
+" i.amount as AMOUNT,"
+" 'Y' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
......@@ -14523,7 +14561,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as DOC_CHECKSUM,"
+" ' ' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" i.tran_id as DOC_NO,"
+" i.invoice_date as DOC_DATE,"
+" i.tran_date as DOC_DATE,"
+" i.amount as AMOUNT,"
+" 'Y' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
......@@ -14653,6 +14691,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"CDNUR-P-RET");
/**
* (A) D-RCP Header distribution receipt *
*/
......@@ -14819,6 +14860,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/* +" and u.unit = item.unit ";*/
//--group by '',it.line_no, 'A', 0, 'G', si.hsn_no, tx.TAXABLE_AMT,t.tax_type,tx.tax_perc, item.sh_descr, item.UNIT, 'OE',''
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"D-RCP(B2B)");
/******* 3 started Inward supplies received from a registered person other than the supplies attracting reverse charge ********/
......@@ -15058,6 +15102,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.vouch_type not in ('C','D')"
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
// +" and ti.tran_code = 'VOUCH' and ti.tran_id = i.tran_id " changes on 27 oct 2017
+" and ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id "
......@@ -15453,6 +15498,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.vouch_type not in ('C','D')"
//+" from voucher i,supplier c, site s, state state"
//+" where c.supp_code = i.supp_code "
//+" and s.site_code = i.site_code "
......@@ -15849,6 +15895,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.vouch_type not in ('C','D')"
//+" from voucher i,supplier c, site s, state state"
//+" where c.supp_code = i.supp_code "
//+" and s.site_code = i.site_code "
......@@ -16245,6 +16292,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.vouch_type not in ('C','D')"
//+" from voucher i,supplier c, site s, state state"
//+" where c.supp_code = i.supp_code "
//+" and s.site_code = i.site_code "
......@@ -16645,6 +16693,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.vouch_type not in ('C','D')"
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id "
// +" and tm.tax_group in ('ITC','RCM') " commented on 14 aug
......@@ -17042,6 +17091,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 = 'UNREGISTER' "
+" and i.vouch_type not in ('C','D')"
+" and (select count(1) from taxtran ti,tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id ";
if(GST_RCM_TAXCLASS.length() > 0)
......@@ -17409,6 +17459,7 @@ hdrSql = " select '' as TRAN_ID,"
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.vouch_type not in ('C','D')"
/*+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I') ) = 0"*/
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
......@@ -18594,7 +18645,11 @@ hdrSql = " select '' as TRAN_ID,"
}
/*********** 7 Started supplies received from composition taxable person and other than exempt/nil rated/non GST supplies received. *************/
if("Y".equalsIgnoreCase(TRANSFER_TOSHOW_INNILRATED))
{
/*********** 7 Started supplies received from composition taxable person and other than exempt/nil rated/non GST supplies received. *************/
/** distribution receipt ( nill rated ) **/
......@@ -18764,7 +18819,7 @@ hdrSql = " select '' as TRAN_ID,"
/*********** 7 Started supplies received from composition taxable person and other than exempt/nil rated/non GST supplies received. *************/
/*********** 7 Started supplies received from composition taxable person and other than exempt/nil rated/non GST supplies received. *************/
/** distribution receipt ( nill rated ) **/
......@@ -18931,7 +18986,7 @@ hdrSql = " select '' as TRAN_ID,"
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"7DIS(Nill)");
}
/******* 7A(1). NIL Inter-State supplies (Compounding Dealer) - inter State Supplies Value of supplies received from - Composition taxable person***********/
......@@ -21386,6 +21441,157 @@ dtlSql = " select '' as TRAN_ID, "
try{
/**** Added on 09-02-2018 Query for Bank charges applied in case of Direct Payments as Service received from Bank -START ****/
System.out.println("inside Query of Bank charges");
{
hdrSql = " select '' as TRAN_ID,"
+" '' as TRAN_ID__REF,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE,"
+" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'I' as GST_TYPE," //need to ask
+" '01' as TRAN_TYPE,"// -- b2b,b2c
+" i.BANK_CODE as CUST_CODE,"
+" c.bank_name as CUST_NAME,"
+" c.STATE_CODE as GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" i.REF_NO as DOC_NO,"
+" i.REF_DATE as DOC_DATE,"
+" i.amount as AMOUNT,"
+" 'Y' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
+" ' ' as REAS_CODE,"
+" ' ' as REF_ID__INV,"
+" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required
+" c.STATE_CODE as REMARKS, " // added on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
+" ' 'CHG_TERM,"
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO,"
+" 'P-RCP' as ref_ser "
//+"from porcp i,supplier c, site s, state state"
+"from payment_exp i,BANK c, site s "
+" where c.BANK_CODE = i.BANK_CODE "
+" and s.site_code = i.site_code "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'P-RCP' and ti.tran_id = i.tran_id "
+" and tm.TAX_GROUP IN ('ITC','NITC') "
+" and tm.tax_type in ('G','H','I','J')";
if(taxClassAllStrOfPurchase.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStrOfPurchase+") ";
}
if(taxEnvAllStrOfPurchase.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env not in ("+taxEnvAllStrOfPurchase+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'P-RCP' and ref_id = i.tran_id ) = 0 ";
/**
* 3 VOUCH Detail Voucher *
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+" case when it.item_code is null then 'S' else 'G' end as LINE_TYPE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('P-RCP' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('P-RCP' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('P-RCP' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('P-RCP' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
+" fn_gst_rate_amt(CAST('P-RCP' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('P-RCP' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('R' AS CHAR(1))) AS SGST_PERC,"
+" fn_gst_rate_amt(CAST('P-RCP' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
}
else
{
dtlSql = dtlSql +" fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+" fn_gst_rate_amt('P-RCP',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+"fn_gst_rate_amt('P-RCP',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+"fn_gst_rate_amt('P-RCP',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+"fn_gst_rate_amt('P-RCP',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+"fn_gst_rate_amt('P-RCP',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+"fn_gst_rate_amt('P-RCP',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+"fn_gst_rate_amt('P-RCP',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+"(select case when udf_str2 is null then descr else udf_str2 end as Unit from uom where unit=it.unit) as UNIT, "
+" it.quantity as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('P-RCP' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('P-RCP' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('P-RCP',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('P-RCP',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'ig' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('P-RCP',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('P-RCP',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
// +"from porcp i,porcpdet it, item "
+" from payment_exp i,PAYDET_EXP it "
+" where i.tran_id = it.tran_id "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'P-RCP' "
+" and tx.TAX_GROUP IN ('ITC','NITC') "
+" and ti.tran_id = i.tran_id "
+"and tx.tax_type in ('G','H','I','J') " ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? ";
// retString = executeSqlAndPopulateData(hdrSql,dtlSql,"B2B-DP(BANK)");
}// end of Direct Payments as Service received from Bank Query
/**** Added on 09-02-2018 Query for Bank charges applied in case of Direct Payments as Service received from Bank -END ****/
/**
* ITC Reversal Purchase Return B2B header
*/
......@@ -21954,6 +22160,7 @@ dtlSql = " select '' as TRAN_ID, "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.vouch_type not in ('C','D') "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id "
// +" and tm.TAX_GROUP IN ('ITC','NITC') "
......@@ -22348,6 +22555,7 @@ dtlSql = " select '' as TRAN_ID, "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.vouch_type not in ('C','D') "
//+" from voucher i,supplier c, site s, state state"
//+" where c.supp_code = i.supp_code "
//+" and s.site_code = i.site_code "
......@@ -22744,6 +22952,7 @@ dtlSql = " select '' as TRAN_ID, "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.vouch_type not in ('C','D')"
//+" from voucher i,supplier c, site s, state state"
//+" where c.supp_code = i.supp_code "
//+" and s.site_code = i.site_code "
......@@ -23141,6 +23350,7 @@ dtlSql = " select '' as TRAN_ID, "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.vouch_type not in ('C','D') "
//+" from voucher i,supplier c, site s, state state"
//+" where c.supp_code = i.supp_code "
//+" and s.site_code = i.site_code "
......@@ -23543,6 +23753,7 @@ dtlSql = " select '' as TRAN_ID, "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.vouch_type not in ('C','D')"
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id "
// +" and tm.tax_group in ('ITC','RCM') " commented on 14 aug
......@@ -23942,6 +24153,7 @@ dtlSql = " select '' as TRAN_ID, "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 = 'UNREGISTER' "
+" and i.vouch_type not in ('C','D')"
+" and (select count(1) from taxtran ti,tax tm where tm.tax_code = ti.tax_code "
+" and tm.TAX_GROUP IN ('RCM') "
+" and ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id ";
......@@ -24317,6 +24529,7 @@ dtlSql = " select '' as TRAN_ID, "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.vouch_type not in ('C','D')"
/*+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I') ) = 0"*/
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
......@@ -24832,7 +25045,7 @@ dtlSql = " select '' as TRAN_ID, "
/******* 6 started debit note from porcp (P-RET)********/
/******* 6 started debit note from porcp (P-RET) START ********/
/** debit Note Date - 6/02/2018 **/
......@@ -25128,40 +25341,1208 @@ dtlSql = " select '' as TRAN_ID, "
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"CDNUR-P-RET");
/*** 6C(1) (CDNR Debit Note registered) Header DRNPAY Debit Note (Register User) *****/
{
/******* 6 started debit note from porcp (P-RET) END ********/
hdrSql = " select '' as TRAN_ID, "
/* +" to_date(i.GP_DATE) as TRAN_DATE, "*/
+" '' 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 ,"
/******* Added on Date:08-02-2018 Credit Note Queries fetch from misc_voucher START ********/
/****
* ***Credit Note from misc-vouc(Supplier)(Reg) ***
* ***/
{
hdrSql = " select '' as TRAN_ID,"
+" '' as TRAN_ID__REF,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , "
+ " i.tran_date as PRD_CODE,"
+" '2' as REC_TYPE, "
+" 'D' as GST_TYPE,"
+" '10' as TRAN_TYPE,"
+" i.supp_code as CUST_CODE, "
+" c.supp_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, "
+" i.tran_date as DOC_DATE,"
+" i.amount as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
// +" null as LR_DATE,"
+" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, "
// +" (select tran_date from voucher v where v.tran_id = voucher_o) 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, "
+" s.site_code as REMARKS, "
+" i.tran_id as REF_ID, "
+ "i.tran_date as PRD_CODE,"
+" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'C' as GST_TYPE,"
+" '10' as TRAN_TYPE,"// -- b2b,b2c
+" i.sundry_code as CUST_CODE,"
+" c.supp_name as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" i.bill_no as DOC_NO, "
+" i.bill_date as DOC_DATE,"
+" i.net_amt as AMOUNT,"
+" 'Y' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
+" ' ' as REAS_CODE,"
+" ' ' as REF_ID__INV,"
+" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required
+" s.site_code as REMARKS, " // on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
+" ' 'CHG_TERM,"
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO,"
+" 'M-VOUC' as ref_ser"
+" from misc_voucher i,supplier c, site s, state state "
+" where c.supp_code = i.sundry_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.sundry_type ='S' and i.vouch_type = 'C' "
// +" and i.sundry_type = c.supp_code "
+" and (select count(1) from taxtran ti where ti.tran_code = 'M-VOUC' "
+" and ti.tran_id = i.tran_id ) > 0 "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'M-VOUC' and ref_id = i.tran_id ) = 0 ";
/**
* Detail Credit Note from MISC-Voucher *
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+" case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,"
+" case when it.ANAL_CODE is null then (Select SAC_no from accounts where accounts.acct_code=it.acct_code) else it.anal_code end as GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('R' AS CHAR(1))) AS SGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
}
else
{
dtlSql = dtlSql
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" ' ' as UNIT,"
+" (it.quantity) as QUANTITY, "
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'ig' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from misc_voucher i,misc_vouchdet it "
+" where i.tran_id = it.tran_id "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
+" and tx.TAX_GROUP IN ('ITC','NITC','RCM') "
+"and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? and it.APPLY_TAX = 'Y' ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"M-VOUC-CNR");
/***
* Credit Note from misc-voucher(supplier-UNREG)*
* ***/
hdrSql = " select '' as TRAN_ID,"
+" '' as TRAN_ID__REF,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , "
+ "i.tran_date as PRD_CODE,"
+" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'C' as GST_TYPE,"
+" '10' as TRAN_TYPE,"// -- b2b,b2c
+" i.sundry_code as CUST_CODE,"
+" c.supp_name as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" i.bill_no as DOC_NO, "
+" i.bill_date as DOC_DATE,"
+" i.net_amt as AMOUNT,"
+" 'Y' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
+" ' ' as REAS_CODE,"
+" ' ' as REF_ID__INV,"
+" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required
+" s.site_code as REMARKS, " // on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
+" ' 'CHG_TERM,"
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO,"
+" 'M-VOUC' as ref_ser"
+" from misc_voucher i,supplier c, site s, state state "
+" where c.supp_code = i.sundry_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 = 'UNREGISTER' "
+" and i.sundry_type ='S' and i.vouch_type = 'C' "
// +" and i.sundry_type = c.supp_code "
+" and (select count(1) from taxtran ti where ti.tran_code = 'M-VOUC' "
+" and ti.tran_id = i.tran_id ) > 0 "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'M-VOUC' and ref_id = i.tran_id ) = 0 ";
/**
* Detail Credit Note from MISC-Voucher(Supplier-UNRG) *
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,"
+" case when it.ANAL_CODE is null then (Select SAC_no from accounts where accounts.acct_code=it.acct_code) else it.anal_code end as GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('R' AS CHAR(1))) AS SGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
}
else
{
dtlSql = dtlSql
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" ' ' as UNIT,"
+" (it.quantity) as QUANTITY, "
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'ig' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from misc_voucher i,misc_vouchdet it "
+" where i.tran_id = it.tran_id "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
+" and tx.TAX_GROUP IN ('ITC','NITC','RCM') "
+"and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? and it.APPLY_TAX = 'Y' ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"M-VOUC-CNR");
/**
* Credit Note from misc-voucher(Transport-reg) Header
* **/
hdrSql = " select '' as TRAN_ID,"
+" '' as TRAN_ID__REF,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , "
+ "i.tran_date as PRD_CODE,"
+" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'C' as GST_TYPE,"
+" '01' as TRAN_TYPE,"// -- b2b,b2c
+" i.sundry_code as CUST_CODE,"
+" c.tran_name as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" i.bill_no as DOC_NO, "
+" i.bill_date as DOC_DATE,"
+" i.net_amt as AMOUNT,"
+" 'Y' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
+" ' ' as REAS_CODE,"
+" ' ' as REF_ID__INV,"
+" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required
+" s.site_code as REMARKS, " // on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
+" ' 'CHG_TERM,"
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO,"
+" 'CRNPAY' as ref_ser"
+" from misc_voucher i,TRANSPORTER c, site s, state state "
+" where c.tran_code = i.sundry_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.sundry_type ='T' and i.vouch_type = 'C' "
//+" and i.sundry_type = c.tran_code "
+" and (select count(1) from taxtran ti where ti.tran_code = 'CRNPAY' "
+" and ti.tran_id = i.tran_id ) > 0 "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'CRNPAY' and ref_id = i.tran_id ) = 0 ";
/**
* Detail Credit Note from MISC-Voucher(transport-REG) *
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,"
+" case when it.ANAL_CODE is null then (Select SAC_no from accounts where accounts.acct_code=it.acct_code) else it.anal_code end as GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('R' AS CHAR(1))) AS SGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
}
else
{
dtlSql = dtlSql
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" ' ' as UNIT,"
+" (it.quantity) as QUANTITY, "
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'ig' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from misc_voucher i,misc_vouchdet it "
+" where i.tran_id = it.tran_id "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
+" and tx.TAX_GROUP IN ('ITC','NITC','RCM') "
+"and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? and it.APPLY_TAX = 'Y' ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"M-VOUC-TP-CNR");
/**
* Credit Note from misc-voucher(Transport-Unreg) Header
* **/
hdrSql = " select '' as TRAN_ID,"
+" '' as TRAN_ID__REF,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , "
+ "i.tran_date as PRD_CODE,"
+" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'C' as GST_TYPE,"
+" '01' as TRAN_TYPE,"// -- b2b,b2c
+" i.sundry_code as CUST_CODE,"
+" c.tran_name as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" i.bill_no as DOC_NO, "
+" i.bill_date as DOC_DATE,"
+" i.net_amt as AMOUNT,"
+" 'Y' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
+" ' ' as REAS_CODE,"
+" ' ' as REF_ID__INV,"
+" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required
+" s.site_code as REMARKS, " // on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
+" ' 'CHG_TERM,"
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO,"
+" 'CRNPAY' as ref_ser"
+" from misc_voucher i,TRANSPORTER c, site s, state state "
+" where c.tran_code = i.sundry_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 = 'UNREGISTER' "
+" and i.sundry_type ='T' and i.vouch_type = 'C' "
//+" and i.sundry_type = c.tran_code "
+" and (select count(1) from taxtran ti where ti.tran_code = 'CRNPAY' "
+" and ti.tran_id = i.tran_id ) > 0 "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'CRNPAY' and ref_id = i.tran_id ) = 0 ";
/**
* Detail Credit Note from MISC-Voucher(transport-UNREG) *
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,"
+" case when it.ANAL_CODE is null then (Select SAC_no from accounts where accounts.acct_code=it.acct_code) else it.anal_code end as GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('R' AS CHAR(1))) AS SGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
}
else
{
dtlSql = dtlSql
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" ' ' as UNIT,"
+" (it.quantity) as QUANTITY, "
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'ig' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from misc_voucher i,misc_vouchdet it "
+" where i.tran_id = it.tran_id "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
+" and tx.TAX_GROUP IN ('ITC','NITC','RCM') "
+"and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? and it.APPLY_TAX = 'Y' ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"M-VOUC-TP-CNR");
}// end of Credit-Note queries(Supplier/transport case)
/*****added on 09-02-2018 start************************/
/***
* Debit Note from misc-vouc(Supp-Reg) header
* */
{
hdrSql = " select '' as TRAN_ID,"
+" '' as TRAN_ID__REF,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , "
+ "i.tran_date as PRD_CODE,"
+" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'C' as GST_TYPE,"
+" '10' as TRAN_TYPE,"// -- b2b,b2c
+" i.sundry_code as CUST_CODE,"
+" c.supp_name as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" i.bill_no as DOC_NO, "
+" i.bill_date as DOC_DATE,"
+" i.net_amt as AMOUNT,"
+" 'Y' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
+" ' ' as REAS_CODE,"
+" ' ' as REF_ID__INV,"
+" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required
+" s.site_code as REMARKS, " // on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
+" ' 'CHG_TERM,"
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO,"
+" 'M-VOUC' as ref_ser"
+" from misc_voucher i,supplier c, site s, state state "
+" where c.supp_code = i.sundry_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.sundry_type ='S' and i.vouch_type = 'D' "
// +" and i.sundry_type = c.supp_code "
+" and (select count(1) from taxtran ti where ti.tran_code = 'M-VOUC' "
+" and ti.tran_id = i.tran_id ) > 0 "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'M-VOUC' and ref_id = i.tran_id ) = 0 ";
/**
* Detail debit Note from MISC-Voucher supplier *
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,"
+" case when it.ANAL_CODE is null then (Select SAC_no from accounts where accounts.acct_code=it.acct_code) else it.anal_code end as GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('R' AS CHAR(1))) AS SGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
}
else
{
dtlSql = dtlSql
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" ' ' as UNIT,"
+" (it.quantity) as QUANTITY, "
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'ig' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from misc_voucher i,misc_vouchdet it "
+" where i.tran_id = it.tran_id "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
+" and tx.TAX_GROUP IN ('ITC','NITC','RCM') "
+"and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? and it.APPLY_TAX = 'Y' ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"DN-SUPP(REG)");
/***
* debit Note from misc-voucher(supplier-UNREG)*
* ***/
hdrSql = " select '' as TRAN_ID,"
+" '' as TRAN_ID__REF,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , "
+ "i.tran_date as PRD_CODE,"
+" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'C' as GST_TYPE,"
+" '10' as TRAN_TYPE,"// -- b2b,b2c
+" i.sundry_code as CUST_CODE,"
+" c.supp_name as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" i.bill_no as DOC_NO, "
+" i.bill_date as DOC_DATE,"
+" i.net_amt as AMOUNT,"
+" 'Y' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
+" ' ' as REAS_CODE,"
+" ' ' as REF_ID__INV,"
+" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required
+" s.site_code as REMARKS, " // on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
+" ' 'CHG_TERM,"
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO,"
+" 'M-VOUC' as ref_ser"
+" from misc_voucher i,supplier c, site s, state state "
+" where c.supp_code = i.sundry_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 = 'UNREGISTER' "
+" and i.sundry_type ='S' and i.vouch_type = 'D' "
// +" and i.sundry_type = c.supp_code "
+" and (select count(1) from taxtran ti where ti.tran_code = 'M-VOUC' "
+" and ti.tran_id = i.tran_id ) > 0 "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'M-VOUC' and ref_id = i.tran_id ) = 0 ";
/**
* Detail debit Note from MISC-Voucher(Supplier-UNRG) *
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,"
+" case when it.ANAL_CODE is null then (Select SAC_no from accounts where accounts.acct_code=it.acct_code) else it.anal_code end as GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('R' AS CHAR(1))) AS SGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
}
else
{
dtlSql = dtlSql
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" ' ' as UNIT,"
+" (it.quantity) as QUANTITY, "
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'ig' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from misc_voucher i,misc_vouchdet it "
+" where i.tran_id = it.tran_id "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
+" and tx.TAX_GROUP IN ('ITC','NITC','RCM') "
+"and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? and it.APPLY_TAX = 'Y' ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"DN-SUPP(UNREG)");
/**
* Credit Note from misc-voucher(Transport-reg) Header
* **/
hdrSql = " select '' as TRAN_ID,"
+" '' as TRAN_ID__REF,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , "
+ "i.tran_date as PRD_CODE,"
+" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'C' as GST_TYPE,"
+" '01' as TRAN_TYPE,"// -- b2b,b2c
+" i.sundry_code as CUST_CODE,"
+" c.tran_name as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" i.bill_no as DOC_NO, "
+" i.bill_date as DOC_DATE,"
+" i.net_amt as AMOUNT,"
+" 'Y' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
+" ' ' as REAS_CODE,"
+" ' ' as REF_ID__INV,"
+" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required
+" s.site_code as REMARKS, " // on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
+" ' 'CHG_TERM,"
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO,"
+" 'CRNPAY' as ref_ser"
+" from misc_voucher i,TRANSPORTER c, site s, state state "
+" where c.tran_code = i.sundry_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.sundry_type ='T' and i.vouch_type = 'D' "
//+" and i.sundry_type = c.tran_code "
+" and (select count(1) from taxtran ti where ti.tran_code = 'CRNPAY' "
+" and ti.tran_id = i.tran_id ) > 0 "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'CRNPAY' and ref_id = i.tran_id ) = 0 ";
/**
* Detail Credit Note from MISC-Voucher(transport-REG) *
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,"
+" case when it.ANAL_CODE is null then (Select SAC_no from accounts where accounts.acct_code=it.acct_code) else it.anal_code end as GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('R' AS CHAR(1))) AS SGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
}
else
{
dtlSql = dtlSql
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" ' ' as UNIT,"
+" (it.quantity) as QUANTITY, "
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'ig' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from misc_voucher i,misc_vouchdet it "
+" where i.tran_id = it.tran_id "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
+" and tx.TAX_GROUP IN ('ITC','NITC','RCM') "
+"and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? and it.APPLY_TAX = 'Y' ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"DN-TRN(REG)");
/**
* debit Note from misc-voucher(Transport-Unreg) Header
* **/
hdrSql = " select '' as TRAN_ID,"
+" '' as TRAN_ID__REF,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , "
+ "i.tran_date as PRD_CODE,"
+" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'C' as GST_TYPE,"
+" '01' as TRAN_TYPE,"// -- b2b,b2c
+" i.sundry_code as CUST_CODE,"
+" c.tran_name as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" i.bill_no as DOC_NO, "
+" i.bill_date as DOC_DATE,"
+" i.net_amt as AMOUNT,"
+" 'Y' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
+" ' ' as REAS_CODE,"
+" ' ' as REF_ID__INV,"
+" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required
+" s.site_code as REMARKS, " // on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
+" ' 'CHG_TERM,"
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO,"
+" 'CRNPAY' as ref_ser"
+" from misc_voucher i,TRANSPORTER c, site s, state state "
+" where c.tran_code = i.sundry_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 = 'UNREGISTER' "
+" and i.sundry_type ='T' and i.vouch_type = 'D' "
//+" and i.sundry_type = c.tran_code "
+" and (select count(1) from taxtran ti where ti.tran_code = 'CRNPAY' "
+" and ti.tran_id = i.tran_id ) > 0 "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'CRNPAY' and ref_id = i.tran_id ) = 0 ";
/**
* Detail Credit Note from MISC-Voucher(transport-UNREG) *
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,"
+" case when it.ANAL_CODE is null then (Select SAC_no from accounts where accounts.acct_code=it.acct_code) else it.anal_code end as GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('R' AS CHAR(1))) AS SGST_PERC,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
}
else
{
dtlSql = dtlSql
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" ' ' as UNIT,"
+" (it.quantity) as QUANTITY, "
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'ig' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from misc_voucher i,misc_vouchdet it "
+" where i.tran_id = it.tran_id "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
+" and tx.TAX_GROUP IN ('ITC','NITC','RCM') "
+"and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? and it.APPLY_TAX = 'Y' ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"DN-SUPP(UNREG)");
}// end of debit note queries (transport/supplier case)
/******* Added on Date:08-02-2018 Credit Note Queries fetch from misc_voucher END ********/
/*** 6C(1) (CDNR Debit Note registered) Header DRNPAY Debit Note (Register User) *****/
{
hdrSql = " select '' as TRAN_ID, "
/* +" to_date(i.GP_DATE) as TRAN_DATE, "*/
+" '' 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 , "
+ " i.tran_date as PRD_CODE,"
+" '2' as REC_TYPE, "
+" 'D' as GST_TYPE,"
+" '10' as TRAN_TYPE,"
+" i.supp_code as CUST_CODE, "
+" c.supp_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, "
+" i.tran_date as DOC_DATE,"
+" i.amount as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
// +" null as LR_DATE,"
+" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, "
// +" (select tran_date from voucher v where v.tran_id = voucher_o) 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, "
+" s.site_code as REMARKS, "
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
// +" null SUBMIT_DATE, "
+" '' ADD_USER, "
......@@ -26462,6 +27843,9 @@ dtlSql = " select '' as TRAN_ID, "
/*********** 7 Started supplies received from composition taxable person and other than exempt/nil rated/non GST supplies received. *************/
if("Y".equalsIgnoreCase(TRANSFER_TOSHOW_INNILRATED))
{
/** distribution receipt ( nill rated ) **/
hdrSql = " select '' as TRAN_ID,"
......@@ -26626,6 +28010,7 @@ dtlSql = " select '' as TRAN_ID, "
//--group by '',it.line_no, 'A', 0, 'G', si.hsn_no, tx.TAXABLE_AMT,t.tax_type,tx.tax_perc, item.sh_descr, item.UNIT, 'OE',''
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"7DIS(Nill)");
}
/**
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