Commit 1b67fdd9 authored by kdabholkar's avatar kdabholkar

commited to add changes of 4A purchase ret.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106447 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 42d1a4c9
......@@ -23,6 +23,8 @@ import java.util.Date;
import javax.ejb.Stateless;
import oracle.sql.TIMESTAMP;
import org.w3c.dom.Document;
......@@ -90,6 +92,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
public String process(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException
{
//Connection connGST = null,connLocal = null;
ConnDriver connDriverGST = null,connDriverLocal = null;
......@@ -135,6 +139,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
System.out.println("sysdate newly added"+sysDate);
currDateStr = sdf.format(sysDate);
System.out.println("currDateStr"+currDateStr);
currDate = Timestamp.valueOf(genericUtility.getValidDateString(currDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("current date newly added"+currDate);
......@@ -143,6 +150,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
c.set(Calendar.DAY_OF_MONTH, 1);
currMonthStartDate = Timestamp.valueOf(genericUtility.getValidDateString(sdf.format(c.getTime()), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy");
String strDate= formatter.format(currMonthStartDate);
System.out.println("strDte"+strDate);
// System.out.println("currMonthStartDate"+to_char(currMonthStartDate,'DD-MMM-YYY');
period = checkNull(genericUtility.getColumnValue("prd_code", headerDom));
type = genericUtility.getColumnValue("gst_type",headerDom);
......@@ -378,7 +392,8 @@ 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 where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') ";
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV'"
+" and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') ";
if(taxClassAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStr+") ";
......@@ -593,7 +608,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and s.site_code = c.site_code"
+" and state.state_code = c.STATE_CODE "
//+" and (select count(1) from taxtran ti where ti.tran_code = 'D-ISS' and ti.tran_id = i.tran_id ";
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'D-ISS' and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') ";
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'D-ISS' "
+" and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') ";
if(taxClassAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStr+") ";
......@@ -746,7 +762,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/*+" to_date(i.excise_ref_date) as TRAN_DATE," commented by kaustubh on 25 july 2017*/
+" '' 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 i.excise_ref_date is null then i.tran_date else i.excise_ref_date end as PRD_CODE,"
+ "case when i.gp_date is null then i.tran_date else i.gp_date end as PRD_CODE,"
/*modified by kaustubh on 20 july 2017*/
/*+" to_char(i.excise_ref_date,'MMYYYY') as PRD_CODE,"*/
/*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) commented by kaustubh on 25 july 2017
......@@ -767,9 +783,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" case when i.excise_ref is null then i.tran_id else i.excise_ref end as DOC_NO," //---changed by kaustubh on 25 july 2017
+" case when i.excise_ref_date is null then i.tran_date else i.excise_ref_date end as DOC_DATE," //---changed by kaustubh on 25 july 2017
+" i.amount as AMOUNT,"
+" case when i.gp_no is null then i.tran_id else i.gp_no end as DOC_NO," //---changed by kaustubh on 25 july 2017
+" case when i.gp_date is null then i.tran_date else i.gp_date end as DOC_DATE," //---changed by kaustubh on 25 july 2017
+" i.net_amt as AMOUNT,"
+" 'N' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
// +" null as LR_DATE," commented by kaustubh 27 july 2017
......@@ -793,15 +809,18 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO,"
+" 'P-RET' as ref_ser"
+" from porcp i,supplier c, site s, state state"
+" 'VOUCH' as ref_ser"
//+" from porcp i,supplier c, site s, state state" changed by kaustubh on 31 july 2017
+" from voucher i,supplier c, site s, state"
+" where c.supp_code = i.supp_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and i.tran_ser = 'P-RET' "
//+" and i.tran_ser = 'P-RET' " commented by kaustubh on 31 july 2017
+" and c.tax_reg_2 <> 'UNREGISTER' "
//+" and (select count(1) from taxtran ti where ti.tran_code = 'P-RET' and ti.tran_id = i.tran_id ";
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'P-RET' and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') ";
+" 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','J') ";
if(taxClassAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStr+") ";
......@@ -810,7 +829,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{
hdrSql = hdrSql +" and ti.tax_env not in ("+taxEnvAllStr+") ";
}
hdrSql = hdrSql +" ) > 0 "
hdrSql = hdrSql +" ) = 0 "
+"and (select count(1) from voucher vh, vouchrcp vr, porcp pr where vr.tran_id = vh.tran_id and vh.purc_order = pr.purc_order "
+"and pr.tran_ser = 'P-RET' and vr.PRCP_ID = pr.tran_id) > 0"
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
//+" and i.conf_date between ? and ? " commented by kaustubh on 27 july 2017
+" and i.tran_date between ? and ? "
......@@ -842,25 +863,25 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('P-RET' 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('P-RET' 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('P-RET' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
+" fn_gst_rate_amt(CAST('P-RET' 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('P-RET' 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('P-RET' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
+" 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,"
+" fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
+" 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
{
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
+ "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,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
......@@ -892,30 +913,34 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('VOUCH' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
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 , "
+" fn_get_gst_rate('P-RET',i.tran_id, it.line_no) as gst_rate "
+" fn_get_gst_rate('VOUCH',i.tran_id, it.line_no) as gst_rate "
/*commented by kaustubh */
+" from porcp i,porcpdet it,item item"
/*+" from porcp i,porcpdet it,item item"*/
/*+" from porcp i,porcpdet it,taxtran tx, siteitem si, tax t, item item, uom u " */
+" from voucher i,vouchrcp it, item, porcp pr, porcpdet pd " //changed on 31 july 2017
+" where i.tran_id = it.tran_id "
+" and pr.tran_id = pd.tran_id"
+"and pr.tran_ser = 'P-RET'"
+"and it.prcp_id = pr.tran_id"
/* commented by kaustubh*/
/* +" and si.site_code = i.site_code "
+" and si.item_code = it.item_code "*/
+" and item.item_code = it.item_code "
+" and it.LINE_NO__RCP = pd.line_no"
+"and item.item_code = it.item_code"
/*commented by kaustubh on 21-7-2017*/
/* +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'P-RET' "
......@@ -1462,7 +1487,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and i.net_amt > "+GST_B2CL_INV_VAL+" " //-- amount is more than 2.5 lakh "
+" and c.tax_reg_2 = 'UNREGISTER' "
//+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') ";
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV' "
+" and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') ";
if(taxClassAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class in ("+taxClassAllStr+") ";
......@@ -5903,6 +5929,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '' 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 i.GP_DATE is null then i.tran_date else i.GP_DATE end as PRD_CODE,"
/* +" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, "*/
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME)) commented by kaustubh on 25 july 2017
{
......@@ -5963,10 +5990,19 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and inv.invoice_id = i.invoice_id "
+" and i.drcr_flag ='C'" //added by kaustubh on 26 july to seperate Debit and credit note data
+" 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 = 'CRNRCP' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP
+" and (select count(1) from taxtran ti where ti.tran_code = 'CRNRCP' ) > 0 " ; //modified by kaustubh on 26 july 2017 add DRNCRP
/* +" and to_date(inv.conf_date) < '"+currMonthStartDate+"' " commented by kaustubh on 26 july remove to_date for DB2*/
// +" and inv.conf_date < '"+currMonthStartDate+"' " commented by kaustubh on 27 july
+" and inv.tran_date < '"+currMonthStartDate+"' "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and inv.tran_date < '"+currMonthStartDate+"' ";
}
else
{
hdrSql = hdrSql +" and inv.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
// +" and i.conf_date between ? and ? " commented by kaustubh on 27 july 2017
......@@ -6097,7 +6133,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
/**
* 9B(1) Header CDNR Debit Note registered (DRNRCP)*
* 9B(1) Header DRNRCP Debit Note registered (DRNRCP)*
*/
{
hdrSql = " select '' as TRAN_ID, "
......@@ -6167,10 +6203,20 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and inv.invoice_id = i.invoice_id "
+" and i.drcr_flag ='D'" //added by kaustubh on 26 july to seperate Debit and credit note data
+" 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 = 'DRNRCP' ) > 0 " //modified by kaustubh on 26 july 2017 add DRNCRP
+" and (select count(1) from taxtran ti where ti.tran_code = 'DRNRCP' ) > 0 " ; //modified by kaustubh on 26 july 2017 add DRNCRP
/* +" and to_date(inv.conf_date) < '"+currMonthStartDate+"' " commented by kaustubh on 26 july remove to_date for DB2*/
// +" and inv.conf_date < '"+currMonthStartDate+"' " commented by kaustubh on 27 july
+" and inv.tran_date < '"+currMonthStartDate+"' "
// +" and inv.conf_date < '"+currMonthStartDate+"' " commented by kaustubh on 27 july 2017
//+" and inv.tran_date < '"+currMonthStartDate+"' " changed by kaustubh on 31 july 2017
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and inv.tran_date < '"+currMonthStartDate+"' ";
}
else
{
hdrSql = hdrSql +" and inv.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
// +" and i.conf_date between ? and ? " commented by kaustubh on 27 july 2017
......@@ -6321,7 +6367,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else
{
hdrSql = hdrSql +"sysdate as PRD_CODE,";
}
}
hdrSql=hdrSql
+" '1' as REC_TYPE, "
+" 'A' as GST_TYPE,"
......@@ -6794,8 +6840,20 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = hdrSql+ " ) > 0 ";
hdrSql = hdrSql +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
// +" and i.conf_date between ? and ? " commented by kaustubh on 27 july
+" and i.tran_date between ? and ? "
+" and ad.date_adv < '"+currMonthStartDate+"' "
+" and i.tran_date between ? and ? " ;
// +" and ad.date_adv < '"+currMonthStartDate+"' " changed by kaustubh on 31 july 2017
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and ad.date_adv < '"+currMonthStartDate+"' ";
}
else
{
hdrSql = hdrSql +" and ad.date_adv < '"+strDate+"' ";
}
hdrSql = hdrSql
+" and (select count(1) from gst_data_hdr where ref_ser = 'R-ADV' and ref_id = i.tran_id ) = 0 "
+" group by state.gst_code,case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end, " ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
......@@ -6920,8 +6978,18 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and it.ref_type = '2' "
//+" and i.conf_date between ? and ? " commented by kaustubh on 27 july
+" and i.tran_date between ? and ? "
+" and state.state_code = ? "
+" and it.date_adv < '"+currMonthStartDate+"' "
+" and state.state_code = ? ";
//+" and it.date_adv < '"+currMonthStartDate+"' " changed by kaustubh on 31 july
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +" and it.date_adv < '"+currMonthStartDate+"' ";
}
else
{
dtlSql = dtlSql +" and it.date_adv < '"+strDate+"' ";
}
dtlSql = dtlSql
+" group by fn_get_gst_rate('R-ADV',i.tran_id, it.line_no) ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"11(B.1)");
......@@ -7000,8 +7068,19 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = hdrSql+ " ) > 0 ";
hdrSql = hdrSql +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
// +" and i.conf_date between ? and ? " commented by kaustubh on 27 july
+" and i.tran_date between ? and ? "
+" and ad.date_adv < '"+currMonthStartDate+"' "
+" and i.tran_date between ? and ? " ;
//+" and ad.date_adv < '"+currMonthStartDate+"' " changed by kaustubh on 31 july
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and ad.date_adv < '"+currMonthStartDate+"' ";
}
else
{
hdrSql = hdrSql +" and ad.date_adv < '"+strDate+"' ";
}
hdrSql = hdrSql
+" and (select count(1) from gst_data_hdr where ref_ser = 'R-ADV' and ref_id = i.tran_id ) = 0 "
+" group by state.gst_code,case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
......@@ -7128,8 +7207,20 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and it.ref_type = '2' "
//+" and i.conf_date between ? and ? " commented by kaustubh on 27 july
+" and i.tran_date between ? and ? "
+" and state.state_code = ? "
+" and it.date_adv < '"+currMonthStartDate+"' "
+" and state.state_code = ? ";
//+" and it.date_adv < '"+currMonthStartDate+"' "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +" and it.date_adv < '"+currMonthStartDate+"' ";
}
else
{
dtlSql = dtlSql +" and it.date_adv < '"+strDate+"' ";
}
dtlSql = dtlSql
+" group by fn_get_gst_rate('R-ADV',i.tran_id, it.line_no) ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"11(B.2)");
......@@ -7143,55 +7234,43 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
* 3 VOUCH Header Voucher*
*/
/*hdrSql = " select '' as TRAN_ID,"
+" to_date(i.gp_date) as TRAN_DATE,"
hdrSql = " select '' as TRAN_ID,"
//+" to_date(i.gp_date) as TRAN_DATE,"
+" 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,"
+" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
+ "i.GP_DATE as PRD_CODE,"
+" to_char(i.gp_date,'MMYYYY') as PRD_CODE,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" cast(case when i.conf_date is null then i.tran_date else i.conf_date end,'MMYYYY') as PRD_CODE, ";
}
else
{
hdrSql = hdrSql +"to_char(case when i.conf_date is null then i.tran_date else i.conf_date end,'MMYYYY') as PRD_CODE,";
}
hdrSql=hdrSql
+ "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.
+" 'R' as GST_TYPE," //need to ask
+" '02' as TRAN_TYPE,"// -- b2b,b2c
// +" 'R' as GST_TYPE," //need to ask
+" '01' as TRAN_TYPE,"// -- b2b,b2c
+" i.supp_code as CUST_CODE,"
+" c.supp_name as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" 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,"
+" 'Y' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
+" null as LR_DATE,"
// +" null as LR_DATE,"
+" ' ' as REAS_CODE,"
+" ' ' as REF_ID__INV,"
+" null REF_DATE__INV,"
// +" null REF_DATE__INV,"
+" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required
+" null as ORDER_DATE,"// -- not required
// +" null as ORDER_DATE,"// -- not required
//+" i.tran_id as REMARKS,"
+" '' as REMARKS, "
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
+" null SUBMIT_DATE,"
// +" null SUBMIT_DATE,"
+" '' ADD_USER,"
+" sysdate ADD_DATE,"
/// +" sysdate ADD_DATE,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
+" sysdate CHG_DATE,"
// +" sysdate CHG_DATE,"
+" ' 'CHG_TERM,"
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
......@@ -7203,7 +7282,7 @@ 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 ti.tran_code = 'VOUCH' and ti.tran_id = i.tran_id and in ('G','H','I') ) = 0";
if(taxClassAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class in ("+taxClassAllStr+") ";
......@@ -7211,9 +7290,81 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql = hdrSql +" and tm.tax_group = 'RCM' ) = 0 "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and i.conf_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";*/
+" and ad.date_adv < period_start_date "
+" and (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
/**
* Detail (vouchrcp) (3) *
*/
dtlSql = " select '' as TRAN_ID, "
+" to_number(trim(it.line_no)) as LINE_NO,"
+" 0 as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('RCM' 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('RCM' 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('RCM' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('RCM' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
+" fn_gst_rate_amt(CAST('RCM' 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('RCM' 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('RCM' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
}
else
{
dtlSql = dtlSql +" fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+" fn_gst_rate_amt('RCM',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+"fn_gst_rate_amt('RCM',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+"fn_gst_rate_amt('RCM',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+"fn_gst_rate_amt('RCM',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+"fn_gst_rate_amt('RCM',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+"fn_gst_rate_amt('RCM',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+"fn_gst_rate_amt('RCM',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
+" item.sh_descr as GS_DESCR,"
+" item.UNIT as UNIT,"
+" it.quantity as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;
/*changed by kaustubh on 20-07-2017*/
/* +" 0 as CESS_PERC,"
+" sum(case when t.tax_type = 'J' then tx.tax_amt else 0 end) as CESS_AMT,"*/
/* +"fn_gst_rate_amt('R-ADV',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('R-ADV',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,"*/
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('RCM' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('RCM' AS VARCHAR(6)),i.tran_id, it.line_no, CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('RCM',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('RCM',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
dtlSql = dtlSql
+" '' as REMARKS, "
//+" from invoice i,invoice_trace it,item "
+"from voucher i,vouchrcp it, item "
+" where i.tran_id = it.tran_id "
+" and item.item_code = it.item_code "
+" and i.invoice_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"11(B.2)");
}
long endTime = System.currentTimeMillis();
......@@ -7524,7 +7675,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
try
{
System.out.println("\n\n\n XXXXXXXXXXXXXXXXXXXX Started Populating ["+tranSer+"] Data XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ");
System.out.println("INSIDE INSERT");
/*String monthStr = "";
java.util.Date date= new Date();
Calendar cal = Calendar.getInstance();
......
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