Commit b88a9725 authored by kdabholkar's avatar kdabholkar

commit changes in misc_drcr_rcp queries of GSTR1 to add Anal code logic

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@190280 ce508802-f39f-4f6c-b175-0d175dae99d5
parent fb2d989d
...@@ -5011,8 +5011,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5011,8 +5011,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and st_own.gst_code <> st_c.gst_code " +"and st_own.gst_code <> st_c.gst_code "
+"AND i.drcr_flag ='C' " +"AND i.drcr_flag ='C' "
+"AND i.tran_id = d.tran_id " +"AND i.tran_id = d.tran_id "
+"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 d.line_no = (select min(line_no) from misc_drcr_rdet where tran_id=i.tran_id) "
+" 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 trim(tax_reg_2) = 'UNREGISTER') " +" and i.sundry_code in (select cust_code from customer where trim(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 (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 st_c.GST_CODE = '00' "
...@@ -5193,8 +5194,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5193,8 +5194,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and st_own.gst_code <> st_c.gst_code " +"and st_own.gst_code <> st_c.gst_code "
+"AND i.drcr_flag ='D' " +"AND i.drcr_flag ='D' "
+"AND i.tran_id = d.tran_id " +"AND i.tran_id = d.tran_id "
+"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 d.line_no = (select min(line_no) from misc_drcr_rdet where tran_id=i.tran_id) "
+" 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 trim(tax_reg_2) = 'UNREGISTER') " +" and i.sundry_code in (select cust_code from customer where trim(tax_reg_2) = 'UNREGISTER') "
+ " and trim(i.tran_type) != 'PR' " + " and trim(i.tran_type) != 'PR' "
+" and st_c.GST_CODE = '00' " +" and st_c.GST_CODE = '00' "
...@@ -5375,8 +5377,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5375,8 +5377,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and st_own.gst_code = st_c.gst_code " +"and st_own.gst_code = st_c.gst_code "
+"AND i.drcr_flag ='C' " +"AND i.drcr_flag ='C' "
+"AND i.tran_id = d.tran_id " +"AND i.tran_id = d.tran_id "
+"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 d.line_no = (select min(line_no) from misc_drcr_rdet where tran_id=i.tran_id) "
+" 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 trim(tax_reg_2) = 'UNREGISTER') " +" and i.sundry_code in (select cust_code from customer where trim(tax_reg_2) = 'UNREGISTER') "
+" and st_c.GST_CODE <> '00' " +" and st_c.GST_CODE <> '00' "
+" and trim(i.tran_type) != 'PR' " +" and trim(i.tran_type) != 'PR' "
...@@ -5569,7 +5572,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5569,7 +5572,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and st_own.gst_code <> st_c.gst_code " +"and st_own.gst_code <> st_c.gst_code "
+"AND i.drcr_flag ='C' " +"AND i.drcr_flag ='C' "
+"AND i.tran_id = d.tran_id " +"AND i.tran_id = d.tran_id "
+"AND d.line_no='1' " // +"AND d.line_no='1' "
+" and d.line_no = (select min(line_no) from misc_drcr_rdet where tran_id=i.tran_id) "
+"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 trim(tax_reg_2) = 'UNREGISTER') " +" and i.sundry_code in (select cust_code from customer where trim(tax_reg_2) = 'UNREGISTER') "
+" and st_c.GST_CODE <> '00' " +" and st_c.GST_CODE <> '00' "
...@@ -5758,7 +5762,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5758,7 +5762,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and st_own.gst_code = st_c.gst_code " +"and st_own.gst_code = st_c.gst_code "
+"AND i.drcr_flag ='D' " +"AND i.drcr_flag ='D' "
+"AND i.tran_id = d.tran_id " +"AND i.tran_id = d.tran_id "
+"AND d.line_no='1' " //+"AND d.line_no='1' "
+" and d.line_no = (select min(line_no) from misc_drcr_rdet where tran_id=i.tran_id) "
+"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 trim(tax_reg_2) = 'UNREGISTER') " +" and i.sundry_code in (select cust_code from customer where trim(tax_reg_2) = 'UNREGISTER') "
+" and st_c.GST_CODE <> '00' " +" and st_c.GST_CODE <> '00' "
...@@ -5946,7 +5951,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5946,7 +5951,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and st_own.gst_code <> st_c.gst_code " +"and st_own.gst_code <> st_c.gst_code "
+"AND i.drcr_flag ='D' " +"AND i.drcr_flag ='D' "
+"AND i.tran_id = d.tran_id " +"AND i.tran_id = d.tran_id "
+"AND d.line_no='1' " // +"AND d.line_no='1' "
+" and d.line_no = (select min(line_no) from misc_drcr_rdet where tran_id=i.tran_id) "
+"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 trim(tax_reg_2) = 'UNREGISTER') " +" and i.sundry_code in (select cust_code from customer where trim(tax_reg_2) = 'UNREGISTER') "
+" and st_c.GST_CODE <> '00' " +" and st_c.GST_CODE <> '00' "
...@@ -7915,44 +7921,59 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -7915,44 +7921,59 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" it.line_no as LINE_NO, " +" it.line_no as LINE_NO, "
+" 'A' as STATUS, " +" 'A' as STATUS, "
+" 0 as SR_NO__OLD, " +" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,"; +" 'G' 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 )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE," dtlSql = dtlSql //+"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+" - 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))) AS TAXABLE_AMT," +" - 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))) 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('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('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('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('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('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,"; +" - 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 else
{ {
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," dtlSql = dtlSql //+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ " - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT," + " - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, ' ', 'T') 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', '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, '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', '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, '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', 'R') as SGST_PERC,"
+ " - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,"; + " - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" ' ' as GS_DESCR, " +" ' ' 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 udf_str2 is null then 'OTH' else udf_str2 end as Unit from uom where unit=item.unit) as UNIT, "
+"(select case when udf_str2 is null then 'OTH' 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," +" (it.QUANTITY) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ; +" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) 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," 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,"; +" - 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 else
{ {
dtlSql = dtlSql +" - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC," 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,"; +" - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
} }
dtlSql = dtlSql dtlSql = dtlSql
...@@ -7967,14 +7988,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -7967,14 +7988,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = dtlSql +" fn_get_gst_rate('MDRCRC',i.tran_id, it.line_no) as gst_rate "; dtlSql = dtlSql +" fn_get_gst_rate('MDRCRC',i.tran_id, it.line_no) as gst_rate ";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" from MISC_DRCR_RCP i,MISC_DRCR_RDET it,item " +" from MISC_DRCR_RCP i,MISC_DRCR_RDET it "
+" where i.tran_id = it.tran_id " +" 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 (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 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) if(GST_NIL_TAXCLASS.length() > 0)
{ {
...@@ -8056,85 +8076,99 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8056,85 +8076,99 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/** /**
*Detail CDNR Query nill Rated CDNR(Intra-state Register) * *Detail CDNR Query nill Rated CDNR(Intra-state Register) *
*/ */
dtlSql = " select '' as TRAN_ID, " dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, " +" it.line_no as LINE_NO, "
+" 'A' as STATUS, " +" 'A' as STATUS, "
+" 0 as SR_NO__OLD, " +" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,"; +" 'G' as LINE_TYPE,"
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) +" (select CASE "
{ +" WHEN (NVL(it.item_code,'X')<>'X') "
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE," +" THEN (fn_get_hsn_no(i.site_code,it.item_code)) "
+" - 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))) AS TAXABLE_AMT," +" WHEN (NVL(it.item_code,'X')='X' AND NVL(GD.anal_code,'X')<>'X') "
+" - 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," +" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GD.anal_code) "
+" - 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," +" WHEN (NVL(it.item_code,'X')='X' AND NVL(GD.anal_code,'X')='X') "
+" - 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," +" THEN fn_get_hsn_sac(GH.site_code,'',GD.acct_code) END "
+" - 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," +" from MISC_DRCR_RCP GH,MISC_DRCR_RDET GD where GH.tran_id=GD.tran_id and GH.tran_id=i.tran_id "
+" - 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," +" and it.line_no=GD.line_no ) AS GS_CODE, ";
+" - 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,"; if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
} dtlSql = dtlSql //+"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
else +" - 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))) 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,"
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," +" - 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('MDRCRC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_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('MDRCRC',i.tran_id, it.line_no, 'I', 'R') as IGST_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('MDRCRC',i.tran_id, it.line_no, 'I', 'A') as IGST_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('MDRCRC',i.tran_id, it.line_no, 'H', 'R') as CGST_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,";
+ " - 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,"; else
} {
dtlSql = dtlSql dtlSql = dtlSql //+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+" ' ' as GS_DESCR, " + " - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
// +"(select case when udf_str2 is null then descr else udf_str2 end as Unit from uom where unit=item.unit) as UNIT, " + " fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+"(select case when udf_str2 is null then 'OTH' else udf_str2 end as Unit from uom where unit=item.unit) as UNIT, " + " - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+" (it.QUANTITY) as QUANTITY," + " fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+" 'OE' as SUPPLY_TYPE," ; + " - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) + " 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 + " - 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,"; dtlSql = dtlSql
} +" ' ' as GS_DESCR, "
else // +"(select case when udf_str2 is null then 'OTH' else udf_str2 end as Unit from uom where unit=item.unit) as UNIT, "
{ +" (select CASE "
dtlSql = dtlSql +" - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC," +" WHEN (NVL(it.item_code,'X')='X') "
+" - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,"; +" THEN 'OTH' "
} +" WHEN (NVL(it.item_code,'X')<>'X') "
dtlSql = dtlSql +" 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 "
+" '' as REMARKS ,"; +" from dual ) AS UNIT, "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) +" (it.QUANTITY) as QUANTITY,"
{ +" 'OE' as SUPPLY_TYPE," ;
dtlSql = dtlSql +" fn_get_gst_rate('MDRCRC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate "; if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
} {
else 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,";
dtlSql = dtlSql +" fn_get_gst_rate('MDRCRC',i.tran_id, it.line_no) as gst_rate "; }
} else
dtlSql = dtlSql {
+" from MISC_DRCR_RCP i,MISC_DRCR_RDET it,item " dtlSql = dtlSql +" fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+" where i.tran_id = it.tran_id " +" - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
+" and item.item_code = it.item_code " }
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " dtlSql = dtlSql
+"and ti.tran_code = 'MDRCRC' "
+"and ti.tran_id = i.tran_id " +" '' as REMARKS ,";
+" and ti.tax_perc = 0 " if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+"and tx.tax_type in ('G','H','I','J')" ; {
if(GST_NIL_TAXCLASS.length() > 0) dtlSql = dtlSql +" fn_get_gst_rate('MDRCRC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
{ }
else
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) "; {
} dtlSql = dtlSql +" fn_get_gst_rate('MDRCRC',i.tran_id, it.line_no) as gst_rate ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) }
{ dtlSql = dtlSql
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; +" from MISC_DRCR_RCP i,MISC_DRCR_RDET it "
} +" where i.tran_id = it.tran_id "
else +" and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
{ +" and ti.tran_code = 'MDRCRC' "
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0"; +" and ti.tran_id = i.tran_id "
} +" and ti.tax_perc = 0 "
dtlSql = dtlSql +" and tx.tax_type in ('G','H','I','J')" ;
+" and i.tran_id = ? "; 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 ))
{
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,"misc-CD(NILL)-Intra-UNREG"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"misc-CD(NILL)-Intra-UNREG");
} }
...@@ -8200,50 +8234,65 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8200,50 +8234,65 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/** /**
*Detail CDNR Query nill Rated CDNR(Intra-state Register) * *Detail CDNR Query nill Rated CDNR(Intra-state Register) *
*/ */
dtlSql = " select '' as TRAN_ID, " dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, " +" it.line_no as LINE_NO, "
+" 'A' as STATUS, " +" 'A' as STATUS, "
+" 0 as SR_NO__OLD, " +" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,"; +" 'G' 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 )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE," dtlSql = dtlSql //+"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+" - 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))) AS TAXABLE_AMT," +" - 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))) 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('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('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('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('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('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,"; +" - 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 else
{ {
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," dtlSql = dtlSql //+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ " - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT," + " - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, ' ', 'T') 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', '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, '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', '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, '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', 'R') as SGST_PERC,"
+ " - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,"; + " - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" ' ' as GS_DESCR, " +" ' ' 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 udf_str2 is null then 'OTH' else udf_str2 end as Unit from uom where unit=item.unit) as UNIT, "
+"(select case when udf_str2 is null then 'OTH' 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," +" (it.QUANTITY) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ; +" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) 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," 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,"; +" - 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 else
{ {
dtlSql = dtlSql +" - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC," 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,"; +" - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" '' as REMARKS ,"; +" '' as REMARKS ,";
...@@ -8256,14 +8305,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8256,14 +8305,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = dtlSql +" fn_get_gst_rate('MDRCRC',i.tran_id, it.line_no) as gst_rate "; dtlSql = dtlSql +" fn_get_gst_rate('MDRCRC',i.tran_id, it.line_no) as gst_rate ";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" from MISC_DRCR_RCP i,MISC_DRCR_RDET it,item " +" from MISC_DRCR_RCP i,MISC_DRCR_RDET it "
+" where i.tran_id = it.tran_id " +" 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 (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 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) if(GST_NIL_TAXCLASS.length() > 0)
{ {
...@@ -8345,50 +8393,65 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8345,50 +8393,65 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/** /**
*Detail CDNR Query nill Rated CDNR(Intra-state Register) * *Detail CDNR Query nill Rated CDNR(Intra-state Register) *
*/ */
dtlSql = " select '' as TRAN_ID, " dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, " +" it.line_no as LINE_NO, "
+" 'A' as STATUS, " +" 'A' as STATUS, "
+" 0 as SR_NO__OLD, " +" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,"; +" 'G' 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 )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE," dtlSql = dtlSql //+"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+" - 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))) AS TAXABLE_AMT," +" - 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))) 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('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('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('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('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('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,"; +" - 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 else
{ {
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," dtlSql = dtlSql //+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ " - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT," + " - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, ' ', 'T') 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', '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, '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', '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, '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', 'R') as SGST_PERC,"
+ " - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,"; + " - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" ' ' as GS_DESCR, " +" ' ' 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 udf_str2 is null then 'OTH' else udf_str2 end as Unit from uom where unit=item.unit) as UNIT, "
+"(select case when udf_str2 is null then 'OTH' 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," +" (it.QUANTITY) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ; +" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) 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," 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,"; +" - 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 else
{ {
dtlSql = dtlSql +" - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC," 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,"; +" - fn_gst_rate_amt('MDRCRC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" '' as REMARKS ,"; +" '' as REMARKS ,";
...@@ -8401,14 +8464,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8401,14 +8464,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = dtlSql +" fn_get_gst_rate('MDRCRC',i.tran_id, it.line_no) as gst_rate "; dtlSql = dtlSql +" fn_get_gst_rate('MDRCRC',i.tran_id, it.line_no) as gst_rate ";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" from MISC_DRCR_RCP i,MISC_DRCR_RDET it,item " +" from MISC_DRCR_RCP i,MISC_DRCR_RDET it "
+" where i.tran_id = it.tran_id " +" 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 (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 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) if(GST_NIL_TAXCLASS.length() > 0)
{ {
...@@ -8496,10 +8558,19 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8496,10 +8558,19 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" it.line_no as LINE_NO, " +" it.line_no as LINE_NO, "
+" 'A' as STATUS, " +" 'A' as STATUS, "
+" 0 as SR_NO__OLD, " +" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,"; +" 'G' 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 )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE," dtlSql = dtlSql //+"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+" 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))) AS TAXABLE_AMT," +" 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))) 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('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('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
...@@ -8511,7 +8582,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8511,7 +8582,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
} }
else else
{ {
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," dtlSql = dtlSql //+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT," + " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, ' ', 'T') 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', '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, 'I', 'A') as IGST_AMT,"
...@@ -8522,8 +8593,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8522,8 +8593,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
} }
dtlSql = dtlSql dtlSql = dtlSql
+" ' ' as GS_DESCR, " +" ' ' 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 udf_str2 is null then 'OTH' else udf_str2 end as Unit from uom where unit=item.unit) as UNIT, "
+"(select case when udf_str2 is null then 'OTH' 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," +" (it.QUANTITY) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ; +" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
...@@ -8548,9 +8625,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8548,9 +8625,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = dtlSql +" fn_get_gst_rate('MDRCRD',i.tran_id, it.line_no) as gst_rate "; dtlSql = dtlSql +" fn_get_gst_rate('MDRCRD',i.tran_id, it.line_no) as gst_rate ";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" from MISC_DRCR_RCP i,MISC_DRCR_RDET it,item " +" from MISC_DRCR_RCP i,MISC_DRCR_RDET it "
+" where i.tran_id = it.tran_id " +" 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 (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 "
...@@ -8637,18 +8713,27 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8637,18 +8713,27 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/** /**
*Detail CDNR Query nill Rated CDNR(Intra-state Register) * *Detail CDNR Query nill Rated CDNR(Intra-state Register) *
*/ */
dtlSql = " select '' as TRAN_ID, " dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, " +" it.line_no as LINE_NO, "
+" 'A' as STATUS, " +" 'A' as STATUS, "
+" 0 as SR_NO__OLD, " +" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,"; +" 'G' 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 )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE," dtlSql = dtlSql //+"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+" 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))) AS TAXABLE_AMT," +" 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))) 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('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('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('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('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('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,"; +" 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,";
...@@ -8656,7 +8741,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8656,7 +8741,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
} }
else else
{ {
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," dtlSql = dtlSql //+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT," + " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, ' ', 'T') 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', '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, 'I', 'A') as IGST_AMT,"
...@@ -8667,8 +8752,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8667,8 +8752,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
} }
dtlSql = dtlSql dtlSql = dtlSql
+" ' ' as GS_DESCR, " +" ' ' 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 udf_str2 is null then 'OTH' else udf_str2 end as Unit from uom where unit=item.unit) as UNIT, "
+"(select case when udf_str2 is null then 'OTH' 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," +" (it.QUANTITY) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ; +" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
...@@ -8679,7 +8770,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8679,7 +8770,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else else
{ {
dtlSql = dtlSql +" fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC," 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,"; +" fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
} }
dtlSql = dtlSql dtlSql = dtlSql
...@@ -8693,9 +8784,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8693,9 +8784,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = dtlSql +" fn_get_gst_rate('MDRCRD',i.tran_id, it.line_no) as gst_rate "; dtlSql = dtlSql +" fn_get_gst_rate('MDRCRD',i.tran_id, it.line_no) as gst_rate ";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" from MISC_DRCR_RCP i,MISC_DRCR_RDET it,item " +" from MISC_DRCR_RCP i,MISC_DRCR_RDET it "
+" where i.tran_id = it.tran_id " +" 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 (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 "
...@@ -8707,6 +8797,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8707,6 +8797,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) "; 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";
} }
...@@ -8780,85 +8871,100 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8780,85 +8871,100 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/** /**
*Detail CDNR Query nill Rated CDNR(Intra-state Register) * *Detail CDNR Query nill Rated CDNR(Intra-state Register) *
*/ */
dtlSql = " select '' as TRAN_ID, " dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, " +" it.line_no as LINE_NO, "
+" 'A' as STATUS, " +" 'A' as STATUS, "
+" 0 as SR_NO__OLD, " +" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,"; +" 'G' as LINE_TYPE,"
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) +" (select CASE "
{ +" WHEN (NVL(it.item_code,'X')<>'X') "
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE," +" THEN (fn_get_hsn_no(i.site_code,it.item_code)) "
+" 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))) AS TAXABLE_AMT," +" WHEN (NVL(it.item_code,'X')='X' AND NVL(GD.anal_code,'X')<>'X') "
+" 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," +" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GD.anal_code) "
+" 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," +" WHEN (NVL(it.item_code,'X')='X' AND NVL(GD.anal_code,'X')='X') "
+" 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," +" THEN fn_get_hsn_sac(GH.site_code,'',GD.acct_code) END "
+" 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," +" from MISC_DRCR_RCP GH,MISC_DRCR_RDET GD where GH.tran_id=GD.tran_id and GH.tran_id=i.tran_id "
+" 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," +" and it.line_no=GD.line_no ) AS GS_CODE, ";
+" 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,"; if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
} dtlSql = dtlSql //+"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
else +" 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))) 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,"
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," +" 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('MDRCRD',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_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('MDRCRD',i.tran_id, it.line_no, 'I', 'R') as IGST_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('MDRCRD',i.tran_id, it.line_no, 'I', 'A') as IGST_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('MDRCRD',i.tran_id, it.line_no, 'H', 'R') as CGST_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,";
+ " 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,"; else
} {
dtlSql = dtlSql dtlSql = dtlSql //+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+" ' ' as GS_DESCR, " + " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
// +"(select case when udf_str2 is null then descr else udf_str2 end as Unit from uom where unit=item.unit) as UNIT, " + " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+"(select case when udf_str2 is null then 'OTH' else udf_str2 end as Unit from uom where unit=item.unit) as UNIT, " + " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+" (it.QUANTITY) as QUANTITY," + " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+" 'OE' as SUPPLY_TYPE," ; + " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) + " 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 + " 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,"; dtlSql = dtlSql
} +" ' ' as GS_DESCR, "
else // +"(select case when udf_str2 is null then 'OTH' else udf_str2 end as Unit from uom where unit=item.unit) as UNIT, "
{ +" (select CASE "
dtlSql = dtlSql +" fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC," +" WHEN (NVL(it.item_code,'X')='X') "
+" fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,"; +" THEN 'OTH' "
} +" WHEN (NVL(it.item_code,'X')<>'X') "
dtlSql = dtlSql +" 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 "
+" '' as REMARKS ,"; +" from dual ) AS UNIT, "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) +" (it.QUANTITY) as QUANTITY,"
{ +" 'OE' as SUPPLY_TYPE," ;
dtlSql = dtlSql +" fn_get_gst_rate('MDRCRD',i.tran_id,CAST(it.line_no as char(3))) as gst_rate "; if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
} {
else 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,";
dtlSql = dtlSql +" fn_get_gst_rate('MDRCRD',i.tran_id, it.line_no) as gst_rate "; }
} else
dtlSql = dtlSql {
+" from MISC_DRCR_RCP i,MISC_DRCR_RDET it,item " dtlSql = dtlSql +" fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+" where i.tran_id = it.tran_id " +" fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
+" and item.item_code = it.item_code " }
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " dtlSql = dtlSql
+"and ti.tran_code = 'MDRCRD' "
+"and ti.tran_id = i.tran_id " +" '' as REMARKS ,";
+" and ti.tax_perc = 0 " if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+"and tx.tax_type in ('G','H','I','J')" ; {
if(GST_NIL_TAXCLASS.length() > 0) dtlSql = dtlSql +" fn_get_gst_rate('MDRCRD',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
{ }
else
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) "; {
} dtlSql = dtlSql +" fn_get_gst_rate('MDRCRD',i.tran_id, it.line_no) as gst_rate ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) }
{ dtlSql = dtlSql
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; +" from MISC_DRCR_RCP i,MISC_DRCR_RDET it "
} +" where i.tran_id = it.tran_id "
else +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
{ +"and ti.tran_code = 'MDRCRD' "
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0"; +"and ti.tran_id = i.tran_id "
} +" and ti.tax_perc = 0 "
dtlSql = dtlSql +"and tx.tax_type in ('G','H','I','J')" ;
+" and i.tran_id = ? "; 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 ))
{
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,"misc-DN(NILL)-intra-UNREG"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"misc-DN(NILL)-intra-UNREG");
...@@ -8925,85 +9031,101 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -8925,85 +9031,101 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/** /**
*Detail CDNR Query nill Rated CDNR(Intra-state Register) * *Detail CDNR Query nill Rated CDNR(Intra-state Register) *
*/ */
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, " dtlSql = " select '' as TRAN_ID, "
+" 'A' as STATUS, " +" it.line_no as LINE_NO, "
+" 0 as SR_NO__OLD, " +" 'A' as STATUS, "
+" 'G' as LINE_TYPE,"; +" 0 as SR_NO__OLD, "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) +" 'G' as LINE_TYPE,"
{ +" (select CASE "
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE," +" WHEN (NVL(it.item_code,'X')<>'X') "
+" 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))) AS TAXABLE_AMT," +" THEN (fn_get_hsn_no(i.site_code,it.item_code)) "
+" 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," +" WHEN (NVL(it.item_code,'X')='X' AND NVL(GD.anal_code,'X')<>'X') "
+" 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," +" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GD.anal_code) "
+" 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," +" WHEN (NVL(it.item_code,'X')='X' AND NVL(GD.anal_code,'X')='X') "
+" 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," +" THEN fn_get_hsn_sac(GH.site_code,'',GD.acct_code) END "
+" 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," +" from MISC_DRCR_RCP GH,MISC_DRCR_RDET GD where GH.tran_id=GD.tran_id and GH.tran_id=i.tran_id "
+" 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,"; +" and it.line_no=GD.line_no ) AS GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
} {
else dtlSql = dtlSql //+"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
{ +" 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))) AS TAXABLE_AMT,"
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," +" 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('MDRCRD',i.tran_id, it.line_no, ' ', 'T') 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('A' AS CHAR(1))) AS IGST_AMT,"
+ " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'I', 'R') as IGST_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('R' AS CHAR(1))) AS CGST_PERC,"
+ " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'I', 'A') 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('A' AS CHAR(1))) AS CGST_AMT,"
+ " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'H', 'R') as CGST_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('R' AS CHAR(1))) AS SGST_PERC,"
+ " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'H', 'A') 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('A' AS CHAR(1))) AS SGST_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,"; }
} else
dtlSql = dtlSql {
+" ' ' as GS_DESCR, " dtlSql = dtlSql //+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
// +"(select case when udf_str2 is null then descr else udf_str2 end as Unit from uom where unit=item.unit) as UNIT, " + " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+"(select case when udf_str2 is null then 'OTH' else udf_str2 end as Unit from uom where unit=item.unit) as UNIT, " + " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+" (it.QUANTITY) as QUANTITY," + " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+" 'OE' as SUPPLY_TYPE," ; + " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) + " 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,"
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('MDRCRD',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
+" 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,"; }
} dtlSql = dtlSql
else +" ' ' as GS_DESCR, "
{ // +"(select case when udf_str2 is null then 'OTH' else udf_str2 end as Unit from uom where unit=item.unit) as UNIT, "
dtlSql = dtlSql +" fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC," +" (select CASE "
+" fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,"; +" WHEN (NVL(it.item_code,'X')='X') "
} +" THEN 'OTH' "
dtlSql = dtlSql +" 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 "
+" '' as REMARKS ,"; +" WHERE unit=(select item.unit from item where item.item_code=it.item_code) ) END "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) +" from dual ) AS UNIT, "
{ +" (it.QUANTITY) as QUANTITY,"
dtlSql = dtlSql +" fn_get_gst_rate('MDRCRD',i.tran_id,CAST(it.line_no as char(3))) as gst_rate "; +" 'OE' as SUPPLY_TYPE," ;
} if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
else {
{ 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,"
dtlSql = dtlSql +" fn_get_gst_rate('MDRCRD',i.tran_id, it.line_no) as gst_rate "; +" 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,";
} }
dtlSql = dtlSql else
+" from MISC_DRCR_RCP i,MISC_DRCR_RDET it,item " {
+" where i.tran_id = it.tran_id " dtlSql = dtlSql +" fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+" and item.item_code = it.item_code " +" fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " }
+"and ti.tran_code = 'MDRCRD' " dtlSql = dtlSql
+"and ti.tran_id = i.tran_id "
+" and ti.tax_perc = 0 " +" '' as REMARKS ,";
+"and tx.tax_type in ('G','H','I','J')" ; if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
if(GST_NIL_TAXCLASS.length() > 0) {
{ dtlSql = dtlSql +" fn_get_gst_rate('MDRCRD',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
dtlSql = dtlSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ("+TAX_CHAP_STR+") ) "; else
} {
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) dtlSql = dtlSql +" fn_get_gst_rate('MDRCRD',i.tran_id, it.line_no) as gst_rate ";
{ }
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql = dtlSql
} +" from MISC_DRCR_RCP i,MISC_DRCR_RDET it "
else +" where i.tran_id = it.tran_id "
{ +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0"; +"and ti.tran_code = 'MDRCRD' "
} +"and ti.tran_id = i.tran_id "
dtlSql = dtlSql +" and ti.tax_perc = 0 "
+" and i.tran_id = ? "; +"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 ))
{
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,"misc-DN(NILL)-intra-REG"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"misc-DN(NILL)-intra-REG");
} }
...@@ -10078,9 +10200,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -10078,9 +10200,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
} }
// }//End of Else Loop of Disparm GST_EXCLUDE_NILL_CDNR // }//End of Else Loop of Disparm GST_EXCLUDE_NILL_CDNR
/*if ("Y".equalsIgnoreCase(IMPL_MIN_RATE_HISTORY))
{*/ {
/** /**
* 9B(1) Header Credit Note registered (CDNRA) - Misc Credit Note registered * * 9B(1) Header Credit Note registered (CDNRA) - Misc Credit Note registered *
*/ */
...@@ -10144,14 +10265,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -10144,14 +10265,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"AND state.state_code = c.STATE_CODE " +"AND state.state_code = c.STATE_CODE "
+"AND i.drcr_flag ='C' " +"AND i.drcr_flag ='C' "
+"AND i.tran_id = d.tran_id " +"AND i.tran_id = d.tran_id "
+"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 d.line_no = (select min(line_no) from misc_drcr_rdet where tran_id=i.tran_id) "
+" AND CASE WHEN i.confirmed IS NULL THEN 'N' ELSE i.confirmed END = 'Y' "
+" and trim(i.tran_type) != 'PR' " +" and trim(i.tran_type) != 'PR' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP
+" and trim(c.tax_reg_2) <> 'UNREGISTER' " +" and trim(c.tax_reg_2) <> 'UNREGISTER' "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and i.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 and tran_type = '29' ) = 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, "
+" 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, " +" 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, "
...@@ -10322,14 +10444,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -10322,14 +10444,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"AND state.state_code = c.STATE_CODE " +"AND state.state_code = c.STATE_CODE "
+"AND i.drcr_flag ='D' " +"AND i.drcr_flag ='D' "
+"AND i.tran_id = d.tran_id " +"AND i.tran_id = d.tran_id "
+"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 d.line_no = (select min(line_no) from misc_drcr_rdet where tran_id=i.tran_id) "
+" AND CASE WHEN i.confirmed IS NULL THEN 'N' ELSE i.confirmed END = 'Y' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP
+" and trim(c.tax_reg_2) <> 'UNREGISTER' " +" and trim(c.tax_reg_2) <> 'UNREGISTER' "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and trim(i.tran_type) != 'PR' " +" and trim(i.tran_type) != 'PR' "
+" and i.tran_date between ? and ? " +" 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 and tran_type= '30' ) = 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, "
+" 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, " +" 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, "
...@@ -10502,14 +10625,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -10502,14 +10625,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"AND state.state_code = c.STATE_CODE " +"AND state.state_code = c.STATE_CODE "
+"AND i.drcr_flag ='C' " +"AND i.drcr_flag ='C' "
+"AND i.tran_id = d.tran_id " +"AND i.tran_id = d.tran_id "
+"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 d.line_no = (select min(line_no) from misc_drcr_rdet where tran_id=i.tran_id) "
+" AND CASE WHEN i.confirmed IS NULL THEN 'N' ELSE i.confirmed END = 'Y' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRC' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP
+" and trim(c.tax_reg_2) = 'UNREGISTER' " +" and trim(c.tax_reg_2) = 'UNREGISTER' "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and trim(i.tran_type) != 'PR' " +" and trim(i.tran_type) != 'PR' "
+" 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 and tran_type ='31' ) = 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, "
+" 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, " +" 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, "
...@@ -10681,14 +10805,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -10681,14 +10805,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"AND state.state_code = c.STATE_CODE " +"AND state.state_code = c.STATE_CODE "
+"AND i.drcr_flag ='D' " +"AND i.drcr_flag ='D' "
+"AND i.tran_id = d.tran_id " +"AND i.tran_id = d.tran_id "
+"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 d.line_no = (select min(line_no) from misc_drcr_rdet where tran_id=i.tran_id) "
+" AND CASE WHEN i.confirmed IS NULL THEN 'N' ELSE i.confirmed END = 'Y' "
+" and trim(i.tran_type) != 'PR' " +" and trim(i.tran_type) != 'PR' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP +" and (select count(1) from taxtran ti where ti.tran_code = 'MDRCRD' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP
+" and trim(c.tax_reg_2) = 'UNREGISTER' " +" and trim(c.tax_reg_2) = 'UNREGISTER' "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and i.tran_date between ? and ? " +" 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 and tran_type = '32' ) = 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, "
+" 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, " +" 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, "
...@@ -10797,11 +10922,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -10797,11 +10922,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
// +" and i.tran_id = ? and it.invoice_ref = REF_ID__INV "; // +" and i.tran_id = ? and it.invoice_ref = REF_ID__INV ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"9B2(MISC-DN-UNREG)"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"9B2(MISC-DN-UNREG)");
} }
}
//}// End (if) of misc debit/credit note disparm
/******11A Started ******/ /******11A Started ******/
{ {
/** /**
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