Commit 61489b2c authored by kdabholkar's avatar kdabholkar

added new queries for CN/DN export transactions to show in CDNUR

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@187349 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a12b0808
...@@ -4556,7 +4556,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4556,7 +4556,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'S-INV' " +"and ti.tran_code = 'S-INV' "
+"and ti.tran_id = i.invoice_id " +"and ti.tran_id = i.invoice_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
...@@ -4565,8 +4571,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4565,8 +4571,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{ {
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0"; dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
} }
dtlSql = dtlSql
dtlSql =dtlSql
+" and i.invoice_id = ? "; +" and i.invoice_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"8A(1) NIL"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"8A(1) NIL");
...@@ -4739,26 +4745,18 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4739,26 +4745,18 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = dtlSql dtlSql = dtlSql
+" from distord_iss i,distord_issdet it, item" +" from distord_iss i,distord_issdet it, item"
+" where i.tran_id = it.tran_id " +" where i.tran_id = it.tran_id "
/*Commented by kaustubh on 19-7-17*/
/*+" and si.site_code = i.site_code "
+" and si.item_code = it.item_code "*/
+" and item.item_code = it.item_code " +" and item.item_code = it.item_code "
/*Commented by kaustubh on 21-7-17 / 3 aug*/
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'D-ISS' " +"and ti.tran_code = 'D-ISS' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
/*Commented by kaustubh on 19-7-17*/ if(GST_NIL_TAXCLASS.length() > 0)
/*+" and t.tax_code = tx.tax_code " {
+" and t.tax_type in ('G','H','I','J') "
+" and tx.tran_code = 'D-ISS' " dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
+" and tx.tran_id = i.tran_id ";*/ }
/*Commented by kaustubh on 21-7-17 / 3 aug */
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
//dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no "; //dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
...@@ -4769,6 +4767,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4769,6 +4767,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
//dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no "; //dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no ";
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0"; dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
} }
dtlSql = dtlSql dtlSql = dtlSql
+ " and i.tran_id = ? " ; + " and i.tran_id = ? " ;
...@@ -4983,7 +4982,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4983,7 +4982,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'S-INV' " +"and ti.tran_code = 'S-INV' "
+"and ti.tran_id = i.invoice_id " +"and ti.tran_id = i.invoice_id "
+"and tx.tax_type in ('G','H','I','J')" ; +"and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J') " ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
//dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no "; //dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
...@@ -4994,6 +4999,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4994,6 +4999,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
//dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no "; //dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no ";
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0"; dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" and i.invoice_id = ? "; +" and i.invoice_id = ? ";
...@@ -5205,7 +5211,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5205,7 +5211,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'S-INV' " +"and ti.tran_code = 'S-INV' "
+"and ti.tran_id = i.invoice_id " +"and ti.tran_id = i.invoice_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
//dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no "; //dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
...@@ -5216,6 +5228,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5216,6 +5228,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
//dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no "; //dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no ";
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0"; dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" and i.invoice_id = ? "; +" and i.invoice_id = ? ";
...@@ -5428,7 +5441,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5428,7 +5441,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'S-INV' " +"and ti.tran_code = 'S-INV' "
+"and ti.tran_id = i.invoice_id " +"and ti.tran_id = i.invoice_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
//dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no "; //dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
...@@ -5439,6 +5458,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5439,6 +5458,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
//dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no "; //dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no ";
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0"; dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" and i.invoice_id = ? "; +" and i.invoice_id = ? ";
...@@ -5681,6 +5701,363 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5681,6 +5701,363 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
if("Y".equalsIgnoreCase(GST_EXCLUDE_NILL_CDNR)) if("Y".equalsIgnoreCase(GST_EXCLUDE_NILL_CDNR))
{ {
System.out.println("Inside CDNR Exclude Nill Rated and nill rated Queries"); System.out.println("Inside CDNR Exclude Nill Rated and nill rated Queries");
/*** New queries added by kaustubh on 6 july 2018 start Misc-CN-export transaction ***/
{
{
hdrSql = "select "
+"TRAN_ID,TRAN_ID__REF,SITE_CODE ,PRD_CODE ,REC_TYPE,GST_TYPE,TRAN_TYPE,CUST_CODE,CUST_NAME,GST_CODE,SUBMISSION_TYPE, "
+"DOC_CHECKSUM,DOC_TYPE,DOC_NO,DOC_DATE,AMOUNT,REVERSE_CHRG,LR_NO,REAS_CODE,REF_ID__INV,REF_DATE__INV,PROV_ASSMNT, "
+"ORDER_NO,REMARKS,REF_ID,SUBMIT_STATUS,ADD_USER,ADD_TERM,CHG_USER,CHG_DATE,CHG_TERM,TAX_REG_NO, RECO_STATUS,ECOM_REG_NO,REF_SER "
+"from "
+"(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 ,"
+"'1' AS REC_TYPE,"
+"'C' AS GST_TYPE,"
+"'31' AS TRAN_TYPE,"
+"i.sundry_code AS CUST_CODE,"
+"c.cust_name AS CUST_NAME,"
+" st_c.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 * i.EXCH_RATE) AS AMOUNT,"
+"'N' AS REVERSE_CHRG,"
+"' ' AS LR_NO,"
+"' ' AS REAS_CODE,";
if ("Y".equalsIgnoreCase(IMPL_MIN_RATE_HISTORY))
{
hdrSql =hdrSql +"d.invoice_ref AS REF_ID__INV,";
}
else
{
hdrSql =hdrSql + "'' AS REF_ID__INV,";
}
hdrSql =hdrSql
+" d.INV_REF_DATE AS REF_DATE__INV," /*Added on 11 June 2018 by Kaustubh */
+"'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,"
+"'MDRCRC' as REF_SER "
+" FROM misc_drcr_rcp i,misc_drcr_rdet d, customer c,state st_c, state st_own, site s "
+"WHERE c.cust_code = i.sundry_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 "
+"AND i.drcr_flag ='C' "
+"AND i.tran_id = d.tran_id "
+"AND d.line_no='1' "
+"AND CASE WHEN i.confirmed IS NULL THEN 'N' ELSE i.confirmed END = 'Y' "
+" and i.sundry_code in (select cust_code from customer where tax_reg_2 = 'UNREGISTER') "
// +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP
+" and st_c.GST_CODE = '00' "
+"AND (SELECT COUNT(1) FROM taxtran ti,tax tm WHERE tm.tax_code = ti.tax_code "
+ " and ti.tran_code = 'MDRCRC' "
+ " and i.TRAN_ID =ti.TRAN_ID "
+ " and tm.tax_type in ('G','H','I','J') ) > 0 "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'MDRCRC' and ref_id = i.tran_id ) = 0 )"
+" group by "
+" TRAN_ID,TRAN_ID__REF,SITE_CODE ,PRD_CODE ,REC_TYPE,GST_TYPE,TRAN_TYPE,CUST_CODE,CUST_NAME,GST_CODE,SUBMISSION_TYPE, "
+" DOC_CHECKSUM,DOC_TYPE,DOC_NO,DOC_DATE,AMOUNT,REVERSE_CHRG,LR_NO,REAS_CODE,REF_ID__INV,REF_DATE__INV,PROV_ASSMNT,ORDER_NO, "
+" REMARKS,REF_ID,SUBMIT_STATUS,ADD_USER,ADD_TERM,CHG_USER,CHG_DATE,CHG_TERM,TAX_REG_NO,RECO_STATUS,ECOM_REG_NO,REF_SER";
/**
* Detail MISC- CDNR Credit Note *
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
// +" 'G' as LINE_TYPE,"
+" CASE WHEN it.item_code IS NULL THEN 'S' ELSE 'G' END AS LINE_TYPE,"
+" (select CASE "
+" WHEN (NVL(it.item_code,'X')<>'X') "
+" THEN (fn_get_hsn_no(i.site_code,it.item_code)) "
+" WHEN (NVL(it.item_code,'X')='X' AND NVL(GD.anal_code,'X')<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GD.anal_code) "
+" WHEN (NVL(it.item_code,'X')='X' AND NVL(GD.anal_code,'X')='X') "
+" THEN fn_get_hsn_sac(GH.site_code,'',GD.acct_code) END "
+" from MISC_DRCR_RCP GH,MISC_DRCR_RDET GD where GH.tran_id=GD.tran_id and GH.tran_id=i.tran_id "
+" and it.line_no=GD.line_no ) AS GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('MDRCRC' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) * i.EXCH_RATE AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('MDRCRC' 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('MDRCRC' 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('MDRCRC' 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('MDRCRC' 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('MDRCRC' 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('MDRCRC' 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('MDRCRC',i.tran_id, it.line_no, ' ', 'T') * i.EXCH_RATE as TAXABLE_AMT,"
+ "fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('MDRCRC',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=item.unit) as UNIT, "
+" (select CASE "
+" WHEN (NVL(it.item_code,'X')='X') "
+" THEN 'OTH' "
+" WHEN (NVL(it.item_code,'X')<>'X') "
+" THEN (SELECT CASE WHEN udf_str2 IS NULL THEN descr ELSE udf_str2 END AS Unit FROM uom "
+" WHERE unit=(select item.unit from item where item.item_code=it.item_code) ) END "
+" from dual ) AS UNIT, "
+" (it.quantity) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('MDRCRC' 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('MDRCRC' 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('MDRCRC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
dtlSql = dtlSql
+" '' as REMARKS ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +" fn_get_gst_rate('MDRCRC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +" fn_get_gst_rate('MDRCRC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from MISC_DRCR_RCP i,MISC_DRCR_RDET 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 = 'MDRCRC' "
+"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,"CNUR-EXP");
}
/*****Export Debit note export transction query CDNUR*****/
{
/***Header ( MISC-Debit note Inter-state)B2CS */
hdrSql = "select "
+"TRAN_ID,TRAN_ID__REF,SITE_CODE ,PRD_CODE ,REC_TYPE,GST_TYPE,TRAN_TYPE,CUST_CODE,CUST_NAME,GST_CODE,SUBMISSION_TYPE, "
+"DOC_CHECKSUM,DOC_TYPE,DOC_NO,DOC_DATE,AMOUNT,REVERSE_CHRG,LR_NO,REAS_CODE,REF_ID__INV,REF_DATE__INV,PROV_ASSMNT, "
+"ORDER_NO,REMARKS,REF_ID,SUBMIT_STATUS,ADD_USER,ADD_TERM,CHG_USER,CHG_DATE,CHG_TERM,TAX_REG_NO, RECO_STATUS,ECOM_REG_NO,REF_SER "
+"from "
+"(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 ,"
+"'1' AS REC_TYPE,"
+"'D' AS GST_TYPE,"
+"'32' AS TRAN_TYPE,"
+"i.sundry_code AS CUST_CODE,"
+"c.cust_name AS CUST_NAME,"
+"st_c.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 * i.EXCH_RATE) AS AMOUNT,"
+"'N' AS REVERSE_CHRG,"
+"' ' AS LR_NO,"
+"' ' AS REAS_CODE,";
if ("Y".equalsIgnoreCase(IMPL_MIN_RATE_HISTORY))
{
hdrSql =hdrSql +"d.invoice_ref AS REF_ID__INV,";
}
else
{
hdrSql =hdrSql + "'' AS REF_ID__INV,";
}
hdrSql =hdrSql
+" d.INV_REF_DATE AS REF_DATE__INV," /*Added on 11 June 2018 by Kaustubh */
+"'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,"
+"'MDRCRD' as REF_SER "
+"FROM misc_drcr_rcp i,misc_drcr_rdet d, customer c,state st_c, state st_own, site s "
+"WHERE c.cust_code = i.sundry_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 "
+"AND i.drcr_flag ='D' "
+"AND i.tran_id = d.tran_id "
+"AND d.line_no='1' "
+"AND CASE WHEN i.confirmed IS NULL THEN 'N' ELSE i.confirmed END = 'Y' "
+" and i.sundry_code in (select cust_code from customer where tax_reg_2 = 'UNREGISTER') "
+" and st_c.GST_CODE = '00' "
// +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP
+"AND (SELECT COUNT(1) FROM taxtran ti,tax tm WHERE tm.tax_code = ti.tax_code "
+ " and ti.tran_code = 'MDRCRC'"
+ " and i.TRAN_ID =ti.TRAN_ID"
+" and ti.tax_perc > 0"
+ " and tm.tax_type in ('G','H','I','J') ) > 0"
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'MDRCRD' and ref_id = i.tran_id ) = 0 )"
+" group by "
+" TRAN_ID,TRAN_ID__REF,SITE_CODE ,PRD_CODE ,REC_TYPE,GST_TYPE,TRAN_TYPE,CUST_CODE,CUST_NAME,GST_CODE,SUBMISSION_TYPE, "
+" DOC_CHECKSUM,DOC_TYPE,DOC_NO,DOC_DATE,AMOUNT,REVERSE_CHRG,LR_NO,REAS_CODE,REF_ID__INV,REF_DATE__INV,PROV_ASSMNT,ORDER_NO, "
+" REMARKS,REF_ID,SUBMIT_STATUS,ADD_USER,ADD_TERM,CHG_USER,CHG_DATE,CHG_TERM,TAX_REG_NO,RECO_STATUS,ECOM_REG_NO,REF_SER";
/**
* Detail debit Note registered inter state (MDRCRD)*
*/
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,"
+" (select CASE "
+" WHEN (NVL(it.item_code,'X')<>'X') "
+" THEN (fn_get_hsn_no(i.site_code,it.item_code)) "
+" WHEN (NVL(it.item_code,'X')='X' AND NVL(GD.anal_code,'X')<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GD.anal_code) "
+" WHEN (NVL(it.item_code,'X')='X' AND NVL(GD.anal_code,'X')='X') "
+" THEN fn_get_hsn_sac(GH.site_code,'',GD.acct_code) END "
+" from MISC_DRCR_RCP GH,MISC_DRCR_RDET GD where GH.tran_id=GD.tran_id and GH.tran_id=i.tran_id "
+" and it.line_no=GD.line_no ) AS GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('MDRCRD' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) * i.EXCH_RATE AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('MDRCRD' 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('MDRCRD' 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('MDRCRD' 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('MDRCRD' 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('MDRCRD' 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('MDRCRD' 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('MDRCRD',i.tran_id, it.line_no, ' ', 'T') * i.EXCH_RATE as TAXABLE_AMT,"
+ "fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" (select CASE "
+" WHEN (NVL(it.item_code,'X')='X') "
+" THEN 'OTH' "
+" WHEN (NVL(it.item_code,'X')<>'X') "
+" THEN (SELECT CASE WHEN udf_str2 IS NULL THEN descr ELSE udf_str2 END AS Unit FROM uom "
+" WHERE unit=(select item.unit from item where item.item_code=it.item_code) ) END "
+" from dual ) AS UNIT, "
+" (it.quantity) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('MDRCRD' 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('MDRCRD' 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('MDRCRD',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
dtlSql = dtlSql
+" '' as REMARKS ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +" fn_get_gst_rate('MDRCRD',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +" fn_get_gst_rate('MDRCRD',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from MISC_DRCR_RCP i,MISC_DRCR_RDET 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 = 'MDRCRD' "
+"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,"DNUR-EXP");
}
}//end of CD/DN export transaction
/**MISC DN/CD queries **/ /**MISC DN/CD queries **/
{ {
...@@ -5747,8 +6124,21 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5747,8 +6124,21 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"AND d.line_no='1' " +"AND d.line_no='1' "
+"AND CASE WHEN i.confirmed IS NULL THEN 'N' ELSE i.confirmed END = 'Y' " +"AND CASE WHEN i.confirmed IS NULL THEN 'N' ELSE i.confirmed END = 'Y' "
+" and i.sundry_code in (select cust_code from customer where tax_reg_2 = 'UNREGISTER') " +" and i.sundry_code in (select cust_code from customer where tax_reg_2 = 'UNREGISTER') "
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP +" and st_c.GST_CODE <> '00' "
+" and i.tran_date between ? and ? " // +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP
+"AND (SELECT COUNT(1) FROM taxtran ti,tax tm WHERE tm.tax_code = ti.tax_code "
+ " and ti.tran_code = 'MDRCRC'"
+ " and i.TRAN_ID =ti.TRAN_ID"
+" and ti.tax_perc > 0"
+ " and tm.tax_type in ('G','H','I','J')";
if(GST_NIL_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class not in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap not in ("+TAX_CHAP_STR+") ) ";
}
hdrSql = hdrSql +" ) > 0 "
+ " and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'MDRCRC' and ref_id = i.tran_id ) = 0 )" +" and (select count(1) from gst_data_hdr where ref_ser = 'MDRCRC' and ref_id = i.tran_id ) = 0 )"
+" group by " +" group by "
+" TRAN_ID,TRAN_ID__REF,SITE_CODE ,PRD_CODE ,REC_TYPE,GST_TYPE,TRAN_TYPE,CUST_CODE,CUST_NAME,GST_CODE,SUBMISSION_TYPE, " +" TRAN_ID,TRAN_ID__REF,SITE_CODE ,PRD_CODE ,REC_TYPE,GST_TYPE,TRAN_TYPE,CUST_CODE,CUST_NAME,GST_CODE,SUBMISSION_TYPE, "
...@@ -5924,7 +6314,19 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5924,7 +6314,19 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"AND d.line_no='1' " +"AND d.line_no='1' "
+"AND CASE WHEN i.confirmed IS NULL THEN 'N' ELSE i.confirmed END = 'Y' " +"AND CASE WHEN i.confirmed IS NULL THEN 'N' ELSE i.confirmed END = 'Y' "
+" and i.sundry_code in (select cust_code from customer where tax_reg_2 = 'UNREGISTER') " +" and i.sundry_code in (select cust_code from customer where tax_reg_2 = 'UNREGISTER') "
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP +" and st_c.GST_CODE <> '00' "
// +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP
+"AND (SELECT COUNT(1) FROM taxtran ti,tax tm WHERE tm.tax_code = ti.tax_code "
+ " and ti.tran_code = 'MDRCRC'"
+ " and i.TRAN_ID =ti.TRAN_ID"
+" and ti.tax_perc > 0"
+ " and tm.tax_type in ('G','H','I','J')";
if(GST_NIL_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class not in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap not in ("+TAX_CHAP_STR+") ) ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? " +" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'MDRCRC' and ref_id = i.tran_id ) = 0 )" +" and (select count(1) from gst_data_hdr where ref_ser = 'MDRCRC' and ref_id = i.tran_id ) = 0 )"
+" group by " +" group by "
...@@ -6097,8 +6499,21 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6097,8 +6499,21 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"AND d.line_no='1' " +"AND d.line_no='1' "
+"AND CASE WHEN i.confirmed IS NULL THEN 'N' ELSE i.confirmed END = 'Y' " +"AND CASE WHEN i.confirmed IS NULL THEN 'N' ELSE i.confirmed END = 'Y' "
+" and i.sundry_code in (select cust_code from customer where tax_reg_2 = 'UNREGISTER') " +" and i.sundry_code in (select cust_code from customer where tax_reg_2 = 'UNREGISTER') "
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP +" and st_c.GST_CODE <> '00' "
+" and i.tran_date between ? and ? " // +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP
+"AND (SELECT COUNT(1) FROM taxtran ti,tax tm WHERE tm.tax_code = ti.tax_code "
+ " and ti.tran_code = 'MDRCRC'"
+ " and i.TRAN_ID =ti.TRAN_ID"
+" and ti.tax_perc > 0"
+ " and tm.tax_type in ('G','H','I','J')";
if(GST_NIL_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class not in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap not in ("+TAX_CHAP_STR+") ) ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'MDRCRD' and ref_id = i.tran_id ) = 0 )" +" and (select count(1) from gst_data_hdr where ref_ser = 'MDRCRD' and ref_id = i.tran_id ) = 0 )"
+" group by " +" group by "
+" TRAN_ID,TRAN_ID__REF,SITE_CODE ,PRD_CODE ,REC_TYPE,GST_TYPE,TRAN_TYPE,CUST_CODE,CUST_NAME,GST_CODE,SUBMISSION_TYPE, " +" TRAN_ID,TRAN_ID__REF,SITE_CODE ,PRD_CODE ,REC_TYPE,GST_TYPE,TRAN_TYPE,CUST_CODE,CUST_NAME,GST_CODE,SUBMISSION_TYPE, "
...@@ -6268,8 +6683,21 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6268,8 +6683,21 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"AND d.line_no='1' " +"AND d.line_no='1' "
+"AND CASE WHEN i.confirmed IS NULL THEN 'N' ELSE i.confirmed END = 'Y' " +"AND CASE WHEN i.confirmed IS NULL THEN 'N' ELSE i.confirmed END = 'Y' "
+" and i.sundry_code in (select cust_code from customer where tax_reg_2 = 'UNREGISTER') " +" and i.sundry_code in (select cust_code from customer where tax_reg_2 = 'UNREGISTER') "
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP +" and st_c.GST_CODE <> '00' "
+" and i.tran_date between ? and ? " // +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP
+"AND (SELECT COUNT(1) FROM taxtran ti,tax tm WHERE tm.tax_code = ti.tax_code "
+ " and ti.tran_code = 'MDRCRC'"
+ " and i.TRAN_ID =ti.TRAN_ID"
+" and ti.tax_perc > 0"
+ " and tm.tax_type in ('G','H','I','J')";
if(GST_NIL_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class not in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap not in ("+TAX_CHAP_STR+") ) ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'MDRCRD' and ref_id = i.tran_id ) = 0 )" +" and (select count(1) from gst_data_hdr where ref_ser = 'MDRCRD' and ref_id = i.tran_id ) = 0 )"
+" group by " +" group by "
+" TRAN_ID,TRAN_ID__REF,SITE_CODE ,PRD_CODE ,REC_TYPE,GST_TYPE,TRAN_TYPE,CUST_CODE,CUST_NAME,GST_CODE,SUBMISSION_TYPE, " +" TRAN_ID,TRAN_ID__REF,SITE_CODE ,PRD_CODE ,REC_TYPE,GST_TYPE,TRAN_TYPE,CUST_CODE,CUST_NAME,GST_CODE,SUBMISSION_TYPE, "
...@@ -6428,6 +6856,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6428,6 +6856,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and (i.cust_code in (select distinct invoice.cust_code from invoice,customer " +" and (i.cust_code in (select distinct invoice.cust_code from invoice,customer "
+" where invoice.cust_code = customer.cust_code and invoice.net_amt <= "+GST_B2CL_INV_VAL+" and c.TAX_REG_2 = 'UNREGISTER'))" +" where invoice.cust_code = customer.cust_code and invoice.net_amt <= "+GST_B2CL_INV_VAL+" and c.TAX_REG_2 = 'UNREGISTER'))"
+" and st_c.GST_CODE <> '00' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'CRNRCP' " +" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'CRNRCP' "
+" and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') " +" and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') "
+" and ti.tax_perc <> 0 "; +" and ti.tax_perc <> 0 ";
...@@ -6568,6 +6997,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6568,6 +6997,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and (i.cust_code in (select distinct invoice.cust_code from invoice,customer " +" and (i.cust_code in (select distinct invoice.cust_code from invoice,customer "
+" where invoice.cust_code = customer.cust_code and invoice.net_amt <= "+GST_B2CL_INV_VAL+" and c.TAX_REG_2 = 'UNREGISTER'))" +" where invoice.cust_code = customer.cust_code and invoice.net_amt <= "+GST_B2CL_INV_VAL+" and c.TAX_REG_2 = 'UNREGISTER'))"
+" and st_c.GST_CODE <> '00' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'CRNRCP' " +" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'CRNRCP' "
+" and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') " +" and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') "
+" and ti.tax_perc <> 0 "; +" and ti.tax_perc <> 0 ";
...@@ -6709,6 +7139,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6709,6 +7139,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and (i.cust_code in (select distinct invoice.cust_code from invoice,customer " +" and (i.cust_code in (select distinct invoice.cust_code from invoice,customer "
+" where invoice.cust_code = customer.cust_code and invoice.net_amt <= "+GST_B2CL_INV_VAL+" and c.TAX_REG_2 = 'UNREGISTER'))" +" where invoice.cust_code = customer.cust_code and invoice.net_amt <= "+GST_B2CL_INV_VAL+" and c.TAX_REG_2 = 'UNREGISTER'))"
+" and st_c.GST_CODE <> '00' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'DRNRCP' " +" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'DRNRCP' "
+" and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') " +" and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') "
+" and ti.tax_perc <> 0 "; +" and ti.tax_perc <> 0 ";
...@@ -6850,6 +7281,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6850,6 +7281,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and (i.cust_code in (select distinct invoice.cust_code from invoice,customer " +" and (i.cust_code in (select distinct invoice.cust_code from invoice,customer "
+" where invoice.cust_code = customer.cust_code and invoice.net_amt <= "+GST_B2CL_INV_VAL+" and c.TAX_REG_2 = 'UNREGISTER'))" +" where invoice.cust_code = customer.cust_code and invoice.net_amt <= "+GST_B2CL_INV_VAL+" and c.TAX_REG_2 = 'UNREGISTER'))"
+" and st_c.GST_CODE <> '00' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'DRNRCP' " +" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'DRNRCP' "
+" and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') " +" and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') "
+" and ti.tax_perc <> 0 "; +" and ti.tax_perc <> 0 ";
...@@ -7065,7 +7497,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -7065,7 +7497,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'CRNRCP' " +"and ti.tran_code = 'CRNRCP' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
...@@ -7074,6 +7512,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -7074,6 +7512,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{ {
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0"; dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" and i.tran_id = ? "; +" and i.tran_id = ? ";
...@@ -7199,7 +7638,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -7199,7 +7638,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'CRNRCP' " +"and ti.tran_code = 'CRNRCP' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
...@@ -7208,6 +7653,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -7208,6 +7653,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{ {
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0"; dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" and i.tran_id = ? "; +" and i.tran_id = ? ";
...@@ -7334,6 +7780,11 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -7334,6 +7780,11 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and ti.tran_code = 'CRNRCP' " +"and ti.tran_code = 'CRNRCP' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
...@@ -7342,6 +7793,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -7342,6 +7793,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{ {
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0"; dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" and i.tran_id = ? "; +" and i.tran_id = ? ";
...@@ -7466,7 +7918,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -7466,7 +7918,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'CRNRCP' " +"and ti.tran_code = 'CRNRCP' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
...@@ -7602,7 +8060,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -7602,7 +8060,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'DRNRCP' " +"and ti.tran_code = 'DRNRCP' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
...@@ -7735,7 +8199,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -7735,7 +8199,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'DRNRCP' " +"and ti.tran_code = 'DRNRCP' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
...@@ -7868,7 +8338,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -7868,7 +8338,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'DRNRCP' " +"and ti.tran_code = 'DRNRCP' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
...@@ -8000,8 +8476,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8000,8 +8476,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and item.item_code = it.item_code " +" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'DRNRCP' " +"and ti.tran_code = 'DRNRCP' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
...@@ -8064,6 +8547,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8064,6 +8547,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and s.state_code = c.state_code " +" and s.state_code = c.state_code "
+" and c.tax_reg_2 <> 'UNREGISTER' " +" and c.tax_reg_2 <> 'UNREGISTER' "
+" and state.GST_CODE <> '00'"
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' and ti.tran_id = i.tran_id " +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "; +" and ti.tax_perc = 0 ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
...@@ -8140,7 +8624,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8140,7 +8624,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRC' " +"and ti.tran_code = 'MDRCRC' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
...@@ -8198,6 +8688,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8198,6 +8688,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and s.state_code = c.state_code " +" and s.state_code = c.state_code "
+" and c.tax_reg_2 = 'UNREGISTER' " +" and c.tax_reg_2 = 'UNREGISTER' "
+" and state.GST_CODE <> '00' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' and ti.tran_id = i.tran_id " +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "; +" and ti.tax_perc = 0 ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
...@@ -8274,7 +8765,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8274,7 +8765,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRC' " +"and ti.tran_code = 'MDRCRC' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
...@@ -8331,6 +8828,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8331,6 +8828,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and s.state_code <> c.state_code " +" and s.state_code <> c.state_code "
+" and c.tax_reg_2 = 'UNREGISTER' " +" and c.tax_reg_2 = 'UNREGISTER' "
+" and state.GST_CODE <> '00' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' and ti.tran_id = i.tran_id " +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "; +" and ti.tax_perc = 0 ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
...@@ -8407,7 +8905,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8407,7 +8905,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRC' " +"and ti.tran_code = 'MDRCRC' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
...@@ -8465,6 +8969,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8465,6 +8969,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and s.state_code <> c.state_code " +" and s.state_code <> c.state_code "
+" and c.tax_reg_2 <> 'UNREGISTER' " +" and c.tax_reg_2 <> 'UNREGISTER' "
+" and state.GST_CODE <> '00' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' and ti.tran_id = i.tran_id " +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "; +" and ti.tax_perc = 0 ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
...@@ -8540,8 +9045,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8540,8 +9045,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and item.item_code = it.item_code " +" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRC' " +"and ti.tran_code = 'MDRCRC' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
...@@ -8601,6 +9112,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8601,6 +9112,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and s.state_code <> c.state_code " +" and s.state_code <> c.state_code "
+" and c.tax_reg_2 <> 'UNREGISTER' " +" and c.tax_reg_2 <> 'UNREGISTER' "
+" and state.GST_CODE <> '00' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' and ti.tran_id = i.tran_id " +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "; +" and ti.tax_perc = 0 ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
...@@ -8677,8 +9189,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8677,8 +9189,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRD' " +"and ti.tran_code = 'MDRCRD' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
} }
...@@ -8734,6 +9253,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8734,6 +9253,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and s.state_code <> c.state_code " +" and s.state_code <> c.state_code "
+" and c.tax_reg_2 = 'UNREGISTER' " +" and c.tax_reg_2 = 'UNREGISTER' "
+" and state.GST_CODE <> '00' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' and ti.tran_id = i.tran_id " +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "; +" and ti.tax_perc = 0 ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
...@@ -8810,7 +9330,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8810,7 +9330,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRD' " +"and ti.tran_code = 'MDRCRD' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
...@@ -8866,6 +9392,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8866,6 +9392,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and s.state_code = c.state_code " +" and s.state_code = c.state_code "
+" and c.tax_reg_2 = 'UNREGISTER' " +" and c.tax_reg_2 = 'UNREGISTER' "
+" and state.GST_CODE <> '00' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' and ti.tran_id = i.tran_id " +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "; +" and ti.tax_perc = 0 ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
...@@ -8942,7 +9469,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8942,7 +9469,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRD' " +"and ti.tran_code = 'MDRCRD' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
...@@ -9000,6 +9533,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -9000,6 +9533,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and state.state_code = c.state_code " +" and state.state_code = c.state_code "
+" and s.state_code = c.state_code " +" and s.state_code = c.state_code "
+" and c.tax_reg_2 <> 'UNREGISTER' " +" and c.tax_reg_2 <> 'UNREGISTER' "
+" and state.GST_CODE <> '00' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' and ti.tran_id = i.tran_id " +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "; +" and ti.tax_perc = 0 ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
...@@ -9076,7 +9610,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -9076,7 +9610,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRD' " +"and ti.tran_code = 'MDRCRD' "
+"and ti.tran_id = i.tran_id " +"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
if(GST_NIL_TAXCLASS.length() > 0)
{
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
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