Commit b76fe204 authored by agaikwad's avatar agaikwad

Added new condition purc_order != current po in existing sql(open po ).


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@101020 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 05fab0db
......@@ -477,13 +477,11 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
double apprvlead= 0 ;
String lineNoold="";
String remark="";
double totAmtpoamdtemp =0,approxCost = 0,totAmtDetpordertot = 0,totAmtPoamd =0,totAmtDetpordertotNtc = 0.0 ,totAmtDetpordertotPorcpConf=0.0, totAmtDetpordertotPorcpSer=0.0;;;
double totAmtpoamdtemp =0,approxCost = 0,totAmtDetpordertot = 0,totAmtPoamd =0,totAmtDetpordertotNtc = 0.0 ,totAmtDetpordertotPorcpConf=0.0, totAmtDetpordertotPorcpSer=0.0;
String pordType ="";
String varValue ="";
boolean ValueType = false, firstNull=true;
DistCommon discommon = new DistCommon();
double sumQtyamd=0,excedAmt=0;
double tottemp = 0.0;
GenericUtility genericUtility = GenericUtility.getInstance();
......@@ -606,9 +604,7 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
System.out.println("Project Code>>>> [" + projCode);
double totAmtpoamdtempold=0;
String totAmtpoamdtempold1="";
sql="select line_no__ord , proj_code from poamd_det where amd_no = ?";
/* sql="select line_no__ord , proj_code from poamd_det where amd_no = ?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, amdNo);
System.out.println("Line is for poamdconf....."+ projCode);
......@@ -624,23 +620,22 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
" from poamd_det a,poamd_hdr b " +
"where a.amd_no = b.amd_no and a.line_no__ord= ?" +
"and a.amd_no = ? group by a.proj_code";*/
sql="select sum(a.tot_amt * b.exch_rate)" +//a.net_amt * b.exch_rate
" from poamd_det a,poamd_hdr b " +
"where a.amd_no = b.amd_no and a.proj_code= ?" +
"and a.amd_no = ? group by a.proj_code";
sql="select sum(a.tot_amt * b.exch_rate),a.proj_code from poamd_det a,poamd_hdr b " +
"where a.amd_no = b.amd_no and a.amd_no = ? group by a.proj_code";
System.out.println("AmdNo>>>>>" + amdNo);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, projCode);
pstmt.setString(2, amdNo);
pstmt.setString(1, amdNo);
rs = pstmt.executeQuery();
if (rs.next())
while (rs.next())
{
totAmtpoamdtemp = rs.getDouble(1);
projCode= rs.getString(2);
System.out.println("TOTAMT OF POAMD"+totAmtpoamdtemp);
System.out.println("Project-" + projCode);
sql2 ="select approx_cost from project where proj_code =?";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1,projCode);
System.out.println("Project code is Abhi....."+ projCode);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
......@@ -651,7 +646,8 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
rs2 = null;
pstmt2.close();
pstmt2 = null;
sql3 ="select sum(a.tot_amt * b.exch_rate) from porddet a,porder b " +
sql3 = "select sum(a.tot_amt * b.exch_rate) from porddet a,porder b " +
"where (a.purc_order = b.purc_order) and" +
" b.confirmed = 'Y' and a.proj_code = ? and b.purc_order = ? and " +
" a.line_no NOT IN (select line_no__ord from poamd_det where amd_no = ? " +
......@@ -674,13 +670,13 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
pstmt3.close();
pstmt3 = null;
System.out.println("@@@@@@@ In @@@@@@@@@");
sql="select sum(a.net_amt * b.exch_rate) from " +
sql= "select sum(a.net_amt * b.exch_rate) from " +
"porcpdet a, porcp b ,porddet c " +
" where ( a.purc_order = c.purc_order ) " +
" and (a.tran_id = b.tran_id ) and a.line_no__ord = c.line_no " +
" and b.confirmed = 'Y' and c.proj_code = ? " +
" and b.status ! = 'X'" +
" and c.status = 'C' and b.tran_ser='P-RCP'";
" and c.status = 'C' and b.tran_ser='P-RCP' ";
pstmtrcp = conn.prepareStatement(sql);
pstmtrcp.setString(1, projCode);
//pstmt.setString(2, pordNo);
......@@ -695,13 +691,13 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
rsrcp = null;
pstmtrcp.close();
pstmtrcp = null;
System.out.println("purc_order"+ purcOrder);
sql = "select sum( a.tot_amt * b.exch_rate) from porddet a, porder b"
+ " where ( a.purc_order = b.purc_order ) and b.confirmed = 'Y' and a.proj_code = ? and b.status! = 'X' and a.status! ='C'" ;
+ " where ( a.purc_order = b.purc_order ) and b.confirmed = 'Y' and a.proj_code = ? and b.status! = 'X' and a.status! ='C' and b.purc_order != ? " ;
pstmtopen = conn.prepareStatement(sql);
pstmtopen.setString(1, projCode);
// pstmt.setString(2, pordNo);
pstmtopen.setString(2, purcOrder);
rsopen = pstmtopen.executeQuery();
if (rsopen.next())
{
......@@ -733,48 +729,14 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
rsret = null;
pstmtret.close();
pstmtret = null;
System.out.println("totAmtDetpordertotNtc["+totAmtDetpordertotNtc+"] + totAmtDetpordertotPorcpConf["+totAmtDetpordertotPorcpConf+"] - totAmtDetpordertotPorcpSer["+totAmtDetpordertotPorcpSer+"]");
totAmtDetpordertot= totAmtDetpordertotNtc + totAmtDetpordertotPorcpConf - totAmtDetpordertotPorcpSer;
totAmtDetpordertot= totAmtDetpordertotNtc + totAmtDetpordertotPorcpConf + totAmtnotcurr - totAmtDetpordertotPorcpSer;
sql="select sum(a.rate__o * a.quantity__o * b.exch_rate) " +
" from poamd_det a,poamd_hdr b " +
"where a.amd_no = b.amd_no " +
"and a.amd_no = ?";
pstmtold = conn.prepareStatement(sql);
pstmtold.setString(1, amdNo);
System.out.println("Project code is for poamdconf....."+ projCode);
rsold = pstmtold.executeQuery();
if(rsold.next())
{
totAmtpoamdtempold = rsold.getDouble(1);
System.out.println("TOTAMT OF POAMD old"+totAmtpoamdtempold);
}
rsold.close();
rsold = null;
pstmtold.close();
pstmtold = null;
if((lineNoold == null || "@".equalsIgnoreCase(lineNoold) || "".equalsIgnoreCase(lineNoold) || lineNoold.trim().length()==0 ) && firstNull== true)
{
firstNull=false;
tottemp+=totAmtpoamdtemp;
System.out.println("totAmtpoamdtemp Null @@@@@" + totAmtpoamdtemp);
}
else
{
tottemp+= totAmtpoamdtemp - totAmtpoamdtempold;
if(tottemp < 0)
{
System.out.println(" IF tottemp");
tottemp=0;
}
}
totAmtPoamd = totAmtDetpordertot + tottemp;
System.out.println("tottemp>>>>.."+tottemp);
System.out.println("totamtpordertot"+totAmtDetpordertot);
System.out.println("totAmtPoamd>>>>.."+totAmtPoamd);
if(approxCost < totAmtPoamd)
totAmtPoamd = totAmtDetpordertot + totAmtpoamdtemp;
System.out.println("totAmtDetpordertot["+totAmtDetpordertot+"] + totAmtpoamdtemp["+totAmtpoamdtemp+"] ");
System.out.println("totAmtDetpordertot["+totAmtDetpordertot+"] + totAmtpoamdtemp["+totAmtpoamdtemp+"] ");
if(totAmtPoamd > approxCost)
{
System.out.println("In approxcost validation>>");
errCode = "VTPROJCNF";
......@@ -808,6 +770,13 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
return errCode;
}
totAmtpoamdtemp =0;
approxCost = 0;
totAmtDetpordertot = 0;
totAmtPoamd =0;
totAmtDetpordertotNtc = 0.0;
totAmtDetpordertotPorcpConf=0.0;
totAmtDetpordertotPorcpSer=0.0;
}
......@@ -815,11 +784,7 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
rs = null;
pstmt.close();
pstmt = null;
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
//}//end while
}
/*Request ID -D15ISUN003 End*/
......
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