Commit 57a9fddd authored by kdabholkar's avatar kdabholkar

commit new queries added for NON-GST in GSTR2.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@187707 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 101d63fe
......@@ -20772,7 +20772,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = dtlSql */
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"4(B) M-VOUC");
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"4(B) M-VOUC1111");
/*** --- 4(C) IMP_S Import of Service ****/
......@@ -26415,7 +26415,7 @@ dtlSql = " select '' as TRAN_ID, "
+" 'R' as GST_TYPE,"
+" '01' as TRAN_TYPE,"// -- b2b,b2c
+" i.sundry_code as CUST_CODE,"
+" c.cust_code as CUST_NAME,"
+" c.CUST_NAME as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
......@@ -30782,7 +30782,8 @@ dtlSql = " select '' as TRAN_ID, "
+" 'M-VOUC' as ref_ser"
+" from misc_voucher i,customer c, site s, state state "
+" where c.cust_code = i.sundry_code "
+" and i.sundry_type = 'S' "
//+" and i.sundry_type = 'S' "
+" and i.sundry_type = 'C' "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and trim(c.tax_reg_2) = 'UNREGISTER' "
......@@ -35013,7 +35014,790 @@ dtlSql = " select '' as TRAN_ID, "
/**
* --- 7A(1). intra State Supplies -- Value of supplies received from - Composition taxable person COMP(REG)
*/
{
/**New Quries added by kaustubh for NON-GST transctions for porcp and Misc-voucher on 17 july 2018 start **/
{
/***Header of misc_voucher against supplier NON-GST**/
{
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, "
+" 'L' as GST_TYPE,"
+" '24' as TRAN_TYPE,"
+" i.Sundry_code as CUST_CODE, "
+" c.supp_name as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" ' ' as DOC_TYPE, "
+" i.bill_no as DOC_NO,"
+" i.bill_date as DOC_DATE,"
+" i.net_amt as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
+" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, "
+" 'N' as PROV_ASSMNT, "
+" ' ' as ORDER_NO,"
+" s.site_code as REMARKS, "
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
+" '' ADD_USER, "
+" '' ADD_TERM, "
+" ' ' CHG_USER, "
+" i.TRAN_DATE as CHG_DATE, "
+" ' '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 "
+" where c.supp_code = i.sundry_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE"
+" and (select count(1) from taxtran ti , tax tm where ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id ";
if(GST_PURNON_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_PURNON_TAXCLASS+") or ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if(GST_PURNON_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURNON_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" 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 and TRAN_TYPE= '24' ) = 0 ";
/**
* Detail intra-state to registered suppliers 7A(4) NIL -MISC-VOUC against suppplier*
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+" 'S' as LINE_TYPE ,"
+" (select CASE "
+" WHEN (NVL(pd.anal_code,'X')<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=pd.anal_code) "
+" WHEN (NVL(pd.anal_code,'X')='X') "
+" THEN fn_get_hsn_sac(ph.site_code,'',pd.acct_code) END "
+" from misc_voucher PH,misc_vouchdet PD where PH.tran_id=PD.tran_id "
+" and PH.tran_id=i.tran_id and pd.line_no=it.line_no) AS GS_CODE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" NVL(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))),0) AS TAXABLE_AMT,"
+" NVL(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))),0) AS IGST_PERC,"
+" NVL(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))),0) AS IGST_AMT,"
+" NVL(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))),0) AS CGST_PERC,"
+" NVL(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))),0) AS CGST_AMT,"
+" NVL(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))),0) AS SGST_PERC,"
+" NVL(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))),0) AS SGST_AMT,";
}
else
{
dtlSql = dtlSql
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T'),0) as TAXABLE_AMT,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R'),0) as IGST_PERC,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A'),0) as IGST_AMT,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R'),0) as CGST_PERC,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A'),0) as CGST_AMT,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R'),0) as SGST_PERC,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A'),0) as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" 'NOS' as UNIT, "
+" (it.quantity) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "NVL(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))),0) AS CESS_PERC,"
+"NVL(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))),0) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R'),0) as CESS_PERC,"
+"NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A'),0) 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 ) 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 ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'ig' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"NVL(fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))),0) as gst_rate ";
}
else
{
dtlSql = dtlSql +"NVL(fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no),0) 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_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ";
}
if(GST_PURNON_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_PURNON_TAXCLASS+") or ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if(GST_PURNON_TAXENV.length() > 0)
{
dtlSql = dtlSql +" and ti.tax_env in ("+GST_PURNON_TAXENV+") ";
}
dtlSql = dtlSql + ") > 0"
+ " and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"7B(4)NONGST-MISC(SUPP)");
}
/***Header of misc_voucher against transporter**/
{
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, "
+" 'L' as GST_TYPE,"
+" '24' as TRAN_TYPE,"
+" i.Sundry_code as CUST_CODE, "
+" c.tran_name as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" ' ' as DOC_TYPE, "
+" i.bill_no as DOC_NO,"
+" i.bill_date as DOC_DATE,"
+" i.net_amt as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
+" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, "
+" 'N' as PROV_ASSMNT, "
+" ' ' as ORDER_NO,"
+" s.site_code as REMARKS, "
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
+" '' ADD_USER, "
+" '' ADD_TERM, "
+" ' ' CHG_USER, "
+" i.TRAN_DATE as CHG_DATE, "
+" ' '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, TRANSPORTER c,site s,state "
+" where c.tran_code = i.sundry_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE"
+" and (select count(1) from taxtran ti , tax tm where ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id ";
if(GST_PURNON_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_PURNON_TAXCLASS+") or ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if(GST_PURNON_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURNON_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" 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 and TRAN_TYPE= '24' ) = 0 ";
/**
* Detail intra-state to registered suppliers 7A(4) NIL -MISC-VOUC against transporter*
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+" 'S' as LINE_TYPE ,"
+" (select CASE "
+" WHEN (NVL(pd.anal_code,'X')<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=pd.anal_code) "
+" WHEN (NVL(pd.anal_code,'X')='X') "
+" THEN fn_get_hsn_sac(ph.site_code,'',pd.acct_code) END "
+" from misc_voucher PH,misc_vouchdet PD where PH.tran_id=PD.tran_id "
+" and PH.tran_id=i.tran_id and pd.line_no=it.line_no) AS GS_CODE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" NVL(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))),0) AS TAXABLE_AMT,"
+" NVL(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))),0) AS IGST_PERC,"
+" NVL(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))),0) AS IGST_AMT,"
+" NVL(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))),0) AS CGST_PERC,"
+" NVL(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))),0) AS CGST_AMT,"
+" NVL(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))),0) AS SGST_PERC,"
+" NVL(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))),0) AS SGST_AMT,";
}
else
{
dtlSql = dtlSql
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T'),0) as TAXABLE_AMT,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R'),0) as IGST_PERC,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A'),0) as IGST_AMT,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R'),0) as CGST_PERC,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A'),0) as CGST_AMT,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R'),0) as SGST_PERC,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A'),0) as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" 'NOS' as UNIT, "
+" (it.quantity) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "NVL(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))),0) AS CESS_PERC,"
+"NVL(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))),0) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R'),0) as CESS_PERC,"
+"NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A'),0) 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 ) 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 ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'ig' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"NVL(fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))),0) as gst_rate ";
}
else
{
dtlSql = dtlSql +"NVL(fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no),0) 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_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ";
}
if(GST_PURNON_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_PURNON_TAXCLASS+") or ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if(GST_PURNON_TAXENV.length() > 0)
{
dtlSql = dtlSql +" and ti.tax_env in ("+GST_PURNON_TAXENV+") ";
}
dtlSql = dtlSql + ") > 0"
+ " and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"7B(4)NONGST-MISC(TRAN)");
}
/***Header of misc_voucher against Customer**/
{
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, "
+" 'L' as GST_TYPE,"
+" '24' as TRAN_TYPE,"
+" i.Sundry_code as CUST_CODE, "
+" c.cust_code as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" ' ' as DOC_TYPE, "
+" i.bill_no as DOC_NO,"
+" i.bill_date as DOC_DATE,"
+" i.net_amt as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
+" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, "
+" 'N' as PROV_ASSMNT, "
+" ' ' as ORDER_NO,"
+" s.site_code as REMARKS, "
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
+" '' ADD_USER, "
+" '' ADD_TERM, "
+" ' ' CHG_USER, "
+" i.TRAN_DATE as CHG_DATE, "
+" ' '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, customer c,site s,state "
+" where c.cust_code = i.sundry_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE"
+" and (select count(1) from taxtran ti , tax tm where ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id ";
if(GST_PURNON_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_PURNON_TAXCLASS+") or ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if(GST_PURNON_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURNON_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" 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 and TRAN_TYPE= '24' ) = 0 ";
/**
* Detail intra-state to registered suppliers 7A(4) NIL -MISC-VOUC against customer*
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+" 'S' as LINE_TYPE ,"
+" (select CASE "
+" WHEN (NVL(pd.anal_code,'X')<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=pd.anal_code) "
+" WHEN (NVL(pd.anal_code,'X')='X') "
+" THEN fn_get_hsn_sac(ph.site_code,'',pd.acct_code) END "
+" from misc_voucher PH,misc_vouchdet PD where PH.tran_id=PD.tran_id "
+" and PH.tran_id=i.tran_id and pd.line_no=it.line_no) AS GS_CODE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" NVL(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))),0) AS TAXABLE_AMT,"
+" NVL(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))),0) AS IGST_PERC,"
+" NVL(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))),0) AS IGST_AMT,"
+" NVL(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))),0) AS CGST_PERC,"
+" NVL(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))),0) AS CGST_AMT,"
+" NVL(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))),0) AS SGST_PERC,"
+" NVL(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))),0) AS SGST_AMT,";
}
else
{
dtlSql = dtlSql
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T'),0) as TAXABLE_AMT,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R'),0) as IGST_PERC,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A'),0) as IGST_AMT,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R'),0) as CGST_PERC,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A'),0) as CGST_AMT,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R'),0) as SGST_PERC,"
+ "NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A'),0) as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" 'NOS' as UNIT, "
+" (it.quantity) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "NVL(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))),0) AS CESS_PERC,"
+"NVL(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))),0) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R'),0) as CESS_PERC,"
+"NVL(fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A'),0) 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 ) 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 ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'ig' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"NVL(fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))),0) as gst_rate ";
}
else
{
dtlSql = dtlSql +"NVL(fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no),0) 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_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ";
}
if(GST_PURNON_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_PURNON_TAXCLASS+") or ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if(GST_PURNON_TAXENV.length() > 0)
{
dtlSql = dtlSql +" and ti.tax_env in ("+GST_PURNON_TAXENV+") ";
}
dtlSql = dtlSql + ") > 0"
+ " and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"7B(4)NONGST-MISC(CUST)");
}
/**NON GST query for PORCP INTER STATE**/
{
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, "
+" 'L' as GST_TYPE,"
+" '20' as TRAN_TYPE,"
+" i.supp_code as CUST_CODE, "
+" c.supp_name as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" ' ' as DOC_TYPE, "
+" i.INVOICE_NO as DOC_NO,"
+" i.invoice_date as DOC_DATE,"
+" i.amount as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
+" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, "
+" 'N' as PROV_ASSMNT, "
+" ' ' as ORDER_NO,"
+" s.site_code as REMARKS, "
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
+" '' ADD_USER, "
+" '' ADD_TERM, "
+" ' ' CHG_USER, "
+" i.TRAN_DATE as CHG_DATE, "
+" ' '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"
+" where c.supp_code = i.supp_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE"
+" and s.state_code <> c.state_code "
+" and (select count(1) from taxtran ti , tax tm where ti.tran_code = 'P-RCP' and ti.tran_id = i.tran_id ";
if(GST_PURNON_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_PURNON_TAXCLASS+") or ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if(GST_PURNON_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURNON_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" 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 and TRAN_TYPE= '20' ) = 0 ";
/**
* Detail NON GST supplies to 7B(4) NON*
*/
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 "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'P-RCP' "
+"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 ";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ";
}
if(GST_PURNON_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_PURNON_TAXCLASS+") or ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if(GST_PURNON_TAXENV.length() > 0)
{
dtlSql = dtlSql +" and ti.tax_env in ("+GST_PURNON_TAXENV+") ";
}
dtlSql = dtlSql + ") > 0"
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"7A(3) NON(INTER)");
}
/***NON-GST query for porpcp intra state added on 17 july 2018 ****/
{
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, "
+" 'L' as GST_TYPE,"
+" '24' as TRAN_TYPE,"
+" i.supp_code as CUST_CODE, "
+" c.supp_name as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" ' ' as DOC_TYPE, "
+" i.INVOICE_NO as DOC_NO,"
+" i.invoice_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, "
// +" null REF_DATE__INV, "
+" 'N' as PROV_ASSMNT, "
+" ' ' as ORDER_NO,"
// +" null as ORDER_DATE, "
//+" i.invoice_id as REMARKS, "
+" s.site_code as REMARKS, "
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
// +" null SUBMIT_DATE, "
+" '' ADD_USER, "
// +" sysdate as ADD_DATE, "
+" '' ADD_TERM, "
+" ' ' CHG_USER, "
// +" sysdate CHG_DATE, "
+" i.TRAN_DATE as CHG_DATE, "
+" ' 'CHG_TERM, "
+" c.tax_reg_2 as TAX_REG_NO, "
+" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, "
+" 'P-RCP' as ref_ser "
// +" from voucher i,supplier c, site s, state "
+"from porcp i,supplier c, site s, state"
+" where c.supp_code = i.supp_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE"
+" and s.state_code = c.state_code "
//+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and (select count(1) from taxtran ti , tax tm where ti.tran_code = 'P-RCP' and ti.tran_id = i.tran_id ";
if(GST_PURNON_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_PURNON_TAXCLASS+") or ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if(GST_PURNON_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURNON_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" 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 and TRAN_TYPE= '24' ) = 0 ";
/**
* Detail intra-state to registered suppliers 7A(4) NIL *
*/
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
//+" item.descr as GS_DESCR,"
+" ' ' as GS_DESCR, "
//+" 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, "
+" (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 "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'P-RCP' "
+"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 ";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ";
}
if(GST_PURNON_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_PURNON_TAXCLASS+") or ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if(GST_PURNON_TAXENV.length() > 0)
{
dtlSql = dtlSql +" and ti.tax_env in ("+GST_PURNON_TAXENV+") ";
}
dtlSql = dtlSql + ") > 0"
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"7B(3) NON(INTRA)");
}
}// End of NON-GST queries of porcp and misc_voucher
/**New query added for nill rated from misc_voucher on 20 june 2018 start ***/
{
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