Commit eed884e1 authored by kdabholkar's avatar kdabholkar

adding new queries in GSTR2 for B2B against customer

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@186647 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a351186c
...@@ -5522,7 +5522,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -5522,7 +5522,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
dtlSql = " select '' as TRAN_ID, " dtlSql = " select '' as TRAN_ID, "
+" it.line_no as LINE_NO, " +" it.line_no as LINE_NO, "
+" 'A' as STATUS, " +" 'A' as STATUS, "
+" 0 as SR_NO__OLD, "; +" 0 as SR_NO__OLD, "
+" 'G' as LINE_TYPE,";
/*changed by kaustubh on 19-07-2017*/ /*changed by kaustubh on 19-07-2017*/
/*+" 'G' as LINE_TYPE," /*+" 'G' as LINE_TYPE,"
+" si.hsn_no as GS_CODE, " +" si.hsn_no as GS_CODE, "
...@@ -6894,7 +6895,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc ...@@ -6894,7 +6895,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
// +" 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, "
+" u.descr as UNIT," // +" u.descr as UNIT,"
/*changed by kaustubh on 19-07-2017*/ /*changed by kaustubh on 19-07-2017*/
// +" 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, "
...@@ -27366,6 +27367,222 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -27366,6 +27367,222 @@ dtlSql = " select '' as TRAN_ID, "
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"3(A) M-VOUC(REG)-TRAN"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"3(A) M-VOUC(REG)-TRAN");
} }
/**Added by Kaustubh on 15 june 2018 for B2B against Customer Start**/
{
hdrSql = " select '' as TRAN_ID,"
/*+" 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,"
+" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'R' as GST_TYPE,"
+" '01' as TRAN_TYPE,"// -- b2b,b2c
+" i.sundry_code as CUST_CODE,"
+" c.cust_code as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
/*+"case when i.gp_no is null then i.tran_id else i.gp_no end as DOC_NO,"
+" i.tran_date as DOC_DATE,"*/
+" i.bill_no as DOC_NO, "
+" i.bill_date as DOC_DATE,"
// +"case when i.gp_date is null then i.tran_date else i.gp_date end as DOC_DATE,"
+" i.net_amt as AMOUNT,"
+" 'Y' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
// +" null as LR_DATE," \
+" ' ' as REAS_CODE,"
+" ' ' as REF_ID__INV,"
// +" null REF_DATE__INV," commented by kaustubh 27 july 2017
+" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required
// +" null as ORDER_DATE,"// -- not required
//+" i.tran_id as REMARKS,"
+" s.site_code as REMARKS, " // on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
// +" null SUBMIT_DATE,"
+" '' ADD_USER,"
// +" sysdate ADD_DATE,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
// +" sysdate CHG_DATE,"
+" i.TRAN_DATE as CHG_DATE, "
+" ' 'CHG_TERM,"
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO,"
+" 'M-VOUC' as ref_ser"
+" from misc_voucher i,customer c, site s, state state "
+" where c.cust_code = i.sundry_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.vouch_type not in ('C','D') "
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id "
// +" and tm.TAX_GROUP IN ('ITC','NITC') "
+" and tm.TAX_GROUP IN ('ITC','NITC','RCM') "
+" and tm.tax_type in ('G','H','I','J')";
if(taxClassAllStrOfPurchase.length() > 0)
{
//hdrSql = hdrSql +" and ti.tax_class not in ("+taxClassAllStr+") ";
hdrSql = hdrSql +" and (ti.tax_class not in ("+taxClassAllStrOfPurchase+") or ti.tax_chap not in ("+TAX_CHAP_STR+") ) ";
}
if(taxEnvAllStrOfPurchase.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env not in ("+taxEnvAllStrOfPurchase+") ";
}
hdrSql = hdrSql +" ) > 0 "
+" and case when i.confirmed is null then 'N' else i.confirmed end = 'Y' "
+" and i.tran_date between ? and ? "
/* if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
hdrSql = hdrSql +" and i.tran_date < '"+currMonthStartDate+"' ";
}
else
{
hdrSql = hdrSql +" and i.tran_date < '"+strDate+"' ";
}
hdrSql = hdrSql */
+" and (select count(1) from gst_data_hdr where ref_ser = 'M-VOUC' and ref_id = i.tran_id ) = 0 ";
/**
* Detail MISC-Voucher(supplier) 3(A) M-VOUC REG *
*/
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
+" case when it.item_code is null then 'S' else 'G' end as LINE_TYPE, "
+"(select CASE "
+"WHEN (NVL(GH.anal_code,'X')<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GH.anal_code) "
+" WHEN (NVL(GH.anal_code,'X')='X' AND GD.anal_code<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GD.anal_code) "
+" WHEN (NVL(GH.anal_code,'X')='X' AND GD.anal_code='X') "
+ " THEN fn_get_hsn_sac(GH.site_code,'',GD.acct_code) END "
+ "from misc_voucher GH,misc_vouchdet GD where GH.tran_id=GD.tran_id and GH.tran_id=i.tran_id "
+ " and it.line_no=GD.line_no ) GS_CODE, " ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
/*if ("A".equalsIgnoreCase(MISC_VOUC_TYPE))
{
dtlSql = dtlSql +"i.anal_code as GS_CODE,";
}
else
{
dtlSql = dtlSql +"fn_get_hsn_sac(i.site_code,'',it.acct_code) AS GS_CODE,";
}*/
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC, "
+" fn_gst_rate_amt(CAST('M-VOUC' 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('M-VOUC' 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('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT, ";
}
else
{
dtlSql = dtlSql
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
// +" item.descr as GS_DESCR,"
// +" accounts.sac_no as GS_DESCR, "
+" ' ' as GS_DESCR, "
// +" item.UNIT as UNIT,"
+" 'OTH' 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('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
//dtlSql = dtlSql
//+" '' as REMARKS ,"
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'is' as ITC_TYPE , ";
// +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
// +" from misc_voucher i,misc_vouchdet it, item item "
+" from misc_voucher i,misc_vouchdet it "
// +" from misc_voucher i,misc_vouchdet it,accounts "
+" where i.tran_id = it.tran_id "
// +" and item.item_code = it.item_code "
// +"and accounts.acct_code=it.acct_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
//+ " and tx.tax_group IN ('ITC','RCM') "
+" and tx.TAX_GROUP IN ('ITC','NITC','RCM') "
+"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";
//dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
}
else
{
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
//dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no ";
}
dtlSql = dtlSql
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"3(A) M-VOUC(REG)CUST");
}
/* 3(A) ---B2B Export to SEZ with payment 3(A) SEWP(REG) */ /* 3(A) ---B2B Export to SEZ with payment 3(A) SEWP(REG) */
...@@ -27947,49 +28164,216 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -27947,49 +28164,216 @@ dtlSql = " select '' as TRAN_ID, "
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"SEWP-M-VOUC(REG)TRAN"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"SEWP-M-VOUC(REG)TRAN");
} }
/** /*******Added by Kaustubh on 15 june 2018 start against customer ( SEWOP Heade)********/
* 3(A) SEWOP Header (porcp)--- B2B Export to SEZ without payment (REG) * {
*/
{
hdrSql = " select '' as TRAN_ID, " hdrSql = " select '' as TRAN_ID,"
/* +" to_date(i.GP_DATE) as TRAN_DATE, "*/ +" '' as TRAN_ID__REF,"
+" '' as TRAN_ID__REF, " +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , "
/// +" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, " on 9 aug + "i.tran_date as PRD_CODE,"
// +" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ," +" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ," +" 'I' as GST_TYPE,"
+ " i.tran_date as PRD_CODE," +" '02' as TRAN_TYPE,"// -- b2b,b2c
+" '2' as REC_TYPE, " +" i.sundry_code as CUST_CODE,"
+" 'I' as GST_TYPE," +" c.cust_code as CUST_NAME,"
+" '03' as TRAN_TYPE," +" state.GST_CODE,"// -- 2 digit code
+" i.supp_code as CUST_CODE, " +" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" c.supp_name as CUST_NAME, " +" ' ' as DOC_CHECKSUM,"
+" state.GST_CODE, " +" 'SEWP' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" '' as SUBMISSION_TYPE," +" i.bill_no as DOC_NO, "
+" '' as DOC_CHECKSUM," +" i.bill_date as DOC_DATE,"
+" 'SEWOP' as DOC_TYPE, " +" i.net_amt as AMOUNT,"
// +"case when i.excise_ref is null then i.invoice_no else i.excise_ref end as DOC_NO," +" 'N' as REVERSE_CHRG,"
+" i.INVOICE_NO as DOC_NO," +" ' ' as LR_NO,"
+" i.invoice_date as DOC_DATE," +" ' ' as REAS_CODE,"
+" i.amount as AMOUNT, " +" ' ' as REF_ID__INV,"
+" 'N' as REVERSE_CHRG, " +" 'N' as PROV_ASSMNT,"// -- not required
+" ' ' as LR_NO, " +" '' as ORDER_NO,"// -- not required
// +" i.lr_date as LR_DATE," +" s.site_code as REMARKS, " // on 9 aug
+" ' ' as REAS_CODE, " +" i.tran_id as REF_ID, "
+" ' ' as REF_ID__INV, " +" ' ' as SUBMIT_STATUS,"
// +" null REF_DATE__INV, " +" '' ADD_USER,"
+" 'N' as PROV_ASSMNT, " +" '' ADD_TERM,"
//+" i.stan_code__init as ORDER_NO," +" ' ' CHG_USER,"
+" ' ' as ORDER_NO," +" i.TRAN_DATE as CHG_DATE, "
// +" null as ORDER_DATE, " +" ' 'CHG_TERM,"
//+" i.invoice_id as REMARKS, " +" c.tax_reg_2 as TAX_REG_NO,"
+" s.site_code as REMARKS, " // on 9 aug +" ' ' as RECO_STATUS,"
+" i.tran_id as REF_ID, " +" ' ' as ECOM_REG_NO,"
+" ' ' as SUBMIT_STATUS, " +" 'M-VOUC' as ref_ser"
// +" null SUBMIT_DATE, " +" from misc_voucher i,customer c, site s, state state "
+" '' ADD_USER, " +" where c.cust_code = i.sundry_code "
// +" sysdate as ADD_DATE, " +" and s.site_code = i.site_code "
+" '' ADD_TERM, " +" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.sundry_type ='T' AND i.vouch_type NOT IN ('C','D')"
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and tm.TAX_GROUP IN ('RCM') "
+" and ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I')";
if(GST_PURSEZWP_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_PURSEZWP_TAXCLASS+") or ti.tax_chap not in ("+TAX_CHAP_STR+") ) ";
}
if(GST_PURSEZWP_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWP_TAXENV+") ";
}
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 = 'M-VOUC' and ref_id = i.tran_id ) = 0 ";
/**
* Detail from MISC-Voucher(transport-REG) *
*/
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,"
+" case when it.item_code is null then 'S' else 'G' end as LINE_TYPE, "
+"(select CASE "
+"WHEN (NVL(GH.anal_code,'X')<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GH.anal_code) "
+" WHEN (NVL(GH.anal_code,'X')='X' AND GD.anal_code<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GD.anal_code) "
+" WHEN (NVL(GH.anal_code,'X')='X' AND GD.anal_code='X') "
+ " THEN fn_get_hsn_sac(GH.site_code,'',GD.acct_code) END "
+ "from misc_voucher GH,misc_vouchdet GD where GH.tran_id=GD.tran_id and GH.tran_id=i.tran_id "
+ " and it.line_no=GD.line_no ) GS_CODE, " ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC, "
+" fn_gst_rate_amt(CAST('M-VOUC' 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('M-VOUC' 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('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT, ";
}
else
{
dtlSql = dtlSql
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" 'OTH' 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('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'is' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from misc_voucher i,misc_vouchdet it "
+" where i.tran_id = it.tran_id "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
+"and tx.TAX_GROUP = 'RCM' "
+"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.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"SEWP-M-VOUC(REG)CUST");
}
/**
* 3(A) SEWOP Header (porcp)--- B2B Export to SEZ without payment (REG) *
*/
{
hdrSql = " select '' as TRAN_ID, "
/* +" to_date(i.GP_DATE) 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, " 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,"
+" '2' as REC_TYPE, "
+" 'I' as GST_TYPE,"
+" '03' as TRAN_TYPE,"
+" i.supp_code as CUST_CODE, "
+" c.supp_name as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" 'SEWOP' as DOC_TYPE, "
// +"case when i.excise_ref is null then i.invoice_no else i.excise_ref end as DOC_NO,"
+" i.INVOICE_NO as DOC_NO,"
+" i.invoice_date as DOC_DATE,"
+" i.amount as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
// +" i.lr_date as LR_DATE,"
+" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, "
// +" null REF_DATE__INV, "
+" 'N' as PROV_ASSMNT, "
//+" i.stan_code__init as ORDER_NO,"
+" ' ' as ORDER_NO,"
// +" null as ORDER_DATE, "
//+" i.invoice_id as REMARKS, "
+" s.site_code as REMARKS, " // on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS, "
// +" null SUBMIT_DATE, "
+" '' ADD_USER, "
// +" sysdate as ADD_DATE, "
+" '' ADD_TERM, "
+" ' ' CHG_USER, " +" ' ' CHG_USER, "
// +" sysdate CHG_DATE, " // +" sysdate CHG_DATE, "
+" i.TRAN_DATE as CHG_DATE, " +" i.TRAN_DATE as CHG_DATE, "
...@@ -28463,56 +28847,223 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -28463,56 +28847,223 @@ dtlSql = " select '' as TRAN_ID, "
} }
/** /************Added by kaustubh on 15 june 2018 DE--Header aganist customer************/
* 3(A) DE--Header (VOUCHER) 3A---B2B Deemed Exports* {
*/
{ hdrSql = " select '' as TRAN_ID,"
hdrSql = " select '' as TRAN_ID, " +" '' as TRAN_ID__REF,"
/* +" to_date(i.GP_DATE) as TRAN_DATE, "*/ +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , "
+" '' as TRAN_ID__REF, "
//+" case when s.SITE_CODE__EXC is null then s.site_code else s.SITE_CODE__EXC end as SITE_CODE, "
// +" ddf_get_siteregno(s.site_code,'OPRTNG_SITE') AS SITE_CODE ,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE ,"
+ "i.tran_date as PRD_CODE," + "i.tran_date as PRD_CODE,"
+" '2' as REC_TYPE, " +" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'I' as GST_TYPE," +" 'I' as GST_TYPE,"
+" '04' as TRAN_TYPE," +" '03' as TRAN_TYPE,"// -- b2b,b2c
+" i.supp_code as CUST_CODE, " +" i.sundry_code as CUST_CODE,"
+" c.supp_name as CUST_NAME, " +" c.cust_code as CUST_NAME,"
+" state.GST_CODE, " +" state.GST_CODE,"// -- 2 digit code
+" '' as SUBMISSION_TYPE," +" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" '' as DOC_CHECKSUM," +" ' ' as DOC_CHECKSUM,"
+" 'DE' as DOC_TYPE, " +" 'SEWOP' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
// +"case when i.excise_ref is null then i.invoice_no else i.excise_ref end as DOC_NO," +" i.bill_no as DOC_NO, "
+" i.INVOICE_NO as DOC_NO," +" i.bill_date as DOC_DATE,"
+" i.invoice_date as DOC_DATE," +" i.net_amt as AMOUNT,"
+" i.tran_date as DOC_DATE, " +" 'N' as REVERSE_CHRG,"
+" i.amount as AMOUNT, " +" ' ' as LR_NO,"
+" 'N' as REVERSE_CHRG, " +" ' ' as REAS_CODE,"
+" ' ' as LR_NO, " +" ' ' as REF_ID__INV,"
// +" i.lr_date as LR_DATE," +" 'N' as PROV_ASSMNT,"// -- not required
+" ' ' as REAS_CODE, " +" '' as ORDER_NO,"// -- not required
+" ' ' as REF_ID__INV, " +" s.site_code as REMARKS, " // on 9 aug
// +" null REF_DATE__INV, " +" i.tran_id as REF_ID, "
+" 'N' as PROV_ASSMNT, " +" ' ' as SUBMIT_STATUS,"
//+" i.stan_code__init as ORDER_NO," +" '' ADD_USER,"
+" ' ' as ORDER_NO," +" '' ADD_TERM,"
// +" null as ORDER_DATE, " +" ' ' CHG_USER,"
//+" i.invoice_id as REMARKS, " +" i.TRAN_DATE as CHG_DATE, "
+" s.site_code as REMARKS, " +" ' 'CHG_TERM,"
+" i.tran_id as REF_ID, " +" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as SUBMIT_STATUS, " +" ' ' as RECO_STATUS,"
// +" null SUBMIT_DATE, " +" ' ' as ECOM_REG_NO,"
+" '' ADD_USER, " +" 'M-VOUC' as ref_ser"
// +" sysdate as ADD_DATE, " +" from misc_voucher i,customer c, site s, state state "
+" '' ADD_TERM, " +" where c.cust_code = i.sundry_code "
+" ' ' CHG_USER, " +" and s.site_code = i.site_code "
// +" sysdate CHG_DATE, " +" and state.state_code = c.STATE_CODE "
+" i.TRAN_DATE as CHG_DATE, " +" and c.tax_reg_2 <> 'UNREGISTER' "
+" ' 'CHG_TERM, " +" and i.sundry_type ='T' AND i.vouch_type NOT IN ('C','D')"
+" c.tax_reg_2 as TAX_REG_NO, " +" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" ' ' as RECO_STATUS, " +" and tm.TAX_GROUP IN ('RCM') "
+" ' ' as ECOM_REG_NO, " +" and ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I')";
if(GST_PURSEZWOP_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_PURSEZWOP_TAXCLASS+") or ti.tax_chap not in ("+TAX_CHAP_STR+") ) ";
}
if(GST_PURSEZWOP_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURSEZWOP_TAXENV+") ";
}
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 = 'M-VOUC' and ref_id = i.tran_id ) = 0 ";
/**
* Detail from MISC-Voucher(transport-REG) *
*/
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,"
+" case when it.item_code is null then 'S' else 'G' end as LINE_TYPE, "
+"(select CASE "
+"WHEN (NVL(GH.anal_code,'X')<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GH.anal_code) "
+" WHEN (NVL(GH.anal_code,'X')='X' AND GD.anal_code<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GD.anal_code) "
+" WHEN (NVL(GH.anal_code,'X')='X' AND GD.anal_code='X') "
+ " THEN fn_get_hsn_sac(GH.site_code,'',GD.acct_code) END "
+ "from misc_voucher GH,misc_vouchdet GD where GH.tran_id=GD.tran_id and GH.tran_id=i.tran_id "
+ " and it.line_no=GD.line_no ) GS_CODE, " ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC, "
+" fn_gst_rate_amt(CAST('M-VOUC' 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('M-VOUC' 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('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT, ";
}
else
{
dtlSql = dtlSql
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" 'OTH' 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('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'is' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from misc_voucher i,misc_vouchdet it "
+" where i.tran_id = it.tran_id "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
+"and tx.TAX_GROUP = 'RCM' "
+"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.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"SEWP-M-VOUC(UNREG)CUST");
}
/**
* 3(A) DE--Header (VOUCHER) 3A---B2B Deemed Exports*
*/
{
hdrSql = " select '' as TRAN_ID, "
/* +" to_date(i.GP_DATE) 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, "
// +" 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,"
+" '2' as REC_TYPE, "
+" 'I' as GST_TYPE,"
+" '04' as TRAN_TYPE,"
+" i.supp_code as CUST_CODE, "
+" c.supp_name as CUST_NAME, "
+" state.GST_CODE, "
+" '' as SUBMISSION_TYPE,"
+" '' as DOC_CHECKSUM,"
+" 'DE' as DOC_TYPE, "
// +"case when i.excise_ref is null then i.invoice_no else i.excise_ref end as DOC_NO,"
+" i.INVOICE_NO as DOC_NO,"
+" i.invoice_date as DOC_DATE,"
+" i.tran_date as DOC_DATE, "
+" i.amount as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
// +" i.lr_date as LR_DATE,"
+" ' ' as REAS_CODE, "
+" ' ' as REF_ID__INV, "
// +" null REF_DATE__INV, "
+" 'N' as PROV_ASSMNT, "
//+" i.stan_code__init as ORDER_NO,"
+" ' ' as ORDER_NO,"
// +" null as ORDER_DATE, "
//+" i.invoice_id as REMARKS, "
+" s.site_code 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, "
+" i.TRAN_DATE as CHG_DATE, "
+" ' 'CHG_TERM, "
+" c.tax_reg_2 as TAX_REG_NO, "
+" ' ' as RECO_STATUS, "
+" ' ' as ECOM_REG_NO, "
+" 'P-RCP' as ref_ser " +" 'P-RCP' as ref_ser "
+" from porcp i,supplier c, site s, state" +" from porcp i,supplier c, site s, state"
+" where c.supp_code = i.supp_code " +" where c.supp_code = i.supp_code "
...@@ -28772,114 +29323,281 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -28772,114 +29323,281 @@ dtlSql = " select '' as TRAN_ID, "
{ {
dtlSql = dtlSql +"fn_get_hsn_sac(i.site_code,' ',it.acct_code) AS GS_CODE,"; dtlSql = dtlSql +"fn_get_hsn_sac(i.site_code,' ',it.acct_code) AS GS_CODE,";
}*/ }*/
dtlSql = dtlSql dtlSql = dtlSql
// +"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE," // +"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT, " +" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC, " +" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT, " +" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC, " +" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('H' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CGST_AMT, " +" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('H' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CGST_AMT, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('G' AS CHAR(1)), CAST('R' AS CHAR(1))) AS SGST_PERC, " +" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('G' AS CHAR(1)), CAST('R' AS CHAR(1))) AS SGST_PERC, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT, "; +" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT, ";
} }
else else
{ {
//dtlSql = dtlSql //dtlSql = dtlSql
//+ "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_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE," //+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
/*if ("A".equalsIgnoreCase(MISC_VOUC_TYPE)) /*if ("A".equalsIgnoreCase(MISC_VOUC_TYPE))
{ {
dtlSql = dtlSql +"i.anal_code as GS_CODE,"; dtlSql = dtlSql +"i.anal_code as GS_CODE,";
} }
else else
{ {
dtlSql = dtlSql +"fn_get_hsn_sac(i.site_code,' ',it.acct_code) AS GS_CODE,"; dtlSql = dtlSql +"fn_get_hsn_sac(i.site_code,' ',it.acct_code) AS GS_CODE,";
}*/
dtlSql = dtlSql
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
// +" item.descr as GS_DESCR,"
+" ' ' as GS_DESCR, "
/*+" u.descr as UNIT,"*/
//+"item.UNIT as UNIT,"
+" 'OTH' as UNIT, "
+" (it.quantity) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
// dtlSql = dtlSql
// +" '' as REMARKS ,"
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'is' as ITC_TYPE , ";
//+"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
// +" from misc_voucher i,misc_vouchdet it, item item "
+" from misc_voucher i,misc_vouchdet it "
// +" from voucher i,vouchrcp it, item item "
+" where i.tran_id = it.tran_id "
// +" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
+"and tx.TAX_GROUP = 'RCM' "
+"and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
//dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
//dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no ";
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"DE(M-VOUC)-REG");
}
/**
* 3(A) DE--Header (MISC-VOUCHER)(transporter) 3A---B2B Deemed Exports(REG)**
*/
{
hdrSql = " select '' as TRAN_ID,"
+" '' as TRAN_ID__REF,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , "
+ "i.tran_date as PRD_CODE,"
+" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'I' as GST_TYPE,"
+" '04' as TRAN_TYPE,"// -- b2b,b2c
+" i.sundry_code as CUST_CODE,"
+" c.tran_name as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'DE' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" i.bill_no as DOC_NO, "
+" i.bill_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, " // on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
+" i.TRAN_DATE as CHG_DATE, "
+" ' 'CHG_TERM,"
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO,"
+" 'M-VOUC' as ref_ser"
+" from misc_voucher i,TRANSPORTER c, site s, state state "
+" where c.tran_code = i.sundry_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.sundry_type ='T' AND i.vouch_type NOT IN ('C','D')"
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and tm.TAX_GROUP IN ('RCM') "
+" and ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id and tm.tax_type in ('G','H','I')";
if(GST_PURDE_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_PURDE_TAXCLASS+") or ti.tax_chap not in ("+TAX_CHAP_STR+") ) ";
}
if(GST_PURDE_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_PURDE_TAXENV+") ";
}
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 = 'M-VOUC' and ref_id = i.tran_id ) = 0 ";
/**
* Detail from MISC-Voucher(transport-REG) *
*/
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,"
+" case when it.item_code is null then 'S' else 'G' end as LINE_TYPE, "
+"(select CASE "
+"WHEN (NVL(GH.anal_code,'X')<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GH.anal_code) "
+" WHEN (NVL(GH.anal_code,'X')='X' AND GD.anal_code<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GD.anal_code) "
+" WHEN (NVL(GH.anal_code,'X')='X' AND GD.anal_code='X') "
+ " THEN fn_get_hsn_sac(GH.site_code,'',GD.acct_code) END "
+ "from misc_voucher GH,misc_vouchdet GD where GH.tran_id=GD.tran_id and GH.tran_id=i.tran_id "
+ " and it.line_no=GD.line_no ) GS_CODE, " ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC, "
+" fn_gst_rate_amt(CAST('M-VOUC' 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('M-VOUC' 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('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT, ";
}
else
{
dtlSql = dtlSql
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" 'OTH' 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('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'is' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from misc_voucher i,misc_vouchdet it "
+" where i.tran_id = it.tran_id "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
+"and tx.TAX_GROUP = 'RCM' "
+"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.tran_id = ? ";
}*/ retString = executeSqlAndPopulateData(hdrSql,dtlSql,"DE-M-VOUC(REG)TRAN");
dtlSql = dtlSql
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
// +" item.descr as GS_DESCR,"
+" ' ' as GS_DESCR, "
/*+" u.descr as UNIT,"*/
//+"item.UNIT as UNIT,"
+" 'OTH' as UNIT, "
+" (it.quantity) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql + "fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, , CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
// dtlSql = dtlSql
// +" '' as REMARKS ,"
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'is' as ITC_TYPE , ";
//+"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
// +" from misc_voucher i,misc_vouchdet it, item item "
+" from misc_voucher i,misc_vouchdet it "
// +" from voucher i,vouchrcp it, item item "
+" where i.tran_id = it.tran_id "
// +" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
+"and tx.TAX_GROUP = 'RCM' "
+"and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
//dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
//dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no ";
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"DE(M-VOUC)-REG"); }
}
/**
* 3(A) DE--Header (MISC-VOUCHER)(transporter) 3A---B2B Deemed Exports(REG)**
*/
/**********Added by kaustubh on 15 june B2B Reverse Charge supplies angainst Customer********/
{ {
hdrSql = " select '' as TRAN_ID," hdrSql = " select '' as TRAN_ID,"
+" '' as TRAN_ID__REF," +" '' as TRAN_ID__REF,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , " +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , "
...@@ -28888,7 +29606,7 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -28888,7 +29606,7 @@ dtlSql = " select '' as TRAN_ID, "
+" 'I' as GST_TYPE," +" 'I' as GST_TYPE,"
+" '04' as TRAN_TYPE,"// -- b2b,b2c +" '04' as TRAN_TYPE,"// -- b2b,b2c
+" i.sundry_code as CUST_CODE," +" i.sundry_code as CUST_CODE,"
+" c.tran_name as CUST_NAME," +" c.cust_code as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code +" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject +" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM," +" ' ' as DOC_CHECKSUM,"
...@@ -28914,8 +29632,8 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -28914,8 +29632,8 @@ dtlSql = " select '' as TRAN_ID, "
+" ' ' as RECO_STATUS," +" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO," +" ' ' as ECOM_REG_NO,"
+" 'M-VOUC' as ref_ser" +" 'M-VOUC' as ref_ser"
+" from misc_voucher i,TRANSPORTER c, site s, state state " +" from misc_voucher i,customer c, site s, state state "
+" where c.tran_code = i.sundry_code " +" where c.cust_code = i.sundry_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.tax_reg_2 <> 'UNREGISTER' " +" and c.tax_reg_2 <> 'UNREGISTER' "
...@@ -29040,10 +29758,10 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -29040,10 +29758,10 @@ dtlSql = " select '' as TRAN_ID, "
dtlSql = dtlSql dtlSql = dtlSql
+" and i.tran_id = ? "; +" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"DE-M-VOUC(REG)TRAN"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"DE-M-VOUC(REG)CUST");
}
}
/******* 4A started ********/ /******* 4A started ********/
/** /**
* 4(a) B2B supplies (REG)* * 4(a) B2B supplies (REG)*
...@@ -29454,10 +30172,180 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -29454,10 +30172,180 @@ dtlSql = " select '' as TRAN_ID, "
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(4A) B2B(REG)"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(4A) B2B(REG)");
} }
/** /**
* 4(a) B2B supplies - Reverse Charge M-VOUC (REG)(Transport)* * 4(a) B2B supplies - Reverse Charge M-VOUC (REG)(Transport)*
*/ */
{
hdrSql = " select '' as TRAN_ID,"
+" '' as TRAN_ID__REF,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , "
+ "i.tran_date as PRD_CODE,"
+" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'U' as GST_TYPE,"
+" '05' as TRAN_TYPE,"// -- b2b,b2c
+" i.sundry_code as CUST_CODE,"
+" c.tran_name as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" ' ' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
+" i.bill_no as DOC_NO, "
+" i.bill_date as DOC_DATE,"
+" i.net_amt as AMOUNT,"
+" 'Y' 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, " // on 9 aug
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
+" '' ADD_USER,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
+" i.TRAN_DATE as CHG_DATE, "
+" ' 'CHG_TERM,"
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO,"
+" 'M-VOUC' as ref_ser"
+" from misc_voucher i,TRANSPORTER c, site s, state state "
+" where c.tran_code = i.sundry_code "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 <> 'UNREGISTER' "
+" and i.sundry_type ='T' AND i.vouch_type NOT IN ('C','D')"
+" and (select count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code "
+" and ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id "
+" and tm.TAX_GROUP IN ('RCM') "
+" and tm.tax_type in ('G','H','I') ";
if(GST_RCM_TAXCLASS.length() > 0)
{
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_RCM_TAXCLASS+") or ti.tax_chap not in ("+TAX_CHAP_STR+") ) ";
}
if(GST_RCM_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_RCM_TAXENV+") ";
}
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 = 'M-VOUC' and ref_id = i.tran_id ) = 0 ";
/**
* Detail from MISC-Voucher(transport-REG) *
*/
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,"
+" case when it.item_code is null then 'S' else 'G' end as LINE_TYPE, "
+"(select CASE "
+"WHEN (NVL(GH.anal_code,'X')<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GH.anal_code) "
+" WHEN (NVL(GH.anal_code,'X')='X' AND GD.anal_code<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GD.anal_code) "
+" WHEN (NVL(GH.anal_code,'X')='X' AND GD.anal_code='X') "
+ " THEN fn_get_hsn_sac(GH.site_code,'',GD.acct_code) END "
+ "from misc_voucher GH,misc_vouchdet GD where GH.tran_id=GD.tran_id and GH.tran_id=i.tran_id "
+ " and it.line_no=GD.line_no ) GS_CODE, " ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC, "
+" fn_gst_rate_amt(CAST('M-VOUC' 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('M-VOUC' 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('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT, ";
}
else
{
dtlSql = dtlSql
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
+" ' ' as GS_DESCR, "
+" 'OTH' 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('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'is' as ITC_TYPE , ";
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
+" from misc_voucher i,misc_vouchdet it "
+" where i.tran_id = it.tran_id "
+" and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+" and ti.tran_code = 'M-VOUC' "
+" and ti.tran_id = i.tran_id "
// +" and tx.TAX_GROUP <> 'NITC' " commented on 14 aug
+" and tx.TAX_GROUP = 'RCM' "
+" and tx.tax_type in ('G','H','I','J')" ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
//dtlSql = dtlSql +" and cast(tx.line_no as integer) = it.line_no ";
dtlSql =dtlSql +" and cast(ti.line_no as integer) = it.line_no ) > 0";
}
else
{
//dtlSql = dtlSql +" and to_number(trim(tx.line_no)) = it.line_no ";
dtlSql =dtlSql +" and to_number(trim(ti.line_no)) = it.line_no ) > 0";
}
dtlSql = dtlSql
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(4A) B2B(REG)MISC-TRAN");
}
/************Aadded by kaustubh on 15 june VOUCH angainst customer start******************/
{ {
hdrSql = " select '' as TRAN_ID," hdrSql = " select '' as TRAN_ID,"
+" '' as TRAN_ID__REF," +" '' as TRAN_ID__REF,"
+" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , " +" ddf_get_siteregno(s.site_code,'OPTNG_SITE') AS SITE_CODE , "
...@@ -29466,7 +30354,7 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -29466,7 +30354,7 @@ dtlSql = " select '' as TRAN_ID, "
+" 'U' as GST_TYPE," +" 'U' as GST_TYPE,"
+" '05' as TRAN_TYPE,"// -- b2b,b2c +" '05' as TRAN_TYPE,"// -- b2b,b2c
+" i.sundry_code as CUST_CODE," +" i.sundry_code as CUST_CODE,"
+" c.tran_name as CUST_NAME," +" c.cust_code as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code +" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject +" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM," +" ' ' as DOC_CHECKSUM,"
...@@ -29492,8 +30380,8 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -29492,8 +30380,8 @@ dtlSql = " select '' as TRAN_ID, "
+" ' ' as RECO_STATUS," +" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO," +" ' ' as ECOM_REG_NO,"
+" 'M-VOUC' as ref_ser" +" 'M-VOUC' as ref_ser"
+" from misc_voucher i,TRANSPORTER c, site s, state state " +" from misc_voucher i,customer c, site s, state state "
+" where c.tran_code = i.sundry_code " +" where c.cust_code = i.sundry_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.tax_reg_2 <> 'UNREGISTER' " +" and c.tax_reg_2 <> 'UNREGISTER' "
...@@ -29622,9 +30510,9 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -29622,9 +30510,9 @@ dtlSql = " select '' as TRAN_ID, "
+" and i.tran_id = ? "; +" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(4A) B2B(REG)MISC-TRAN"); retString = executeSqlAndPopulateData(hdrSql,dtlSql,"(4A) B2B(REG)MISC-CUST");
}
}
/******* 4B started Inward supplies received from an unregistered supplier********/ /******* 4B started Inward supplies received from an unregistered supplier********/
/** /**
* 4(B) VOUCH Header Voucher(UNREG)* * 4(B) VOUCH Header Voucher(UNREG)*
...@@ -30739,6 +31627,212 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -30739,6 +31627,212 @@ dtlSql = " select '' as TRAN_ID, "
} }
/**************Added by kaustubh on 15 june 2018 start UNREG angaist customer*********/
{
hdrSql = " select '' as TRAN_ID,"
/*+" to_date(i.gp_date) 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, " 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,"
+" '2' as REC_TYPE,"// -- GSTR1,GSTR2,etc.
+" 'U' as GST_TYPE,"
+" '06' as TRAN_TYPE,"// -- b2b,b2c
+" i.sundry_code as CUST_CODE,"
+" c.cust_code as CUST_NAME,"
+" state.GST_CODE,"// -- 2 digit code
+" ' ' as SUBMISSION_TYPE,"// -- M-Modify, D-Delete, A-Accept, R-Reject
+" ' ' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE,"// -- R- Regular B2B Invoices, DE – Deemed Exports, SEWP – SEZ Exports with payment,SEWOP – SEZ exports without payment
/*+" i.gp_no as DOC_NO,"*/
/*+"case when i.gp_no is null then i.tran_id else i.gp_no end as DOC_NO,"
+" i.tran_date as DOC_DATE,"*/
+" i.bill_no as DOC_NO, "
+" i.bill_date as DOC_DATE,"
//+"case when i.gp_date is null then i.tran_date else i.gp_date end as DOC_DATE,"
+" i.net_amt as AMOUNT,"
+" 'Y' as REVERSE_CHRG,"
+" ' ' as LR_NO,"
// +" null as LR_DATE,"
+" ' ' as REAS_CODE,"
+" ' ' as REF_ID__INV,"
// +" null REF_DATE__INV,"
+" 'N' as PROV_ASSMNT,"// -- not required
+" '' as ORDER_NO,"// -- not required
// +" null as ORDER_DATE,"// -- not required
//+" i.tran_id as REMARKS,"
+" s.site_code as REMARKS, "
+" i.tran_id as REF_ID, "
+" ' ' as SUBMIT_STATUS,"
// +" null SUBMIT_DATE,"
+" '' ADD_USER,"
// +" sysdate ADD_DATE,"
+" '' ADD_TERM,"
+" ' ' CHG_USER,"
// +" sysdate CHG_DATE,"
+" i.TRAN_DATE as CHG_DATE, "
+" ' 'CHG_TERM,"
+" c.tax_reg_2 as TAX_REG_NO,"
+" ' ' as RECO_STATUS,"
+" ' ' as ECOM_REG_NO,"
+" 'M-VOUC' as ref_ser"
+" from misc_voucher i,customer c, site s, state state "
+" where c.cust_code = i.sundry_code "
+" and i.sundry_type = 'S' "
+" and s.site_code = i.site_code "
+" and state.state_code = c.STATE_CODE "
+" and c.tax_reg_2 = 'UNREGISTER' "
+" and i.vouch_type not in ('C','D')"
+" and (select count(1) from taxtran ti,tax tm where tm.tax_code = ti.tax_code "
+" and tm.TAX_GROUP IN ('RCM') "
+" and ti.tran_code = 'M-VOUC' and ti.tran_id = i.tran_id ";
if(GST_RCM_TAXCLASS.length() > 0)
{
//hdrSql = hdrSql +" and ti.tax_class in ("+GST_RCM_TAXCLASS+") ";
hdrSql = hdrSql +" and (ti.tax_class in ("+GST_RCM_TAXCLASS+") or ti.tax_chap not in ("+TAX_CHAP_STR+") ) ";
}
if(GST_RCM_TAXENV.length() > 0)
{
hdrSql = hdrSql +" and ti.tax_env in ("+GST_RCM_TAXENV+") ";
}
//hdrSql = hdrSql +" and tm.tax_group = 'RCM' ) = 0 "
hdrSql = hdrSql +" and tm.tax_group = 'RCM' ) > 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 = 'M-VOUC' and ref_id = i.tran_id ) = 0 ";
/**
* Detail MISC-Voucher 4(B) M-VOUC (UNREG)*
*/
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
+"case when it.item_code is null then 'S' else 'G' end as LINE_TYPE ,"
+"(select CASE "
+"WHEN (NVL(GH.anal_code,'X')<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GH.anal_code) "
+" WHEN (NVL(GH.anal_code,'X')='X' AND GD.anal_code<>'X') "
+" THEN (select SH_DESCR from ANALYSIS where ANALYSIS.ANAL_CODE=GD.anal_code) "
+" WHEN (NVL(GH.anal_code,'X')='X' AND GD.anal_code='X') "
+ " THEN fn_get_hsn_sac(GH.site_code,'',GD.acct_code) END "
+ "from misc_voucher GH,misc_vouchdet GD where GH.tran_id=GD.tran_id and GH.tran_id=i.tran_id "
+ " and it.line_no=GD.line_no ) as GS_CODE, " ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
//dtlSql = dtlSql //+"fn_get_hsn_no(i.site_code,it.item_code) AS GS_CODE,"
//+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
/*if ("A".equalsIgnoreCase(MISC_VOUC_TYPE))
{
dtlSql = dtlSql +"i.anal_code as GS_CODE,";
}
else
{
dtlSql = dtlSql +"fn_get_hsn_sac(i.site_code,'',it.acct_code) AS GS_CODE,";
}*/
dtlSql = dtlSql
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST(' ' AS CHAR(1)), CAST('T' AS CHAR(1))) AS TAXABLE_AMT, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('R' AS CHAR(1))) AS IGST_PERC, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('I' AS CHAR(1)), CAST('A' AS CHAR(1))) AS IGST_AMT, "
+" fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('H' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CGST_PERC, "
+" fn_gst_rate_amt(CAST('M-VOUC' 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('M-VOUC' 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('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('G' AS CHAR(1)), CAST('A' AS CHAR(1))) AS SGST_AMT, ";
}
else
{
//dtlSql = dtlSql
//+ "fn_get_hsn_no(i.site_code,it.item_code) as GS_CODE,"
System.out.println("misc_vouch_code::"+MISC_VOUC_TYPE);
/*if ("A".equalsIgnoreCase(MISC_VOUC_TYPE))
{
dtlSql = dtlSql +"i.anal_code as GS_CODE,";
}
else
{
dtlSql = dtlSql +"fn_get_hsn_sac(i.site_code,'',it.acct_code) AS GS_CODE,";
}*/
dtlSql = dtlSql
//+"fn_get_hsn_sac(i.site_code,it.item_code,it.acct_code) AS GS_CODE,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, ' ', 'T') as TAXABLE_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'R') as IGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'I', 'A') as IGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'R') as CGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'H', 'A') as CGST_AMT,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'R') as SGST_PERC,"
+ "fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'G', 'A') as SGST_AMT,";
}
dtlSql = dtlSql
// +" item.descr as GS_DESCR,"
+" ' ' as GS_DESCR, "
/* +" u.descr as UNIT,"*/
// +" item.UNIT as UNIT,"
+" 'OTH' 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('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('R' AS CHAR(1))) AS CESS_PERC,"
+"fn_gst_rate_amt(CAST('M-VOUC' AS VARCHAR(6)),i.tran_id, CAST(it.line_no as char(3)), CAST('J' AS CHAR(1)), CAST('A' AS CHAR(1))) AS CESS_AMT,";
}
else
{
dtlSql = dtlSql +"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'R') as CESS_PERC,"
+"fn_gst_rate_amt('M-VOUC',i.tran_id, it.line_no, 'J', 'A') as CESS_AMT,";
}
//dtlSql = dtlSql
//+" '' as REMARKS ,"
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and cast(ti.line_no as integer) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
else
{
dtlSql = dtlSql +"(SELECT count(1) from taxtran ti, tax tm where tm.tax_code = ti.tax_code and ti.tran_id = i.tran_id and to_number(trim(ti.line_no)) = it.line_no and tm.tax_group='ITC' ) as REMARKS, ";
}
dtlSql = dtlSql
+" 'is' as ITC_TYPE , ";
//+"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate "
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id,CAST(it.line_no as char(3))) as gst_rate ";
}
else
{
dtlSql = dtlSql +"fn_get_gst_rate('M-VOUC',i.tran_id, it.line_no) as gst_rate ";
}
dtlSql = dtlSql
// +" from misc_voucher i,misc_vouchdet it, item item "
+" from misc_voucher i,misc_vouchdet it "
+" where i.tran_id = it.tran_id "
// +" and item.item_code = it.item_code "
+"and (select count(1) from taxtran ti, tax tx where tx.tax_code = ti.tax_code "
+"and ti.tran_code = 'M-VOUC' "
+"and ti.tran_id = i.tran_id "
+" and tx.TAX_GROUP IN ('RCM') "
+"and tx.tax_type in ('G','H','I','J')) > 0 "
/*if(taxClassAllStr.length() > 0)
{
dtlSql = dtlSql +" and tx.tax_class not in ("+taxClassAllStr+") ";
}
dtlSql = dtlSql */
+" and i.tran_id = ? ";
retString = executeSqlAndPopulateData(hdrSql,dtlSql,"4(B) M-VOUC(UNREG)CUST");
}
/*** --- 4(C) IMP_S Import of Service ****/ /*** --- 4(C) IMP_S Import of Service ****/
{ {
...@@ -37112,7 +38206,7 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -37112,7 +38206,7 @@ dtlSql = " select '' as TRAN_ID, "
+" ' ' as GS_DESCR, " +" ' ' as GS_DESCR, "
//+" 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) as QUANTITY," +" (it.RCP_QTY) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ; +" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
...@@ -37287,7 +38381,7 @@ dtlSql = " select '' as TRAN_ID, " ...@@ -37287,7 +38381,7 @@ dtlSql = " select '' as TRAN_ID, "
+" ' ' as GS_DESCR, " +" ' ' as GS_DESCR, "
//+" 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) as QUANTITY," +" (it.RCP_QTY) as QUANTITY,"
+" 'OE' as SUPPLY_TYPE," ; +" 'OE' as SUPPLY_TYPE," ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME )) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{ {
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