Commit 97267b6d authored by prane's avatar prane

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@197884 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2557bd72
......@@ -675,7 +675,23 @@ public class PdcToReceiptPrc extends ProcessEJB implements PdcToReceiptPrcLocal,
xmlBuff.append("</Detail1>");
xmlBuff.append("\n");
System.out.println("Before Insert data");
// 01-mar-2019 manoharan to update receivables.pdc_amount_adj
if (CommonConstants.DB_NAME.equalsIgnoreCase("db2"))
{
sql = "select case when pdc_amount_adj is null then 0 else pdc_amount_adj end as pdc_amount_adj from receivables where tran_ser = ? and ref_no = ? FOR UPDATE ";
} else if (CommonConstants.DB_NAME.equalsIgnoreCase("mssql"))
{
sql = "select case when pdc_amount_adj is null then 0 else pdc_amount_adj end as pdc_amount_adj from receivables (UPDLOCK) where tran_ser = ? and ref_no = ?";
} else
{
sql = "select case when pdc_amount_adj is null then 0 else pdc_amount_adj end as pdc_amount_adj from receivables where tran_ser = ? and ref_no = ? FOR UPDATE NOWAIT";
}
pstmt1 = conn.prepareStatement(sql);
sql = "update receivables set pdc_amount_adj = case when pdc_amount_adj is null then 0 else pdc_amount_adj end + ? where tran_ser = ? and ref_no = ?";
pstmt2 = conn.prepareStatement(sql);
// 01-mar-2019 manoharan to update receivables.pdc_amount_adj
int lineNoCount = 0;
//INSERT INTO RECEIPT DETTAIL...
sql = " SELECT pdc_recdet.tran_id,"+
......@@ -744,12 +760,55 @@ public class PdcToReceiptPrc extends ProcessEJB implements PdcToReceiptPrcLocal,
xmlBuff.append("\n");
billAmt = billAmt + amount;
// 01-mar-2019 manoharan to update receivables.pdc_amount_adj
pstmt1.setString(1,refSerDet);
pstmt1.setString(2,refNoDet);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
pstmt2.setDouble(1,amountDet);
pstmt2.setString(2,refSerDet);
pstmt2.setString(3,refNoDet);
pstmt2.addBatch();
pstmt2.clearParameters();
}
else
{
// eerror locking
errString = itmDBAccessEJB.getErrorString("","VTLCKERR","","",conn);
return errString;
}
rs1.close();
rs1 = null;
pstmt1.clearParameters();
// end 01-mar-2019 manoharan to update receivables.pdc_amount_adj
}
rs.close();
rs = null;
pstmt.close();
pstmt =null;
// 01-mar-2019 manoharan to update receivables.pdc_amount_adj
pstmt2.executeBatch();
if(rs1 != null)
{
rs1.close();
rs1 = null;
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
if(pstmt2 != null)
{
pstmt2.close();
pstmt2 = null;
}
// end 01-mar-2019 manoharan to update receivables.pdc_amount_adj
xmlBuff.append("</Header0>");
xmlBuff.append("</group0>");
xmlBuff.append("</DocumentRoot>");
......@@ -779,11 +838,14 @@ public class PdcToReceiptPrc extends ProcessEJB implements PdcToReceiptPrcLocal,
}
//update receipt sql
diffTot = diffTot + diff ;
sql = "update receipt set diff_amt__exch = ? where TRAN_ID = ?";
// 01-mar-2019 manoharan update the column
//sql = "update receipt set diff_amt__exch = ? where TRAN_ID = ?";
sql = "update receipt set diff_amt__exch = ?,tran_id__pdc = '" + TranIdPdc +"' where TRAN_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, diffTot);
pstmt.setString(2, tranId);
rs = pstmt.executeQuery();
//rs = pstmt.executeQuery();
pstmt.executeUpdate();
pstmt.close();
pstmt = null;
......@@ -1015,11 +1077,26 @@ public class PdcToReceiptPrc extends ProcessEJB implements PdcToReceiptPrcLocal,
rs.close();
rs = null;
}
if(rs1 != null)
{
rs1.close();
rs1 = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
if(pstmt2 != null)
{
pstmt2.close();
pstmt2 = null;
}
if(rsPdc != null)
{
rsPdc.close();
......
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