Commit f27a6504 authored by kdabholkar's avatar kdabholkar

commit changes of inventory account,amount,bank_ref

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@177216 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a65e0215
......@@ -51,7 +51,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
GST_PUREXE_TAXCLASS="",GST_PUREXE_TAXENV="",GST_PURNIL_TAXCLASS="",GST_PURNIL_TAXENV="",GST_PURNON_TAXCLASS="",
GST_PURNON_TAXENV="",GST_IMPSER_TAXCLASS="",GST_IMPSER_TAXENV="",GST_IMPGD_TAXCLASS="",GST_IMPGD_TAXENV="",
GST_IMPGDSEZ_TAXCLASS="",GST_IMPGDSEZ_TAXENV="",GST_PURSEZWP_TAXENV="",GST_PURSEZWP_TAXCLASS="",GST_PURSEZWOP_TAXENV="",GST_PURSEZWOP_TAXCLASS="",
GST_PURDE_TAXENV="",GST_PURDE_TAXCLASS="",GST_RCM_TAXCLASS="",GST_RCM_TAXENV="",SALES_DATA_MISC="",PURCHASE_DATA_PORCP="",MISC_VOUC_TYPE="";
GST_PURDE_TAXENV="",GST_PURDE_TAXCLASS="",GST_RCM_TAXCLASS="",GST_RCM_TAXENV="",SALES_DATA_MISC="",PURCHASE_DATA_PORCP="",MISC_VOUC_TYPE="",INV_ACCT_PORCP="";
Timestamp fromDate = null, toDate = null , fromdateOracle = null, todateOracle=null;
......@@ -1252,6 +1252,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/**
* 4(A) P-RET Header Porcp Return*
*/
if("N".equalsIgnoreCase(INV_ACCT_PORCP))
{
hdrSql = " select '' as TRAN_ID,"
/*+" to_date(i.excise_ref_date) as TRAN_DATE," commented by kaustubh on 25 july 2017*/
+" '' as TRAN_ID__REF,"
......@@ -1481,8 +1484,163 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/* +" and u.unit = item.unit ";*/
//--group by '',it.line_no, 'A', 0, 'G', si.hsn_no, tx.TAXABLE_AMT,t.tax_type,tx.tax_perc, item.sh_descr, item.UNIT, 'OE',''
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"4(A) P-RET");
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"4(A)P-RET INV-OFF");
} //End of Inventory OFF
else
{
System.out.println("inside Inventary ON");
hdrSql = " select '' as TRAN_ID,"
+" '' as TRAN_ID__REF,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE,"
+" '1' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'I' as GST_TYPE,"
+" '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
//+" case when i.gp_no is null then i.tran_id else i.gp_no end as DOC_NO," //---changed by kaustubh on 9 sep 2017
+" i.tran_id as DOC_NO,"
+" i.tran_date as DOC_DATE,"
+" i.amount as AMOUNT,"
+" 'N' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
+" ' ' as REAS_CODE,"
+" ' ' as REF_ID__INV,"
+" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required
+" s.site_code as REMARKS, "
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
+" ' 'CHG_TERM,"
+" 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"
//+" 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 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 = 'P-RET' "
+" 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+") ";
}
if(taxEnvAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env not in ("+taxEnvAllStr+") ";
}
// hdrSql = hdrSql +" ) = 0 " Commented on 22 aug 2017
hdrSql = hdrSql +" ) > 0 "
+" and (SELECT COUNT(1) FROM PORCP vh,PORCPDET vr WHERE vr.tran_id = vh.tran_id AND vh.tran_ser = 'P-RET' "
+" AND i.tran_id =vh.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 ? "
+" AND '01-JUL-2017' > (Select Tran_date from porcp where tran_id =i.TRAN_ID__REF) "
+" and (select count(1) from gst_data_hdr where ref_ser = 'P-RET' and ref_id = i.tran_id ) = 0 ";
/**
* Detail Porcp Return Detail 4(A) P-RET*
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS," // -- M – Modification, A – Accept D – Delete
+" 0 as SR_NO__OLD,"
+" 'G' as LINE_TYPE,"; // -- G – Goods, S – Serice
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,CAST(it.line_no as char(3)), 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,CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
+" fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('R' AS CHAR(1))) AS SGST_PERC,"
+" fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
}
else
{
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "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,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+"(select case when udf_str2 is null then descr else udf_str2 end as Unit from uom where unit=it.unit) as UNIT, "
+" 0 as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;// -- E/OE (Ecom/Other than Ecom)
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('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
+" '' as REMARKS , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +" fn_get_gst_rate('P-RET',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +" fn_get_gst_rate('P-RET',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from porcp i,porcpdet 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 = 'P-RET' "
+"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 ";
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
//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,"4(A)P-RET INV-ON");
}
/******* 4B started ********/
/**
* 4(B) VOUCH Header Voucher*
......@@ -2501,7 +2659,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/*+" 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.tran_date as DOC_DATE, "
+" i.net_amt as AMOUNT, "
// +" i.net_amt as AMOUNT, "
+" (i.NET_AMT * i.EXCH_RATE) as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" i.lr_no as LR_NO, "
+" i.lr_date as LR_DATE,"
......@@ -2511,7 +2670,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'N' as PROV_ASSMNT, "
//+" i.stan_code__init as ORDER_NO,"
// +" station.descr as ORDER_NO," COMMENTED ON 22 AUG 2017
+" (select descr from station where stan_code=i.stan_code__init) AS ORDER_NO, "
// +" (select descr from station where stan_code=i.stan_code__init) AS ORDER_NO, "
+" (select BANK_REF from station where stan_code=i.stan_code__init) AS ORDER_NO, " //Changed by kaustubh on 26 dec 2017 as per Devendra sirs's direction
// +" null as ORDER_DATE, " commented by kaustubh 27 july 2017
//+" i.invoice_id as REMARK S, "
+" s.site_code as REMARKS, "
......@@ -2576,7 +2736,7 @@ 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('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) * i.EXCH_RATE AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
......@@ -2588,7 +2748,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else
{
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, ' ', 'T') * i.EXCH_RATE as TAXABLE_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'R') as CGST_PERC,"
......@@ -2730,7 +2890,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/* +" 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.tran_date as DOC_DATE,"
+" i.net_amt as AMOUNT, "
// +" i.net_amt as AMOUNT, "
+" (i.NET_AMT * i.EXCH_RATE) as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" i.lr_no as LR_NO, "
+" i.lr_date as LR_DATE,"
......@@ -2740,7 +2901,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'N' as PROV_ASSMNT, "
//+" i.stan_code__init as ORDER_NO,"
// +" station.descr as ORDER_NO,"
+"(select descr from station where stan_code=i.stan_code__init) AS ORDER_NO, "
//changed by kaustubh on 26 dec 2017 start
// +"(select descr from station where stan_code=i.stan_code__init) AS ORDER_NO, "
+"(select BANK_REF from station where stan_code=i.stan_code__init) AS ORDER_NO, "
//changed by kaustubh on 26 dec 2017 end
// +" null as ORDER_DATE, " commented by kaustubh 27 july 2017
//+" i.invoice_id as REMARKS, "
+" s.site_code as REMARKS, "
......@@ -2804,7 +2968,7 @@ 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('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) * i.EXCH_RATE AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
......@@ -2816,7 +2980,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else
{
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, ' ', 'T') * i.EXCH_RATE as TAXABLE_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'R') as CGST_PERC,"
......@@ -2957,7 +3121,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/*+" 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.tran_date as DOC_DATE, "
+" i.net_amt as AMOUNT, "
// +" i.net_amt as AMOUNT, "
+" (i.NET_AMT * i.EXCH_RATE) as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" i.lr_no as LR_NO, "
+" i.lr_date as LR_DATE,"
......@@ -2967,7 +3132,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'N' as PROV_ASSMNT, "
//+" i.stan_code__init as ORDER_NO,"
// +" station.descr as ORDER_NO," COMMENETED BY KAUSTUBH 22 AUG 2017
+"(select descr from station where stan_code=i.stan_code__init) AS ORDER_NO, "
//Changed by kaustubh on 26 dec 2017 as per Devendra sirs's direction start
// +"(select descr from station where stan_code=i.stan_code__init) AS ORDER_NO, "
+"(select BANK_REF from station where stan_code=i.stan_code__init) AS ORDER_NO, "
//Changed by kaustubh on 26 dec 2017 as per Devendra sirs's direction end
// +" null as ORDER_DATE, " commented by kaustubh 27 july 2017
//+" i.invoice_id as REMARKS, "
+" s.site_code as REMARKS, "
......@@ -3028,7 +3198,7 @@ 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('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) * i.EXCH_RATE AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
......@@ -3040,7 +3210,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else
{
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, ' ', 'T') * i.EXCH_RATE as TAXABLE_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'R') as CGST_PERC,"
......@@ -3179,7 +3349,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/*+" 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.tran_date as DOC_DATE, "
+" i.net_amt as AMOUNT, "
// +" i.net_amt as AMOUNT, "
+" (i.NET_AMT * i.EXCH_RATE) as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" i.lr_no as LR_NO, "
+" i.lr_date as LR_DATE,"
......@@ -3189,7 +3360,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'N' as PROV_ASSMNT, "
//+" i.stan_code__init as ORDER_NO,"
// +" station.descr as ORDER_NO,"
+"(select descr from station where stan_code=i.stan_code__init) AS ORDER_NO, "
//Changed by kaustubh on 26 dec 2017 as per Devendra sirs's direction start
// +"(select descr from station where stan_code=i.stan_code__init) AS ORDER_NO, "
+"(select BANK_REF from station where stan_code=i.stan_code__init) AS ORDER_NO, "
// Changed by kaustubh on 26 dec 2017 as per Devendra sirs's direction end
// +" null as ORDER_DATE, " commented by kaustubh 27 july 2017
//+" i.invoice_id as REMARKS, "
+" s.site_code as REMARKS, "
......@@ -3258,7 +3434,7 @@ 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('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) * i.EXCH_RATE AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
......@@ -3270,7 +3446,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else
{
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, ' ', 'T') * i.EXCH_RATE as TAXABLE_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'R') as CGST_PERC,"
......@@ -3396,7 +3572,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/* +" 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.tran_date as DOC_DATE, "
+" i.net_amt as AMOUNT, "
// +" i.net_amt as AMOUNT, "
+" (i.NET_AMT * i.EXCH_RATE) as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" i.lr_no as LR_NO, "
+" i.lr_date as LR_DATE,"
......@@ -3406,7 +3583,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'N' as PROV_ASSMNT, "
//+" i.stan_code__init as ORDER_NO,"
// +" station.descr as ORDER_NO,"
+"(select descr from station where stan_code=i.stan_code__init) AS ORDER_NO, "
//Changed by kaustubh on 26 dec 2017 as per Devendra sirs's direction start
// +"(select descr from station where stan_code=i.stan_code__init) AS ORDER_NO, "
+"(select BANK_REF from station where stan_code=i.stan_code__init) AS ORDER_NO, "
//Changed by kaustubh on 26 dec 2017 as per Devendra sirs's direction end
// +" null as ORDER_DATE, " commented by kaustubh 27 july 2017
//+" i.invoice_id as REMARKS, "
+" '' as REMARKS, "
......@@ -3476,7 +3658,7 @@ 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('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) * i.EXCH_RATE AS TAXABLE_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
......@@ -3488,7 +3670,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else
{
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, ' ', 'T') * i.EXCH_RATE as TAXABLE_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'R') as CGST_PERC,"
......@@ -9106,6 +9288,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
GST_RCM_TAXENV=distCommon.getDisparams("999999", "GST_RCM_TAXENV", connGST);
PURCHASE_DATA_PORCP = distCommon.getDisparams("999999", "PURCHASE_DATA_PORCP", connGST);
MISC_VOUC_TYPE = distCommon.getDisparams("999999", "MISC_VOUC_TYPE", connGST);
//added by kaustubh on 26 dec 2017 start Inventory Account flag
INV_ACCT_PORCP = distCommon.getDisparams("999999", "INV_ACCT_PORCP", connGST);
//added by kaustubh on 26 dec 2017 end Inventory Account flag
PORD_TYP_IMP_SERVICE=PORD_TYP_IMP_SERVICE.replace(",", "','");
PORD_TYP_IMP_SERVICE= "'"+PORD_TYP_IMP_SERVICE+"'";
......@@ -19794,6 +19979,166 @@ dtlSql = " select '' as TRAN_ID, "
try{
/**
* ITC Reversal Purchase Return B2B header
*/
System.out.println("inside ITC Reversal Purchase Return");
hdrSql = " select '' as TRAN_ID,"
+" '' as TRAN_ID__REF,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE,"
+" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'I' as GST_TYPE,"
+" '31' 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
//+" case when i.gp_no is null then i.tran_id else i.gp_no end as DOC_NO," //---changed by kaustubh on 9 sep 2017
+" i.tran_id as DOC_NO,"
+" i.tran_date as DOC_DATE,"
+" i.amount as AMOUNT,"
+" 'N' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
+" ' ' as REAS_CODE,"
+" ' ' as REF_ID__INV,"
+" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required
+" s.site_code as REMARKS, "
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
+" ' 'CHG_TERM,"
+" 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"
+" 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 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 = 'P-RET' "
+" and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') ";
if(taxClassAllStrOfPurchase.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStrOfPurchase+") ";
}
if(taxEnvAllStrOfPurchase.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env not in ("+taxEnvAllStrOfPurchase+") ";
}
// hdrSql = hdrSql +" ) = 0 " Commented on 22 aug 2017
hdrSql = hdrSql +" ) > 0 "
+" and (SELECT COUNT(1) FROM PORCP vh, PORCPDET vr WHERE vr.tran_id = vh.tran_id AND vh.tran_ser = 'P-RET' "
+" AND i.tran_id = vh.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 ? "
+" AND '01-JUL-2017' <= (Select Tran_date from porcp where tran_id =i.TRAN_ID__REF) "
+" and (select count(1) from gst_data_hdr where ref_ser = 'P-RET' and ref_id = i.tran_id ) = 0 ";
/**
* Detail Porcp Return Detail 4(A) detail*
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS," // -- M – Modification, A – Accept D – Delete
+" 0 as SR_NO__OLD,"
+" 'G' as LINE_TYPE,"; // -- G – Goods, S – Serice
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,CAST(it.line_no as char(3)), 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,CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC,"
+" fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT,"
+" fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC,"
+" fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('R' AS CHAR(1))) AS SGST_PERC,"
+" fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
}
else
{
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "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,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+"(select case when udf_str2 is null then descr else udf_str2 end as Unit from uom where unit=it.unit) as UNIT, "
+" 0 as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;// -- E/OE (Ecom/Other than Ecom)
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('P-RET' AS VARCHAR(6)),i.tran_id,CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('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
+" '' as REMARKS , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +" fn_get_gst_rate('P-RET',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +" fn_get_gst_rate('P-RET',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from porcp i,porcpdet 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 = 'P-RET' "
+"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 ";
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
//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,"ITC-REV PUR-RET");
/**
* (A) D-RCP Header distribution receipt *
*/
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