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 ...@@ -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_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_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_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; Timestamp fromDate = null, toDate = null , fromdateOracle = null, todateOracle=null;
...@@ -1252,237 +1252,395 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -1252,237 +1252,395 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/** /**
* 4(A) P-RET Header Porcp Return* * 4(A) P-RET Header Porcp Return*
*/ */
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,"
// +" 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 ,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
// + " case when i.gp_date is null then i.tran_date else i.gp_date end as PRD_CODE,"
+ " i.tran_date 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
{
hdrSql = hdrSql +" cast(i.excise_ref_date,'MMYYYY') as PRD_CODE, ";
}
else
{
hdrSql = hdrSql +"to_char(i.excise_ref_date,'MMYYYY') as PRD_CODE,";
}
hdrSql=hdrSql*/
+" '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, "
// +" 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,"
+" 'N' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
// +" null as LR_DATE," commented by kaustubh 27 july 2017
+" ' ' as REAS_CODE,"
+" ' ' as REF_ID__INV,"
// +" null REF_DATE__INV," commented by kaustubh 27 july 2017
+" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required
// +" null as ORDER_DATE,"// -- not required commented by kaustubh 27 july 2017
//+" i.tran_id as REMARKS,"
+" s.site_code as REMARKS, "
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
// +" null SUBMIT_DATE," commented by kaustubh 27 july 2017
+" '' ADD_USER,"
// +" sysdate ADD_DATE," commented by kaustubh 27 july 2017
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
// +" sysdate CHG_DATE," commented by kaustubh 27 july 2017
+" ' 'CHG_TERM,"
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO,"
+" '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' " 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 = '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+") ";
}
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 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 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 (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' and ref_id = i.tran_id ) = 0 ";
/** if("N".equalsIgnoreCase(INV_ACCT_PORCP))
* Detail Porcp Return Detail 4(A) P-RET* {
*/ hdrSql = " select '' as TRAN_ID,"
dtlSql = " select '' as TRAN_ID, " /*+" to_date(i.excise_ref_date) as TRAN_DATE," commented by kaustubh on 25 july 2017*/
+" it.line_no as LINE_NO, " +" '' as TRAN_ID__REF,"
+" 'A' as STATUS," // -- M – Modification, A – Accept D – Delete // +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
+" 0 as SR_NO__OLD," // +" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+" 'G' as LINE_TYPE,"; // -- G – Goods, S – Serice +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
/*Changed by Kaustubh*/ // + " case when i.gp_date is null then i.tran_date else i.gp_date end as PRD_CODE,"
/* +" si.hsn_no as GS_CODE," + " i.tran_date as PRD_CODE,"
+" tx.TAXABLE_AMT as TAXABLE_AMT," /*modified by kaustubh on 20 july 2017*/
+" case when t.tax_type = 'I' then tx.tax_perc else 0 end as IGST_PERC," /*+" to_char(i.excise_ref_date,'MMYYYY') as PRD_CODE,"*/
//-- sum(case when t.tax_type = 'I' then tx.tax_amt else 0 end) as IGST_AMT, /*if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) commented by kaustubh on 25 july 2017
+" (case when t.tax_type = 'I' then tx.tax_amt else 0 end) as IGST_AMT," {
+" case when t.tax_type = 'H' then tx.tax_perc else 0 end as CGST_PERC," hdrSql = hdrSql +" cast(i.excise_ref_date,'MMYYYY') as PRD_CODE, ";
//-- sum(case when t.tax_type = 'H' then tx.tax_amt else 0 end) as CGST_AMT, }
+" (case when t.tax_type = 'H' then tx.tax_amt else 0 end) as CGST_AMT," else
+" case when t.tax_type = 'G' then tx.tax_perc else 0 end as SGST_PERC," {
//--sum(case when t.tax_type = 'G' then tx.tax_amt else 0 end) as SGST_AMT, hdrSql = hdrSql +"to_char(i.excise_ref_date,'MMYYYY') as PRD_CODE,";
+" (case when t.tax_type = 'G' then tx.tax_amt else 0 end) as SGST_AMT,"*/ }
hdrSql=hdrSql*/
/*modified by kaustubh on 28 july*/ +" '1' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'I' as GST_TYPE,"
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) +" '01' as TRAN_TYPE,"// -- b2b,b2c
{ +" i.supp_code as CUST_CODE,"
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE," +" c.supp_name as CUST_NAME,"
+" fn_gst_rate_amt(CAST('VOUCH' 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," +" state.GST_CODE,"// -- 2 digit code
+" fn_gst_rate_amt(CAST('VOUCH' 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," +" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" fn_gst_rate_amt(CAST('VOUCH' 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," +" ' ' as DOC_CHECKSUM,"
+" fn_gst_rate_amt(CAST('VOUCH' 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," +" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" fn_gst_rate_amt(CAST('VOUCH' 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," +" 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
+" fn_gst_rate_amt(CAST('VOUCH' 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," //+" i.tran_id as DOC_NO, "
+" fn_gst_rate_amt(CAST('VOUCH' 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,"; // +" 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,"
else +" 'N' as REVERSE_CHRG,"
{ +" ' ' as LR_NO,"
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," // +" null as LR_DATE," commented by kaustubh 27 july 2017
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT," +" ' ' as REAS_CODE,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC," +" ' ' as REF_ID__INV,"
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT," // +" null REF_DATE__INV," commented by kaustubh 27 july 2017
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC," +" 'N' as PROV_ASSMNT,"// -- not required
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT," +" '' as ORDER_NO,"// -- not required
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC," // +" null as ORDER_DATE,"// -- not required commented by kaustubh 27 july 2017
+ "fn_gst_rate_amt('VOUCH',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,"; //+" i.tran_id as REMARKS,"
} +" s.site_code as REMARKS, "
dtlSql = dtlSql +" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
/* + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," // +" null SUBMIT_DATE," commented by kaustubh 27 july 2017
+ "fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT," +" '' ADD_USER,"
+ "fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC," // +" sysdate ADD_DATE," commented by kaustubh 27 july 2017
+ "fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT," +" '' ADD_TERM,"
+ "fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC," +" ' ' CHG_USER,"
+ "fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT," // +" sysdate CHG_DATE," commented by kaustubh 27 july 2017
+ "fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC," +" ' 'CHG_TERM,"
+ "fn_gst_rate_amt('P-RET',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,"*/ +" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
// +" item.sh_descr GS_DESCR," commented by kaustubh on 28 july +" ' ' as ECOM_REG_NO,"
// +" item.descr as GS_DESCR," +" 'VOUCH' as ref_ser"
+" ' ' as GS_DESCR, " //+" from porcp i,supplier c, site s, state state" changed by kaustubh on 31 july 2017
/*chnaged by Kaustubh*/ +" from voucher i,supplier c, site s, state"
/* +" u.descr as UNIT,"*/ +" where c.supp_code = i.supp_code "
// +"item.UNIT as UNIT," chnaged on 7 sep 2017 +" and s.site_code = i.site_code "
+"(select case when udf_str2 is null then descr else udf_str2 end as Unit from uom where unit=it.unit) as UNIT, " +" and state.state_code = c.STATE_CODE "
//--sum(it.quantity__stduom) as QUANTITY, //+" and i.tran_ser = 'P-RET' " commented by kaustubh on 31 july 2017
// +" (it.quantity) as QUANTITY," +" and c.tax_reg_2 <> 'UNREGISTER' "
+" 0 as QUANTITY," //+" and (select count(1) from taxtran ti where ti.tran_code = 'P-RET' and ti.tran_id = i.tran_id ";
+" 'OE' as SUPPLY_TYPE," ;// -- E/OE (Ecom/Other than Ecom) +" 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') ";
/* chnaged by kaustubh on 19-07-2017*/ if(taxClassAllStr.length() > 0)
/* +" case when t.tax_type = 'J' then tx.tax_perc else 0 end as CESS_PERC," {
//--sum(case when t.tax_type = 'J' then tx.tax_amt else 0 end) as CESS_AMT, hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStr+") ";
+" (case when t.tax_type = 'J' then tx.tax_amt else 0 end) as CESS_AMT,"*/ }
if(taxEnvAllStr.length() > 0)
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) {
{ hdrSql = hdrSql +" and ti.tax_env not in ("+taxEnvAllStr+") ";
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('VOUCH' 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('VOUCH' 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,"; // hdrSql = hdrSql +" ) = 0 " Commented on 22 aug 2017
} hdrSql = hdrSql +" ) > 0 "
else +"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 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 (select count(1) from gst_data_hdr where ref_ser = 'VOUCH' 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
/*Changed by Kaustubh*/
/* +" si.hsn_no as GS_CODE,"
+" tx.TAXABLE_AMT as TAXABLE_AMT,"
+" case when t.tax_type = 'I' then tx.tax_perc else 0 end as IGST_PERC,"
//-- sum(case when t.tax_type = 'I' then tx.tax_amt else 0 end) as IGST_AMT,
+" (case when t.tax_type = 'I' then tx.tax_amt else 0 end) as IGST_AMT,"
+" case when t.tax_type = 'H' then tx.tax_perc else 0 end as CGST_PERC,"
//-- sum(case when t.tax_type = 'H' then tx.tax_amt else 0 end) as CGST_AMT,
+" (case when t.tax_type = 'H' then tx.tax_amt else 0 end) as CGST_AMT,"
+" case when t.tax_type = 'G' then tx.tax_perc else 0 end as SGST_PERC,"
//--sum(case when t.tax_type = 'G' then tx.tax_amt else 0 end) as SGST_AMT,
+" (case when t.tax_type = 'G' then tx.tax_amt else 0 end) as SGST_AMT,"*/
/*modified by kaustubh on 28 july*/
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('VOUCH' 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('VOUCH' 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('VOUCH' 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('VOUCH' 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('VOUCH' 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('VOUCH' 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('VOUCH' 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('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
/* + "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,"*/
// +" item.sh_descr GS_DESCR," commented by kaustubh on 28 july
// +" item.descr as GS_DESCR,"
+" ' ' as GS_DESCR, "
/*chnaged by Kaustubh*/
/* +" u.descr as UNIT,"*/
// +"item.UNIT as UNIT," chnaged on 7 sep 2017
+"(select case when udf_str2 is null then descr else udf_str2 end as Unit from uom where unit=it.unit) as UNIT, "
//--sum(it.quantity__stduom) as QUANTITY,
// +" (it.quantity) as QUANTITY,"
+" 0 as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;// -- E/OE (Ecom/Other than Ecom)
/* chnaged by kaustubh on 19-07-2017*/
/* +" case when t.tax_type = 'J' then tx.tax_perc else 0 end as CESS_PERC,"
//--sum(case when t.tax_type = 'J' then tx.tax_amt else 0 end) as CESS_AMT,
+" (case when t.tax_type = 'J' then tx.tax_amt else 0 end) as CESS_AMT,"*/
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('VOUCH' 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('VOUCH' 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('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('VOUCH',i.tran_id, it.line_no) as gst_rate "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +" fn_get_gst_rate('VOUCH',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +" fn_get_gst_rate('VOUCH',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
/*commented by kaustubh */
/*+" 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 it.LINE_NO__RCP = pd.line_no"
+" and item.item_code = it.item_code "
/*commented by kaustubh on 21-7-2017 / 3 aug */
+"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_type in ('G','H','I','J')" ;
/*commented by kaustubh on 19-7-2017*/
/* +" and t.tax_code = tx.tax_code "
+" and t.tax_type in ('G','H','I','J') "
+" and tx.tran_code = 'P-RET' "
+" and tx.tran_id = i.tran_id ";*/
/*commented by kaustubh on 21-7-2017 / 3 aug */
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 = ? ";
/*commented by kaustubh*/
/* +" 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 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
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('VOUCH',i.tran_id, it.line_no) as gst_rate "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +" fn_get_gst_rate('VOUCH',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +" fn_get_gst_rate('VOUCH',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
/*commented by kaustubh */
/*+" 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 it.LINE_NO__RCP = pd.line_no"
+" and item.item_code = it.item_code "
/*commented by kaustubh on 21-7-2017 / 3 aug */
+"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_type in ('G','H','I','J')" ;
/*commented by kaustubh on 19-7-2017*/
/* +" and t.tax_code = tx.tax_code "
+" and t.tax_type in ('G','H','I','J') "
+" and tx.tran_code = 'P-RET' "
+" and tx.tran_id = i.tran_id ";*/
/*commented by kaustubh on 21-7-2017 / 3 aug */
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 = ? ";
/*commented by kaustubh*/
/* +" 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"); 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 ********/ /******* 4B started ********/
/** /**
* 4(B) VOUCH Header Voucher* * 4(B) VOUCH Header Voucher*
...@@ -2501,7 +2659,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2501,7 +2659,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/*+" i.gp_date as DOC_DATE, "*/ /*+" 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," // +"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.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, " +" 'N' as REVERSE_CHRG, "
+" i.lr_no as LR_NO, " +" i.lr_no as LR_NO, "
+" i.lr_date as LR_DATE," +" i.lr_date as LR_DATE,"
...@@ -2511,7 +2670,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2511,7 +2670,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'N' as PROV_ASSMNT, " +" 'N' as PROV_ASSMNT, "
//+" i.stan_code__init as ORDER_NO," //+" i.stan_code__init as ORDER_NO,"
// +" station.descr as ORDER_NO," COMMENTED ON 22 AUG 2017 // +" 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 // +" null as ORDER_DATE, " commented by kaustubh 27 july 2017
//+" i.invoice_id as REMARK S, " //+" i.invoice_id as REMARK S, "
+" s.site_code as REMARKS, " +" s.site_code as REMARKS, "
...@@ -2576,7 +2736,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2576,7 +2736,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE," dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('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('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('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," +" 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 ...@@ -2588,7 +2748,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else else
{ {
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "fn_gst_rate_amt('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', '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, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'R') as CGST_PERC," + "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 ...@@ -2730,7 +2890,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/* +" i.gp_date as DOC_DATE, "*/ /* +" 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," // + "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.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, " +" 'N' as REVERSE_CHRG, "
+" i.lr_no as LR_NO, " +" i.lr_no as LR_NO, "
+" i.lr_date as LR_DATE," +" i.lr_date as LR_DATE,"
...@@ -2740,7 +2901,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2740,7 +2901,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'N' as PROV_ASSMNT, " +" 'N' as PROV_ASSMNT, "
//+" i.stan_code__init as ORDER_NO," //+" i.stan_code__init as ORDER_NO,"
// +" station.descr 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 // +" null as ORDER_DATE, " commented by kaustubh 27 july 2017
//+" i.invoice_id as REMARKS, " //+" i.invoice_id as REMARKS, "
+" s.site_code as REMARKS, " +" s.site_code as REMARKS, "
...@@ -2804,7 +2968,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2804,7 +2968,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE," dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('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('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('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," +" 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 ...@@ -2816,7 +2980,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else else
{ {
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "fn_gst_rate_amt('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', '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, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'R') as CGST_PERC," + "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 ...@@ -2957,7 +3121,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/*+" i.gp_date as DOC_DATE, "*/ /*+" 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," // +"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.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, " +" 'N' as REVERSE_CHRG, "
+" i.lr_no as LR_NO, " +" i.lr_no as LR_NO, "
+" i.lr_date as LR_DATE," +" i.lr_date as LR_DATE,"
...@@ -2967,7 +3132,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2967,7 +3132,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'N' as PROV_ASSMNT, " +" 'N' as PROV_ASSMNT, "
//+" i.stan_code__init as ORDER_NO," //+" i.stan_code__init as ORDER_NO,"
// +" station.descr as ORDER_NO," COMMENETED BY KAUSTUBH 22 AUG 2017 // +" 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 // +" null as ORDER_DATE, " commented by kaustubh 27 july 2017
//+" i.invoice_id as REMARKS, " //+" i.invoice_id as REMARKS, "
+" s.site_code as REMARKS, " +" s.site_code as REMARKS, "
...@@ -3028,7 +3198,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3028,7 +3198,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE," dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('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('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('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," +" 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 ...@@ -3040,7 +3210,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else else
{ {
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "fn_gst_rate_amt('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', '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, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'R') as CGST_PERC," + "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 ...@@ -3179,7 +3349,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/*+" i.gp_date as DOC_DATE, "*/ /*+" 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," // +"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.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, " +" 'N' as REVERSE_CHRG, "
+" i.lr_no as LR_NO, " +" i.lr_no as LR_NO, "
+" i.lr_date as LR_DATE," +" i.lr_date as LR_DATE,"
...@@ -3189,7 +3360,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3189,7 +3360,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'N' as PROV_ASSMNT, " +" 'N' as PROV_ASSMNT, "
//+" i.stan_code__init as ORDER_NO," //+" i.stan_code__init as ORDER_NO,"
// +" station.descr 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 // +" null as ORDER_DATE, " commented by kaustubh 27 july 2017
//+" i.invoice_id as REMARKS, " //+" i.invoice_id as REMARKS, "
+" s.site_code as REMARKS, " +" s.site_code as REMARKS, "
...@@ -3258,7 +3434,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3258,7 +3434,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE," dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('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('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('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," +" 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 ...@@ -3270,7 +3446,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else else
{ {
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "fn_gst_rate_amt('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', '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, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'R') as CGST_PERC," + "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 ...@@ -3396,7 +3572,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
/* +" i.gp_date as DOC_DATE, "*/ /* +" 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," // +"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.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, " +" 'N' as REVERSE_CHRG, "
+" i.lr_no as LR_NO, " +" i.lr_no as LR_NO, "
+" i.lr_date as LR_DATE," +" i.lr_date as LR_DATE,"
...@@ -3406,7 +3583,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3406,7 +3583,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'N' as PROV_ASSMNT, " +" 'N' as PROV_ASSMNT, "
//+" i.stan_code__init as ORDER_NO," //+" i.stan_code__init as ORDER_NO,"
// +" station.descr 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 // +" null as ORDER_DATE, " commented by kaustubh 27 july 2017
//+" i.invoice_id as REMARKS, " //+" i.invoice_id as REMARKS, "
+" '' as REMARKS, " +" '' as REMARKS, "
...@@ -3476,7 +3658,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3476,7 +3658,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE," dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('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('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('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," +" 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 ...@@ -3488,7 +3670,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
else else
{ {
dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," dtlSql = dtlSql + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "fn_gst_rate_amt('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', '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, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'R') as CGST_PERC," + "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'R') as CGST_PERC,"
...@@ -9106,7 +9288,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -9106,7 +9288,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
GST_RCM_TAXENV=distCommon.getDisparams("999999", "GST_RCM_TAXENV", connGST); GST_RCM_TAXENV=distCommon.getDisparams("999999", "GST_RCM_TAXENV", connGST);
PURCHASE_DATA_PORCP = distCommon.getDisparams("999999", "PURCHASE_DATA_PORCP", connGST); PURCHASE_DATA_PORCP = distCommon.getDisparams("999999", "PURCHASE_DATA_PORCP", connGST);
MISC_VOUC_TYPE = distCommon.getDisparams("999999", "MISC_VOUC_TYPE", 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.replace(",", "','");
PORD_TYP_IMP_SERVICE= "'"+PORD_TYP_IMP_SERVICE+"'"; PORD_TYP_IMP_SERVICE= "'"+PORD_TYP_IMP_SERVICE+"'";
...@@ -19794,6 +19979,166 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -19794,6 +19979,166 @@ dtlSql = " select '' as TRAN_ID, "
try{ 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 * * (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