Commit 225b6a1a authored by kdabholkar's avatar kdabholkar

Adding new queries for e-commerce and update condition for invoice nill rated query.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@179889 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c0a68f24
...@@ -855,6 +855,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -855,6 +855,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 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.tax_reg_2 <> 'UNREGISTER' " +" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.inv_type <> 'EC' "
//+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id "; //+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV'" +" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV'"
+" and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') "; +" and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') ";
...@@ -1565,7 +1566,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -1565,7 +1566,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 0 as SR_NO__OLD," +" 0 as SR_NO__OLD,"
+" 'G' as LINE_TYPE,"; // -- G – Goods, S – Serice +" 'G' as LINE_TYPE,"; // -- G – Goods, S – Serice
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,"
...@@ -1576,11 +1576,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -1576,11 +1576,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 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('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('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,"; +" 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 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('P-RET',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT," + "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', '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, 'I', 'A') as IGST_AMT,"
...@@ -1592,7 +1591,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -1592,7 +1591,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = dtlSql dtlSql = dtlSql
+" ' ' as GS_DESCR, " +" ' ' 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, " +"(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," +" 0 as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;// -- E/OE (Ecom/Other than Ecom) +" 'OE' as SUPPLY_TYPE," ;// -- E/OE (Ecom/Other than Ecom)
...@@ -2166,6 +2165,152 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2166,6 +2165,152 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"4(B) M-VOUC");*/ retString = executeSqlAndPopulateData(hdrSql,dtlSql,"4(B) M-VOUC");*/
/******* 4C started ********/
/**
* 4(C) B2B supplies by e-Commerce site (Header Query) *
*/
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,"
+" '03' as TRAN_TYPE," // b2b,b2c
+" i.cust_code as CUST_CODE, "
+" c.cust_name as CUST_NAME, "
+" state.GST_CODE, " // 2 digit code
+" '' as SUBMISSION_TYPE," // M-Modify, D-Delete, A-Accept, R-Reject
+" '' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE, " // R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" i.invoice_id as DOC_NO,"
+" i.tran_date as DOC_DATE, "
+" i.net_amt 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.invoice_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, "
+" (select Tax_REG_2 from sales_pers where sales_pers=(select Sales_Pers from invoice where invoice_id=i.invoice_id)) AS ECOM_REG_NO, "
+" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state state"
+" where c.cust_code = i.cust_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.state_code "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.inv_type='EC' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV'"
+" and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') ";
if(taxClassAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStr+") ";
}
if(taxEnvAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env not in ("+taxEnvAllStr+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'S-INV' and ref_id = i.invoice_id ) = 0 ";
/**
* Detail Sales Invoice Detail 4(C) S-INV*
*/
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('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('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,"
+" 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('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV',i.invoice_id, it.line_no, ' ', 'T') 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,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_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, "
+" (it.quantity__stduom) 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('S-INV' AS VARCHAR(6)), i.invoice_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('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV',i.invoice_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('S-INV',i.invoice_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('S-INV',i.invoice_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('S-INV',i.invoice_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from invoice i,invoice_trace it, item"
+" where i.invoice_id = it.invoice_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 = 'S-INV' "
+"and ti.tran_id = i.invoice_id "
+"and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.invoice_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"4(C) S-INV(E-COMM)");
/************* 5A started ****************/ /************* 5A started ****************/
/** /**
* 5(A) S-INV Invoice Header * * 5(A) S-INV Invoice Header *
...@@ -2238,6 +2383,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2238,6 +2383,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and st_c.gst_code <> st_own.gst_code " //-- inter-state only +" and st_c.gst_code <> st_own.gst_code " //-- inter-state only
+" and i.net_amt > "+GST_B2CL_INV_VAL+" " //-- amount is more than 2.5 lakh " +" and i.net_amt > "+GST_B2CL_INV_VAL+" " //-- amount is more than 2.5 lakh "
+" and c.tax_reg_2 = 'UNREGISTER' " +" and c.tax_reg_2 = 'UNREGISTER' "
+" and i.inv_type <> 'EC' "
//+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id "; //+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV' " +" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV' "
//+" and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') "; inter state changed on 22 aug //+" and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') "; inter state changed on 22 aug
...@@ -2623,6 +2769,149 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -2623,6 +2769,149 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(5A) P-RET"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(5A) P-RET");
/************* 5B started ****************/
/**
* 5(B) (S-INV) B2CL Inter-State unregistered supplies by e-Comm *
*/
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.
+" 'S' as GST_TYPE,"
+" '05' as TRAN_TYPE," //-- b2cl
+" i.cust_code as CUST_CODE,"
+" c.cust_name as CUST_NAME,"
+" st_c.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" i.invoice_id as DOC_NO, "
+" i.tran_date as DOC_DATE,"
+" i.net_amt 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.invoice_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,"
+"(select Tax_REG_2 from sales_pers where sales_pers=(select Sales_Pers from invoice where invoice_id=i.invoice_id)) as ECOM_REG_NO, "
+" 'S-INV' as ref_ser"
+" from invoice i,customer c, site s, state st_c, state st_own "
+" where c.cust_code = i.cust_code "
+" and s.site_code = i.site_code "
+" and st_c.state_code = c.STATE_CODE "
+" and st_own.state_code = s.STATE_CODE "
+" and st_c.gst_code <> st_own.gst_code " //-- inter-state only
+" and i.net_amt > "+GST_B2CL_INV_VAL+" " //-- amount is more than 2.5 lakh "
+" and c.tax_reg_2 = 'UNREGISTER' "
+" and i.inv_type = 'EC' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV' "
+" and ti.tran_id = i.invoice_id and tm.tax_type in ('I','J') ";
if(taxClassAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStr+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'S-INV' and ref_id = i.invoice_id ) = 0 ";
/**
* Detail Invoice 5(A) S-INV *
*/
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('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('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,"
+" 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('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV',i.invoice_id, it.line_no, ' ', 'T') 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,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_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, "
+" (it.quantity) 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('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV',i.invoice_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('S-INV',i.invoice_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('S-INV',i.invoice_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +" fn_get_gst_rate('S-INV',i.invoice_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from invoice i,invoice_trace it, item item "
+" where i.invoice_id = it.invoice_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 = 'S-INV' "
+"and ti.tran_id = i.invoice_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(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.invoice_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(5B)B2CL-ECOMM");
/***********6A started************/ /***********6A started************/
/** /**
* 6(A) WPAY Header Invoice Exports (Pure Export)- with Payment * * 6(A) WPAY Header Invoice Exports (Pure Export)- with Payment *
...@@ -3764,17 +4053,373 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3764,17 +4053,373 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(6C) DE"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(6C) DE");
/*********** 7A started ************/ /*********** 7A started ************/
/**
* 7A(1) B2CS Header B2CS Intra-state supplies *
*/
hdrSql = " select '' as TRAN_ID, "
/* modified by kaustubh*/
/*+" to_date(i.GP_DATE) as TRAN_DATE, "*/
/* +" to_date(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end) 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, " on 9 aug
// +" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE,"
/* +" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, "*/
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" cast(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE, ";
}
else
{
hdrSql = hdrSql +"to_char(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE,";
}
hdrSql=hdrSql*/
+" '1' as REC_TYPE, "
+" 'S' as GST_TYPE,"
+" '11' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, "
+" c.cust_name as CUST_NAME, "
+" st_c.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE, "
/* modified by kaustubh*/
/*+" i.GP_NO as DOC_NO, "*/
//+"case when i.GP_NO is null then i.invoice_id else i.GP_NO end as DOC_NO, "
+" i.invoice_id as DOC_NO, "
/* +" i.gp_date as DOC_DATE, "*/
// +"case when i.gp_date is null then i.tran_date else i.gp_date end as DOC_DATE,"
+" i.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, "
+" i.stan_code__init as ORDER_NO," //
// +" null as ORDER_DATE, " commented by kaustubh 27 july 2017
//+" i.invoice_id as REMARKS, "
+" s.site_code as REMARKS, "
+" i.invoice_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
// +" null SUBMIT_DATE, " commented by kaustubh 27 july 2017
+" '' ADD_USER, "
// +" sysdate as 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, "
+" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state st_c, state st_own"
+" where c.cust_code = i.cust_code "
+" and s.site_code = i.site_code "
+" and st_c.state_code = c.state_code "
+" and s.state_code = st_own.state_code "
+" and st_own.gst_code = st_c.gst_code " //Intra-state supply. Site.GST_CODE = Customer's SITE.GST_CODE
+" and c.tax_reg_2 = 'UNREGISTER' "
+" and i.inv_type <> 'EC' "
+" 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
/* below added on 22 aug */
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV' "
+" and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') ";
if(taxClassAllStr.length() > 0)
{
//hdrSql = hdrSql +" and ti.tax_class in ("+taxClassAllStr+") ";
hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStr+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'S-INV' and ref_id = i.invoice_id ) = 0 ";
/**
* Detail B2CS Intra-state supplies 7A(1) B2CS *
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,";
/*changed by kaustubh on 19-07-2017*/
/*+" 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,"
+" (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,"
+" (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,"
+" (case when t.tax_type = 'G' then tx.tax_amt else 0 end) as SGST_AMT,"*/
/* + "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, '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,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'A') as SGST_AMT,"*/
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('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,"
+" 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('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV',i.invoice_id, it.line_no, ' ', 'T') 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,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
// +" item.sh_descr GS_DESCR," commented by kaustubh on 28 july 2017
// +" item.descr as GS_DESCR,"
+" ' ' as GS_DESCR, "
/*changed by kaustubh on 19-07-2017*/
/*+" u.descr as UNIT,"*/
// +"item.UNIT as UNIT,"
+"(select case when udf_str2 is null then descr else udf_str2 end as Unit from uom where unit=it.unit) as UNIT, "
+" (it.quantity__stduom) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;
/*changed by kaustubh on 19-07-2017*/
/*+" case when t.tax_type = 'J' then tx.tax_perc else 0 end as CESS_PERC,"
+" (case when t.tax_type = 'J' then tx.tax_amt else 0 end) as CESS_AMT,"*/
/*+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'A') as CESS_AMT,"*/
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV',i.invoice_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
dtlSql = dtlSql
+" '' as REMARKS ,";
/*added by kaustubh on 19-07-2017*/
// +"fn_get_gst_rate('S-INV',i.invoice_id, it.line_no) as gst_rate "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +" fn_get_gst_rate('S-INV',i.invoice_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +" fn_get_gst_rate('S-INV',i.invoice_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
/*changed by kaustubh on 19-07-2017*/
/*+" from invoice i,invoice_trace it,taxtran tx, siteitem si, tax t, item, uom u "*/
+" from invoice i,invoice_trace it, item "
+" where i.invoice_id = it.invoice_id "
/*added by kaustubh on 19-07-2017*/
/*+" and si.site_code = i.site_code "
+" and si.item_code = it.item_code "*/
+" and item.item_code = it.item_code "
/*changed by kaustubh on 19-07-2017*/
/*+" and t.tax_code = tx.tax_code "
+" and t.tax_type in ('G','H','I','J') "
+" and tx.tran_code = 'S-INV' "
+" and tx.tran_id = i.invoice_id ";*/
/*changed by kaustubh on 21-07-2017 / 3 aug */
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'S-INV' "
+"and ti.tran_id = i.invoice_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.invoice_id = ? ";
/*changed by kaustubh on 19-07-2017*/
/*+" and u.unit = item.unit ";*/
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"7A(1) B2CS");
/**
* 7A(2) B2CS Intra-state supplies by e-Commerce site *
*/
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, "
+" 'S' as GST_TYPE,"
+" '12' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, "
+" c.cust_name as CUST_NAME, "
+" st_c.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE, "
+" i.invoice_id as DOC_NO, "
+" i.tran_date as DOC_DATE, "
+" i.net_amt as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
+" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, "
+" 'N' as PROV_ASSMNT, "
+" i.stan_code__init as ORDER_NO,"
+" s.site_code as REMARKS, "
+" i.invoice_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, "
+" (select Tax_REG_2 from sales_pers where sales_pers=(select Sales_Pers from invoice where invoice_id=i.invoice_id)) as ECOM_REG_NO, "
+" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state st_c, state st_own"
+" where c.cust_code = i.cust_code "
+" and s.site_code = i.site_code "
+" and st_c.state_code = c.state_code "
+" and s.state_code = st_own.state_code "
+" and st_own.gst_code = st_c.gst_code " //Intra-state supply. Site.GST_CODE = Customer's SITE.GST_CODE
+" and c.tax_reg_2 = 'UNREGISTER' "
+" and i.inv_type = 'EC' "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV' "
+" and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') ";
if(taxClassAllStr.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStr+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? "
+" and (select count(1) from gst_data_hdr where ref_ser = 'S-INV' and ref_id = i.invoice_id ) = 0 ";
/**
* Detail B2CS Intra-state supplies 7A(1) B2CS *
*/
dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, "
+" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('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('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,"
+" 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('A' AS CHAR(1))) AS CGST_AMT,"
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV',i.invoice_id, it.line_no, ' ', 'T') 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,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_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, "
+" (it.quantity__stduom) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV',i.invoice_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('S-INV',i.invoice_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('S-INV',i.invoice_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +" fn_get_gst_rate('S-INV',i.invoice_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from invoice i,invoice_trace it, item "
+" where i.invoice_id = it.invoice_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 = 'S-INV' "
+"and ti.tran_id = i.invoice_id "
+"and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.invoice_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"7A(2) B2CS-ECOMM");
/** /**
* 7A(1) B2CS Header B2CS Intra-state supplies * * 7B(1) B2CS Header Inter-state supplies *
*/ */
hdrSql = " select '' as TRAN_ID, " hdrSql = " select '' as TRAN_ID, "
/* modified by kaustubh*/ /*modified by kaustubh*/
/*+" to_date(i.GP_DATE) as TRAN_DATE, "*/ /*+" to_date(i.GP_DATE) as TRAN_DATE, "*/
/* +" to_date(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end) as TRAN_DATE, " commented by kaustubh on 25 july 2017*/ /*+" to_date(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end) as TRAN_DATE, " commented by kaustubh on 25 july 2017*/
+" '' 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, " on 9 aug // +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
// +" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ," +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE," + " i.tran_date as PRD_CODE,"
/* +" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, "*/ /* +" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, "*/
...@@ -3789,55 +4434,57 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3789,55 +4434,57 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
hdrSql=hdrSql*/ hdrSql=hdrSql*/
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'S' as GST_TYPE," +" 'S' as GST_TYPE,"
+" '11' as TRAN_TYPE," +" '13' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +" i.cust_code as CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
+" st_c.GST_CODE, " +" st_c.GST_CODE, "
+" '' as SUBMISSION_TYPE," +" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM," +" '' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE, " +" 'R' as DOC_TYPE, "
/* modified by kaustubh*/ /*modified by kaustubh*/
/*+" i.GP_NO as DOC_NO, "*/ /* +" i.GP_NO as DOC_NO, "*/
//+"case when i.GP_NO is null then i.invoice_id else i.GP_NO end as DOC_NO, " // +"case when i.GP_NO is null then i.invoice_id else i.GP_NO end as DOC_NO, "
+" i.invoice_id as DOC_NO, " +" i.invoice_id as DOC_NO, "
/* +" 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, "
+" 'N' as REVERSE_CHRG, " +" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, " +" ' ' as LR_NO, "
// +" null as LR_DATE," commented by kaustubh 27 july 2017 // +" null as LR_DATE," commented by kaustubh 27 july 2017
+" ' ' as REAS_CODE, " +" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, " +" ' ' as REF_ID__INV, "
// +" null REF_DATE__INV, " commented by kaustubh 27 july 2017 // +" null REF_DATE__INV, " commented by kaustubh 27 july 2017
+" 'N' as PROV_ASSMNT, " +" 'N' as PROV_ASSMNT, "
+" i.stan_code__init as ORDER_NO," // +" i.stan_code__init as ORDER_NO," //
// +" 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, "
+" i.invoice_id as REF_ID, " +" i.invoice_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, " +" ' ' as SUBMIT_STATUS, "
// +" null SUBMIT_DATE, " commented by kaustubh 27 july 2017 // +" null SUBMIT_DATE, " commented by kaustubh 27 july 2017
+" '' ADD_USER, " +" '' ADD_USER, "
// +" sysdate as ADD_DATE, " commented by kaustubh 27 july 2017 // +" sysdate as ADD_DATE, " commented by kaustubh 27 july 2017
+" '' ADD_TERM, " +" '' ADD_TERM, "
+" ' ' CHG_USER, " +" ' ' CHG_USER, "
// +" sysdate CHG_DATE, " commented by kaustubh 27 july 2017 // +" sysdate CHG_DATE, " commented by kaustubh 27 july 2017
+" ' 'CHG_TERM, " +" ' 'CHG_TERM, "
+" c.tax_reg_2 as TAX_REG_NO, " +" c.tax_reg_2 as TAX_REG_NO, "
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " +" ' ' as ECOM_REG_NO, "
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state st_c, state st_own" +" from invoice i,customer c, site s, state st_c, state st_own "
+" where c.cust_code = i.cust_code " +" where c.cust_code = i.cust_code "
+" and s.site_code = i.site_code " +" and s.site_code = i.site_code "
+" and st_c.state_code = c.state_code " +" and st_c.state_code = c.state_code "
+" and s.state_code = st_own.state_code " +" and s.state_code = st_own.state_code "
+" and st_own.gst_code = st_c.gst_code " //Intra-state supply. Site.GST_CODE = Customer's SITE.GST_CODE +" and st_own.gst_code <> st_c.gst_code " //Site.GST_CODE<>Customer's SITE.GST_CODE
+" and c.tax_reg_2 = 'UNREGISTER' " +" and c.tax_reg_2 = 'UNREGISTER' "
+" and i.net_amt <= "+GST_B2CL_INV_VAL+" "
+" and i.inv_type <> 'EC' "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
// +" and i.conf_date between ? and ? " commented by kaustubh on 27 july //+" and i.conf_date between ? and ? " commented by kaustubh 27 july 2017
/* below added on 22 aug */ /*below added on 22 aug */
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV' " +" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV' "
+" and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') "; +" and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') ";
if(taxClassAllStr.length() > 0) if(taxClassAllStr.length() > 0)
...@@ -3847,10 +4494,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3847,10 +4494,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
} }
hdrSql = hdrSql +" ) > 0 " hdrSql = hdrSql +" ) > 0 "
+" and i.tran_date between ? and ? " +" and i.tran_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 = 'S-INV' and ref_id = i.invoice_id ) = 0 ";
/** /**
* Detail B2CS Intra-state supplies 7A(1) B2CS * * Detail Inter-state supplies 7B(1) B2CS *
*/ */
dtlSql = " select '' as TRAN_ID, " dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, " +" it.line_no as LINE_NO, "
...@@ -3867,8 +4514,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3867,8 +4514,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" (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," +" case when t.tax_type = 'G' then tx.tax_perc else 0 end 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,"*/
/* + "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE," /*+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
+ "fn_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') 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,"
...@@ -3877,49 +4524,49 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3877,49 +4524,49 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'R') as SGST_PERC," + "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'A') as SGST_AMT,"*/ + "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'A') as SGST_AMT,"*/
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))) 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," +" 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('A' AS CHAR(1))) AS CGST_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('A' AS CHAR(1))) AS CGST_AMT," +" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
+" fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT,";
}
} 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') 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," + "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'A') as CGST_AMT," + "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'R') as SGST_PERC," + "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'A') as SGST_AMT,";
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'A') as SGST_AMT,"; }
} dtlSql = dtlSql
dtlSql = dtlSql
// +" item.sh_descr GS_DESCR," commented by kaustubh on 28 july 2017
// +" item.sh_descr GS_DESCR," commented by kaustubh on 28 july 2017 // +" item.descr as GS_DESCR,"
// +" item.descr as GS_DESCR," +" ' ' as GS_DESCR, "
+" ' ' as GS_DESCR, " /*changed by kaustubh on 19-07-2017*/
/*changed by kaustubh on 19-07-2017*/
/*+" u.descr as UNIT,"*/ /*+" u.descr as UNIT,"*/
// +"item.UNIT as UNIT," // +"item.UNIT as UNIT,"
+"(select case when udf_str2 is null then descr else udf_str2 end as Unit from uom where unit=it.unit) as UNIT, " +"(select case when udf_str2 is null then descr else udf_str2 end as Unit from uom where unit=it.unit) as UNIT, "
+" (it.quantity__stduom) as QUANTITY," +" (it.quantity__stduom) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ; +" 'OE' as SUPPLY_TYPE," ;
/*changed by kaustubh on 19-07-2017*/ /*changed by kaustubh on 19-07-2017*/
/*+" case when t.tax_type = 'J' then tx.tax_perc else 0 end as CESS_PERC," /*+" case when t.tax_type = 'J' then tx.tax_perc else 0 end 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,"*/
/*+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'R') as CESS_PERC," /* +"fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'A') as CESS_AMT,"*/ +"fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'A') as CESS_AMT,"*/
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC," dtlSql = dtlSql + "fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_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('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,"; +"fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
} }
else else
...@@ -3930,12 +4577,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3930,12 +4577,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+"fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'A') as CESS_AMT,"; +"fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'A') as CESS_AMT,";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" '' as REMARKS ,"; +" '' as REMARKS ,";
/*added by kaustubh on 19-07-2017*/ /*changed by kaustubh on 19-07-2017*/
// +"fn_get_gst_rate('S-INV',i.invoice_id, it.line_no) as gst_rate " //+"fn_get_gst_rate('S-INV',i.invoice_id, it.line_no) as gst_rate "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql +" fn_get_gst_rate('S-INV',i.invoice_id,CAST(it.line_no as char(3))) as gst_rate "; dtlSql = dtlSql +" fn_get_gst_rate('S-INV',i.invoice_id,CAST(it.line_no as char(3))) as gst_rate ";
} }
...@@ -3944,105 +4591,79 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -3944,105 +4591,79 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = dtlSql +" fn_get_gst_rate('S-INV',i.invoice_id, it.line_no) as gst_rate "; dtlSql = dtlSql +" fn_get_gst_rate('S-INV',i.invoice_id, it.line_no) as gst_rate ";
} }
dtlSql = dtlSql dtlSql = dtlSql
/*changed by kaustubh on 19-07-2017*/ /*changed by kaustubh on 19-07-2017*/
/*+" from invoice i,invoice_trace it,taxtran tx, siteitem si, tax t, item, uom u "*/ /*+" from invoice i,invoice_trace it,taxtran tx, siteitem si, tax t, item,uom u "*/
+" from invoice i,invoice_trace it, item " +" from invoice i,invoice_trace it, item "
+" where i.invoice_id = it.invoice_id " +" where i.invoice_id = it.invoice_id "
/*added by kaustubh on 19-07-2017*/
/*+" and si.site_code = i.site_code " /*+" and si.site_code = i.site_code "
+" and si.item_code = it.item_code "*/ +" and si.item_code = it.item_code "*/
+" and item.item_code = it.item_code " +" and item.item_code = it.item_code "
/*changed by kaustubh on 19-07-2017*/ /*changed by kaustubh on 19-07-2017*/
/*+" and t.tax_code = tx.tax_code " /*+" and t.tax_code = tx.tax_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 = 'S-INV' "
+" and tx.tran_id = i.invoice_id ";*/ +" and tx.tran_id = i.invoice_id ";*/
/*changed by kaustubh on 21-07-2017 / 3 aug */ /* 3 aug uncommented */
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'S-INV' " +"and ti.tran_code = 'S-INV' "
+"and ti.tran_id = i.invoice_id " +"and ti.tran_id = i.invoice_id "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
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 ";
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
} }
else else
{ {
//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 to_number(trim(ti.line_no)) = it.line_no ) > 0"; dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" and i.invoice_id = ? "; +" and i.invoice_id = ? ";
/*changed by kaustubh on 19-07-2017*/ /*changed by kaustubh on 19-07-2017*/
/*+" and u.unit = item.unit ";*/ /*+" and u.unit = item.unit ";*/
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"7A(1) B2CS"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"7B(1) B2CS");
/** /**
* 7B(1) B2CS Header Inter-state supplies * * 7B(2) B2CS Inter-state supplies by e-Commerce site *
*/ */
hdrSql = " select '' as TRAN_ID, " hdrSql = " select '' as TRAN_ID, "
/*modified by kaustubh*/
/*+" to_date(i.GP_DATE) as TRAN_DATE, "*/
/*+" to_date(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end) as TRAN_DATE, " commented by kaustubh on 25 july 2017*/
+" '' 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, "
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ," +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ " i.tran_date as PRD_CODE," + " i.tran_date as PRD_CODE,"
/* +" to_char(i.GP_DATE,'MMYYYY') as PRD_CODE, "*/
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" cast(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE, ";
}
else
{
hdrSql = hdrSql +"to_char(case when i.GP_DATE is null then i.tran_date else i.GP_DATE end,'MMYYYY') as PRD_CODE,";
}
hdrSql=hdrSql*/
+" '1' as REC_TYPE, " +" '1' as REC_TYPE, "
+" 'S' as GST_TYPE," +" 'S' as GST_TYPE,"
+" '13' as TRAN_TYPE," +" '14' as TRAN_TYPE,"
+" i.cust_code as CUST_CODE, " +" i.cust_code as CUST_CODE, "
+" c.cust_name as CUST_NAME, " +" c.cust_name as CUST_NAME, "
+" st_c.GST_CODE, " +" st_c.GST_CODE, "
+" '' as SUBMISSION_TYPE," +" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM," +" '' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE, " +" 'R' as DOC_TYPE, "
/*modified by kaustubh*/
/* +" i.GP_NO as DOC_NO, "*/
// +"case when i.GP_NO is null then i.invoice_id else i.GP_NO end as DOC_NO, "
+" i.invoice_id as DOC_NO, " +" i.invoice_id as DOC_NO, "
/* +" i.gp_date as DOC_DATE, "*/
// +"case when i.gp_date is null then i.tran_date else i.gp_date end as DOC_DATE,"
+" i.tran_date as DOC_DATE," +" i.tran_date as DOC_DATE,"
+" i.net_amt as AMOUNT, " +" i.net_amt as AMOUNT, "
+" 'N' as REVERSE_CHRG, " +" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, " +" ' ' as LR_NO, "
// +" null as LR_DATE," commented by kaustubh 27 july 2017
+" ' ' as REAS_CODE, " +" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, " +" ' ' as REF_ID__INV, "
// +" null REF_DATE__INV, " commented by kaustubh 27 july 2017
+" 'N' as PROV_ASSMNT, " +" 'N' as PROV_ASSMNT, "
+" i.stan_code__init as ORDER_NO," // +" i.stan_code__init as ORDER_NO," //
// +" null as ORDER_DATE, " commented by kaustubh 27 july 2017
//+" i.invoice_id as REMARKS, "
+" s.site_code as REMARKS, " +" s.site_code as REMARKS, "
+" i.invoice_id as REF_ID, " +" i.invoice_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, " +" ' ' as SUBMIT_STATUS, "
// +" null SUBMIT_DATE, " commented by kaustubh 27 july 2017
+" '' ADD_USER, " +" '' ADD_USER, "
// +" sysdate as ADD_DATE, " commented by kaustubh 27 july 2017
+" '' ADD_TERM, " +" '' ADD_TERM, "
+" ' ' CHG_USER, " +" ' ' CHG_USER, "
// +" sysdate CHG_DATE, " commented by kaustubh 27 july 2017
+" ' 'CHG_TERM, " +" ' 'CHG_TERM, "
+" c.tax_reg_2 as TAX_REG_NO, " +" c.tax_reg_2 as TAX_REG_NO, "
+" ' ' as RECO_STATUS, " +" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, " // +" ' ' as ECOM_REG_NO, "
+"( select Tax_REG_2 from sales_pers where sales_pers=(select Sales_Pers from invoice where invoice_id=i.invoice_id)) as ECOM_REG_NO ,"
+" 'S-INV' as ref_ser " +" 'S-INV' as ref_ser "
+" from invoice i,customer c, site s, state st_c, state st_own " +" from invoice i,customer c, site s, state st_c, state st_own "
+" where c.cust_code = i.cust_code " +" where c.cust_code = i.cust_code "
...@@ -4052,14 +4673,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4052,14 +4673,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and st_own.gst_code <> st_c.gst_code " //Site.GST_CODE<>Customer's SITE.GST_CODE +" and st_own.gst_code <> st_c.gst_code " //Site.GST_CODE<>Customer's SITE.GST_CODE
+" and c.tax_reg_2 = 'UNREGISTER' " +" and c.tax_reg_2 = 'UNREGISTER' "
+" and i.net_amt <= "+GST_B2CL_INV_VAL+" " +" and i.net_amt <= "+GST_B2CL_INV_VAL+" "
+" and i.inv_type = 'EC' "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' " +" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
//+" and i.conf_date between ? and ? " commented by kaustubh 27 july 2017
/*below added on 22 aug */
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV' " +" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_code = 'S-INV' "
+" and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') "; +" and ti.tran_id = i.invoice_id and tm.tax_type in ('G','H','I','J') ";
if(taxClassAllStr.length() > 0) if(taxClassAllStr.length() > 0)
{ {
//hdrSql = hdrSql +" and ti.tax_class in ("+taxClassAllStr+") ";
hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStr+") "; hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStr+") ";
} }
hdrSql = hdrSql +" ) > 0 " hdrSql = hdrSql +" ) > 0 "
...@@ -4074,26 +4693,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4074,26 +4693,6 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'A' as STATUS, " +" 'A' as STATUS, "
+" 0 as SR_NO__OLD, " +" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,"; +" 'G' as LINE_TYPE,";
/*changed by kaustubh on 19-07-2017*/
/*+" 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,"
+" (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,"
+" (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,"
+" (case when t.tax_type = 'G' then tx.tax_amt else 0 end) as SGST_AMT,"*/
/*+ "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, '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,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'A') as SGST_AMT,"*/
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,"
...@@ -4118,22 +4717,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4118,22 +4717,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+ "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'A') as SGST_AMT,"; + "fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'G', 'A') as SGST_AMT,";
} }
dtlSql = dtlSql dtlSql = dtlSql
// +" item.sh_descr GS_DESCR," commented by kaustubh on 28 july 2017
// +" item.descr as GS_DESCR,"
+" ' ' as GS_DESCR, " +" ' ' as GS_DESCR, "
/*changed by kaustubh on 19-07-2017*/
/*+" u.descr as UNIT,"*/
// +"item.UNIT as UNIT,"
+"(select case when udf_str2 is null then descr else udf_str2 end as Unit from uom where unit=it.unit) as UNIT, " +"(select case when udf_str2 is null then descr else udf_str2 end as Unit from uom where unit=it.unit) as UNIT, "
+" (it.quantity__stduom) as QUANTITY," +" (it.quantity__stduom) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ; +" 'OE' as SUPPLY_TYPE," ;
/*changed by kaustubh on 19-07-2017*/
/*+" case when t.tax_type = 'J' then tx.tax_perc else 0 end as CESS_PERC,"
+" (case when t.tax_type = 'J' then tx.tax_amt else 0 end) as CESS_AMT,"*/
/* +"fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'A') as CESS_AMT,"*/
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC," dtlSql = dtlSql + "fn_gst_rate_amt(CAST('S-INV' AS VARCHAR(6)),i.invoice_id,CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
...@@ -4141,17 +4728,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4141,17 +4728,12 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
} }
else else
{ {
dtlSql = dtlSql +"fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'R') as CESS_PERC," dtlSql = dtlSql +"fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'A') as CESS_AMT,"; +"fn_gst_rate_amt('S-INV',i.invoice_id, it.line_no, 'J', 'A') as CESS_AMT,";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" '' as REMARKS ,"; +" '' as REMARKS ,";
/*changed by kaustubh on 19-07-2017*/
//+"fn_get_gst_rate('S-INV',i.invoice_id, it.line_no) as gst_rate "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
dtlSql = dtlSql +" fn_get_gst_rate('S-INV',i.invoice_id,CAST(it.line_no as char(3))) as gst_rate "; dtlSql = dtlSql +" fn_get_gst_rate('S-INV',i.invoice_id,CAST(it.line_no as char(3))) as gst_rate ";
...@@ -4161,42 +4743,30 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4161,42 +4743,30 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = dtlSql +" fn_get_gst_rate('S-INV',i.invoice_id, it.line_no) as gst_rate "; dtlSql = dtlSql +" fn_get_gst_rate('S-INV',i.invoice_id, it.line_no) as gst_rate ";
} }
dtlSql = dtlSql dtlSql = dtlSql
/*changed by kaustubh on 19-07-2017*/
/*+" from invoice i,invoice_trace it,taxtran tx, siteitem si, tax t, item,uom u "*/
+" from invoice i,invoice_trace it, item " +" from invoice i,invoice_trace it, item "
+" where i.invoice_id = it.invoice_id " +" where i.invoice_id = it.invoice_id "
/*+" and si.site_code = i.site_code "
+" and si.item_code = it.item_code "*/
+" and item.item_code = it.item_code " +" and item.item_code = it.item_code "
/*changed by kaustubh on 19-07-2017*/
/*+" and t.tax_code = tx.tax_code "
+" and t.tax_type in ('G','H','I','J') "
+" and tx.tran_code = 'S-INV' "
+" and tx.tran_id = i.invoice_id ";*/
/* 3 aug uncommented */
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code " +"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'S-INV' " +"and ti.tran_code = 'S-INV' "
+"and ti.tran_id = i.invoice_id " +"and ti.tran_id = i.invoice_id "
+"and tx.tax_type in ('G','H','I','J')" ; +"and tx.tax_type in ('G','H','I','J')" ;
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(ti.line_no as integer) = it.line_no ) > 0"; dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
} }
else 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 to_number(trim(ti.line_no)) = it.line_no ) > 0";
} }
dtlSql = dtlSql dtlSql = dtlSql
+" and i.invoice_id = ? "; +" and i.invoice_id = ? ";
/*changed by kaustubh on 19-07-2017*/
/*+" and u.unit = item.unit ";*/ retString = executeSqlAndPopulateData(hdrSql,dtlSql,"7B(2) B2CS-ECOMM");
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"7B(1) B2CS");
/******** 8A Started *****/ /******** 8A Started *****/
/** /**
...@@ -4271,7 +4841,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4271,7 +4841,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id "; +" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
{ {
hdrSql = hdrSql +" and ti.tax_class in ("+GST_NIL_TAXCLASS+") ";
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL')) ";
} }
if(GST_NIL_TAXENV.length() > 0) if(GST_NIL_TAXENV.length() > 0)
{ {
...@@ -4486,7 +5057,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4486,7 +5057,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id "; +" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_EXE_TAXCLASS.length() > 0) if(GST_EXE_TAXCLASS.length() > 0)
{ {
hdrSql = hdrSql +" and ti.tax_class in ("+GST_EXE_TAXCLASS+") "; hdrSql = hdrSql +" and ti.tax_class in ("+GST_EXE_TAXCLASS+") ";
} }
if(GST_EXE_TAXENV.length() > 0) if(GST_EXE_TAXENV.length() > 0)
{ {
...@@ -4702,7 +5273,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4702,7 +5273,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id "; +" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
{ {
hdrSql = hdrSql +" and ti.tax_class in ("+GST_NIL_TAXCLASS+") "; hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL')) ";
} }
if(GST_NIL_TAXENV.length() > 0) if(GST_NIL_TAXENV.length() > 0)
{ {
...@@ -4918,7 +5489,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -4918,7 +5489,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') "; +" and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I','J') ";
if(taxClassAllStr.length() > 0) if(taxClassAllStr.length() > 0)
{ {
hdrSql = hdrSql +" and ti.tax_class in ("+GST_NIL_TAXCLASS+") ";
hdrSql = hdrSql +" and ti.tax_class in ("+GST_NIL_TAXCLASS+") ";
} }
/*if(taxEnvAllStr.length() > 0) /*if(taxEnvAllStr.length() > 0)
{ {
...@@ -5119,7 +5691,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5119,7 +5691,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id "; +" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
{ {
hdrSql = hdrSql +" and ti.tax_class in ("+GST_NIL_TAXCLASS+") "; hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL'))";
} }
if(GST_NIL_TAXENV.length() > 0) if(GST_NIL_TAXENV.length() > 0)
{ {
...@@ -5335,7 +5907,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5335,7 +5907,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id "; +" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_EXE_TAXCLASS.length() > 0) if(GST_EXE_TAXCLASS.length() > 0)
{ {
hdrSql = hdrSql +" and ti.tax_class in ("+GST_EXE_TAXCLASS+") "; //hdrSql = hdrSql +" and ti.tax_class in ("+GST_EXE_TAXCLASS+") ";
hdrSql = hdrSql +" and ti.tax_class in ("+GST_EXE_TAXCLASS+") ";
} }
if(GST_EXE_TAXENV.length() > 0) if(GST_EXE_TAXENV.length() > 0)
{ {
...@@ -5546,7 +6119,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5546,7 +6119,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id "; +" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
{ {
hdrSql = hdrSql +" and ti.tax_class in ("+GST_NIL_TAXCLASS+") "; hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL')) ";
} }
if(GST_NIL_TAXENV.length() > 0) if(GST_NIL_TAXENV.length() > 0)
{ {
...@@ -5764,7 +6337,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5764,7 +6337,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id "; +" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
{ {
hdrSql = hdrSql +" and ti.tax_class in ("+GST_NIL_TAXCLASS+") "; hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL') )";
} }
if(GST_NIL_TAXENV.length() > 0) if(GST_NIL_TAXENV.length() > 0)
{ {
...@@ -5979,7 +6552,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5979,7 +6552,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id "; +" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_EXE_TAXCLASS.length() > 0) if(GST_EXE_TAXCLASS.length() > 0)
{ {
hdrSql = hdrSql +" and ti.tax_class in ("+GST_EXE_TAXCLASS+") "; hdrSql = hdrSql +" and ti.tax_class in ("+GST_EXE_TAXCLASS+") ";
} }
if(GST_EXE_TAXENV.length() > 0) if(GST_EXE_TAXENV.length() > 0)
{ {
...@@ -6196,7 +6769,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6196,7 +6769,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id "; +" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
{ {
hdrSql = hdrSql +" and ti.tax_class in ("+GST_NIL_TAXCLASS+") "; hdrSql = hdrSql +" and (ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL') )";
} }
if(GST_NIL_TAXENV.length() > 0) if(GST_NIL_TAXENV.length() > 0)
{ {
...@@ -6416,7 +6989,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6416,7 +6989,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id "; +" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
{ {
hdrSql = hdrSql +" and ti.tax_class in ("+GST_NIL_TAXCLASS+") "; hdrSql = hdrSql +" and ( ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL') )";
} }
if(GST_NIL_TAXENV.length() > 0) if(GST_NIL_TAXENV.length() > 0)
{ {
...@@ -6631,7 +7204,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6631,7 +7204,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id "; +" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_EXE_TAXCLASS.length() > 0) if(GST_EXE_TAXCLASS.length() > 0)
{ {
hdrSql = hdrSql +" and ti.tax_class in ("+GST_EXE_TAXCLASS+") "; hdrSql = hdrSql +" and ti.tax_class in ("+GST_EXE_TAXCLASS+") ";
} }
if(GST_EXE_TAXENV.length() > 0) if(GST_EXE_TAXENV.length() > 0)
{ {
...@@ -6847,7 +7420,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6847,7 +7420,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id "; +" and (select count(1) from taxtran ti where ti.tran_code = 'S-INV' and ti.tran_id = i.invoice_id ";
if(GST_NIL_TAXCLASS.length() > 0) if(GST_NIL_TAXCLASS.length() > 0)
{ {
hdrSql = hdrSql +" and ti.tax_class in ("+GST_NIL_TAXCLASS+") "; hdrSql = hdrSql +" and ( ti.tax_class in ("+GST_NIL_TAXCLASS+") OR ti.tax_chap in ('GST-NIL') )";
} }
if(GST_NIL_TAXENV.length() > 0) if(GST_NIL_TAXENV.length() > 0)
{ {
...@@ -13814,7 +14387,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -13814,7 +14387,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'N' as PROV_ASSMNT,"// -- not required +" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required +" '' as ORDER_NO,"// -- not required
+" c.site_code as REMARKS, " // added on 9 aug +" c.site_code as REMARKS, " // added on 9 aug
+" i.invoice_no as REF_ID, " +" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS," +" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER," +" '' ADD_USER,"
+" '' ADD_TERM," +" '' ADD_TERM,"
...@@ -13959,7 +14532,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -13959,7 +14532,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" 'N' as PROV_ASSMNT,"// -- not required +" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required +" '' as ORDER_NO,"// -- not required
+" c.site_code as REMARKS, " // added on 9 aug +" c.site_code as REMARKS, " // added on 9 aug
+" i.invoice_no as REF_ID, " +" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS," +" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER," +" '' ADD_USER,"
+" '' ADD_TERM," +" '' ADD_TERM,"
...@@ -24283,11 +24856,11 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -24283,11 +24856,11 @@ dtlSql = " select '' as TRAN_ID, "
+" 'Y' as REVERSE_CHRG," +" 'Y' as REVERSE_CHRG,"
+" ' ' as LR_NO," +" ' ' as LR_NO,"
+" ' ' as REAS_CODE," +" ' ' as REAS_CODE,"
+" i.invoice_no as REF_ID__INV," +" i.tran_id as REF_ID__INV,"
+" 'N' as PROV_ASSMNT,"// -- not required +" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required +" '' as ORDER_NO,"// -- not required
+" c.site_code as REMARKS, " // added on 9 aug +" c.site_code as REMARKS, " // added on 9 aug
+" i.invoice_no as REF_ID, " +" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS," +" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER," +" '' ADD_USER,"
+" '' ADD_TERM," +" '' ADD_TERM,"
...@@ -24434,7 +25007,7 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -24434,7 +25007,7 @@ dtlSql = " select '' as TRAN_ID, "
+" 'N' as PROV_ASSMNT,"// -- not required +" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required +" '' as ORDER_NO,"// -- not required
+" c.site_code as REMARKS, " // added on 9 aug +" c.site_code as REMARKS, " // added on 9 aug
+" i.invoice_no as REF_ID, " +" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS," +" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER," +" '' ADD_USER,"
+" '' ADD_TERM," +" '' ADD_TERM,"
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