Commit 2a3954aa authored by agaikwad's avatar agaikwad

Changes in poamd term.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100001 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 816c264c
...@@ -414,7 +414,7 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd ...@@ -414,7 +414,7 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
private String ConfirmPordAmd(String amdNo, Connection conn) throws RemoteException, ITMException private String ConfirmPordAmd(String amdNo, Connection conn) throws RemoteException, ITMException
{ {
PreparedStatement pstmt = null, pstmt1 = null, pstmt3 = null, pstmtSql = null, pstmt4 = null,pstmt2 = null,pstmt5 = null,pstmt6 = null, pstmt7 = null, pstmtmax = null, pstmtcount = null; PreparedStatement pstmt = null, pstmt1 = null, pstmt3 = null, pstmtSql = null, pstmt4 = null,pstmt2 = null,pstmt5 = null,pstmt6 = null, pstmt7 = null, pstmtmax = null, pstmtcount = null,pstmtupd = null;
ResultSet rs = null, rs1 = null, rs3 = null, rs2 = null, rs6= null, rs7 = null, rsmax= null, rscount= null; ResultSet rs = null, rs1 = null, rs3 = null, rs2 = null, rs6= null, rs7 = null, rsmax= null, rscount= null;
int cnt = 0 ,cnt1 = 0,cntpo = 0; int cnt = 0 ,cnt1 = 0,cntpo = 0;
// Document dom = null; // Document dom = null;
...@@ -443,7 +443,7 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd ...@@ -443,7 +443,7 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
String cctrCodeReco = "", recoPerc = "", acctCode = "", cctrCode = "", rateType = "", round = "", roundTo = "", taxForm = ""; String cctrCodeReco = "", recoPerc = "", acctCode = "", cctrCode = "", rateType = "", round = "", roundTo = "", taxForm = "";
String acctCodeApAdv = "", cctrCodeApAdv = ""; // VALLABH KADAM Add two String acctCodeApAdv = "", cctrCodeApAdv = ""; // VALLABH KADAM Add two
// new field 19/NOV/14 // new field 19/NOV/14
String chgUser = "", chgTerm = "", posted = "", payTax = "", orderOpt = "", bom = "", oldItem = "", lastTermLine = "",lastTermLine1 = ""; String chgUser = "", chgTerm = "", posted = "", payTax = "", orderOpt = "", bom = "", oldItem = "", lastTermLine = "",lastTermLine1 = "", lineNoPOterm ="";
double taxableAmt = 0, recoAmont = 0, dlvQuantity = 0, clgRate = 0, ordQty = 0, totOrdQty = 0, quantStduom = 0; double taxableAmt = 0, recoAmont = 0, dlvQuantity = 0, clgRate = 0, ordQty = 0, totOrdQty = 0, quantStduom = 0;
Timestamp taxFormDate = null, chgDate = null; Timestamp taxFormDate = null, chgDate = null;
int updCnt = 0, updCnt1=0; int updCnt = 0, updCnt1=0;
...@@ -1947,6 +1947,128 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd ...@@ -1947,6 +1947,128 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
pstmt1 = null; pstmt1 = null;
} }
if (errCode == null || errCode.trim().length() == 0) if (errCode == null || errCode.trim().length() == 0)
{
int count =0;
sql = " select count(1) from poamd_term where amd_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, amdNo);
rs = pstmt.executeQuery();
if (rs.next())
{
cntTerm = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("@@@@@@@@@trem cntTerm:[" + cntTerm + "]");
if(cntTerm > 0)
{
sql = " select * from poamd_term where amd_no = ? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, amdNo);
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
purcOrder = rs1.getString("purc_order");
lineNoPO = rs1.getString("line_no_ord");//LINE_NO_ORD
termCode=rs1.getString("term_code");
descr = rs1.getString("descr");
printOpt = rs1.getString("print_opt");
if (lineNoPO != null && lineNoPO.trim().length() > 0)
{
sql="select count(*) from pord_term where purc_order = ? and line_no = ?";
pstmtcount = conn.prepareStatement(sql);
pstmtcount.setString(1, purcOrder);
pstmtcount.setString(2, lineNoPO);
rscount = pstmtcount.executeQuery();
if (rscount.next())
{
count = rscount.getInt(1);
}
rscount.close();
rscount = null;
pstmtcount.close();
pstmtcount = null;
if(count > 0)
{
System.out.println("@@@@@@@@@term update executed.... lineNoPO:[" + lineNoPO + "]");
sql = " update pord_term set term_code = ?, descr = ?, print_opt = ? where purc_order = ? and line_no = ? ";
pstmtupd = conn.prepareStatement(sql);
pstmtupd.setString(1, termCode);
pstmtupd.setString(2, descr);
pstmtupd.setString(3, printOpt);
pstmtupd.setString(4, purcOrder);
pstmtupd.setString(5, lineNoPO);
updCnt = pstmtupd.executeUpdate();
pstmtupd.close();
pstmtupd = null;
if (!(updCnt == 1))
{
errCode = "VTORDTERM";
errCode = itmDBAccessLocal.getErrorString("", errCode, "");
return errCode;
}
}
else
{
sql = " insert into pord_term ( purc_order, line_no, term_code, descr , print_opt) values (?,?,?,?, ?) ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, purcOrder);
pstmt.setString(2, lineNoPO);
pstmt.setString(3, termCode);
pstmt.setString(4, descr);
pstmt.setString(5, printOpt);
cnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
}
else
{
sql = " select max(line_no) from pord_term where purc_order = ? ";
pstmtmax = conn.prepareStatement(sql);
pstmtmax.setString(1, purcOrder);
rsmax = pstmtmax.executeQuery();
if (rsmax.next())
{
lineNoPOterm = rsmax.getString(1);
System.out.println("@@@@@@lineNoPO4[" + lineNoPO1 + "]");
}
rsmax.close();
rsmax = null;
pstmtmax.close();
pstmtmax = null;
if (lineNoPO1 == null)
{
lineNoPOterm = "0";
}
int tempId = (Integer.parseInt(lineNoPO1.trim()) + 1);
lineNoPOterm = " " + tempId;
lineNoPOterm = lineNoPOterm.substring(lineNoPOterm.length() - 3, lineNoPOterm.length());
System.out.println("@@@@@@lineNoPO[" + lineNoPOterm + "]");
System.out.println("**********************insert Data***********************");
sql = " insert into pord_term ( purc_order, line_no, term_code, descr , print_opt) values (?,?,?,?, ?) ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, purcOrder);
pstmt.setString(2, lineNoPOterm);
pstmt.setString(3, termCode);
pstmt.setString(4, descr);
pstmt.setString(5, printOpt);
cnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
}
}
/* if (errCode == null || errCode.trim().length() == 0)
{ {
cntTerm = 0; cntTerm = 0;
sql = " select count(1) from poamd_term where amd_no = ? "; sql = " select count(1) from poamd_term where amd_no = ? ";
...@@ -2047,7 +2169,7 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd ...@@ -2047,7 +2169,7 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
} }
} }
} }*/
/*if (errCode == null || errCode.trim().length() == 0) /*if (errCode == null || errCode.trim().length() == 0)
{ {
sql="select * from poamd_pay_term where amd_no = ? "; sql="select * from poamd_pay_term where amd_no = ? ";
......
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