Fixed [ 1867464 ] Incorrect Partner Location when create manual shipment
http://sourceforge.net/tracker/index.php?func=detail&aid=1867464&group_id=176962&atid=879332
This commit is contained in:
parent
bca948a704
commit
863fdf174a
|
@ -71,6 +71,8 @@ public class CalloutInOut extends CalloutEngine
|
||||||
mTab.setValue("FreightAmt", order.getFreightAmt());
|
mTab.setValue("FreightAmt", order.getFreightAmt());
|
||||||
|
|
||||||
mTab.setValue("C_BPartner_ID", new Integer(order.getC_BPartner_ID()));
|
mTab.setValue("C_BPartner_ID", new Integer(order.getC_BPartner_ID()));
|
||||||
|
mTab.setValue("C_BPartner_Location_ID", new Integer(order.getC_BPartner_Location_ID()));
|
||||||
|
mTab.setValue("AD_User_ID", new Integer(order.getAD_User_ID()));
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
} // order
|
} // order
|
||||||
|
@ -164,56 +166,66 @@ public class CalloutInOut extends CalloutEngine
|
||||||
if (C_BPartner_ID == null || C_BPartner_ID.intValue() == 0)
|
if (C_BPartner_ID == null || C_BPartner_ID.intValue() == 0)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
String sql = "SELECT p.AD_Language,p.C_PaymentTerm_ID,"
|
boolean IsSOTrx = "Y".equals(Env.getContext(ctx, WindowNo, "IsSOTrx"));
|
||||||
+ "p.M_PriceList_ID,p.PaymentRule,p.POReference,"
|
if (!IsSOTrx)
|
||||||
+ "p.SO_Description,p.IsDiscountPrinted,"
|
|
||||||
+ "p.SO_CreditLimit-p.SO_CreditUsed AS CreditAvailable,"
|
|
||||||
+ "l.C_BPartner_Location_ID,c.AD_User_ID "
|
|
||||||
+ "FROM C_BPartner p, C_BPartner_Location l, AD_User c "
|
|
||||||
+ "WHERE p.C_BPartner_ID=l.C_BPartner_ID(+)"
|
|
||||||
+ " AND p.C_BPartner_ID=c.C_BPartner_ID(+)"
|
|
||||||
+ " AND p.C_BPartner_ID=?"; // 1
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
//When Is Receipt
|
||||||
pstmt.setInt(1, C_BPartner_ID.intValue());
|
String sql = "SELECT p.AD_Language,p.C_PaymentTerm_ID,"
|
||||||
ResultSet rs = pstmt.executeQuery();
|
+ "p.M_PriceList_ID,p.PaymentRule,p.POReference,"
|
||||||
BigDecimal bd;
|
+ "p.SO_Description,p.IsDiscountPrinted,"
|
||||||
if (rs.next())
|
+ "p.SO_CreditLimit-p.SO_CreditUsed AS CreditAvailable,"
|
||||||
|
+ "l.C_BPartner_Location_ID,c.AD_User_ID "
|
||||||
|
+ "FROM C_BPartner p, C_BPartner_Location l, AD_User c "
|
||||||
|
+ "WHERE l.IsActive='Y' AND p.C_BPartner_ID=l.C_BPartner_ID(+)"
|
||||||
|
+ " AND p.C_BPartner_ID=c.C_BPartner_ID(+)"
|
||||||
|
+ " AND p.C_BPartner_ID=?"; // 1
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// Location
|
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||||
Integer ii = new Integer(rs.getInt("C_BPartner_Location_ID"));
|
pstmt.setInt(1, C_BPartner_ID.intValue());
|
||||||
if (rs.wasNull())
|
ResultSet rs = pstmt.executeQuery();
|
||||||
mTab.setValue("C_BPartner_Location_ID", null);
|
BigDecimal bd;
|
||||||
else
|
if (rs.next())
|
||||||
mTab.setValue("C_BPartner_Location_ID", ii);
|
|
||||||
// Contact
|
|
||||||
ii = new Integer(rs.getInt("AD_User_ID"));
|
|
||||||
if (rs.wasNull())
|
|
||||||
mTab.setValue("AD_User_ID", null);
|
|
||||||
else
|
|
||||||
mTab.setValue("AD_User_ID", ii);
|
|
||||||
|
|
||||||
//Bugs item #1679818: checking for SOTrx only
|
|
||||||
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
|
||||||
if (IsSOTrx)
|
|
||||||
{
|
{
|
||||||
// CreditAvailable
|
// Location
|
||||||
double CreditAvailable = rs.getDouble("CreditAvailable");
|
Integer ii = new Integer(rs.getInt("C_BPartner_Location_ID"));
|
||||||
if (!rs.wasNull() && CreditAvailable < 0)
|
if (rs.wasNull())
|
||||||
mTab.fireDataStatusEEvent("CreditLimitOver",
|
mTab.setValue("C_BPartner_Location_ID", null);
|
||||||
DisplayType.getNumberFormat(DisplayType.Amount).format(CreditAvailable),
|
else
|
||||||
false);
|
mTab.setValue("C_BPartner_Location_ID", ii);
|
||||||
}//
|
// Contact
|
||||||
|
ii = new Integer(rs.getInt("AD_User_ID"));
|
||||||
|
if (rs.wasNull())
|
||||||
|
mTab.setValue("AD_User_ID", null);
|
||||||
|
else
|
||||||
|
mTab.setValue("AD_User_ID", ii);
|
||||||
|
|
||||||
|
//Bugs item #1679818: checking for SOTrx only
|
||||||
|
//boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
||||||
|
|
||||||
|
if (IsSOTrx)
|
||||||
|
{
|
||||||
|
// CreditAvailable
|
||||||
|
double CreditAvailable = rs.getDouble("CreditAvailable");
|
||||||
|
if (!rs.wasNull() && CreditAvailable < 0)
|
||||||
|
mTab.fireDataStatusEEvent("CreditLimitOver",
|
||||||
|
DisplayType.getNumberFormat(DisplayType.Amount).format(CreditAvailable),
|
||||||
|
false);
|
||||||
|
}//
|
||||||
|
}
|
||||||
|
rs.close();
|
||||||
|
pstmt.close();
|
||||||
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, sql, e);
|
||||||
|
return e.getLocalizedMessage();
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
else
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
|
||||||
return e.getLocalizedMessage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|
Loading…
Reference in New Issue