Commit e566b55c authored by kdabholkar's avatar kdabholkar

commit the changes of GSTR2 purchase data


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106590 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3a328cf9
......@@ -145,7 +145,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
DatabaseMetaData dbmd = connGST.getMetaData();
System.out.println("________________________________________");
System.out.println(" Driver Information ");
System.out.println(" Driver Information 11 aug ");
System.out.println("________________________________________");
System.out.println("DriverName["+dbmd.getDriverName() + "]");
System.out.println("DriverURI["+dbmd.getURL() + "]");
......@@ -7548,7 +7548,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
hdrSql = hdrSql +" ) = 0 "
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) commented on 10 aug
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -7576,8 +7576,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
// +" 0 as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
//+" 'G' as LINE_TYPE,";
+" case when it.item_code is null then 'S' else 'G' end as LINE_TYPE , ";
// +" 'G' as LINE_TYPE,"
+" case when it.item_code is null then 'S' else 'G' end as LINE_TYPE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
......@@ -7711,7 +7711,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
hdrSql = hdrSql +" ) = 0 "
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -7736,12 +7736,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
dtlSql = dtlSql +" 'A' as STATUS," // -- M – Modification, A – Accept D – Delete
+" 0 as SR_NO__OLD,"
+" 'G' as LINE_TYPE," ;// -- G – Goods, S – Serice
// +" 'G' as LINE_TYPE," ;// -- G – Goods, S – Serice
+"when case it.item_code is null then 'S' else 'G' end as LINE_TYPE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
//dtlSql = dtlSql +"fn_get_hsn_sac(i.site_code,it.item_code) AS GS_CODE,"
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_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT, "
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC, "
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT, "
......@@ -7752,9 +7753,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
else
{
//dtlSql = dtlSql +"fn_get_hsn_sac(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_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
......@@ -7789,7 +7790,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 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 = 'VOUCH' "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
+ " and tx.tax_group <> 'NITC' "
+"and tx.tax_type in ('G','H','I','J')" ;
......@@ -7810,26 +7811,24 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/******* 4A started ********/
/**
* 4(a) B2B supplies *
* 3(a) VOUCH Header B2B Export to SEZ with payment 3(A) SEWP*
*/
hdrSql = " select '' as TRAN_ID, "
/*+" to_date(i.GP_DATE) as TRAN_DATE, "*/
+" '' as TRAN_ID__REF, "
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 aug
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 uag
+" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+ "case when i.GP_DATE is null then i.tran_date else i.GP_DATE end as PRD_CODE,"
+" '1' as REC_TYPE, "
+" 'I' as GST_TYPE,"
+" '01' as TRAN_TYPE,"
+" '02' as TRAN_TYPE,"
+" i.supp_code as CUST_CODE, "
+" c.supp_name as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" ' ' as DOC_TYPE, "
+" 'SEWP' as DOC_TYPE, "
/*+" i.GP_NO as DOC_NO, "*/
+"case when i.GP_NO is null then i.tran_id else i.GP_NO end as DOC_NO, "
/*+" i.gp_date as DOC_DATE, "*/
......@@ -7846,7 +7845,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as ORDER_NO,"
// +" null as ORDER_DATE, "
//+" i.invoice_id as REMARKS, "
+" 's.site_code' as REMARKS, " //on 9 aug
+" s.site_code as REMARKS, " // on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
// +" null SUBMIT_DATE, "
......@@ -7866,21 +7865,19 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'VOUCH' and ti.tran_id = i.tran_id "
+" and tm.tax_group in ('ITC','RCM') "
+" and tm.tax_type in ('G','H','I') ";
if(GST_RCM_TAXCLASS.length() > 0)
+" and ti.tran_code = 'VOUCH' and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I')";
if(GST_PURSEZWP_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class in ("+GST_RCM_TAXCLASS+") ";
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWP_TAXCLASS+") ";
}
if(GST_RCM_TAXENV.length() > 0)
if(GST_PURSEZWP_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class in ("+GST_RCM_TAXENV+") ";
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWP_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -7888,19 +7885,19 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
/**
* Detail ---4(A) B2B supplies *
* Detail ---B2B Export to SEZ with payment 3(A) SEWP *
*/
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,";
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -7946,16 +7943,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '' as REMARKS ,"
+" 'ig' as ITC_TYPE , "
+"fn_get_gst_rate('VOUCH',i.tran_id, it.line_no) as gst_rate "
+" from voucher i,vouchrcp it, item item "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
+" and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+" and ti.tran_code = 'VOUCH' "
+" and ti.tran_id = i.tran_id "
+" and tx.TAX_GROUP <> 'NITC' "
+" and tx.TAX_GROUP = 'RCM' "
+" and tx.tax_type in ('G','H','I','J')" ;
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'VOUCH' "
+"and ti.tran_id = i.tran_id "
+"and tx.TAX_GROUP = 'RCM' "
+"and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
//dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
......@@ -7965,26 +7960,28 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
//dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no ";
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(4A) B2B");
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(3A) SEWP");
/**
* 4(a) B2B supplies M-VOUCH *
* 3(a) MIS-VOUCH Header B2B Export to SEZ with payment *
*/
hdrSql = " select '' as TRAN_ID, "
/*+" to_date(i.GP_DATE) as TRAN_DATE, "*/
+" '' as TRAN_ID__REF, "
//+" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 aug
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 aug
+" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+ "case when i.GP_DATE is null then i.tran_date else i.GP_DATE end as PRD_CODE,"
+" '1' as REC_TYPE, "
+" 'I' as GST_TYPE,"
+" '01' as TRAN_TYPE,"
+" '02' as TRAN_TYPE,"
+" i.sundry_code as CUST_CODE, "
+" c.supp_name as CUST_NAME, "
+" state.GST_CODE, "
......@@ -8007,7 +8004,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as ORDER_NO,"
// +" null as ORDER_DATE, "
//+" i.invoice_id as REMARKS, "
+" 's.site_code' as REMARKS, " // on 9 aug
+" s.site_code as REMARKS, " // 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
// +" null SUBMIT_DATE, "
......@@ -8027,22 +8024,25 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
//+" from voucher i,supplier c, site s, state state"
//+" where c.supp_code = i.supp_code "
//+" and s.site_code = i.site_code "
//+" and state.state_code = c.STATE_CODE "
//+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'VOUCH' and ti.tran_id = i.tran_id "
+" and tm.tax_group in ('ITC','RCM') "
+" and tm.tax_type in ('G','H','I') ";
if(GST_RCM_TAXCLASS.length() > 0)
+" and ti.tran_code = 'VOUCH' and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I')";
if(GST_PURSEZWP_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class in ("+GST_RCM_TAXCLASS+") ";
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWP_TAXCLASS+") ";
}
if(GST_RCM_TAXENV.length() > 0)
if(GST_PURSEZWP_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class in ("+GST_RCM_TAXENV+") ";
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWP_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -8050,22 +8050,23 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'M-VOUC' and ref_id = i.tran_id ) = 0 ";
/**
* Detail --- B2B supplies M-VOUCH *
* Detail ---B2B Export to SEZ with payment 3(A) SEWP *
*/
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,";
+" case when it.item_code is null then 'S' else 'G' end as LINE_TYPE";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
dtlSql = dtlSql //+"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT, "
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC, "
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT, "
......@@ -8077,7 +8078,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else
{
dtlSql = dtlSql
+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
//+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
......@@ -8108,16 +8110,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '' as REMARKS ,"
+" 'is' as ITC_TYPE , "
+"fn_get_gst_rate('VOUCH',i.tran_id, it.line_no) as gst_rate "
+" from misc_voucher i,misc_vouchdet it, item item "
// +" from voucher i,vouchrcp it, item item "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
+" and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+" and ti.tran_code = 'M-VOUCH' "
+" and ti.tran_id = i.tran_id "
+" and tx.TAX_GROUP <> 'NITC' "
+" and tx.TAX_GROUP = 'RCM' "
+" and tx.tax_type in ('G','H','I','J')" ;
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUCH' "
+"and ti.tran_id = i.tran_id "
+"and tx.TAX_GROUP = 'RCM' "
+"and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
//dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
......@@ -8127,33 +8128,35 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
//dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no ";
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(4A) B2B");
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(3A) SEWP(M-VOUCH)");
/**
* 4(a) VOUCH Header B2B Export to SEZ with payment 4(A) SEWP*
* 3(A) SEWOP Header (VOUCHER)--- B2B Export to SEZ without payment *
*/
hdrSql = " select '' as TRAN_ID, "
/*+" to_date(i.GP_DATE) as TRAN_DATE, "*/
/* +" to_date(i.GP_DATE) as TRAN_DATE, "*/
+" '' as TRAN_ID__REF, "
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 uag
/// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 aug
+" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+ "case when i.GP_DATE is null then i.tran_date else i.GP_DATE end as PRD_CODE,"
+" '1' as REC_TYPE, "
+" '2' as REC_TYPE, "
+" 'I' as GST_TYPE,"
+" '02' as TRAN_TYPE,"
+" '03' as TRAN_TYPE,"
+" i.supp_code as CUST_CODE, "
+" c.supp_name as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" 'SEWP' as DOC_TYPE, "
/*+" i.GP_NO as DOC_NO, "*/
+" 'SEWOP' as DOC_TYPE, "
+"case when i.GP_NO is null then i.tran_id else i.GP_NO end as DOC_NO, "
/*+" i.gp_date as DOC_DATE, "*/
+"case when i.gp_date is null then i.tran_date else i.gp_date end as DOC_DATE,"
......@@ -8190,18 +8193,18 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'VOUCH' and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I')";
if(GST_PURSEZWP_TAXCLASS.length() > 0)
if(GST_PURSEZWOP_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWP_TAXCLASS+") ";
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWOP_TAXCLASS+") ";
}
if(GST_PURSEZWP_TAXENV.length() > 0)
if(GST_PURSEZWOP_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWP_TAXENV+") ";
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWOP_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -8209,18 +8212,20 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
/**
* Detail ---B2B Export to SEZ with payment 4(A) SEWP *
* Detail (VOUCHER) ---B2B Export to SEZ without payment 3(A) SEWOP *
*/
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,";
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -8266,7 +8271,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '' as REMARKS ,"
+" 'ig' as ITC_TYPE , "
+"fn_get_gst_rate('VOUCH',i.tran_id, it.line_no) as gst_rate "
+" from voucher i,vouchrcp it, item item "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
......@@ -8290,27 +8294,27 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(4A) SEWP");
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(3A) SEWOP");
/**
* 4(a) MIS-VOUCH Header B2B Export to SEZ with payment *
* 3(A) SEWOP Header (MIS-VOUCHER)--- B2B Export to SEZ without payment *
*/
hdrSql = " select '' as TRAN_ID, "
/*+" to_date(i.GP_DATE) as TRAN_DATE, "*/
+" '' as TRAN_ID__REF, "
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 aug
//+" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 aug
+" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+ "case when i.GP_DATE is null then i.tran_date else i.GP_DATE end as PRD_CODE,"
+" '1' as REC_TYPE, "
+" 'I' as GST_TYPE,"
+" '02' as TRAN_TYPE,"
+" '03' as TRAN_TYPE,"
+" i.sundry_code as CUST_CODE, "
+" c.supp_name as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" 'SEWP' as DOC_TYPE, "
+" 'SEWOP' as DOC_TYPE, "
/*+" i.GP_NO as DOC_NO, "*/
+"case when i.GP_NO is null then i.tran_id else i.GP_NO end as DOC_NO, "
/*+" i.gp_date as DOC_DATE, "*/
......@@ -8327,7 +8331,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as ORDER_NO,"
// +" null as ORDER_DATE, "
//+" i.invoice_id as REMARKS, "
+" s.site_code as REMARKS, " // 9 aug
+" s.site_code as REMARKS, "
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
// +" null SUBMIT_DATE, "
......@@ -8354,18 +8358,18 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
//+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'VOUCH' and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I')";
if(GST_PURSEZWP_TAXCLASS.length() > 0)
if(GST_PURSEZWOP_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWP_TAXCLASS+") ";
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWOP_TAXCLASS+") ";
}
if(GST_PURSEZWP_TAXENV.length() > 0)
if(GST_PURSEZWOP_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWP_TAXENV+") ";
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWOP_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -8373,20 +8377,22 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'M-VOUC' and ref_id = i.tran_id ) = 0 ";
/**
* Detail ---B2B Export to SEZ with payment 4(A) SEWP *
* Detail ---B2B Export to SEZ with payment 3(A) SEWP (MISC-VOUCHER) *
*/
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,";
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
dtlSql = dtlSql //+"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT, "
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC, "
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT, "
......@@ -8398,7 +8404,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else
{
dtlSql = dtlSql
+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
//+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
......@@ -8431,7 +8438,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"fn_get_gst_rate('VOUCH',i.tran_id, it.line_no) as gst_rate "
+" from misc_voucher i,misc_vouchdet it, item item "
// +" from voucher i,vouchrcp it, item item "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
......@@ -8455,30 +8461,29 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(4A) SEWP(M-VOUCH)");
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(3A) SEWOP(M-VOUCH)");
/**
* 4(A) SEWOP Header (VOUCHER)--- B2B Export to SEZ without payment *
* 3(A) DE--Header (VOUCHER) 3A---B2B Deemed Exports*
*/
hdrSql = " select '' as TRAN_ID, "
/* +" to_date(i.GP_DATE) as TRAN_DATE, "*/
+" '' as TRAN_ID__REF, "
/// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 aug
//+" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
+" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+ "case when i.GP_DATE is null then i.tran_date else i.GP_DATE end as PRD_CODE,"
+" '2' as REC_TYPE, "
+" '1' as REC_TYPE, "
+" 'I' as GST_TYPE,"
+" '03' as TRAN_TYPE,"
+" '04' as TRAN_TYPE,"
+" i.supp_code as CUST_CODE, "
+" c.supp_name as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" 'SEWOP' as DOC_TYPE, "
+" 'DE' as DOC_TYPE, "
/* +" i.GP_NO as DOC_NO, "*/
+"case when i.GP_NO is null then i.tran_id else i.GP_NO end as DOC_NO, "
/*+" i.gp_date as DOC_DATE, "*/
+"case when i.gp_date is null then i.tran_date else i.gp_date end as DOC_DATE,"
+" i.net_amt as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
......@@ -8492,7 +8497,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as ORDER_NO,"
// +" null as ORDER_DATE, "
//+" i.invoice_id as REMARKS, "
+" s.site_code as REMARKS, " // on 9 aug
+" s.site_code as REMARKS, "
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
// +" null SUBMIT_DATE, "
......@@ -8513,18 +8518,18 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'VOUCH' and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I')";
if(GST_PURSEZWOP_TAXCLASS.length() > 0)
if(GST_PURDE_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWOP_TAXCLASS+") ";
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURDE_TAXCLASS+") ";
}
if(GST_PURSEZWOP_TAXENV.length() > 0)
if(GST_PURDE_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWOP_TAXENV+") ";
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURDE_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -8532,18 +8537,20 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql*/
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
/**
* Detail (VOUCHER) ---B2B Export to SEZ without payment 4(A) SEWOP *
* Detail ---B2B Deemed Exports 3(A) DE*
*/
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,";
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -8613,27 +8620,28 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(4A) SEWOP");
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(3A) DE");
/**
* 4(A) SEWOP Header (MIS-VOUCHER)--- B2B Export to SEZ without payment *
* 3(A) DE--Header (MISC-VOUCHER) 3A---B2B Deemed Exports**
*/
hdrSql = " select '' as TRAN_ID, "
/*+" to_date(i.GP_DATE) as TRAN_DATE, "*/
+" '' as TRAN_ID__REF, "
//+" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 aug
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 aug
+" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+ "case when i.GP_DATE is null then i.tran_date else i.GP_DATE end as PRD_CODE,"
+" '1' as REC_TYPE, "
+" 'I' as GST_TYPE,"
+" '03' as TRAN_TYPE,"
+" '04' as TRAN_TYPE,"
+" i.sundry_code as CUST_CODE, "
+" c.supp_name as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" 'SEWOP' as DOC_TYPE, "
+" 'DE' as DOC_TYPE, "
/*+" i.GP_NO as DOC_NO, "*/
+"case when i.GP_NO is null then i.tran_id else i.GP_NO end as DOC_NO, "
/*+" i.gp_date as DOC_DATE, "*/
......@@ -8677,18 +8685,18 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
//+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'VOUCH' and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I')";
if(GST_PURSEZWOP_TAXCLASS.length() > 0)
if(GST_PURDE_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWOP_TAXCLASS+") ";
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURDE_TAXCLASS+") ";
}
if(GST_PURSEZWOP_TAXENV.length() > 0)
if(GST_PURDE_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWOP_TAXENV+") ";
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURDE_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -8696,21 +8704,25 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'M-VOUC' and ref_id = i.tran_id ) = 0 ";
/**
* Detail ---B2B Export to SEZ with payment 4(A) SEWP (MISC-VOUCHER) *
* Detail ---B2B 3A-- Deemed Exports (MISC-VOUCHER) *
*/
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,";
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
dtlSql = dtlSql //+"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT, "
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC, "
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT, "
......@@ -8722,7 +8734,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else
{
dtlSql = dtlSql
+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
//+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
......@@ -8753,9 +8766,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '' as REMARKS ,"
+" 'is' as ITC_TYPE , "
+"fn_get_gst_rate('VOUCH',i.tran_id, it.line_no) as gst_rate "
+" from misc_voucher i,misc_vouchdet it, item item "
// +" from voucher i,vouchrcp it, item item "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
......@@ -8773,36 +8784,37 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
//dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no ";
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(4A) SEWOP(M-VOUCH)");
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(3A) DE(M-VOUCH)");
/******* 4A started ********/
/**
* 4(A) DE--Header (VOUCHER) 4A---B2B Deemed Exports*
* 4(a) B2B supplies *
*/
hdrSql = " select '' as TRAN_ID, "
/* +" to_date(i.GP_DATE) as TRAN_DATE, "*/
/*+" to_date(i.GP_DATE) as TRAN_DATE, "*/
+" '' as TRAN_ID__REF, "
//+" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 aug
+" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+ "case when i.GP_DATE is null then i.tran_date else i.GP_DATE end as PRD_CODE,"
+" '1' as REC_TYPE, "
+" 'I' as GST_TYPE,"
+" '04' as TRAN_TYPE,"
+" '01' as TRAN_TYPE,"
+" i.supp_code as CUST_CODE, "
+" c.supp_name as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" 'DE' as DOC_TYPE, "
/* +" i.GP_NO as DOC_NO, "*/
+" ' ' as DOC_TYPE, "
/*+" i.GP_NO as DOC_NO, "*/
+"case when i.GP_NO is null then i.tran_id else i.GP_NO end as DOC_NO, "
/*+" i.gp_date as DOC_DATE, "*/
+"case when i.gp_date is null then i.tran_date else i.gp_date end as DOC_DATE,"
+" i.net_amt as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
......@@ -8816,7 +8828,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as ORDER_NO,"
// +" null as ORDER_DATE, "
//+" i.invoice_id as REMARKS, "
+" s.site_code as REMARKS, "
+" 's.site_code' as REMARKS, " //on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
// +" null SUBMIT_DATE, "
......@@ -8836,19 +8848,21 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'VOUCH' and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I')";
if(GST_PURDE_TAXCLASS.length() > 0)
+" and ti.tran_code = 'VOUCH' and ti.tran_id = i.tran_id "
+" and tm.tax_group in ('ITC','RCM') "
+" and tm.tax_type in ('G','H','I') ";
if(GST_RCM_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURDE_TAXCLASS+") ";
hdrSql = hdrSql +" and ti.tax_class in ("+GST_RCM_TAXCLASS+") ";
}
if(GST_PURDE_TAXENV.length() > 0)
if(GST_RCM_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURDE_TAXENV+") ";
hdrSql = hdrSql +" and ti.tax_class in ("+GST_RCM_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -8856,19 +8870,20 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
/**
* Detail ---B2B Deemed Exports 4(A) DE*
* Detail ---4(A) B2B supplies *
*/
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,";
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -8914,15 +8929,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '' as REMARKS ,"
+" 'ig' as ITC_TYPE , "
+"fn_get_gst_rate('VOUCH',i.tran_id, it.line_no) as gst_rate "
+" from voucher i,vouchrcp it, item item "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'VOUCH' "
+"and ti.tran_id = i.tran_id "
+"and tx.TAX_GROUP = 'RCM' "
+"and tx.tax_type in ('G','H','I','J')" ;
+" and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+" and ti.tran_code = 'VOUCH' "
+" and ti.tran_id = i.tran_id "
+" and tx.TAX_GROUP <> 'NITC' "
+" and tx.TAX_GROUP = 'RCM' "
+" and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
//dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
......@@ -8932,34 +8947,32 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
//dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no ";
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(4A) DE");
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(4A) B2B");
/**
* 4(A) DE--Header (MISC-VOUCHER) 4A---B2B Deemed Exports**
* 4(a) B2B supplies M-VOUCH *
*/
hdrSql = " select '' as TRAN_ID, "
/*+" to_date(i.GP_DATE) as TRAN_DATE, "*/
+" '' as TRAN_ID__REF, "
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 aug
//+" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 aug
+" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+ "case when i.GP_DATE is null then i.tran_date else i.GP_DATE end as PRD_CODE,"
+" '1' as REC_TYPE, "
+" 'I' as GST_TYPE,"
+" '04' as TRAN_TYPE,"
+" '01' as TRAN_TYPE,"
+" i.sundry_code as CUST_CODE, "
+" c.supp_name as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" 'DE' as DOC_TYPE, "
+" 'SEWP' as DOC_TYPE, "
/*+" i.GP_NO as DOC_NO, "*/
+"case when i.GP_NO is null then i.tran_id else i.GP_NO end as DOC_NO, "
/*+" i.gp_date as DOC_DATE, "*/
......@@ -8976,7 +8989,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as ORDER_NO,"
// +" null as ORDER_DATE, "
//+" i.invoice_id as REMARKS, "
+" s.site_code as REMARKS, "
+" 's.site_code' as REMARKS, " // on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
// +" null SUBMIT_DATE, "
......@@ -8996,25 +9009,22 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
//+" from voucher i,supplier c, site s, state state"
//+" where c.supp_code = i.supp_code "
//+" and s.site_code = i.site_code "
//+" and state.state_code = c.STATE_CODE "
//+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'VOUCH' and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I')";
if(GST_PURDE_TAXCLASS.length() > 0)
+" and ti.tran_code = 'VOUCH' and ti.tran_id = i.tran_id "
+" and tm.tax_group in ('ITC','RCM') "
+" and tm.tax_type in ('G','H','I') ";
if(GST_RCM_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURDE_TAXCLASS+") ";
hdrSql = hdrSql +" and ti.tax_class in ("+GST_RCM_TAXCLASS+") ";
}
if(GST_PURDE_TAXENV.length() > 0)
if(GST_RCM_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURDE_TAXENV+") ";
hdrSql = hdrSql +" and ti.tax_class in ("+GST_RCM_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) commented on 10 aug.
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -9022,22 +9032,24 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
+" and (select count(1) from gst_data_hdr where ref_ser = 'M-VOUC' and ref_id = i.tran_id ) = 0 ";
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
/**
* Detail ---B2B 4A-- Deemed Exports (MISC-VOUCHER) *
* Detail --- B2B supplies M-VOUCH *
*/
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,";
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
dtlSql = dtlSql //+"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT, "
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC, "
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT, "
......@@ -9049,7 +9061,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else
{
dtlSql = dtlSql
+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
//+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
......@@ -9080,15 +9093,16 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '' as REMARKS ,"
+" 'is' as ITC_TYPE , "
+"fn_get_gst_rate('VOUCH',i.tran_id, it.line_no) as gst_rate "
+" from misc_voucher i,misc_vouchdet it, item item "
// +" from voucher i,vouchrcp it, item item "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUCH' "
+"and ti.tran_id = i.tran_id "
+"and tx.TAX_GROUP = 'RCM' "
+"and tx.tax_type in ('G','H','I','J')" ;
+" and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+" and ti.tran_code = 'M-VOUCH' "
+" and ti.tran_id = i.tran_id "
+" and tx.TAX_GROUP <> 'NITC' "
+" and tx.TAX_GROUP = 'RCM' "
+" and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
//dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
......@@ -9103,7 +9117,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(4A) DE(M-VOUCH)");
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(4A) B2B");
......@@ -9111,6 +9126,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/**
* 4(B) VOUCH Header Voucher*
*/
hdrSql = " select '' as TRAN_ID,"
/*+" to_date(i.gp_date) as TRAN_DATE,"*/
+" '' as TRAN_ID__REF,"
......@@ -9188,6 +9204,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/**
* Detail Voucher 4(B) VOUCH *
*/
dtlSql = " select '' as TRAN_ID, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
......@@ -9199,8 +9216,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
dtlSql = dtlSql +" 'A' as STATUS," // -- M – Modification, A – Accept D – Delete
+" 0 as SR_NO__OLD,"
+" 'G' as LINE_TYPE,";// -- G – Goods, S – Serice
// +" 'G' as LINE_TYPE,";// -- G – Goods, S – Serice
+" case when it.item_code is null then 'S' else 'G' end as LINE_TYPE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -9211,7 +9228,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('H' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('G' AS CHAR(1)), CAST('R' AS CHAR(1))) AS SGST_PERC,"
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
}
else
{
......@@ -9273,16 +9289,17 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"4(B) VOUCH");
/**
* 4(B) M-VOUC Header MISC-Voucher *
*/
hdrSql = " select '' as TRAN_ID,"
/*+" to_date(i.gp_date) as TRAN_DATE,"*/
+" '' as TRAN_ID__REF,"
// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 aug
+" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+ "case when i.GP_DATE is null then i.tran_date else i.GP_DATE end as PRD_CODE,"
+" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'U' as GST_TYPE,"
+" '06' as TRAN_TYPE,"// -- b2b,b2c
......@@ -9345,6 +9362,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/**
* Detail MISC-Voucher 4(B) M-VOUC *
*/
dtlSql = " select '' as TRAN_ID, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
......@@ -9356,11 +9374,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
dtlSql = dtlSql +" 'A' as STATUS," // -- M – Modification, A – Accept D – Delete
+" 0 as SR_NO__OLD,"
+" 'G' as LINE_TYPE," ;// -- G – Goods, S – Serice
// +" 'G' as LINE_TYPE," ;// -- G – Goods, S – Serice
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
dtlSql = dtlSql //+"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT, "
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC, "
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT, "
......@@ -9372,7 +9391,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else
{
dtlSql = dtlSql
+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
//+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
......@@ -9386,7 +9406,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" item.descr as GS_DESCR,"
/* +" u.descr as UNIT,"*/
+" item.UNIT as UNIT,"
+" (it.quantity) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;// -- E/OE (Ecom/Other than Ecom)
......@@ -9397,11 +9416,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
dtlSql = dtlSql
+" '' as REMARKS ,"
......@@ -9424,10 +9440,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"4(B) M-VOUC");
/*** --- 4(C) IMP_S Import of Service ****/
hdrSql = " select '' as TRAN_ID,"
//+" to_date(case when i.conf_date is null then i.tran_date else i.conf_date end) as TRAN_DATE,"
+" '' as TRAN_ID__REF,"
......@@ -9489,8 +9504,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -9498,7 +9513,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
......@@ -9518,7 +9533,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
// +" 0 as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,";
// +" 'G' as LINE_TYPE,";
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
......@@ -9652,8 +9668,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.date_adv < '"+currMonthStartDate+"' ";
}
......@@ -9661,12 +9677,11 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'M-VOUC' and ref_id = i.tran_id ) = 0 ";
/** Detail MISC-Voucher 4(C) M-VOUC */
......@@ -9681,11 +9696,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
dtlSql = dtlSql +" 'A' as STATUS," // -- M – Modification, A – Accept D – Delete
+" 0 as SR_NO__OLD,"
+" 'G' as LINE_TYPE," ;// -- G – Goods, S – Serice
+" 'G' as LINE_TYPE," // -- G – Goods, S – Serice
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
dtlSql = dtlSql //+"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT, "
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC, "
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT, "
......@@ -9697,7 +9713,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else
{
dtlSql = dtlSql
+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
//+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
......@@ -9745,6 +9762,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"4(C) M-VOUC");
/******* 5(A) started ********/
/**
* 5(A)IMP_G Header IMPG Import of goods from SEZ (IMP_G)*
......@@ -9812,8 +9830,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -9821,7 +9839,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
/**
......@@ -9842,7 +9860,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
// +" 0 as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,";
// +" 'G' as LINE_TYPE,";
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
......@@ -9911,6 +9930,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/****** 5(B) IMP_G Received from SEZ *******/
hdrSql = " select '' as TRAN_ID,"
//+" to_date(case when i.conf_date is null then i.tran_date else i.conf_date end) as TRAN_DATE,"
+" '' as TRAN_ID__REF,"
......@@ -9970,8 +9990,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -9979,13 +9999,14 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
/**
* 5(B) IMP_G Detail IMPG Received from SEZ *
*/
dtlSql = " select '' as TRAN_ID, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
......@@ -9999,7 +10020,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
// +" 0 as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,";
// +" 'G' as LINE_TYPE,";
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
......@@ -10096,7 +10118,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as LR_NO, "
// +" null as LR_DATE,"
+" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV,"
+" ' ' as REF_ID__INV, "
// +" (select tran_date from voucher v where v.tran_id = voucher_o) as REF_ID__INV, "
// +"case when inv.gp_date is null then inv.tran_date else inv.gp_date end as REF_DATE__INV, "
+" 'N' as PROV_ASSMNT, "
......@@ -10140,7 +10162,8 @@ 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,";
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -10151,7 +10174,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" fn_gst_rate_amt(CAST('CRNPAY' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('H' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('CRNPAY' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('G' AS CHAR(1)), CAST('R' AS CHAR(1))) AS SGST_PERC,"
+" fn_gst_rate_amt(CAST('CRNPAY' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
}
else
{
......@@ -10178,14 +10200,11 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('CRNPAY',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('CRNPAY',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
dtlSql = dtlSql
+" '' as REMARKS ,"
+" 'ig' as ITC_TYPE , "
/*added by kaustubh on 20-07-2017*/
......@@ -10243,7 +10262,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as LR_NO, "
// +" null as LR_DATE,"
+" ' ' as REAS_CODE, "
+ " '' as REF_ID__INV, "
+" ' ' as REF_ID__INV, "
// +" (select tran_date from voucher v where v.tran_id = voucher_o) as REF_ID__INV, "
// +"case when inv.gp_date is null then inv.tran_date else inv.gp_date end as REF_DATE__INV, "
+" 'N' as PROV_ASSMNT, "
......@@ -10281,13 +10300,15 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
// +"ti.tax_class in ('BOND' ,'REB' ,'DEEM' ,'SEWP' ,'SEWOP') ) = 0 "
+" and i.tran_date between ? and ? ";
/*** Detail CDNR Credit Note registered 6C(2) (CRNPAY)**/
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,";
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -10325,11 +10346,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('CRNPAY',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('CRNPAY',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
dtlSql = dtlSql
......@@ -10363,6 +10381,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/*** 6C(2) Header DRNPAY Debit Note (Register User) *****/
{
hdrSql = " select '' as TRAN_ID, "
......@@ -10387,7 +10406,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as LR_NO, "
// +" null as LR_DATE,"
+" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, "
// +" (select tran_date from voucher v where v.tran_id = voucher_o) as REF_ID__INV, "
// +"case when inv.gp_date is null then inv.tran_date else inv.gp_date end as REF_DATE__INV, "
......@@ -10430,7 +10448,8 @@ 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,";
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -10572,7 +10591,8 @@ 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,";
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -10709,8 +10729,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = hdrSql +" and ti.tax_env in ("+GST_COMP_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -10718,11 +10738,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
/* commented on 8 aug 2017*/
/* +" and (select count(1) from taxtran ti tax tm where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_COMP_TAXCLASS.length() > 0)
......@@ -10744,7 +10763,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, ";
+" 0 as SR_NO__OLD, "
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -10789,7 +10810,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" from voucher i,vouchrcp it,taxtran tx, tax t, item "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
//+" from invoice i,invoice_trace it, item "
//+" where i.invoice_id = it.invoice_id "
//+" and item.item_code = it.item_code "
......@@ -10813,7 +10833,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"7A(1) COMP");
/**
* --- 7A(2). intra State Supplies -- Value of supplies received from - Exempt supply
*/
......@@ -10877,8 +10896,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PUREXE_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -10886,7 +10905,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
......@@ -10896,7 +10915,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, ";
+" 0 as SR_NO__OLD, "
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -10949,6 +10969,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"and ti.tran_code = 'VOUCH' "
+"and ti.tran_id = i.tran_id "
+"and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
//dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
......@@ -11028,8 +11049,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURNIL_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -11037,7 +11058,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
......@@ -11047,7 +11068,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, ";
+" 0 as SR_NO__OLD, "
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -11092,7 +11115,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" from voucher i,vouchrcp it,taxtran tx, tax t, item "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
//+" from invoice i,invoice_trace it, item "
//+" where i.invoice_id = it.invoice_id "
//+" and item.item_code = it.item_code "
......@@ -11114,7 +11136,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"7A(3) NIL");
......@@ -11182,8 +11203,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURNON_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -11191,7 +11212,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
/**
......@@ -11200,7 +11221,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, ";
+" 0 as SR_NO__OLD, "
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -11330,8 +11353,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = hdrSql +" and ti.tax_env in ("+GST_COMP_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -11339,7 +11362,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
......@@ -11350,7 +11373,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, ";
+" 0 as SR_NO__OLD, "
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -11395,7 +11420,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" from voucher i,vouchrcp it,taxtran tx, tax t, item "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
//+" from invoice i,invoice_trace it, item "
//+" where i.invoice_id = it.invoice_id "
//+" and item.item_code = it.item_code "
......@@ -11481,8 +11505,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PUREXE_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -11490,7 +11514,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
/**
......@@ -11500,7 +11524,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, ";
+" 0 as SR_NO__OLD, "
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -11545,7 +11571,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" from voucher i,vouchrcp it,taxtran tx, tax t, item "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
//+" from invoice i,invoice_trace it, item "
//+" where i.invoice_id = it.invoice_id "
//+" and item.item_code = it.item_code "
......@@ -11631,8 +11656,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURNIL_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -11640,10 +11665,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
/**
* Detail COMP Inter-State COMP rated supplies to registered 7B(3) NIL*
*/
......@@ -11651,7 +11675,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, ";
+" 0 as SR_NO__OLD, "
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -11696,7 +11722,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" from voucher i,vouchrcp it,taxtran tx, tax t, item "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
//+" from invoice i,invoice_trace it, item "
//+" where i.invoice_id = it.invoice_id "
//+" and item.item_code = it.item_code "
......@@ -11783,8 +11808,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURNON_TAXENV+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
+" and i.tran_date between ? and ? "
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
......@@ -11792,7 +11817,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
/**
......@@ -11802,7 +11827,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, ";
+" 0 as SR_NO__OLD, "
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
......@@ -11847,7 +11874,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" from voucher i,vouchrcp it,taxtran tx, tax t, item "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
//+" from invoice i,invoice_trace it, item "
//+" where i.invoice_id = it.invoice_id "
//+" and item.item_code = it.item_code "
......@@ -11947,7 +11973,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
dtlSql = dtlSql +" 'A' as STATUS," // -- M – Modification, A – Accept D – Delete
+" 0 as SR_NO__OLD,"
+" 'G' as LINE_TYPE,"// -- G – Goods, S – Serice
// +" 'G' as LINE_TYPE,"// -- G – Goods, S – Serice
+" case when it.item_code is null then 'S' else 'G' end as LINE_TYPE, "
+" '' as GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
......@@ -12093,7 +12120,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
dtlSql = dtlSql +" 'A' as STATUS," // -- M – Modification, A – Accept D – Delete
+" 0 as SR_NO__OLD,"
+" 'G' as LINE_TYPE,"// -- G – Goods, S – Serice
// +" 'G' as LINE_TYPE,"// -- G – Goods, S – Serice
+" case when it.item_code is null then 'S' else 'G' end as LINE_TYPE, "
+" '' as GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
......@@ -12249,7 +12277,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
dtlSql = dtlSql +" 'A' as STATUS," // -- M – Modification, A – Accept D – Delete
+" 0 as SR_NO__OLD,"
+" 'G' as LINE_TYPE,"// -- G – Goods, S – Serice
// +" 'G' as LINE_TYPE,"// -- G – Goods, S – Serice
+" case when it.item_code is null then 'S' else 'G' end as LINE_TYPE, "
+" ' ' as GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
......@@ -12465,6 +12494,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = dtlSql +" 'A' as STATUS," // -- M – Modification, A – Accept D – Delete
+" 0 as SR_NO__OLD,"
+" 'G' as LINE_TYPE,"// -- G – Goods, S – Serice
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,"
+" ' ' as GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
......@@ -12665,6 +12695,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = dtlSql +" 'A' as STATUS," // -- M – Modification, A – Accept D – Delete
+" 0 as SR_NO__OLD,"
+" 'G' as LINE_TYPE,"// -- G – Goods, S – Serice
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,"
+" ' ' as GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
......@@ -12798,11 +12829,11 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = hdrSql +") > 0 "
+" and i.tran_date between ? and ? ";
/**
* --- Detail 10B(4). Advance adjust through payment inter-state*
*/
dtlSql = " select '' as TRAN_ID, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
......@@ -12814,7 +12845,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
dtlSql = dtlSql +" 'A' as STATUS," // -- M – Modification, A – Accept D – Delete
+" 0 as SR_NO__OLD,"
+" 'G' as LINE_TYPE,"// -- G – Goods, S – Serice
// +" 'G' as LINE_TYPE,"// -- G – Goods, S – Serice
+" case when it.item_code is null then 'S' else 'G' end as LINE_TYPE, "
+" ' ' as GS_CODE, ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
......@@ -12884,7 +12916,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
System.out.println("END TIME FOR GST DATA POPULATION PROCESS IN SECONDS:::["+endTime/1000+"]");
System.out.println("DIFFERANCE IN TIME GST DATA POPULATION PROCESS IN SECONDS:::["+(endTime-startTime)/1000+"]");
gstDataSink = distCommon.getDisparams("999999", "GST_DATA_SYNC", connGST);
System.out.println("GST_DATA_SYNC ["+gstDataSink+"]");
System.out.println("retString today"+ retString);
......@@ -13177,7 +13208,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
currDate = Timestamp.valueOf(genericUtility.getValidDateString(currDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("cuuent Datedddddd"+currDate);
System.out.println("cuuent Date"+currDate);
int updCnt = 0;
int detCnts = 0,hdrCnts = 0,lineNo = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment