1003544 Purchase Order window is showing as default the Sales Price List

This commit is contained in:
Elaine Tan 2013-12-03 12:29:25 +08:00
parent 5b3e0af93f
commit c03e01aa2e
3 changed files with 45 additions and 7 deletions

View File

@ -159,7 +159,18 @@ public class CalloutInvoice extends CalloutEngine
{ // get default PriceList
int i = Env.getContextAsInt(ctx, "#M_PriceList_ID");
if (i != 0)
mTab.setValue("M_PriceList_ID", new Integer(i));
{
MPriceList pl = new MPriceList(ctx, i, null);
if (IsSOTrx == pl.isSOPriceList())
mTab.setValue("M_PriceList_ID", new Integer(i));
else
{
String sql2 = "SELECT M_PriceList_ID FROM M_PriceList WHERE AD_Client_ID=? AND IsSOPriceList=? AND IsActive='Y' ORDER BY IsDefault DESC";
ii = DB.getSQLValue (null, sql2, Env.getAD_Client_ID(ctx), IsSOTrx);
if (ii != 0)
mTab.setValue("M_PriceList_ID", new Integer(ii));
}
}
}
// PaymentRule

View File

@ -289,7 +289,18 @@ public class CalloutOrder extends CalloutEngine
{ // get default PriceList
int i = Env.getContextAsInt(ctx, "#M_PriceList_ID");
if (i != 0)
mTab.setValue("M_PriceList_ID", new Integer(i));
{
MPriceList pl = new MPriceList(ctx, i, null);
if (IsSOTrx == pl.isSOPriceList())
mTab.setValue("M_PriceList_ID", new Integer(i));
else
{
String sql2 = "SELECT M_PriceList_ID FROM M_PriceList WHERE AD_Client_ID=? AND IsSOPriceList=? AND IsActive='Y' ORDER BY IsDefault DESC";
ii = DB.getSQLValue (null, sql2, Env.getAD_Client_ID(ctx), IsSOTrx);
if (ii != 0)
mTab.setValue("M_PriceList_ID", new Integer(ii));
}
}
}
// Bill-To
@ -494,7 +505,18 @@ public class CalloutOrder extends CalloutEngine
{ // get default PriceList
int i = Env.getContextAsInt(ctx, "#M_PriceList_ID");
if (i != 0)
mTab.setValue("M_PriceList_ID", new Integer(i));
{
MPriceList pl = new MPriceList(ctx, i, null);
if (IsSOTrx == pl.isSOPriceList())
mTab.setValue("M_PriceList_ID", new Integer(i));
else
{
String sql2 = "SELECT M_PriceList_ID FROM M_PriceList WHERE AD_Client_ID=? AND IsSOPriceList=? AND IsActive='Y' ORDER BY IsDefault DESC";
ii = DB.getSQLValue (null, sql2, Env.getAD_Client_ID(ctx), IsSOTrx);
if (ii != 0)
mTab.setValue("M_PriceList_ID", new Integer(ii));
}
}
}
int bill_Location_ID = rs.getInt("Bill_Location_ID");

View File

@ -925,11 +925,16 @@ public class MInvoice extends X_C_Invoice implements DocAction
{
int ii = Env.getContextAsInt(getCtx(), "#M_PriceList_ID");
if (ii != 0)
setM_PriceList_ID(ii);
else
{
String sql = "SELECT M_PriceList_ID FROM M_PriceList WHERE AD_Client_ID=? AND IsDefault='Y'";
ii = DB.getSQLValue (null, sql, getAD_Client_ID());
MPriceList pl = new MPriceList(getCtx(), ii, null);
if (isSOTrx() == pl.isSOPriceList())
setM_PriceList_ID(ii);
}
if (getM_PriceList_ID() == 0)
{
String sql = "SELECT M_PriceList_ID FROM M_PriceList WHERE AD_Client_ID=? AND IsSOPriceList=? AND IsActive='Y' ORDER BY IsDefault DESC";
ii = DB.getSQLValue (null, sql, getAD_Client_ID(), isSOTrx());
if (ii != 0)
setM_PriceList_ID (ii);
}