Commit 5547e4ba authored by msharma's avatar msharma

set cost rate for byproduct item


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95175 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4e3f9a48
...@@ -171,7 +171,9 @@ QCTransferConfLocal, QCTransferConfRemote ...@@ -171,7 +171,9 @@ QCTransferConfLocal, QCTransferConfRemote
boolean isByProduct=false; boolean isByProduct=false;
double noArt=0,convertedNoArt=0,convertedNetWeight=0; double noArt=0,convertedNoArt=0,convertedNetWeight=0;
double rate=0;
double grossRate=0;
String dimension="";
try try
{ {
StockUpdate stockUpdate = new StockUpdate(); StockUpdate stockUpdate = new StockUpdate();
...@@ -184,7 +186,7 @@ QCTransferConfLocal, QCTransferConfRemote ...@@ -184,7 +186,7 @@ QCTransferConfLocal, QCTransferConfRemote
sysDate= Timestamp.valueOf(genericUtility.getValidDateString(sysDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0"); sysDate= Timestamp.valueOf(genericUtility.getValidDateString(sysDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
sql = " Select confirmed, qorder_no, tran_date ,site_code,loc_code__trf,quantity," + sql = " Select confirmed, qorder_no, tran_date ,site_code,loc_code__trf,quantity," +
" lot_sl,lot_no,porcp_no, loc_code,item_code " + " lot_sl,lot_no,porcp_no, loc_code,item_code,case when dimension is null then '' else dimension end as dimension " +
" from qc_transfer where tran_id = ? "; " from qc_transfer where tran_id = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
...@@ -204,6 +206,7 @@ QCTransferConfLocal, QCTransferConfRemote ...@@ -204,6 +206,7 @@ QCTransferConfLocal, QCTransferConfRemote
itemCode= rs.getString("item_code"); itemCode= rs.getString("item_code");
//noArtQCTransfer= rs.getDouble("no_art"); //noArtQCTransfer= rs.getDouble("no_art");
//netWeightQCTransfer= rs.getDouble("net_weight"); //netWeightQCTransfer= rs.getDouble("net_weight");
dimension=rs.getString("dimension");
} }
rs.close(); rs.close();
...@@ -438,7 +441,8 @@ QCTransferConfLocal, QCTransferConfRemote ...@@ -438,7 +441,8 @@ QCTransferConfLocal, QCTransferConfRemote
stkTareWt = rs.getDouble("tare_weight"); stkTareWt = rs.getDouble("tare_weight");
stkNetWt = rs.getDouble("net_weight"); stkNetWt = rs.getDouble("net_weight");
stockUpd.put("pack_instr", rs.getString("pack_instr")); stockUpd.put("pack_instr", rs.getString("pack_instr"));
stockUpd.put("dimension", rs.getString("dimension")); //stockUpd.put("dimension", rs.getString("dimension")); //Commented by Manoj dtd 30/05/2014 set from qc_transfer
stockUpd.put("dimension", dimension);
stockUpd.put("rate", rs.getString("rate")); stockUpd.put("rate", rs.getString("rate"));
stockUpd.put("rate_oh", rs.getString("rate__oh")); stockUpd.put("rate_oh", rs.getString("rate__oh"));
stockUpd.put("acct_code_inv", rs.getString("acct_code__inv")); stockUpd.put("acct_code_inv", rs.getString("acct_code__inv"));
...@@ -456,6 +460,8 @@ QCTransferConfLocal, QCTransferConfRemote ...@@ -456,6 +460,8 @@ QCTransferConfLocal, QCTransferConfRemote
grossWtPerArt = rs.getDouble("gross_wt_per_art"); grossWtPerArt = rs.getDouble("gross_wt_per_art");
tareWtPerArt = rs.getDouble("tare_wt_per_art"); tareWtPerArt = rs.getDouble("tare_wt_per_art");
stockQty = rs.getDouble("quantity"); stockQty = rs.getDouble("quantity");
rate=rs.getDouble("rate");
grossRate=rs.getDouble("gross_rate");
} }
rs.close(); rs.close();
rs = null; rs = null;
...@@ -471,6 +477,61 @@ QCTransferConfLocal, QCTransferConfRemote ...@@ -471,6 +477,61 @@ QCTransferConfLocal, QCTransferConfRemote
if( errCode == null || errCode.trim().length() == 0 ) if( errCode == null || errCode.trim().length() == 0 )
{ {
//Added by manoj dtd 31/05/2014 to set rate for byproduct
if(isByProduct)
{
String considerYield="N";
double costRate=0;
sql="select case when consider_yield is null then 'N' else consider_yield end consider_yield from byproduct where item_code__byprod=? and item_code=?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
pstmt.setString(2,qcOrderItem);
rs = pstmt.executeQuery();
if(rs.next())
{
considerYield=rs.getString(1);
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
if(considerYield.equalsIgnoreCase("N"))
{
sql="select cost_rate from item where item_code=?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
rs=pstmt.executeQuery();
if(rs.next())
{
costRate=rs.getDouble(1);
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
stockUpd.put("rate", costRate);
stockUpd.put("gross_rate", costRate);
}
else
{
double convQty=0;
convQty=dcommon.convQtyFactor(qcOrdItemUnit,byprodUnit, "X", convertedQty, conn);
System.out.println("convQty-----"+convQty);
System.out.println("rate before conversion-----"+rate);
rate=roundVal((rate/convertedQty)*convQty,3);
System.out.println("rate after conversion-----"+rate);
grossRate=roundVal((grossRate/convertedQty)*convQty,3);
stockUpd.put("rate", rate);
stockUpd.put("gross_rate", grossRate);
}
}
sql = " Select unit From item where item_code = ? "; sql = " Select unit From item where item_code = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
if(isByProduct) if(isByProduct)
......
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