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
+"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 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 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 st_c.GST_CODE = '00' "
......@@ -5193,8 +5194,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"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 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 i.sundry_code in (select cust_code from customer where trim(tax_reg_2) = 'UNREGISTER') "
+ " and trim(i.tran_type) != 'PR' "
+" and st_c.GST_CODE = '00' "
......@@ -5375,8 +5377,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"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 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 i.sundry_code in (select cust_code from customer where trim(tax_reg_2) = 'UNREGISTER') "
+" and st_c.GST_CODE <> '00' "
+" and trim(i.tran_type) != 'PR' "
......@@ -5569,7 +5572,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"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 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 i.sundry_code in (select cust_code from customer where trim(tax_reg_2) = 'UNREGISTER') "
+" and st_c.GST_CODE <> '00' "
......@@ -5758,7 +5762,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"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 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 i.sundry_code in (select cust_code from customer where trim(tax_reg_2) = 'UNREGISTER') "
+" and st_c.GST_CODE <> '00' "
......@@ -5946,7 +5951,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"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 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 i.sundry_code in (select cust_code from customer where trim(tax_reg_2) = 'UNREGISTER') "
+" and st_c.GST_CODE <> '00' "
......@@ -7915,44 +7921,59 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 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 ))
{
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('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('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('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,";
}
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, '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, '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, '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,";
}
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 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,"
+" '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,"
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,"
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
......@@ -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
+" 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 "
+" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRC' "
+"and ti.tran_id = i.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 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)
{
......@@ -8060,44 +8080,59 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 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 ))
{
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('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('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('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,";
}
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, '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, '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, '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,";
}
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 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,"
+" '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,"
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,"
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
......@@ -8112,14 +8147,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
+" 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 "
+" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRC' "
+"and ti.tran_id = i.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 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)
{
......@@ -8204,44 +8238,59 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 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 ))
{
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('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('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('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,";
}
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, '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, '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, '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,";
}
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 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,"
+" '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,"
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,"
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
......@@ -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
+" 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 "
+" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRC' "
+"and ti.tran_id = i.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 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)
{
......@@ -8349,44 +8397,59 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 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 ))
{
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('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('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('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,";
}
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, '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, '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, '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,";
}
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 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,"
+" '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,"
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,"
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
......@@ -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
+" 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 "
+" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRC' "
+"and ti.tran_id = i.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 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)
{
......@@ -8496,10 +8558,19 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 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 ))
{
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('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,"
......@@ -8511,7 +8582,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
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, 'I', 'R') as IGST_PERC,"
+ " 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
}
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 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,"
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
......@@ -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
+" 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 "
+" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRD' "
+"and ti.tran_id = i.tran_id "
......@@ -8641,10 +8717,19 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 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 ))
{
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('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,"
......@@ -8656,7 +8741,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
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, 'I', 'R') as IGST_PERC,"
+ " 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
}
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 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,"
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
......@@ -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
+" 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 "
+" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRD' "
+"and ti.tran_id = i.tran_id "
......@@ -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+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
......@@ -8784,10 +8875,19 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 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 ))
{
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('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,"
......@@ -8799,7 +8899,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
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, 'I', 'R') as IGST_PERC,"
+ " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
......@@ -8810,8 +8910,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
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 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,"
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
......@@ -8836,9 +8942,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
+" 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 "
+" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRD' "
+"and ti.tran_id = i.tran_id "
......@@ -8850,6 +8955,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+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
......@@ -8925,14 +9031,24 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/**
*Detail CDNR Query nill Rated CDNR(Intra-state Register) *
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 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 ))
{
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('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,"
......@@ -8944,7 +9060,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
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, 'I', 'R') as IGST_PERC,"
+ " fn_gst_rate_amt('MDRCRD',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
......@@ -8955,8 +9071,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
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 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,"
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
......@@ -8981,9 +9103,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
+" 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 "
+" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'MDRCRD' "
+"and ti.tran_id = i.tran_id "
......@@ -8995,6 +9116,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+") ) ";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
......@@ -10078,9 +10200,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
// }//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 *
*/
......@@ -10144,14 +10265,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"AND state.state_code = c.STATE_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 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 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 trim(c.tax_reg_2) <> 'UNREGISTER' "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = '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 "
+" 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, "
......@@ -10322,14 +10444,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"AND state.state_code = c.STATE_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 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 (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 case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and trim(i.tran_type) != 'PR' "
+" 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 "
+" 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, "
......@@ -10502,14 +10625,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"AND state.state_code = c.STATE_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 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 (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 case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and trim(i.tran_type) != 'PR' "
+" 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 "
+" 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, "
......@@ -10681,14 +10805,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"AND state.state_code = c.STATE_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 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 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 trim(c.tax_reg_2) = 'UNREGISTER' "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = '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 "
+" 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, "
......@@ -10797,10 +10922,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
// +" and i.tran_id = ? and it.invoice_ref = REF_ID__INV ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"9B2(MISC-DN-UNREG)");
}
//}// End (if) of misc debit/credit note disparm
}
/******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