Commit b5dfccf8 authored by wansari's avatar wansari

S17BBAS004 updated source for calling web service for synching GST data


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106275 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b2198d57
...@@ -23,6 +23,8 @@ import java.util.Date; ...@@ -23,6 +23,8 @@ import java.util.Date;
import org.w3c.dom.Document; import org.w3c.dom.Document;
@javax.ejb.Stateless @javax.ejb.Stateless
public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrcRemote public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrcRemote
{ {
...@@ -96,7 +98,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -96,7 +98,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
boolean isError = false; boolean isError = false;
String hdrSql = "",dtlSql = ""; String hdrSql = "",dtlSql = "",gstDataSink = "";
int cnt = 0; int cnt = 0;
...@@ -3291,28 +3293,29 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3291,28 +3293,29 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"9B(1)"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"9B(1)");
} }
/******11 Started ******/ /******11A Started ******/
{ {
/** /**
* 11(A.1) Header AT Intra-State advance received(Rate wise) * * 11(A.1) Header AT Intra-State advance received(Rate wise) *
*/ */
hdrSql = " select '' as TRAN_ID, " hdrSql = " select '' as TRAN_ID, "
+" to_date(i.GP_DATE) as TRAN_DATE, " +" to_date(sysdate) as TRAN_DATE, "
+" '' as TRAN_ID__REF, " +" '' as TRAN_ID__REF, "
+" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
+" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, " +" to_char(sysdate,'MMYYYY') as PRD_CODE, "
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'A' as GST_TYPE," //+" 'A' as GST_TYPE,"
+" '41' as TRAN_TYPE," //+" '41' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +" '45' as TRAN_TYPE,"
+" c.cust_name as CUST_NAME, " +" null as CUST_CODE, "
+" null as CUST_NAME, "
+" state.GST_CODE, " +" state.GST_CODE, "
+" '' as SUBMISSION_TYPE," +" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM," +" '' as DOC_CHECKSUM,"
+" '' as DOC_TYPE, " +" 'R' as DOC_TYPE, "
+" i.GP_NO as DOC_NO, " +" null as DOC_NO, "
+" i.gp_date as DOC_DATE, " +" null as DOC_DATE, "
+" i.net_amt as AMOUNT, " +" 0 as AMOUNT, "
+" 'N' as REVERSE_CHRG, " +" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, " +" ' ' as LR_NO, "
+" null as LR_DATE," +" null as LR_DATE,"
...@@ -3324,7 +3327,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3324,7 +3327,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" null as ORDER_DATE, " +" null as ORDER_DATE, "
//+" i.invoice_id as REMARKS, " //+" i.invoice_id as REMARKS, "
+" '' as REMARKS, " +" '' as REMARKS, "
+" i.invoice_id as REF_ID, " +" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, " +" ' ' as SUBMIT_STATUS, "
+" null SUBMIT_DATE, " +" null SUBMIT_DATE, "
+" '' ADD_USER, " +" '' ADD_USER, "
...@@ -3333,50 +3336,65 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3333,50 +3336,65 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' CHG_USER, " +" ' ' CHG_USER, "
+" sysdate CHG_DATE, " +" sysdate CHG_DATE, "
+" ' 'CHG_TERM, " +" ' 'CHG_TERM, "
+" c.tax_reg_2 as TAX_REG_NO, " +" '' as TAX_REG_NO, "
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'R-ADV' as ref_ser "
+" from invoice i,customer c, site s, state state " +" from adv_rcp_tax i,adv_rcp_tax_det ad,customer c, site s, state "
+" where c.cust_code = i.cust_code " +" where ad.tran_id = i.tran_id "
+" and c.cust_code = ad.cust_code "
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and state.state_code = c.state_code " +" and state.state_code = c.STATE_CODE "
+" and s.state_code = c.state_code " +" and ad.ref_type = '1' "
+" 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 = 'R-ADV' and ti.tran_id = i.tran_id ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and cast(ti.line_no as integer) = ad.line_no ";
}
else
{
hdrSql = hdrSql +" and to_number(ti.line_no) = ad.line_no ";
}
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 ? " +" and i.conf_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'S-INV' and ref_id = i.invoice_id ) = 0 "; +" 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, sysdate,i.tran_id ";
/** /**
* Detail AT Intra-State advance received(Rate wise) 11(A.1)* * Detail AT Intra-State advance received(Rate wise) 11(A.1) *
*/ */
dtlSql = " select '' as TRAN_ID, " dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, " +" 0 as LINE_NO, "
+" 'A' as STATUS, " +" 'A' as STATUS, "
+" 0 as SR_NO__OLD, " +" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE," +" '' as LINE_TYPE,"
+" si.hsn_no as GS_CODE, " +" '' as GS_CODE, "
+" tx.TAXABLE_AMT as TAXABLE_AMT, " +" 0 as TAXABLE_AMT, "
+" case when t.tax_type = 'I' then tx.tax_perc else 0 end as IGST_PERC," +" 0 as IGST_PERC,"
+" (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," +" 0 as CGST_PERC,"
+" (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," +" 0 as SGST_PERC,"
+" (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,"
+" item.sh_descr GS_DESCR," +" '' GS_DESCR,"
+" u.descr as UNIT," +" '' as UNIT,"
+" (it.quantity__stduom) as QUANTITY," +" 0 as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," +" '' as SUPPLY_TYPE,"
+" case when t.tax_type = 'J' then tx.tax_perc else 0 end as CESS_PERC," +" 0 as CESS_PERC,"
+" (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,"
+" '' as REMARKS " +" '' as REMARKS, "
+" from invoice i,invoice_trace it,taxtran tx, siteitem si, tax t, item,uom u " +" fn_get_gst_rate('R-ADV',i.tran_id, it.line_no) as gst_rate "
+" where i.invoice_id = it.invoice_id " +" from adv_rcp_tax i,adv_rcp_tax_det it,taxtran tx, tax t, customer c, state, site s "
+" and si.site_code = i.site_code " +" where i.tran_id = it.tran_id "
+" and si.item_code = it.item_code "
+" and item.item_code = it.item_code "
+" and t.tax_code = tx.tax_code " +" and t.tax_code = tx.tax_code "
+" and c.cust_code = it.cust_code "
+" and state.state_code = c.state_code "
+" and s.site_code = i.site_code "
+" and s.state_code = state.state_code "
+" and t.tax_type in ('G','H','I','J') " +" and t.tax_type in ('G','H','I','J') "
+" and tx.tran_code = 'S-INV' " +" and tx.tran_code = 'R-ADV' "
+" and tx.tran_id = i.invoice_id "; +" and tx.tran_id = i.tran_id ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no "; dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
...@@ -3385,32 +3403,34 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3385,32 +3403,34 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
{ {
dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no "; dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no ";
} }
dtlSql = dtlSql +" and i.invoice_id = ? " dtlSql = dtlSql +" and it.ref_type = '1' "
+" and u.unit = item.unit "; +" and i.conf_date between ? and ? "
+" and state.state_code = ? "
//retString = executeSqlAndPopulateData(hdrSql,dtlSql,"11(A).1"); Not called as it will be changed as per new requirement +" group by fn_get_gst_rate('R-ADV',i.tran_id, it.line_no) ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"11(A.1)");
/** /**
* 11(A.2) Header AT Intra-State advance received(Rate wise)* * 11(A.2) Header AT Intra-State advance received(Rate wise)*
*/ */
hdrSql = " select '' as TRAN_ID, " hdrSql = " select '' as TRAN_ID, "
+" to_date(i.GP_DATE) as TRAN_DATE, " +" to_date(sysdate) as TRAN_DATE, "
+" '' as TRAN_ID__REF, " +" '' as TRAN_ID__REF, "
+" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
+" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, " +" to_char(sysdate,'MMYYYY') as PRD_CODE, "
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'A' as GST_TYPE," //+" 'A' as GST_TYPE,"
+" '42' as TRAN_TYPE," //+" '41' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +" '45' as TRAN_TYPE,"
+" c.cust_name as CUST_NAME, " +" null as CUST_CODE, "
+" null as CUST_NAME, "
+" state.GST_CODE, " +" state.GST_CODE, "
+" '' as SUBMISSION_TYPE," +" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM," +" '' as DOC_CHECKSUM,"
+" '' as DOC_TYPE, " +" 'R' as DOC_TYPE, "
+" i.GP_NO as DOC_NO, " +" null as DOC_NO, "
+" i.gp_date as DOC_DATE, " +" null as DOC_DATE, "
+" i.net_amt as AMOUNT, " +" 0 as AMOUNT, "
+" 'N' as REVERSE_CHRG, " +" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, " +" ' ' as LR_NO, "
+" null as LR_DATE," +" null as LR_DATE,"
...@@ -3422,7 +3442,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3422,7 +3442,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" null as ORDER_DATE, " +" null as ORDER_DATE, "
//+" i.invoice_id as REMARKS, " //+" i.invoice_id as REMARKS, "
+" '' as REMARKS, " +" '' as REMARKS, "
+" i.invoice_id as REF_ID, " +" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, " +" ' ' as SUBMIT_STATUS, "
+" null SUBMIT_DATE, " +" null SUBMIT_DATE, "
+" '' ADD_USER, " +" '' ADD_USER, "
...@@ -3431,62 +3451,319 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3431,62 +3451,319 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" ' ' CHG_USER, " +" ' ' CHG_USER, "
+" sysdate CHG_DATE, " +" sysdate CHG_DATE, "
+" ' 'CHG_TERM, " +" ' 'CHG_TERM, "
+" c.tax_reg_2 as TAX_REG_NO, " +" '' as TAX_REG_NO, "
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'R-ADV' as ref_ser "
+" from invoice i,customer c, site s, state state" +" from adv_rcp_tax i,adv_rcp_tax_det ad,customer c, site s, state "
+" where c.cust_code = i.cust_code " +" where ad.tran_id = i.tran_id "
+" and c.cust_code = ad.cust_code "
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and state.state_code = c.state_code " +" and state.state_code <> c.STATE_CODE "
+" and c.state_code <> s.state_code " +" and ad.ref_type = '1' "
+" 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 = 'R-ADV' and ti.tran_id = i.tran_id ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and cast(ti.line_no as integer) = ad.line_no ";
}
else
{
hdrSql = hdrSql +" and to_number(ti.line_no) = ad.line_no ";
}
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 ? " +" and i.conf_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'S-INV' and ref_id = i.invoice_id ) = 0 "; +" 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, sysdate,i.tran_id ";
/** /**
* Detail AT Intra-State advance received(Rate wise) 11(A.2)* * Detail AT Intra-State advance received(Rate wise) 11(A.2)*
*/ */
dtlSql = " select '' as TRAN_ID, " dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, " +" 0 as LINE_NO, "
+" 'A' as STATUS, " +" 'A' as STATUS, "
+" 0 as SR_NO__OLD, " +" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE," +" '' as LINE_TYPE,"
+" si.hsn_no as GS_CODE, " +" '' as GS_CODE, "
+" tx.TAXABLE_AMT as TAXABLE_AMT, " +" 0 as TAXABLE_AMT, "
+" case when t.tax_type = 'I' then tx.tax_perc else 0 end as IGST_PERC," +" 0 as IGST_PERC,"
+" (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," +" 0 as CGST_PERC,"
+" (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," +" 0 as SGST_PERC,"
+" (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,"
+" item.sh_descr GS_DESCR," +" '' GS_DESCR,"
+" u.descr as UNIT," +" '' as UNIT,"
+" (it.quantity__stduom) as QUANTITY," +" 0 as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," +" '' as SUPPLY_TYPE,"
+" case when t.tax_type = 'J' then tx.tax_perc else 0 end as CESS_PERC," +" 0 as CESS_PERC,"
+" (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,"
+" '' as REMARKS " +" '' as REMARKS, "
+" from invoice i,invoice_trace it,taxtran tx, siteitem si, tax t, item,uom u " +" fn_get_gst_rate('R-ADV',i.tran_id, it.line_no) as gst_rate "
+" where i.invoice_id = it.invoice_id " +" from adv_rcp_tax i,adv_rcp_tax_det it,taxtran tx, tax t, customer c, state, site s "
+" and si.site_code = i.site_code " +" where i.tran_id = it.tran_id "
+" and si.item_code = it.item_code "
+" and item.item_code = it.item_code "
+" and t.tax_code = tx.tax_code " +" and t.tax_code = tx.tax_code "
+" and c.cust_code = it.cust_code "
+" and state.state_code = c.state_code "
+" and s.site_code = i.site_code "
+" and s.state_code <> state.state_code "
+" and t.tax_type in ('G','H','I','J') " +" and t.tax_type in ('G','H','I','J') "
+" and tx.tran_code = 'S-INV' " +" and tx.tran_code = 'R-ADV' "
+" and tx.tran_id = i.invoice_id "; +" and tx.tran_id = i.tran_id ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no "; dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
} }
else else
{ {
dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no "; dtlSql = dtlSql +" to_number(trim(tx.line_no)) = it.line_no ";
} }
dtlSql = dtlSql +" and i.invoice_id = ? " dtlSql = dtlSql +" and it.ref_type = '1' "
+" and u.unit = item.unit "; +" and i.conf_date between ? and ? "
+" and state.state_code = ? "
+" group by fn_get_gst_rate('R-ADV',i.tran_id, it.line_no) ";
//retString = executeSqlAndPopulateData(hdrSql,dtlSql,"11(A).2"); Not called as it will be changed as per new requirement retString = executeSqlAndPopulateData(hdrSql,dtlSql,"11(A.2)");
}
/******11B Started ******/
{
/**
* 11(B.1) Intra-State Supplies (Rate Wise)*
*/
hdrSql = " select '' as TRAN_ID, "
+" to_date(sysdate) 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, "
+" to_char(sysdate,'MMYYYY') as PRD_CODE, "
+" '1' as REC_TYPE, "
//+" 'A' as GST_TYPE,"
//+" '41' as TRAN_TYPE,"
+" '45' as TRAN_TYPE,"
+" null as CUST_CODE, "
+" null as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE, "
+" null as DOC_NO, "
+" null as DOC_DATE, "
+" 0 as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
+" null as LR_DATE,"
+" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, "
+" null REF_DATE__INV, "
+" 'N' as PROV_ASSMNT, "
+" '' as ORDER_NO,"
+" null as ORDER_DATE, "
//+" i.invoice_id as REMARKS, "
+" '' as REMARKS, "
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
+" null SUBMIT_DATE, "
+" '' ADD_USER, "
+" sysdate as ADD_DATE, "
+" '' ADD_TERM, "
+" ' ' CHG_USER, "
+" sysdate CHG_DATE, "
+" ' 'CHG_TERM, "
+" '' as TAX_REG_NO, "
+" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, "
+" 'R-ADV' as ref_ser "
+" from adv_rcp_tax i,adv_rcp_tax_det ad,customer c, site s, state "
+" where ad.tran_id = i.tran_id "
+" and c.cust_code = ad.cust_code "
+" and s.site_code = i.site_code "
+" and state.state_code <> c.STATE_CODE "
+" and ad.ref_type = '2' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'R-ADV' and ti.tran_id = i.tran_id ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and cast(ti.line_no as integer) = ad.line_no ";
}
else
{
hdrSql = hdrSql +" and to_number(ti.line_no) = ad.line_no ";
}
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 ? "
+" and ad.date_adv < '"+currMonthStartDate+"' "
+" 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, sysdate,i.tran_id ";
/**
* Detail Intra-State Supplies (Rate Wise) 11(B.1) *
*/
dtlSql = " select '' as TRAN_ID, "
+" 0 as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+" '' as LINE_TYPE,"
+" '' as GS_CODE, "
+" 0 as TAXABLE_AMT, "
+" 0 as IGST_PERC,"
+" sum(case when t.tax_type = 'I' then tx.tax_amt else 0 end) as IGST_AMT,"
+" 0 as CGST_PERC,"
+" sum(case when t.tax_type = 'H' then tx.tax_amt else 0 end) as CGST_AMT,"
+" 0 as SGST_PERC,"
+" sum(case when t.tax_type = 'G' then tx.tax_amt else 0 end) as SGST_AMT,"
+" '' GS_DESCR,"
+" '' as UNIT,"
+" 0 as QUANTITY,"
+" '' as SUPPLY_TYPE,"
+" 0 as CESS_PERC,"
+" sum(case when t.tax_type = 'J' then tx.tax_amt else 0 end) as CESS_AMT,"
+" '' as REMARKS, "
+" fn_get_gst_rate('R-ADV',i.tran_id, it.line_no) as gst_rate "
+" from adv_rcp_tax i,adv_rcp_tax_det it,taxtran tx, tax t, customer c, state, site s "
+" where i.tran_id = it.tran_id "
+" and t.tax_code = tx.tax_code "
+" and c.cust_code = it.cust_code "
+" and state.state_code = c.state_code "
+" and s.site_code = i.site_code "
+" and s.state_code = state.state_code "
+" and t.tax_type in ('G','H','I','J') "
+" and tx.tran_code = 'R-ADV' "
+" and tx.tran_id = i.tran_id ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
}
else
{
dtlSql = dtlSql +" to_number(trim(tx.line_no)) = it.line_no ";
}
dtlSql = dtlSql +" and it.ref_type = '2' "
+" and i.conf_date between ? and ? "
+" and state.state_code = ? "
+" and it.date_adv < '"+currMonthStartDate+"' "
+" group by fn_get_gst_rate('R-ADV',i.tran_id, it.line_no) ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"11(B.1)");
/**
* 11(B.2) Header Inter-State Supplies (Rate Wise) *
*/
hdrSql = " select '' as TRAN_ID, "
+" to_date(sysdate) 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, "
+" to_char(sysdate,'MMYYYY') as PRD_CODE, "
+" '1' as REC_TYPE, "
//+" 'A' as GST_TYPE,"
//+" '41' as TRAN_TYPE,"
+" '45' as TRAN_TYPE,"
+" null as CUST_CODE, "
+" null as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE, "
+" null as DOC_NO, "
+" null as DOC_DATE, "
+" 0 as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
+" null as LR_DATE,"
+" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, "
+" null REF_DATE__INV, "
+" 'N' as PROV_ASSMNT, "
+" '' as ORDER_NO,"
+" null as ORDER_DATE, "
//+" i.invoice_id as REMARKS, "
+" '' as REMARKS, "
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
+" null SUBMIT_DATE, "
+" '' ADD_USER, "
+" sysdate as ADD_DATE, "
+" '' ADD_TERM, "
+" ' ' CHG_USER, "
+" sysdate CHG_DATE, "
+" ' 'CHG_TERM, "
+" '' as TAX_REG_NO, "
+" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, "
+" 'R-ADV' as ref_ser "
+" from adv_rcp_tax i,adv_rcp_tax_det ad,customer c, site s, state "
+" where ad.tran_id = i.tran_id "
+" and c.cust_code = ad.cust_code "
+" and s.site_code = i.site_code "
+" and state.state_code <> c.STATE_CODE "
+" and ad.ref_type = '2' "
+" and (select count(1) from taxtran ti where ti.tran_code = 'R-ADV' and ti.tran_id = i.tran_id ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and cast(ti.line_no as integer) = ad.line_no ";
}
else
{
hdrSql = hdrSql +" and to_number(ti.line_no) = ad.line_no ";
}
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 ? "
+" and ad.date_adv < '"+currMonthStartDate+"' "
+" 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, sysdate,i.tran_id ";
/**
* Detail Inter-State Supplies (Rate Wise) 11(B.2) *
*/
dtlSql = " select '' as TRAN_ID, "
+" 0 as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+" '' as LINE_TYPE,"
+" '' as GS_CODE, "
+" 0 as TAXABLE_AMT, "
+" 0 as IGST_PERC,"
+" sum(case when t.tax_type = 'I' then tx.tax_amt else 0 end) as IGST_AMT,"
+" 0 as CGST_PERC,"
+" sum(case when t.tax_type = 'H' then tx.tax_amt else 0 end) as CGST_AMT,"
+" 0 as SGST_PERC,"
+" sum(case when t.tax_type = 'G' then tx.tax_amt else 0 end) as SGST_AMT,"
+" '' GS_DESCR,"
+" '' as UNIT,"
+" 0 as QUANTITY,"
+" '' as SUPPLY_TYPE,"
+" 0 as CESS_PERC,"
+" sum(case when t.tax_type = 'J' then tx.tax_amt else 0 end) as CESS_AMT,"
+" '' as REMARKS, "
+" fn_get_gst_rate('R-ADV',i.tran_id, it.line_no) as gst_rate "
+" from adv_rcp_tax i,adv_rcp_tax_det it,taxtran tx, tax t, customer c, state, site s "
+" where i.tran_id = it.tran_id "
+" and t.tax_code = tx.tax_code "
+" and c.cust_code = it.cust_code "
+" and state.state_code = c.state_code "
+" and s.site_code = i.site_code "
+" and s.state_code <> state.state_code "
+" and t.tax_type in ('G','H','I','J') "
+" and tx.tran_code = 'R-ADV' "
+" and tx.tran_id = i.tran_id ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
}
else
{
dtlSql = dtlSql +" to_number(trim(tx.line_no)) = it.line_no ";
}
dtlSql = dtlSql +" and it.ref_type = '2' "
+" and i.conf_date between ? and ? "
+" and state.state_code = ? "
+" and it.date_adv < '"+currMonthStartDate+"' "
+" group by fn_get_gst_rate('R-ADV',i.tran_id, it.line_no) ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"11(B.2)");
} }
} }
...@@ -3498,6 +3775,35 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3498,6 +3775,35 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis();
System.out.println("END TIME FOR GST DATA POPULATION PROCESS IN SECONDS:::["+endTime/1000+"]"); System.out.println("END TIME FOR GST DATA POPULATION PROCESS IN SECONDS:::["+endTime/1000+"]");
System.out.println("DIFFERANCE IN TIME GST DATA POPULATION PROCESS IN SECONDS:::["+(endTime-startTime)/1000+"]"); System.out.println("DIFFERANCE IN TIME GST DATA POPULATION PROCESS IN SECONDS:::["+(endTime-startTime)/1000+"]");
gstDataSink = distCommon.getDisparams("999999", "GST_DATA_SYNC", connGST);
System.out.println("GST_DATA_SYNC ["+gstDataSink+"]");
if(("NULLFOUND".equals(gstDataSink) || gstDataSink == null || gstDataSink.trim().length() == 0))
{
System.out.println("GST_DATA_SYNC not found or blank");
}
else if("Y".equalsIgnoreCase(gstDataSink))
{
GetGstTableData gstDataSinkObj = new GetGstTableData();
retString = gstDataSinkObj.getGstTableData("", xtraParams, "" ,connGST);
System.out.println("Return String from GST_DATA_SYNC["+retString+"]");
if(retString.contains("PRCSUCCESS"))
{
errorMessage.append("\n GST Data synched successfully");
}
else if(retString.contains("URLNOTFOUND"))
{
errorMessage.append("\n URL not found for synching GST data, GST data not synched successfully");
}
else
{
errorMessage.append("\n GST Data not synched successfully ");
}
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -3755,7 +4061,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3755,7 +4061,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
int detSum=0,hdrSum = 0; int detSum=0,hdrSum = 0;
int cnt = 0; int cnt = 0;
double amount = 0, taxableAmt = 0, igstPerc = 0, igstAmt = 0, cgstPerc = 0, cgstAmt = 0, sgstPerc= 0,sgstAmt = 0,quantity = 0, cessPerc = 0,cessAmt = 0; double amount = 0, taxableAmt = 0, igstPerc = 0, igstAmt = 0, cgstPerc = 0, cgstAmt = 0, sgstPerc= 0,sgstAmt = 0,quantity = 0,
cessPerc = 0,cessAmt = 0,gstRate = 0;
try try
{ {
...@@ -3769,8 +4076,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3769,8 +4076,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
pstmtInsHdr = connGST.prepareStatement(sql); pstmtInsHdr = connGST.prepareStatement(sql);
sql = " INSERT INTO GST_DATA_DET (TRAN_ID,LINE_NO,STATUS,SR_NO__OLD,LINE_TYPE,GS_CODE,TAXABLE_AMT,IGST_PERC," sql = " INSERT INTO GST_DATA_DET (TRAN_ID,LINE_NO,STATUS,SR_NO__OLD,LINE_TYPE,GS_CODE,TAXABLE_AMT,IGST_PERC,"
+" IGST_AMT,CGST_PERC,CGST_AMT,SGST_PERC,SGST_AMT,GS_DESCR,UNIT,QUANTITY,SUPPLY_TYPE,CESS_PERC,CESS_AMT,REMARKS)" +" IGST_AMT,CGST_PERC,CGST_AMT,SGST_PERC,SGST_AMT,GS_DESCR,UNIT,QUANTITY,SUPPLY_TYPE,CESS_PERC,CESS_AMT,REMARKS,GST_RATE)"
+" values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) "; +" VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
//pstmtInsDet = connLocal.prepareStatement(sql); //pstmtInsDet = connLocal.prepareStatement(sql);
pstmtInsDet = connGST.prepareStatement(sql); pstmtInsDet = connGST.prepareStatement(sql);
...@@ -3829,6 +4136,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3829,6 +4136,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
remarksHdr = rsSelHdr.getString("REMARKS"); remarksHdr = rsSelHdr.getString("REMARKS");
refID = rsSelHdr.getString("REF_ID"); refID = rsSelHdr.getString("REF_ID");
//gstTranId = ( generateTranId( "w_gstr", loginSiteCode, currDateStr, connLocal) ); //gstTranId = ( generateTranId( "w_gstr", loginSiteCode, currDateStr, connLocal) );
gstTranId = ( generateTranId( "w_gstr", loginSiteCode, currDateStr, connGST) ); gstTranId = ( generateTranId( "w_gstr", loginSiteCode, currDateStr, connGST) );
System.out.println("Tran ID generated for tranSer ["+tranSer+"] ["+gstTranId+"]"); System.out.println("Tran ID generated for tranSer ["+tranSer+"] ["+gstTranId+"]");
...@@ -3893,7 +4201,17 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3893,7 +4201,17 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
sql = dtlSql; sql = dtlSql;
pstmtSelDet = connGST.prepareStatement(sql); pstmtSelDet = connGST.prepareStatement(sql);
if("11(A.1)".equals(tranSer) || "11(A.2)".equals(tranSer) || "11(B.1)".equals(tranSer) || "11(B.2)".equals(tranSer))
{
pstmtSelDet.setTimestamp(1, fromDate);
pstmtSelDet.setTimestamp(2, toDate);
pstmtSelDet.setString(3, stateCode);
}
else
{
pstmtSelDet.setString(1, refID); pstmtSelDet.setString(1, refID);
}
rsSelDet = pstmtSelDet.executeQuery(); rsSelDet = pstmtSelDet.executeQuery();
//detCnts = 0; //detCnts = 0;
...@@ -3922,7 +4240,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3922,7 +4240,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
cessPerc = rsSelDet.getDouble("CESS_PERC"); cessPerc = rsSelDet.getDouble("CESS_PERC");
cessAmt = rsSelDet.getDouble("CESS_AMT"); cessAmt = rsSelDet.getDouble("CESS_AMT");
remarksDet = rsSelDet.getString("REMARKS"); remarksDet = rsSelDet.getString("REMARKS");
if("11(A.1)".equals(tranSer) || "11(A.2)".equals(tranSer) || "11(B.1)".equals(tranSer) || "11(B.2)".equals(tranSer))
{
gstRate = rsSelDet.getDouble("GST_RATE");
}
/*sql= " INSERT INTO GST_DATA_DET (TRAN_ID,LINE_NO,STATUS,SR_NO__OLD,LINE_TYPE,GS_CODE,TAXABLE_AMT,IGST_PERC," /*sql= " INSERT INTO GST_DATA_DET (TRAN_ID,LINE_NO,STATUS,SR_NO__OLD,LINE_TYPE,GS_CODE,TAXABLE_AMT,IGST_PERC,"
+" IGST_AMT,CGST_PERC,CGST_AMT,SGST_PERC,SGST_AMT,GS_DESCR,UNIT,QUANTITY,SUPPLY_TYPE,CESS_PERC,CESS_AMT,REMARKS)" +" IGST_AMT,CGST_PERC,CGST_AMT,SGST_PERC,SGST_AMT,GS_DESCR,UNIT,QUANTITY,SUPPLY_TYPE,CESS_PERC,CESS_AMT,REMARKS)"
+" values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) "; +" values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
...@@ -3948,6 +4269,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3948,6 +4269,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
pstmtInsDet.setDouble(18,cessPerc); pstmtInsDet.setDouble(18,cessPerc);
pstmtInsDet.setDouble(19,cessAmt); pstmtInsDet.setDouble(19,cessAmt);
pstmtInsDet.setString(20,remarksDet); pstmtInsDet.setString(20,remarksDet);
pstmtInsDet.setDouble(21,gstRate);
pstmtInsDet.addBatch(); pstmtInsDet.addBatch();
pstmtInsDet.clearParameters(); pstmtInsDet.clearParameters();
......
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