Implemented info factory as extension point for zk and swing client.
This commit is contained in:
parent
c321e8feb6
commit
b9e40c4bf4
|
@ -21,6 +21,8 @@
|
|||
</factory>
|
||||
</extension>
|
||||
<extension
|
||||
id="org.adempiere.base.DefaultDocFactory"
|
||||
name="Default Document Factory"
|
||||
point="org.adempiere.base.IDocFactory">
|
||||
<factory
|
||||
class="org.adempiere.base.DefaultDocumentFactory"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<plugin>
|
||||
<extension-point id="org.adempiere.osgi.IMenuAction" name="MenuAction" schema="schema/org.adempiere.osgi.IMenuAction.exsd"/>
|
||||
<extension-point id="org.adempiere.apps.Form" name="Form" schema="schema/org.adempiere.apps.Form.exsd"/>
|
||||
<extension-point id="org.adempiere.osgi.IInfoFactory" name="Info Factory extension" schema="schema/org.adempiere.osgi.IInfoFactory.exsd"/>
|
||||
<extension
|
||||
id="RF"
|
||||
name="RF"
|
||||
|
@ -49,5 +50,14 @@
|
|||
</property>
|
||||
</product>
|
||||
</extension>
|
||||
<extension
|
||||
id="org.adempiere.osgi.DefaultInfoFactory"
|
||||
name="Default Info Factory"
|
||||
point="org.adempiere.osgi.IInfoFactory">
|
||||
<factory
|
||||
class="org.adempiere.osgi.DefaultInfoFactory"
|
||||
priority="0">
|
||||
</factory>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.ui.swing" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.ui.swing" id="org.adempiere.osgi.IInfoFactory" name="Info Factory extension"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="factory"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="factory">
|
||||
<complexType>
|
||||
<attribute name="priority" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
numeric priority value. bigger number have higher priority.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.adempiere.osgi.IInfoFactory"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter the first release in which this extension point appears.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter extension point usage example here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter API information here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter information about supplied implementation of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
|
||||
</schema>
|
|
@ -0,0 +1,145 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2010 Heng Sin Low *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.osgi;
|
||||
|
||||
import java.awt.Frame;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.apps.search.Info;
|
||||
import org.compiere.apps.search.InfoAsset;
|
||||
import org.compiere.apps.search.InfoAssignment;
|
||||
import org.compiere.apps.search.InfoBPartner;
|
||||
import org.compiere.apps.search.InfoCashLine;
|
||||
import org.compiere.apps.search.InfoFactory;
|
||||
import org.compiere.apps.search.InfoGeneral;
|
||||
import org.compiere.apps.search.InfoInOut;
|
||||
import org.compiere.apps.search.InfoInvoice;
|
||||
import org.compiere.apps.search.InfoOrder;
|
||||
import org.compiere.apps.search.InfoPayment;
|
||||
import org.compiere.apps.search.InfoProduct;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MInvoiceLine;
|
||||
import org.compiere.model.MOrderLine;
|
||||
import org.compiere.model.MProductPrice;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.eevolution.model.I_PP_Product_BOMLine;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class DefaultInfoFactory implements IInfoFactory {
|
||||
|
||||
private final static CLogger log = CLogger.getCLogger(DefaultInfoFactory.class);
|
||||
|
||||
@Override
|
||||
public Info create(Frame frame, boolean modal, Lookup lookup,
|
||||
GridField field, String tableName, String keyColumn, String queryValue,
|
||||
boolean multiSelection, String whereClause) {
|
||||
Info info = null;
|
||||
String col = lookup.getColumnName(); // fully qualified name
|
||||
if (col.indexOf('.') != -1)
|
||||
col = col.substring(col.indexOf('.')+1);
|
||||
boolean multipleSelection = false;
|
||||
String infoFactoryClass = lookup.getInfoFactoryClass();
|
||||
if (infoFactoryClass != null && infoFactoryClass.trim().length() > 0)
|
||||
{
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<InfoFactory> clazz = (Class<InfoFactory>)this.getClass().getClassLoader().loadClass(infoFactoryClass);
|
||||
InfoFactory factory = clazz.newInstance();
|
||||
info = factory.create (frame, true, lookup.getWindowNo(),
|
||||
tableName, keyColumn, queryValue, false, whereClause);
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Failed to load custom InfoFactory - " + e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
else if (col.equals("M_Product_ID"))
|
||||
{
|
||||
int M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), lookup.getWindowNo(), "M_Warehouse_ID");
|
||||
int M_PriceList_ID = Env.getContextAsInt(Env.getCtx(), lookup.getWindowNo(), "M_PriceList_ID");
|
||||
|
||||
if(field != null)
|
||||
{
|
||||
int AD_Table_ID = MColumn.getTable_ID(Env.getCtx(), field.getAD_Column_ID(), null);
|
||||
multipleSelection = (MOrderLine.Table_ID == AD_Table_ID) || (MInvoiceLine.Table_ID == AD_Table_ID) || (I_PP_Product_BOMLine.Table_ID == AD_Table_ID) || (MProductPrice.Table_ID == AD_Table_ID);
|
||||
}
|
||||
// Show Info
|
||||
info = new InfoProduct (frame, true, lookup.getWindowNo(),
|
||||
M_Warehouse_ID, M_PriceList_ID, queryValue, multipleSelection, whereClause);
|
||||
}
|
||||
else if (col.equals("C_BPartner_ID"))
|
||||
{
|
||||
boolean isSOTrx = true; // default
|
||||
if (Env.getContext(Env.getCtx(), lookup.getWindowNo(), "IsSOTrx").equals("N"))
|
||||
isSOTrx = false;
|
||||
info = new InfoBPartner (frame, true, lookup.getWindowNo(),
|
||||
queryValue, isSOTrx, multipleSelection, whereClause);
|
||||
}
|
||||
else // General Info
|
||||
{
|
||||
info = create (frame, true, lookup.getWindowNo(),
|
||||
tableName, keyColumn, queryValue, multipleSelection, whereClause, true);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Info create(Frame frame, boolean modal, int WindowNo,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup) {
|
||||
Info info = null;
|
||||
|
||||
if (tableName.equals("C_BPartner"))
|
||||
info = new InfoBPartner (frame, modal, WindowNo, value, !Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"),
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("M_Product"))
|
||||
info = new InfoProduct (frame, modal, WindowNo,
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_Warehouse_ID"),
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_PriceList_ID"),
|
||||
value, multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("C_Invoice"))
|
||||
info = new InfoInvoice (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("A_Asset"))
|
||||
info = new InfoAsset (frame, modal, WindowNo, 0, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("C_Order"))
|
||||
info = new InfoOrder (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("M_InOut"))
|
||||
info = new InfoInOut (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("C_Payment"))
|
||||
info = new InfoPayment (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("C_CashLine"))
|
||||
info = new InfoCashLine (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("S_ResourceAssigment"))
|
||||
info = new InfoAssignment (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else
|
||||
info = new InfoGeneral (frame, modal, WindowNo, value,
|
||||
tableName, keyColumn,
|
||||
multiSelection, whereClause, lookup);
|
||||
//
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2010 Heng Sin Low *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.osgi;
|
||||
|
||||
import java.awt.Frame;
|
||||
|
||||
import org.compiere.apps.search.Info;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public interface IInfoFactory {
|
||||
|
||||
/**
|
||||
* Factory Constructor
|
||||
* @param frame parent frame
|
||||
* @param modal new window is modal
|
||||
* @param lookup Lookup
|
||||
* @param field Grid field
|
||||
* @param tableName table name of the search
|
||||
* @param keyColumn key column of the search
|
||||
* @param value query value
|
||||
* @param multiSelection allow to select more than one row
|
||||
* @param whereClause fully qualified where clause for the search
|
||||
* @return special or general Info Window
|
||||
*/
|
||||
public Info create (Frame frame, boolean modal, Lookup lookup, GridField field,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause);
|
||||
|
||||
/**
|
||||
* Factory Constructor
|
||||
* @param frame parent frame
|
||||
* @param modal new window is modal
|
||||
* @param WindowNo window no
|
||||
* @param tableName table name of the search
|
||||
* @param keyColumn key column of the search
|
||||
* @param value query value
|
||||
* @param multiSelection allow to select more than one row
|
||||
* @param whereClause fully qualified where clause for the search
|
||||
* @param lookup
|
||||
* @return special or general Info Window
|
||||
*/
|
||||
public Info create (Frame frame, boolean modal, int WindowNo,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup);
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2010 Heng Sin Low *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.osgi;
|
||||
|
||||
import java.awt.Frame;
|
||||
import java.util.List;
|
||||
|
||||
import org.adempiere.base.Service;
|
||||
import org.compiere.apps.search.Info;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class InfoManager
|
||||
{
|
||||
/**
|
||||
* Factory Constructor
|
||||
* @param frame parent frame
|
||||
* @param modal new window is modal
|
||||
* @param lookup Lookup
|
||||
* @param field Grid field
|
||||
* @param tableName table name of the search
|
||||
* @param keyColumn key column of the search
|
||||
* @param value query value
|
||||
* @param multiSelection allow to select more than one row
|
||||
* @param whereClause fully qualified where clause for the search
|
||||
* @return special or general Info Window
|
||||
*/
|
||||
public static Info create(Frame frame, boolean modal, Lookup lookup,
|
||||
GridField field, String tableName, String keyColumn, String queryValue,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
Info info = null;
|
||||
List<IInfoFactory> factoryList = Service.list(IInfoFactory.class);
|
||||
for(IInfoFactory factory : factoryList)
|
||||
{
|
||||
info = factory.create(frame, true, lookup, field, tableName, keyColumn,
|
||||
queryValue, multiSelection, whereClause);
|
||||
if (info != null)
|
||||
break;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory Constructor
|
||||
* @param frame parent frame
|
||||
* @param modal new window is modal
|
||||
* @param WindowNo window no
|
||||
* @param tableName table name of the search
|
||||
* @param keyColumn key column of the search
|
||||
* @param value query value
|
||||
* @param multiSelection allow to select more than one row
|
||||
* @param whereClause fully qualified where clause for the search
|
||||
* @param lookup
|
||||
* @return special or general Info Window
|
||||
*/
|
||||
public static Info create(Frame frame, boolean modal, int WindowNo,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
Info info = null;
|
||||
|
||||
List<IInfoFactory> factoryList = Service.list(IInfoFactory.class);
|
||||
for(IInfoFactory factory : factoryList)
|
||||
{
|
||||
info = factory.create(frame, modal, WindowNo, tableName, keyColumn, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
if (info != null)
|
||||
break;
|
||||
}
|
||||
//
|
||||
return info;
|
||||
}
|
||||
}
|
|
@ -40,6 +40,7 @@ import javax.swing.SwingUtilities;
|
|||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
import org.adempiere.osgi.InfoManager;
|
||||
import org.compiere.apps.ADialog;
|
||||
import org.compiere.apps.AEnv;
|
||||
import org.compiere.apps.AWindow;
|
||||
|
@ -49,6 +50,15 @@ import org.compiere.apps.StatusBar;
|
|||
import org.compiere.grid.ed.Calculator;
|
||||
import org.compiere.minigrid.IDColumn;
|
||||
import org.compiere.minigrid.MiniTable;
|
||||
import org.compiere.model.I_A_Asset;
|
||||
import org.compiere.model.I_C_BPartner;
|
||||
import org.compiere.model.I_C_CashLine;
|
||||
import org.compiere.model.I_C_Invoice;
|
||||
import org.compiere.model.I_C_Order;
|
||||
import org.compiere.model.I_C_Payment;
|
||||
import org.compiere.model.I_M_InOut;
|
||||
import org.compiere.model.I_M_Product;
|
||||
import org.compiere.model.I_S_ResourceAssignment;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MSysConfig;
|
||||
|
@ -75,7 +85,7 @@ import org.compiere.util.Msg;
|
|||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: Info.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
|
||||
*
|
||||
*
|
||||
* @author Teo Sarca
|
||||
* <li>FR [ 2846869 ] Info class - add more helper methods
|
||||
* https://sourceforge.net/tracker/?func=detail&atid=879335&aid=2846869&group_id=176962
|
||||
|
@ -88,10 +98,10 @@ public abstract class Info extends CDialog
|
|||
implements ListSelectionListener
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5606614040914295869L;
|
||||
|
||||
|
||||
public static final String SYSCONFIG_INFO_DEFAULTSELECTED = "INFO_DEFAULTSELECTED";
|
||||
public static final String SYSCONFIG_INFO_DOUBLECLICKTOGGLESSELECTION = "INFO_DOUBLECLICKTOGGLESSELECTION";
|
||||
|
||||
|
@ -112,39 +122,8 @@ public abstract class Info extends CDialog
|
|||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
Info info = null;
|
||||
|
||||
if (tableName.equals("C_BPartner"))
|
||||
info = new InfoBPartner (frame, modal, WindowNo, value, !Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"),
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("M_Product"))
|
||||
info = new InfoProduct (frame, modal, WindowNo, 0,0, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("C_Invoice"))
|
||||
info = new InfoInvoice (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("A_Asset"))
|
||||
info = new InfoAsset (frame, modal, WindowNo, 0, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("C_Order"))
|
||||
info = new InfoOrder (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("M_InOut"))
|
||||
info = new InfoInOut (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("C_Payment"))
|
||||
info = new InfoPayment (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("C_CashLine"))
|
||||
info = new InfoCashLine (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("S_ResourceAssigment"))
|
||||
info = new InfoAssignment (frame, modal, WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else
|
||||
info = new InfoGeneral (frame, modal, WindowNo, value,
|
||||
tableName, keyColumn,
|
||||
multiSelection, whereClause);
|
||||
Info info = InfoManager.create(frame, modal, WindowNo, tableName, keyColumn, value,
|
||||
multiSelection, whereClause, true);
|
||||
//
|
||||
AEnv.positionCenterWindow(frame, info);
|
||||
return info;
|
||||
|
@ -157,8 +136,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showBPartner (Frame frame, int WindowNo)
|
||||
{
|
||||
Info info = new InfoBPartner (frame, false, WindowNo, "",
|
||||
!Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"), false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_C_BPartner.Table_Name, I_C_BPartner.COLUMNNAME_C_BPartner_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showBPartner
|
||||
|
||||
|
@ -169,8 +149,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showAsset (Frame frame, int WindowNo)
|
||||
{
|
||||
Info info = new InfoAsset (frame, false, WindowNo,
|
||||
0, "", false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_A_Asset.Table_Name, I_A_Asset.COLUMNNAME_A_Asset_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showBPartner
|
||||
|
||||
|
@ -181,11 +162,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showProduct (Frame frame, int WindowNo)
|
||||
{
|
||||
Info info = new InfoProduct (frame, false, WindowNo,
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_Warehouse_ID"),
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_PriceList_ID"),
|
||||
"", // value
|
||||
false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_M_Product.Table_Name, I_M_Product.COLUMNNAME_M_Product_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showProduct
|
||||
|
||||
|
@ -197,8 +176,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showOrder (Frame frame, int WindowNo, String value)
|
||||
{
|
||||
Info info = new InfoOrder (frame, false, WindowNo, value,
|
||||
false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_C_Order.Table_Name, I_C_Order.COLUMNNAME_C_Order_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showOrder
|
||||
|
||||
|
@ -210,8 +190,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showInvoice (Frame frame, int WindowNo, String value)
|
||||
{
|
||||
Info info = new InfoInvoice (frame, false, WindowNo, value,
|
||||
false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_C_Invoice.Table_Name, I_C_Invoice.COLUMNNAME_C_Invoice_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showInvoice
|
||||
|
||||
|
@ -223,8 +204,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showInOut (Frame frame, int WindowNo, String value)
|
||||
{
|
||||
Info info = new InfoInOut (frame, false, WindowNo, value,
|
||||
false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_M_InOut.Table_Name, I_M_InOut.COLUMNNAME_M_InOut_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showInOut
|
||||
|
||||
|
@ -236,8 +218,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showPayment (Frame frame, int WindowNo, String value)
|
||||
{
|
||||
Info info = new InfoPayment (frame, false, WindowNo, value,
|
||||
false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_C_Payment.Table_Name, I_C_Payment.COLUMNNAME_C_Payment_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showPayment
|
||||
|
||||
|
@ -249,8 +232,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showCashLine (Frame frame, int WindowNo, String value)
|
||||
{
|
||||
Info info = new InfoCashLine (frame, false, WindowNo, value,
|
||||
false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_C_CashLine.Table_Name, I_C_CashLine.COLUMNNAME_C_CashLine_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showCashLine
|
||||
|
||||
|
@ -262,8 +246,9 @@ public abstract class Info extends CDialog
|
|||
*/
|
||||
public static void showAssignment (Frame frame, int WindowNo, String value)
|
||||
{
|
||||
Info info = new InfoAssignment (frame, false, WindowNo, value,
|
||||
false, "");
|
||||
Info info = InfoManager.create(frame, false, WindowNo,
|
||||
I_S_ResourceAssignment.Table_Name, I_S_ResourceAssignment.COLUMNNAME_S_ResourceAssignment_ID,
|
||||
"", false, "", false);
|
||||
AEnv.showCenterWindow(frame, info);
|
||||
} // showAssignment
|
||||
|
||||
|
@ -273,7 +258,9 @@ public abstract class Info extends CDialog
|
|||
|
||||
protected final int INFO_WIDTH = screensize.width > 1500 ? 1500 : screensize.width - 100;
|
||||
protected final int SCREEN_HEIGHT = screensize.height;
|
||||
|
||||
|
||||
private boolean p_lookup;
|
||||
|
||||
/**************************************************************************
|
||||
* Detail Constructor
|
||||
* @param frame parent frame
|
||||
|
@ -287,6 +274,24 @@ public abstract class Info extends CDialog
|
|||
protected Info (Frame frame, boolean modal, int WindowNo,
|
||||
String tableName, String keyColumn,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(frame,modal,WindowNo,tableName,keyColumn,multiSelection,whereClause,true);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Detail Constructor
|
||||
* @param frame parent frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param tableName table name
|
||||
* @param keyColumn key column name
|
||||
* @param multiSelection multiple selection
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
protected Info (Frame frame, boolean modal, int WindowNo,
|
||||
String tableName, String keyColumn,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal);
|
||||
log.info("WinNo=" + p_WindowNo + " " + whereClause);
|
||||
|
@ -294,6 +299,7 @@ public abstract class Info extends CDialog
|
|||
p_tableName = tableName;
|
||||
p_keyColumn = keyColumn;
|
||||
p_multiSelection = multiSelection;
|
||||
p_lookup = lookup;
|
||||
if (whereClause == null || whereClause.indexOf('@') == -1)
|
||||
p_whereClause = whereClause;
|
||||
else
|
||||
|
@ -358,7 +364,7 @@ public abstract class Info extends CDialog
|
|||
|
||||
/** Worker */
|
||||
private Worker m_worker = null;
|
||||
|
||||
|
||||
/** Logger */
|
||||
protected CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
|
@ -443,7 +449,7 @@ public abstract class Info extends CDialog
|
|||
} // setStatusDB
|
||||
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Prepare Table, Construct SQL (m_m_sqlMain, m_sqlAdd)
|
||||
* and size Window
|
||||
|
@ -472,13 +478,13 @@ public abstract class Info extends CDialog
|
|||
if (layout[i].getColClass() == IDColumn.class)
|
||||
m_keyColumnIndex = i;
|
||||
}
|
||||
|
||||
|
||||
// Table Selection (Invoked before setting column class so that row selection is enabled)
|
||||
p_table.setRowSelectionAllowed(true);
|
||||
p_table.addMouseListener(this);
|
||||
p_table.setMultiSelection(p_multiSelection);
|
||||
p_table.setShowTotals(true);
|
||||
|
||||
|
||||
// set editors (two steps)
|
||||
for (int i = 0; i < layout.length; i++)
|
||||
p_table.setColumnClass(i, layout[i].getColClass(), layout[i].isReadOnly(), layout[i].getColHeader());
|
||||
|
@ -495,7 +501,7 @@ public abstract class Info extends CDialog
|
|||
|
||||
if (m_keyColumnIndex == -1)
|
||||
log.log(Level.SEVERE, "No KeyColumn - " + sql);
|
||||
|
||||
|
||||
// Window Sizing
|
||||
parameterPanel.setPreferredSize(new Dimension (INFO_WIDTH, parameterPanel.getPreferredSize().height));
|
||||
//Begin - [FR 1823612 ] Product Info Screen Improvements
|
||||
|
@ -503,7 +509,7 @@ public abstract class Info extends CDialog
|
|||
//End - [FR 1823612 ] Product Info Screen Improvements
|
||||
} // prepareTable
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Execute Query
|
||||
*/
|
||||
|
@ -534,7 +540,7 @@ public abstract class Info extends CDialog
|
|||
if (dynWhere.length() > 0)
|
||||
sql.append(dynWhere); // includes first AND
|
||||
String countSql = Msg.parseTranslation(Env.getCtx(), sql.toString()); // Variables
|
||||
countSql = MRole.getDefault().addAccessSQL(countSql, getTableName(),
|
||||
countSql = MRole.getDefault().addAccessSQL(countSql, getTableName(),
|
||||
MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
|
||||
log.finer(countSql);
|
||||
PreparedStatement pstmt = null;
|
||||
|
@ -559,12 +565,12 @@ public abstract class Info extends CDialog
|
|||
}
|
||||
log.fine("#" + no + " - " + (System.currentTimeMillis()-start) + "ms");
|
||||
//Armen: add role checking (Patch #1694788 )
|
||||
MRole role = MRole.getDefault();
|
||||
MRole role = MRole.getDefault();
|
||||
if (role.isQueryMax(no))
|
||||
return ADialog.ask(p_WindowNo, this, "InfoHighRecordCount", String.valueOf(no));
|
||||
return true;
|
||||
} // testCount
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Save Selection - Called by dispose
|
||||
|
@ -620,7 +626,7 @@ public abstract class Info extends CDialog
|
|||
return selectedDataList.get(0);
|
||||
}
|
||||
} // getSelectedRowKey
|
||||
|
||||
|
||||
/**
|
||||
* Get the keys of selected row/s based on layout defined in prepareTable
|
||||
* @return IDs if selection present
|
||||
|
@ -629,12 +635,12 @@ public abstract class Info extends CDialog
|
|||
protected ArrayList<Integer> getSelectedRowKeys()
|
||||
{
|
||||
ArrayList<Integer> selectedDataList = new ArrayList<Integer>();
|
||||
|
||||
|
||||
if (m_keyColumnIndex == -1)
|
||||
{
|
||||
return selectedDataList;
|
||||
}
|
||||
|
||||
|
||||
if (p_multiSelection)
|
||||
{
|
||||
int rows = p_table.getRowCount();
|
||||
|
@ -660,7 +666,7 @@ public abstract class Info extends CDialog
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (selectedDataList.size() == 0)
|
||||
{
|
||||
int row = p_table.getSelectedRow();
|
||||
|
@ -673,7 +679,7 @@ public abstract class Info extends CDialog
|
|||
selectedDataList.add((Integer)data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return selectedDataList;
|
||||
} // getSelectedRowKeys
|
||||
|
||||
|
@ -722,7 +728,7 @@ public abstract class Info extends CDialog
|
|||
Object[] keys = getSelectedKeys();
|
||||
if (keys == null || keys.length == 0)
|
||||
{
|
||||
log.config("No Results - OK="
|
||||
log.config("No Results - OK="
|
||||
+ m_ok + ", Cancel=" + m_cancel);
|
||||
return "";
|
||||
}
|
||||
|
@ -748,7 +754,7 @@ public abstract class Info extends CDialog
|
|||
return sb.toString();
|
||||
} // getSelectedSQL;
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* (Button) Action Listener & Popup Menu
|
||||
* @param e event
|
||||
|
@ -891,7 +897,7 @@ public abstract class Info extends CDialog
|
|||
return p_keyColumn;
|
||||
} // getKeyColumn
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Table Selection Changed
|
||||
* @param e event
|
||||
|
@ -913,21 +919,21 @@ public abstract class Info extends CDialog
|
|||
{
|
||||
boolean enable = (p_table.getSelectedRowCount() == 1);
|
||||
confirmPanel.getOKButton().setEnabled(p_table.getSelectedRowCount() > 0);
|
||||
|
||||
|
||||
if (hasHistory())
|
||||
confirmPanel.getHistoryButton().setEnabled(enable);
|
||||
if (hasZoom())
|
||||
confirmPanel.getZoomButton().setEnabled(enable);
|
||||
} // enableButtons
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Get dynamic WHERE part of SQL
|
||||
* To be overwritten by concrete classes
|
||||
* @return WHERE clause
|
||||
*/
|
||||
protected abstract String getSQLWhere();
|
||||
|
||||
|
||||
/**
|
||||
* Set Parameters for Query
|
||||
* To be overwritten by concrete classes
|
||||
|
@ -935,7 +941,7 @@ public abstract class Info extends CDialog
|
|||
* @param forCount for counting records
|
||||
* @throws SQLException
|
||||
*/
|
||||
protected abstract void setParameters (PreparedStatement pstmt, boolean forCount)
|
||||
protected abstract void setParameters (PreparedStatement pstmt, boolean forCount)
|
||||
throws SQLException;
|
||||
|
||||
/**
|
||||
|
@ -1028,34 +1034,34 @@ public abstract class Info extends CDialog
|
|||
return m_PO_Window_ID;
|
||||
return m_SO_Window_ID;
|
||||
} // getAD_Window_ID
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return Index of Key Column
|
||||
*/
|
||||
protected int getKeyColumnIndex()
|
||||
{
|
||||
return m_keyColumnIndex;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return true if OK button was pressed
|
||||
*/
|
||||
public boolean isOkPressed()
|
||||
{
|
||||
return m_ok;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return true if Cancel button was pressed
|
||||
*/
|
||||
public boolean isCancelPressed()
|
||||
{
|
||||
return m_cancel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specify if the records should be checked(selected) by default.
|
||||
* (for multi-selection only)
|
||||
|
@ -1065,7 +1071,7 @@ public abstract class Info extends CDialog
|
|||
{
|
||||
p_isDefaultSelected = value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (for multi-selection only)
|
||||
* @return true if records are selected by default
|
||||
|
@ -1074,7 +1080,7 @@ public abstract class Info extends CDialog
|
|||
{
|
||||
return p_isDefaultSelected;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (for multi-selection only)
|
||||
* @param value true if double click should toggle record selection
|
||||
|
@ -1083,7 +1089,7 @@ public abstract class Info extends CDialog
|
|||
{
|
||||
p_doubleClickTogglesSelection = value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (for multi-selection only)
|
||||
* @return true if double click should toggle record selection
|
||||
|
@ -1093,6 +1099,16 @@ public abstract class Info extends CDialog
|
|||
return p_doubleClickTogglesSelection;
|
||||
}
|
||||
|
||||
// reset value so that is always treated as new entry
|
||||
public boolean isResetValue()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isLookup()
|
||||
{
|
||||
return p_lookup;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Mouse Clicked
|
||||
|
@ -1107,7 +1123,7 @@ public abstract class Info extends CDialog
|
|||
// Double click with selected row => exit/zoom
|
||||
if (e.getClickCount() > 1 && p_table.getSelectedRow() != -1)
|
||||
{
|
||||
if (p_multiSelection && isDoubleClickTogglesSelection())
|
||||
if (isLookup() && p_multiSelection && isDoubleClickTogglesSelection())
|
||||
{
|
||||
if (m_keyColumnIndex >= 0)
|
||||
{
|
||||
|
@ -1121,7 +1137,17 @@ public abstract class Info extends CDialog
|
|||
}
|
||||
}
|
||||
else
|
||||
dispose(true);
|
||||
{
|
||||
if (isLookup())
|
||||
{
|
||||
dispose(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
zoom();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// Right Click => start Calculator
|
||||
else if (SwingUtilities.isRightMouseButton(e))
|
||||
|
@ -1138,7 +1164,7 @@ public abstract class Info extends CDialog
|
|||
{
|
||||
private PreparedStatement m_pstmt = null;
|
||||
private ResultSet m_rs = null;
|
||||
|
||||
|
||||
/**
|
||||
* Do Work (load data)
|
||||
*/
|
||||
|
@ -1157,7 +1183,7 @@ public abstract class Info extends CDialog
|
|||
sql.append(dynWhere); // includes first AND
|
||||
sql.append(m_sqlOrder);
|
||||
String dataSql = Msg.parseTranslation(Env.getCtx(), sql.toString()); // Variables
|
||||
dataSql = MRole.getDefault().addAccessSQL(dataSql, getTableName(),
|
||||
dataSql = MRole.getDefault().addAccessSQL(dataSql, getTableName(),
|
||||
MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
|
||||
log.finer(dataSql);
|
||||
|
||||
|
@ -1238,7 +1264,7 @@ public abstract class Info extends CDialog
|
|||
p_table.requestFocus();
|
||||
}
|
||||
} // run
|
||||
|
||||
|
||||
/**
|
||||
* Close ResultSet and Statement
|
||||
*/
|
||||
|
@ -1247,10 +1273,10 @@ public abstract class Info extends CDialog
|
|||
m_rs = null;
|
||||
m_pstmt = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Interrupt this thread - cancel the query if still in execution
|
||||
* Carlos Ruiz - globalqss - [2826660] - Info product performance BIG problem
|
||||
* Carlos Ruiz - globalqss - [2826660] - Info product performance BIG problem
|
||||
*/
|
||||
public void interrupt() {
|
||||
if (m_pstmt != null) {
|
||||
|
|
|
@ -37,20 +37,19 @@ import org.compiere.util.Msg;
|
|||
|
||||
/**
|
||||
* Asset Information
|
||||
*
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: InfoAsset.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
|
||||
*/
|
||||
public class InfoAsset extends Info
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6014685562933753813L;
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
|
||||
* @param frame frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
|
@ -62,6 +61,24 @@ public class InfoAsset extends Info
|
|||
public InfoAsset (Frame frame, boolean modal, int WindowNo,
|
||||
int A_Asset_ID, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(frame, modal, WindowNo, A_Asset_ID, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
* @param frame frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param A_Asset_ID asset
|
||||
* @param value Query Value or Name if enclosed in @
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoAsset (Frame frame, boolean modal, int WindowNo,
|
||||
int A_Asset_ID, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "a", "A_Asset_ID", multiSelection, whereClause);
|
||||
log.info(value + ", ID=" + A_Asset_ID + ", WHERE=" + whereClause);
|
||||
|
@ -101,7 +118,7 @@ public class InfoAsset extends Info
|
|||
new Info_Column(Msg.translate(Env.getCtx(), "GuaranteeDate"), "a.GuaranteeDate", Timestamp.class),
|
||||
new Info_Column(Msg.translate(Env.getCtx(), "VersionNo"), "a.VersionNo", String.class)
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
private CLabel labelValue = new CLabel();
|
||||
private CTextField fieldValue = new CTextField(10);
|
||||
|
@ -112,7 +129,7 @@ public class InfoAsset extends Info
|
|||
private VLookup fBPartner_ID;
|
||||
private CLabel lProduct_ID = new CLabel(Msg.translate(Env.getCtx(), "Product"));
|
||||
private VLookup fProduct_ID;
|
||||
|
||||
|
||||
/**
|
||||
* Static Setup - add fields to parameterPanel
|
||||
*/
|
||||
|
@ -140,7 +157,7 @@ public class InfoAsset extends Info
|
|||
parameterPanel.add(fieldValue, null);
|
||||
parameterPanel.add(lBPartner_ID, null);
|
||||
parameterPanel.add(fBPartner_ID, null);
|
||||
//
|
||||
//
|
||||
parameterPanel.add(labelName, new ALayoutConstraint(1,0));
|
||||
parameterPanel.add(fieldName, null);
|
||||
parameterPanel.add(lProduct_ID, null);
|
||||
|
|
|
@ -48,7 +48,7 @@ import org.compiere.util.Msg;
|
|||
public class InfoAssignment extends Info
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5017170699571459745L;
|
||||
|
||||
|
@ -63,9 +63,25 @@ public class InfoAssignment extends Info
|
|||
*/
|
||||
public InfoAssignment (Frame frame, boolean modal, int WindowNo,
|
||||
String value, boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(frame, modal, WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param frame frame
|
||||
* @param modal modal
|
||||
* @param WindowNo WindowNo
|
||||
* @param value Query value Name or Value if contains numbers
|
||||
* @param multiSelection multiple selection
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoAssignment (Frame frame, boolean modal, int WindowNo,
|
||||
String value, boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "ra", "S_ResourceAssigment_ID",
|
||||
multiSelection, whereClause);
|
||||
multiSelection, whereClause, lookup);
|
||||
log.info(value);
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoAssignment"));
|
||||
//
|
||||
|
|
|
@ -44,7 +44,7 @@ import org.compiere.util.Msg;
|
|||
public class InfoBPartner extends Info
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5550733934685665946L;
|
||||
|
||||
|
@ -62,7 +62,25 @@ public class InfoBPartner extends Info
|
|||
String value, boolean isSOTrx,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, "C_BPartner", "C_BPartner_ID", multiSelection, whereClause);
|
||||
this(frame, modal, WindowNo, value, isSOTrx, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
* @param frame frame
|
||||
* @param modal modal
|
||||
* @param WindowNo WindowNo
|
||||
* @param value Query value Name or Value if contains numbers
|
||||
* @param isSOTrx if false, query vendors only
|
||||
* @param multiSelection multiple selection
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoBPartner(Frame frame, boolean modal, int WindowNo,
|
||||
String value, boolean isSOTrx,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "C_BPartner", "C_BPartner_ID", multiSelection, whereClause, lookup);
|
||||
log.info(value);
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoBPartner"));
|
||||
m_isSOTrx = isSOTrx;
|
||||
|
@ -92,9 +110,9 @@ public class InfoBPartner extends Info
|
|||
/** From Clause */
|
||||
private static String s_partnerFROM = "C_BPartner"
|
||||
+ " LEFT OUTER JOIN C_BPartner_Location l ON (C_BPartner.C_BPartner_ID=l.C_BPartner_ID AND l.IsActive='Y')"
|
||||
+ " LEFT OUTER JOIN AD_User c ON (C_BPartner.C_BPartner_ID=c.C_BPartner_ID AND (c.C_BPartner_Location_ID IS NULL OR c.C_BPartner_Location_ID=l.C_BPartner_Location_ID) AND c.IsActive='Y')"
|
||||
+ " LEFT OUTER JOIN AD_User c ON (C_BPartner.C_BPartner_ID=c.C_BPartner_ID AND (c.C_BPartner_Location_ID IS NULL OR c.C_BPartner_Location_ID=l.C_BPartner_Location_ID) AND c.IsActive='Y')"
|
||||
+ " LEFT OUTER JOIN C_Location a ON (l.C_Location_ID=a.C_Location_ID)";
|
||||
|
||||
|
||||
/** Array of Column Info */
|
||||
private static Info_Column[] s_partnerLayout = {
|
||||
new Info_Column(" ", "C_BPartner.C_BPartner_ID", IDColumn.class),
|
||||
|
@ -145,7 +163,7 @@ public class InfoBPartner extends Info
|
|||
labelContact.setText(Msg.getMsg(Env.getCtx(), "Contact"));
|
||||
fieldContact.setBackground(AdempierePLAF.getInfoBackground());
|
||||
fieldContact.addActionListener(this);
|
||||
|
||||
|
||||
labelEMail.setText(Msg.getMsg(Env.getCtx(), "EMail"));
|
||||
fieldEMail.setBackground(AdempierePLAF.getInfoBackground());
|
||||
fieldEMail.addActionListener(this);
|
||||
|
@ -180,7 +198,7 @@ public class InfoBPartner extends Info
|
|||
parameterPanel.add(labelPhone, null);
|
||||
parameterPanel.add(fieldPhone, null);
|
||||
parameterPanel.add(checkCustomer, null);
|
||||
//
|
||||
//
|
||||
parameterPanel.add(labelName, new ALayoutConstraint(1,0));
|
||||
parameterPanel.add(fieldName, null);
|
||||
parameterPanel.add(labelEMail, null);
|
||||
|
@ -199,8 +217,8 @@ public class InfoBPartner extends Info
|
|||
{
|
||||
/** From
|
||||
C_BPartner
|
||||
LEFT OUTER JOIN C_BPartner_Location l ON (C_BPartner.C_BPartner_ID=l.C_BPartner_ID AND l.IsActive='Y')
|
||||
LEFT OUTER JOIN AD_User c ON (C_BPartner.C_BPartner_ID=c.C_BPartner_ID AND (c.C_BPartner_Location_ID IS NULL OR c.C_BPartner_Location_ID=l.C_BPartner_Location_ID) AND c.IsActive='Y')
|
||||
LEFT OUTER JOIN C_BPartner_Location l ON (C_BPartner.C_BPartner_ID=l.C_BPartner_ID AND l.IsActive='Y')
|
||||
LEFT OUTER JOIN AD_User c ON (C_BPartner.C_BPartner_ID=c.C_BPartner_ID AND (c.C_BPartner_Location_ID IS NULL OR c.C_BPartner_Location_ID=l.C_BPartner_Location_ID) AND c.IsActive='Y')
|
||||
LEFT OUTER JOIN C_Location a ON (l.C_Location_ID=a.C_Location_ID)
|
||||
**/
|
||||
|
||||
|
@ -425,7 +443,7 @@ public class InfoBPartner extends Info
|
|||
Integer C_BPartner_ID = getSelectedRowKey();
|
||||
if (C_BPartner_ID == null)
|
||||
return;
|
||||
InvoiceHistory ih = new InvoiceHistory (this, C_BPartner_ID.intValue(),
|
||||
InvoiceHistory ih = new InvoiceHistory (this, C_BPartner_ID.intValue(),
|
||||
0, 0, 0);
|
||||
ih.setVisible(true);
|
||||
ih = null;
|
||||
|
|
|
@ -46,14 +46,14 @@ import org.compiere.util.Util;
|
|||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: InfoCashLine.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
|
||||
*
|
||||
*
|
||||
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
||||
* <li>FR [ 1976044 ] Info Cash Line: search by Charge
|
||||
*/
|
||||
public class InfoCashLine extends Info
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3315036454469996930L;
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class InfoCashLine extends Info
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause whwre clause
|
||||
*/
|
||||
protected InfoCashLine(Frame frame, boolean modal, int WindowNo, String value,
|
||||
public InfoCashLine(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, "cl", "C_CashLine_ID", multiSelection, whereClause);
|
||||
|
@ -244,7 +244,7 @@ public class InfoCashLine extends Info
|
|||
return true;
|
||||
} // initInfo
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Construct SQL Where Clause and define parameters
|
||||
* (setParameters needs to set parameters)
|
||||
|
|
|
@ -46,14 +46,14 @@ import org.compiere.util.Msg;
|
|||
* <ul>
|
||||
* <li>2007-02-14 - teo_sarca - [ 1659737 ] InfoGeneral not working with virtual columns
|
||||
* </ul>
|
||||
*
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: InfoGeneral.java,v 1.3 2006/10/06 00:42:38 jjanke Exp $
|
||||
*/
|
||||
public class InfoGeneral extends Info
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -7588425490485071820L;
|
||||
|
||||
|
@ -69,11 +69,31 @@ public class InfoGeneral extends Info
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoGeneral (Frame frame, boolean modal, int WindowNo, String value,
|
||||
public InfoGeneral (Frame frame, boolean modal, int WindowNo, String value,
|
||||
String tableName, String keyColumn,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, tableName, keyColumn, multiSelection, whereClause);
|
||||
this(frame, modal, WindowNo, value, tableName, keyColumn, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detail Protected Constructor.
|
||||
*
|
||||
* @param frame parent
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param value QueryValue
|
||||
* @param tableName table name
|
||||
* @param keyColumn key column (ignored)
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoGeneral (Frame frame, boolean modal, int WindowNo, String value,
|
||||
String tableName, String keyColumn,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, tableName, keyColumn, multiSelection, whereClause, lookup);
|
||||
log.info(tableName + " - " + keyColumn + " - " + whereClause);
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "Info"));
|
||||
//
|
||||
|
@ -81,7 +101,7 @@ public class InfoGeneral extends Info
|
|||
p_loadedOK = initInfo ();
|
||||
//
|
||||
int no = p_table.getRowCount();
|
||||
setStatusLine(Integer.toString(no) + " "
|
||||
setStatusLine(Integer.toString(no) + " "
|
||||
+ Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
|
||||
setStatusDB(Integer.toString(no));
|
||||
// Focus
|
||||
|
@ -234,7 +254,7 @@ public class InfoGeneral extends Info
|
|||
m_queryColumnsSql.add(columnSql);
|
||||
else
|
||||
m_queryColumnsSql.add(rs.getString(1));
|
||||
|
||||
|
||||
if (AD_Table_ID == 0)
|
||||
{
|
||||
AD_Table_ID = rs.getInt(2);
|
||||
|
@ -259,7 +279,7 @@ public class InfoGeneral extends Info
|
|||
log.log(Level.SEVERE, "No query columns found");
|
||||
return false;
|
||||
}
|
||||
log.finest("Table " + tableName + ", ID=" + AD_Table_ID
|
||||
log.finest("Table " + tableName + ", ID=" + AD_Table_ID
|
||||
+ ", QueryColumns #" + m_queryColumns.size());
|
||||
// Only 4 Query Columns
|
||||
while (m_queryColumns.size() > 4) {
|
||||
|
@ -285,7 +305,7 @@ public class InfoGeneral extends Info
|
|||
// + " (f.IsDisplayed='Y' AND f.IsEncrypted='N' AND f.ObscureType IS NULL)) "
|
||||
+ " (f.IsEncrypted='N' AND f.ObscureType IS NULL)) "
|
||||
+ "ORDER BY c.IsKey DESC, f.SeqNo";
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
|
@ -367,7 +387,7 @@ public class InfoGeneral extends Info
|
|||
log.log(Level.SEVERE, "No Info for AD_Table_ID=" + AD_Table_ID + " - " + sql);
|
||||
return false;
|
||||
}
|
||||
log.finest("InfoColumns #" + list.size());
|
||||
log.finest("InfoColumns #" + list.size());
|
||||
|
||||
// Convert ArrayList to Array
|
||||
m_generalLayout = new Info_Column[list.size()];
|
||||
|
|
|
@ -48,7 +48,7 @@ import org.compiere.util.Util;
|
|||
public class InfoInOut extends Info
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -2066307179999903184L;
|
||||
|
||||
|
@ -61,10 +61,26 @@ public class InfoInOut extends Info
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoInOut(Frame frame, boolean modal, int WindowNo, String value,
|
||||
public InfoInOut(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, "i", "M_InOut_ID", multiSelection, whereClause);
|
||||
this(frame, modal, WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detail Protected Contructor
|
||||
* @param frame parent frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param value query value
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoInOut(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "i", "M_InOut_ID", multiSelection, whereClause, lookup);
|
||||
log.info( "InfoInOut");
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoInOut"));
|
||||
//
|
||||
|
|
|
@ -46,14 +46,14 @@ import org.compiere.util.Util;
|
|||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: InfoInvoice.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
|
||||
*
|
||||
*
|
||||
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
||||
* FR [ 1926882 ] Info Invoice: display Due Date
|
||||
*/
|
||||
public class InfoInvoice extends Info
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 2119484421367033632L;
|
||||
|
||||
|
@ -67,10 +67,27 @@ public class InfoInvoice extends Info
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoInvoice(Frame frame, boolean modal, int WindowNo, String value,
|
||||
public InfoInvoice(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, "i", "C_Invoice_ID", multiSelection, whereClause);
|
||||
this(frame, modal, WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detail Protected Contructor
|
||||
*
|
||||
* @param frame parent frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param value query value
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoInvoice(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "i", "C_Invoice_ID", multiSelection, whereClause, lookup);
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoInvoice"));
|
||||
//
|
||||
try
|
||||
|
@ -250,7 +267,7 @@ public class InfoInvoice extends Info
|
|||
return true;
|
||||
} // initInfo
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Construct SQL Where Clause and define parameters.
|
||||
* (setParameters needs to set parameters)
|
||||
|
@ -382,7 +399,7 @@ public class InfoInvoice extends Info
|
|||
log.fine( "String=" + s);
|
||||
return s;
|
||||
} // getSQLText
|
||||
|
||||
|
||||
/**
|
||||
* Zoom
|
||||
*/
|
||||
|
@ -430,6 +447,6 @@ public class InfoInvoice extends Info
|
|||
else
|
||||
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_InvoicePaySchedule_ID", String.valueOf(C_InvoicePaySchedule_ID));
|
||||
} // saveSelectionDetail
|
||||
|
||||
|
||||
|
||||
|
||||
} // InfoInvoice
|
||||
|
|
|
@ -49,7 +49,7 @@ import org.compiere.util.Util;
|
|||
public class InfoOrder extends Info
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 2246871771555208114L;
|
||||
|
||||
|
@ -62,10 +62,26 @@ public class InfoOrder extends Info
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoOrder(Frame frame, boolean modal, int WindowNo, String value,
|
||||
public InfoOrder(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, "o", "C_Order_ID", multiSelection, whereClause);
|
||||
this(frame, modal, WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detail Protected Contructor
|
||||
* @param frame parent frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param value query value
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoOrder(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "o", "C_Order_ID", multiSelection, whereClause, lookup);
|
||||
log.info( "InfoOrder");
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoOrder"));
|
||||
//
|
||||
|
@ -228,7 +244,7 @@ public class InfoOrder extends Info
|
|||
return true;
|
||||
} // initInfo
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Construct SQL Where Clause and define parameters.
|
||||
* (setParameters needs to set parameters)
|
||||
|
@ -348,7 +364,7 @@ public class InfoOrder extends Info
|
|||
log.fine("String=" + s);
|
||||
return s;
|
||||
} // getSQLText
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Zoom
|
||||
|
@ -374,5 +390,5 @@ public class InfoOrder extends Info
|
|||
{
|
||||
return true;
|
||||
} // hasZoom
|
||||
|
||||
|
||||
} // InfoOrder
|
||||
|
|
|
@ -49,7 +49,7 @@ import org.compiere.util.Util;
|
|||
public class InfoPayment extends Info
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -2917241055484901704L;
|
||||
|
||||
|
@ -62,10 +62,26 @@ public class InfoPayment extends Info
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause whwre clause
|
||||
*/
|
||||
protected InfoPayment(Frame frame, boolean modal, int WindowNo, String value,
|
||||
public InfoPayment(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, "p", "C_Payment_ID", multiSelection, whereClause);
|
||||
this(frame, modal, WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detail Protected Contructor
|
||||
* @param frame parent frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param value query value
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause whwre clause
|
||||
* @param lookup
|
||||
*/
|
||||
public InfoPayment(Frame frame, boolean modal, int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "p", "C_Payment_ID", multiSelection, whereClause, lookup);
|
||||
log.info( "InfoPayment");
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoPayment"));
|
||||
//
|
||||
|
@ -228,7 +244,7 @@ public class InfoPayment extends Info
|
|||
return true;
|
||||
} // initInfo
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Construct SQL Where Clause and define parameters
|
||||
* (setParameters needs to set parameters)
|
||||
|
@ -340,7 +356,7 @@ public class InfoPayment extends Info
|
|||
log.fine( "String=" + s);
|
||||
return s;
|
||||
} // getSQLText
|
||||
|
||||
|
||||
/**
|
||||
* Zoom
|
||||
*/
|
||||
|
@ -365,5 +381,5 @@ public class InfoPayment extends Info
|
|||
{
|
||||
return true;
|
||||
} // hasZoom
|
||||
|
||||
|
||||
} // InfoPayment
|
||||
|
|
|
@ -73,14 +73,14 @@ import org.jdesktop.swingx.JXTaskPane;
|
|||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: InfoProduct.java,v 1.4 2006/07/30 00:51:27 jjanke Exp $
|
||||
*
|
||||
*
|
||||
* @author Bogdan Ioan, SC ARHIPAC SERVICE SRL
|
||||
* <li>FR [ 2012362 ] Info Product: Add Product Category
|
||||
* <li>FR [ 2012362 ] Info Product: Add Product Category
|
||||
*/
|
||||
public class InfoProduct extends Info implements ActionListener, ChangeListener
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 2076229793041196087L;
|
||||
|
||||
|
@ -99,7 +99,25 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
int M_Warehouse_ID, int M_PriceList_ID, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
super (frame, modal, WindowNo, "p", "M_Product_ID", multiSelection, whereClause);
|
||||
this(frame, modal, WindowNo, M_Warehouse_ID, M_PriceList_ID, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
* @param frame frame
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param M_Warehouse_ID warehouse
|
||||
* @param M_PriceList_ID price list
|
||||
* @param value Query Value or Name if enclosed in @
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
public InfoProduct(Frame frame, boolean modal, int WindowNo,
|
||||
int M_Warehouse_ID, int M_PriceList_ID, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (frame, modal, WindowNo, "p", "M_Product_ID", multiSelection, whereClause, lookup);
|
||||
log.info(value + ", Wh=" + M_Warehouse_ID + ", PL=" + M_PriceList_ID + ", WHERE=" + whereClause);
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoProduct"));
|
||||
//
|
||||
|
@ -117,7 +135,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
p_loadedOK = true;
|
||||
// Focus
|
||||
fieldValue.requestFocus();
|
||||
|
||||
|
||||
//Begin - fer_luck @ centuryon
|
||||
mWindowNo = WindowNo;
|
||||
//End - fer_luck @ centuryon
|
||||
|
@ -156,7 +174,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
private VComboBox pickProductCategory = new VComboBox();
|
||||
private CLabel labelAS = new CLabel(); // @Trifon
|
||||
private VComboBox pickAS = new VComboBox(); // @Trifon
|
||||
|
||||
|
||||
//Begin - fer_luck @ centuryon
|
||||
private CTextArea fieldDescription = new CTextArea();
|
||||
JXTaskPane warehouseStockPanel = new JXTaskPane();
|
||||
|
@ -194,7 +212,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
labelValue.setText(Msg.getMsg(Env.getCtx(), "Value"));
|
||||
fieldValue.setBackground(AdempierePLAF.getInfoBackground());
|
||||
fieldValue.addActionListener(this);
|
||||
|
||||
|
||||
labelName.setText(Msg.getMsg(Env.getCtx(), "Name"));
|
||||
fieldName.setBackground(AdempierePLAF.getInfoBackground());
|
||||
fieldName.addActionListener(this);
|
||||
|
@ -206,24 +224,24 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
labelSKU.setText(Msg.translate(Env.getCtx(), "SKU"));
|
||||
fieldSKU.setBackground(AdempierePLAF.getInfoBackground());
|
||||
fieldSKU.addActionListener(this);
|
||||
|
||||
|
||||
labelWarehouse.setText(Msg.getMsg(Env.getCtx(), "Warehouse"));
|
||||
pickWarehouse.setBackground(AdempierePLAF.getInfoBackground());
|
||||
|
||||
|
||||
labelPriceList.setText(Msg.getMsg(Env.getCtx(), "PriceListVersion"));
|
||||
pickPriceList.setBackground(AdempierePLAF.getInfoBackground());
|
||||
|
||||
labelProductCategory.setText(Msg.translate(Env.getCtx(), "M_Product_Category_ID"));
|
||||
pickProductCategory.setBackground(AdempierePLAF.getInfoBackground());
|
||||
|
||||
|
||||
// @Trifon
|
||||
labelAS.setText(Msg.translate(Env.getCtx(), "M_AttributeSet_ID"));
|
||||
pickAS.setBackground(AdempierePLAF.getInfoBackground());
|
||||
|
||||
|
||||
m_InfoPAttributeButton.setMargin(new Insets(2,2,2,2));
|
||||
m_InfoPAttributeButton.setToolTipText(Msg.getMsg(Env.getCtx(), "InfoPAttribute"));
|
||||
m_InfoPAttributeButton.addActionListener(this);
|
||||
|
||||
|
||||
labelVendor.setText(Msg.translate(Env.getCtx(), "Vendor"));
|
||||
fieldVendor.setBackground(AdempierePLAF.getInfoBackground());
|
||||
fieldVendor.addActionListener(this);
|
||||
|
@ -244,7 +262,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
parameterPanel.add(fieldSKU, null);
|
||||
parameterPanel.add(labelVendor, null);
|
||||
parameterPanel.add(fieldVendor, null);
|
||||
|
||||
|
||||
// Line 3
|
||||
parameterPanel.add(labelPriceList, new ALayoutConstraint(2,0));
|
||||
parameterPanel.add(pickPriceList, null);
|
||||
|
@ -252,13 +270,13 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
parameterPanel.add(pickProductCategory, null);
|
||||
parameterPanel.add(labelAS, null); // @Trifon
|
||||
parameterPanel.add(pickAS, null); // @Trifon
|
||||
|
||||
|
||||
// Product Attribute Instance
|
||||
m_PAttributeButton = ConfirmPanel.createPAttributeButton(true);
|
||||
confirmPanel.addButton(m_PAttributeButton);
|
||||
m_PAttributeButton.addActionListener(this);
|
||||
m_PAttributeButton.setEnabled(false);
|
||||
|
||||
|
||||
//Begin - fer_luck @ centuryon
|
||||
//add taskpane
|
||||
fieldDescription.setBackground(AdempierePLAF.getInfoBackground());
|
||||
|
@ -269,7 +287,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
warehouseStockPanel.setUI(new AdempiereTaskPaneUI());
|
||||
warehouseStockPanel.getContentPane().setBackground(new ColorUIResource(251,248,241));
|
||||
warehouseStockPanel.getContentPane().setForeground(new ColorUIResource(251,0,0));
|
||||
|
||||
|
||||
ColumnInfo[] s_layoutWarehouse = new ColumnInfo[]{
|
||||
new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "Warehouse", String.class),
|
||||
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "sum(QtyAvailable)", Double.class),
|
||||
|
@ -287,13 +305,13 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
warehouseTbl.getSelectionModel().addListSelectionListener(this);
|
||||
warehouseTbl.setShowTotals(true);
|
||||
warehouseTbl.autoSize();
|
||||
|
||||
|
||||
ColumnInfo[] s_layoutSubstitute = new ColumnInfo[]{
|
||||
new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class),
|
||||
new ColumnInfo(
|
||||
Msg.translate(Env.getCtx(), "Value"),
|
||||
"(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)",
|
||||
String.class),
|
||||
String.class),
|
||||
new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class),
|
||||
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class),
|
||||
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class),
|
||||
|
@ -307,7 +325,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
substituteTbl.addMouseListener(this);
|
||||
substituteTbl.getSelectionModel().addListSelectionListener(this);
|
||||
substituteTbl.autoSize();
|
||||
|
||||
|
||||
ColumnInfo[] s_layoutRelated = new ColumnInfo[]{
|
||||
new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class),
|
||||
new ColumnInfo(
|
||||
|
@ -327,11 +345,11 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
relatedTbl.addMouseListener(this);
|
||||
relatedTbl.getSelectionModel().addListSelectionListener(this);
|
||||
relatedTbl.autoSize();
|
||||
|
||||
|
||||
//Available to Promise Tab
|
||||
m_tableAtp.setRowSelectionAllowed(false);
|
||||
m_tableAtp.setMultiSelection(false);
|
||||
|
||||
|
||||
CTabbedPane jTab = new CTabbedPane();
|
||||
jTab.addTab(Msg.translate(Env.getCtx(), "Warehouse"), new JScrollPane(warehouseTbl));
|
||||
jTab.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 250 : 105));
|
||||
|
@ -341,12 +359,12 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
jTab.addTab (Msg.getMsg(Env.getCtx(), "ATP"), new JScrollPane(m_tableAtp));
|
||||
jTab.addChangeListener(this);
|
||||
tablePanel.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 255 : 110));
|
||||
tablePanel.add(jTab);
|
||||
tablePanel.add(jTab);
|
||||
|
||||
warehouseStockPanel.setCollapsed(true);
|
||||
warehouseStockPanel.add(tablePanel);
|
||||
this.addonPanel.add(warehouseStockPanel);
|
||||
|
||||
|
||||
this.p_table.addKeyListener(new KeyAdapter() {
|
||||
public void keyReleased(KeyEvent ke){
|
||||
int row = ((MiniTable)ke.getSource()).getSelectedRow();
|
||||
|
@ -358,7 +376,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
warehouseStockPanel.setCollapsed(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.p_table.addMouseListener(new MouseAdapter() {
|
||||
public void mouseClicked(MouseEvent me) {
|
||||
int row = ((MiniTable)me.getSource()).getSelectedRow();
|
||||
|
@ -407,7 +425,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
sql = "SELECT M_Product_ID FROM M_Product WHERE Value = ?";
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
|
@ -423,7 +441,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
|
||||
|
||||
sql = m_sqlSubstitute;
|
||||
log.finest(sql);
|
||||
try {
|
||||
|
@ -441,7 +459,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
|
||||
|
||||
sql = m_sqlRelated;
|
||||
log.finest(sql);
|
||||
try {
|
||||
|
@ -462,7 +480,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
initAtpTab(M_Warehouse_ID);
|
||||
} // refresh
|
||||
//End - fer_luck @ centuryon
|
||||
|
||||
|
||||
/**
|
||||
* Dynamic Init
|
||||
*
|
||||
|
@ -530,7 +548,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
SQL += " AND EXISTS (SELECT * FROM M_PriceList xp WHERE xp.M_PriceList_ID=" + M_PriceList_ID
|
||||
+ " AND pl.C_Currency_ID=xp.C_Currency_ID)";
|
||||
// Add Access & Order
|
||||
SQL = MRole.getDefault().addAccessSQL (SQL, "M_PriceList_Version", true, false) // fully qualidfied - RO
|
||||
SQL = MRole.getDefault().addAccessSQL (SQL, "M_PriceList_Version", true, false) // fully qualidfied - RO
|
||||
+ " ORDER BY M_PriceList_Version.Name";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
@ -563,7 +581,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
pickWarehouse.addItem(kn);
|
||||
}
|
||||
DB.close(rs, pstmt);
|
||||
|
||||
|
||||
// Product Category
|
||||
SQL = MRole.getDefault().addAccessSQL (
|
||||
"SELECT M_Product_Category_ID, Value || ' - ' || Name FROM M_Product_Category WHERE IsActive='Y'",
|
||||
|
@ -572,7 +590,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
for (KeyNamePair kn : DB.getKeyNamePairs(SQL, true)) {
|
||||
pickProductCategory.addItem(kn);
|
||||
}
|
||||
|
||||
|
||||
// Attribute Set - @Trifon
|
||||
SQL = MRole.getDefault().addAccessSQL (
|
||||
"SELECT M_AttributeSet_ID, Name FROM M_AttributeSet WHERE IsActive='Y'",
|
||||
|
@ -642,7 +660,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
{
|
||||
Timestamp priceDate = null;
|
||||
// Sales Order Date
|
||||
String dateStr = Env.getContext(Env.getCtx(), p_WindowNo, "DateOrdered");
|
||||
String dateStr = Env.getContext(Env.getCtx(), p_WindowNo, "DateOrdered");
|
||||
if (dateStr != null && dateStr.length() > 0)
|
||||
priceDate = Env.getContextAsDate(Env.getCtx(), p_WindowNo, "DateOrdered");
|
||||
else // Invoice Date
|
||||
|
@ -652,7 +670,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
priceDate = Env.getContextAsDate(Env.getCtx(), p_WindowNo, "DateInvoiced");
|
||||
}
|
||||
// Today
|
||||
if (priceDate == null)
|
||||
if (priceDate == null)
|
||||
priceDate = new Timestamp(System.currentTimeMillis());
|
||||
//
|
||||
log.config("M_PriceList_ID=" + M_PriceList_ID + " - " + priceDate);
|
||||
|
@ -690,7 +708,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
return retValue;
|
||||
} // findPLV
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Construct SQL Where Clause and define parameters
|
||||
* (setParameters needs to set parameters)
|
||||
|
@ -700,7 +718,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
protected String getSQLWhere()
|
||||
{
|
||||
StringBuffer where = new StringBuffer();
|
||||
|
||||
|
||||
// Optional PLV
|
||||
int M_PriceList_Version_ID = 0;
|
||||
KeyNamePair pl = (KeyNamePair)pickPriceList.getSelectedItem();
|
||||
|
@ -708,17 +726,17 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
M_PriceList_Version_ID = pl.getKey();
|
||||
if (M_PriceList_Version_ID != 0)
|
||||
where.append(" AND pr.M_PriceList_Version_ID=?");
|
||||
|
||||
|
||||
// Optional Product Category
|
||||
if (getM_Product_Category_ID() > 0) {
|
||||
where.append(" AND p.M_Product_Category_ID=?");
|
||||
}
|
||||
|
||||
|
||||
// Optional Attribute Set
|
||||
if (getM_AttributeSet_ID() > 0) {
|
||||
where.append(" AND p.M_AttributeSet_ID=?");
|
||||
}
|
||||
|
||||
|
||||
// Product Attribute Search
|
||||
if (m_pAttributeWhere != null)
|
||||
{
|
||||
|
@ -749,7 +767,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
String vendor = fieldVendor.getText().toUpperCase();
|
||||
if (!(vendor.equals("") || vendor.equals("%")))
|
||||
where.append(" AND UPPER(bp.Name) LIKE ? AND ppo.IsCurrentVendor='Y'");
|
||||
|
||||
|
||||
return where.toString();
|
||||
} // getSQLWhere
|
||||
|
||||
|
@ -858,7 +876,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
|
||||
} // setParameters
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Action Listener
|
||||
* @param e event
|
||||
|
@ -869,15 +887,15 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
if ((e.getSource() == pickWarehouse || e.getSource() == pickPriceList)
|
||||
&& (fieldValue.getText().length() == 0 && fieldName.getText().length() == 0))
|
||||
return;
|
||||
|
||||
|
||||
// Product Attribute Search
|
||||
if (e.getSource().equals(m_InfoPAttributeButton))
|
||||
{
|
||||
cmd_InfoPAttribute();
|
||||
return;
|
||||
return;
|
||||
}
|
||||
m_pAttributeWhere = null;
|
||||
|
||||
|
||||
// Query Product Attribute Instance
|
||||
int row = p_table.getSelectedRow();
|
||||
if (e.getSource().equals(m_PAttributeButton) && row != -1)
|
||||
|
@ -888,13 +906,13 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
if (productInteger == null || productInteger.intValue() == 0 || warehouse == null)
|
||||
return;
|
||||
String title = warehouse.getName() + " - " + productName;
|
||||
PAttributeInstance pai = new PAttributeInstance (this, title,
|
||||
PAttributeInstance pai = new PAttributeInstance (this, title,
|
||||
warehouse.getKey(), 0, productInteger.intValue(), m_C_BPartner_ID);
|
||||
m_M_AttributeSetInstance_ID = pai.getM_AttributeSetInstance_ID();
|
||||
m_M_Locator_ID = pai.getM_Locator_ID();
|
||||
if (m_M_AttributeSetInstance_ID != -1)
|
||||
dispose(true);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
//
|
||||
super.actionPerformed(e);
|
||||
|
@ -952,7 +970,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
if (m_M_AttributeSetInstance_ID < -1) // not selected
|
||||
M_AttributeSetInstance_ID = 0;
|
||||
//
|
||||
InvoiceHistory ih = new InvoiceHistory (this, 0,
|
||||
InvoiceHistory ih = new InvoiceHistory (this, 0,
|
||||
M_Product_ID.intValue(), M_Warehouse_ID, M_AttributeSetInstance_ID);
|
||||
ih.setVisible(true);
|
||||
ih = null;
|
||||
|
@ -978,7 +996,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
if (M_Product_ID == null)
|
||||
return;
|
||||
// AEnv.zoom(MProduct.Table_ID, M_Product_ID.intValue(), true); // SO
|
||||
|
||||
|
||||
MQuery query = new MQuery("M_Product");
|
||||
query.addRestriction("M_Product_ID", MQuery.EQUAL, M_Product_ID);
|
||||
query.setRecordCount(1);
|
||||
|
@ -1032,9 +1050,9 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
}
|
||||
else
|
||||
{
|
||||
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID",
|
||||
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID",
|
||||
String.valueOf(m_M_AttributeSetInstance_ID));
|
||||
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "M_Locator_ID",
|
||||
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "M_Locator_ID",
|
||||
String.valueOf(m_M_Locator_ID));
|
||||
}
|
||||
} // saveSelectionDetail
|
||||
|
@ -1078,51 +1096,51 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
}
|
||||
return s_productLayout;
|
||||
} // getProductLayout
|
||||
|
||||
|
||||
/**
|
||||
* System has Unconfirmed records
|
||||
* @return true if unconfirmed
|
||||
*/
|
||||
private boolean isUnconfirmed()
|
||||
{
|
||||
int no = DB.getSQLValue(null,
|
||||
"SELECT COUNT(*) FROM M_InOutLineConfirm WHERE AD_Client_ID=?",
|
||||
int no = DB.getSQLValue(null,
|
||||
"SELECT COUNT(*) FROM M_InOutLineConfirm WHERE AD_Client_ID=?",
|
||||
Env.getAD_Client_ID(Env.getCtx()));
|
||||
if (no > 0)
|
||||
return true;
|
||||
no = DB.getSQLValue(null,
|
||||
"SELECT COUNT(*) FROM M_MovementLineConfirm WHERE AD_Client_ID=?",
|
||||
no = DB.getSQLValue(null,
|
||||
"SELECT COUNT(*) FROM M_MovementLineConfirm WHERE AD_Client_ID=?",
|
||||
Env.getAD_Client_ID(Env.getCtx()));
|
||||
return no > 0;
|
||||
} // isUnconfirmed
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Tab Changed
|
||||
* @param e event
|
||||
*/
|
||||
public void stateChanged(ChangeEvent e)
|
||||
{
|
||||
{
|
||||
if(e.getSource() instanceof CTabbedPane)
|
||||
{
|
||||
CTabbedPane tab = (CTabbedPane) e.getSource();
|
||||
|
||||
|
||||
if(tab.getSelectedIndex() == 4 & warehouseTbl.getRowCount() > 0)
|
||||
{
|
||||
{
|
||||
String value = (String)warehouseTbl.getValueAt(warehouseTbl.getSelectedRow(),0);
|
||||
int M_Warehouse_ID = DB.getSQLValue(null, "SELECT M_Warehouse_ID FROM M_Warehouse WHERE UPPER(Name) = UPPER(?) AND AD_Client_ID=?", new Object[] { value ,Env.getAD_Client_ID(Env.getCtx())});
|
||||
initAtpTab(M_Warehouse_ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // stateChanged
|
||||
|
||||
|
||||
/**
|
||||
* Query ATP
|
||||
*/
|
||||
private void initAtpTab (int m_M_Warehouse_ID)
|
||||
{
|
||||
|
||||
|
||||
// Header
|
||||
Vector<String> columnNames = new Vector<String>();
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Date"));
|
||||
|
@ -1155,7 +1173,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
if (!showDetail)
|
||||
sql += " GROUP BY productAttribute(s.M_AttributeSetInstance_ID), w.Name, l.Value";
|
||||
sql += " ORDER BY l.Value";
|
||||
|
||||
|
||||
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
||||
double qty = 0;
|
||||
PreparedStatement pstmt = null;
|
||||
|
@ -1267,7 +1285,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
|
||||
// Table
|
||||
MiniTable table = null;
|
||||
m_modelAtp = new DefaultTableModel(data, columnNames);
|
||||
m_modelAtp = new DefaultTableModel(data, columnNames);
|
||||
m_tableAtp.setModel(m_modelAtp);
|
||||
table = m_tableAtp;
|
||||
//
|
||||
|
@ -1294,7 +1312,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
M_Product_Category_ID = pc.getKey();
|
||||
return M_Product_Category_ID;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return selected Attribute Set ID
|
||||
*/
|
||||
|
@ -1305,4 +1323,11 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
M_AttributeSet_ID = as.getKey();
|
||||
return M_AttributeSet_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isResetValue() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // InfoProduct
|
||||
|
|
|
@ -46,22 +46,16 @@ import javax.swing.KeyStroke;
|
|||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.adempiere.osgi.InfoManager;
|
||||
import org.compiere.apps.ADialog;
|
||||
import org.compiere.apps.AEnv;
|
||||
import org.compiere.apps.AWindow;
|
||||
import org.compiere.apps.FieldRecordInfo;
|
||||
import org.compiere.apps.search.Info;
|
||||
import org.compiere.apps.search.InfoBPartner;
|
||||
import org.compiere.apps.search.InfoFactory;
|
||||
import org.compiere.apps.search.InfoProduct;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MInvoiceLine;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MOrderLine;
|
||||
import org.compiere.model.MProductPrice;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.swing.CButton;
|
||||
|
@ -75,7 +69,6 @@ import org.compiere.util.Ini;
|
|||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.NamePair;
|
||||
import org.compiere.util.ValueNamePair;
|
||||
import org.eevolution.model.I_PP_Product_BOMLine;
|
||||
|
||||
/**
|
||||
* Lookup Visual Field.
|
||||
|
@ -96,7 +89,7 @@ import org.eevolution.model.I_PP_Product_BOMLine;
|
|||
* <li>BF [ 1979213 ] VLookup.getDirectAccessSQL issue
|
||||
* <li>BF [ 2552901 ] VLookup: TAB is not working OK
|
||||
* @author Michael Judd (MultiSelect)
|
||||
*
|
||||
*
|
||||
* @author hengsin, hengsin.low@idalica.com
|
||||
* @see FR [2887701] https://sourceforge.net/tracker/?func=detail&atid=879335&aid=2887701&group_id=176962
|
||||
* @sponsor www.metas.de
|
||||
|
@ -141,8 +134,8 @@ public class VLookup extends JComponent
|
|||
} // mouse Clicked
|
||||
|
||||
} // VLookup_mouseAdapter
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e,
|
||||
int condition, boolean pressed) {
|
||||
|
@ -680,7 +673,7 @@ public class VLookup extends JComponent
|
|||
if (m_mField != null
|
||||
&& MRole.getDefault().isShowPreference())
|
||||
ValuePreference.addMenu (this, popupMenu);
|
||||
|
||||
|
||||
if (m_mField != null)
|
||||
FieldRecordInfo.addMenu(this, popupMenu);
|
||||
} // setField
|
||||
|
@ -799,7 +792,7 @@ public class VLookup extends JComponent
|
|||
{
|
||||
// happens if VLookup is used outside of APanel/GridController (no property listener)
|
||||
log.fine(m_columnName + " - Value explicitly set - new=" + updatedValue + ", old=" + m_value);
|
||||
|
||||
|
||||
// phib: the following check causes the update to fail on jre > 1.6.0_13
|
||||
// commenting out as it does not appear to be necessary
|
||||
//if (getListeners(PropertyChangeListener.class).length <= 0)
|
||||
|
@ -832,82 +825,30 @@ public class VLookup extends JComponent
|
|||
boolean cancelled = false;
|
||||
boolean multipleSelection = false;
|
||||
//
|
||||
String col = m_lookup.getColumnName(); // fully qualified name
|
||||
if (col.indexOf('.') != -1)
|
||||
col = col.substring(col.indexOf('.')+1);
|
||||
// Zoom / Validation
|
||||
String whereClause = getWhereClause();
|
||||
//
|
||||
log.fine(col
|
||||
log.fine(m_lookup.getColumnName()
|
||||
+ ", Zoom=" + m_lookup.getZoom()
|
||||
+ " (" + whereClause + ")");
|
||||
//
|
||||
boolean resetValue = false; // reset value so that is always treated as new entry
|
||||
String infoFactoryClass = m_lookup.getInfoFactoryClass();
|
||||
if (infoFactoryClass != null && infoFactoryClass.trim().length() > 0)
|
||||
{
|
||||
try {
|
||||
Class<InfoFactory> clazz = (Class<InfoFactory>)this.getClass().getClassLoader().loadClass(infoFactoryClass);
|
||||
InfoFactory factory = clazz.newInstance();
|
||||
if (m_tableName == null) // sets table name & key column
|
||||
getDirectAccessSQL("*");
|
||||
Info ig = factory.create (frame, true, m_lookup.getWindowNo(),
|
||||
m_tableName, m_keyColumnName, queryValue, false, whereClause);
|
||||
ig.setVisible(true);
|
||||
cancelled = ig.isCancelled();
|
||||
result = ig.getSelectedKeys();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Failed to load custom InfoFactory - " + e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
else if (col.equals("M_Product_ID"))
|
||||
{
|
||||
// Reset
|
||||
resetTabInfo();
|
||||
// Replace Value with name if no value exists
|
||||
if (queryValue.length() == 0 && m_text.getText().length() > 0)
|
||||
queryValue = "@" + m_text.getText() + "@"; // Name indicator - otherwise Value
|
||||
int M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), m_lookup.getWindowNo(), "M_Warehouse_ID");
|
||||
int M_PriceList_ID = Env.getContextAsInt(Env.getCtx(), m_lookup.getWindowNo(), "M_PriceList_ID");
|
||||
Info info = null;
|
||||
|
||||
if(m_mField != null)
|
||||
{
|
||||
int AD_Table_ID = MColumn.getTable_ID(Env.getCtx(), m_mField.getAD_Column_ID(), null);
|
||||
// Reset
|
||||
resetTabInfo();
|
||||
if (m_tableName == null) // sets table name & key column
|
||||
getDirectAccessSQL("*");
|
||||
|
||||
multipleSelection = (MOrderLine.Table_ID == AD_Table_ID) || (MInvoiceLine.Table_ID == AD_Table_ID) || (I_PP_Product_BOMLine.Table_ID == AD_Table_ID) || (MProductPrice.Table_ID == AD_Table_ID);
|
||||
}
|
||||
// Show Info
|
||||
InfoProduct ip = new InfoProduct (frame, true, m_lookup.getWindowNo(),
|
||||
M_Warehouse_ID, M_PriceList_ID, queryValue, multipleSelection, whereClause);
|
||||
ip.setVisible(true);
|
||||
cancelled = ip.isCancelled();
|
||||
result = ip.getSelectedKeys();
|
||||
resetValue = true;
|
||||
}
|
||||
else if (col.equals("C_BPartner_ID"))
|
||||
{
|
||||
// Replace Value with name if no value exists
|
||||
if (queryValue.length() == 0 && m_text.getText().length() > 0)
|
||||
queryValue = m_text.getText();
|
||||
boolean isSOTrx = true; // default
|
||||
if (Env.getContext(Env.getCtx(), m_lookup.getWindowNo(), "IsSOTrx").equals("N"))
|
||||
isSOTrx = false;
|
||||
InfoBPartner ip = new InfoBPartner (frame, true, m_lookup.getWindowNo(),
|
||||
queryValue, isSOTrx, multipleSelection, whereClause);
|
||||
ip.setVisible(true);
|
||||
cancelled = ip.isCancelled();
|
||||
result = ip.getSelectedKeys();
|
||||
}
|
||||
else // General Info
|
||||
{
|
||||
if (m_tableName == null) // sets table name & key column
|
||||
getDirectAccessSQL("*");
|
||||
Info ig = Info.create (frame, true, m_lookup.getWindowNo(),
|
||||
m_tableName, m_keyColumnName, queryValue, multipleSelection, whereClause);
|
||||
ig.setVisible(true);
|
||||
cancelled = ig.isCancelled();
|
||||
result = ig.getSelectedKeys();
|
||||
}
|
||||
// Replace Value with name if no value exists
|
||||
if (queryValue.length() == 0 && m_text.getText().length() > 0)
|
||||
queryValue = m_text.getText();
|
||||
|
||||
info = InfoManager.create(frame, true, m_lookup, m_mField, m_tableName, m_keyColumnName,
|
||||
queryValue, multipleSelection, whereClause);
|
||||
|
||||
info.setVisible(true);
|
||||
cancelled = info.isCancelled();
|
||||
result = info.getSelectedKeys();
|
||||
|
||||
// Result
|
||||
if (result != null && result.length > 0)
|
||||
|
@ -915,7 +856,7 @@ public class VLookup extends JComponent
|
|||
log.config(m_columnName + " - Result = " + result.toString() + " (" + result.getClass().getName() + ")");
|
||||
// make sure that value is in cache
|
||||
m_lookup.getDirect(result[0], false, true);
|
||||
if (resetValue)
|
||||
if (info.isResetValue())
|
||||
actionCombo (null);
|
||||
// juddm added logic for multi-select handling
|
||||
if (result.length > 1)
|
||||
|
|
|
@ -30,10 +30,9 @@ import org.adempiere.webui.event.ContextMenuEvent;
|
|||
import org.adempiere.webui.event.ContextMenuListener;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.event.ValueChangeListener;
|
||||
import org.adempiere.webui.factory.InfoManager;
|
||||
import org.adempiere.webui.grid.WBPartner;
|
||||
import org.adempiere.webui.panel.InfoBPartnerPanel;
|
||||
import org.adempiere.webui.panel.InfoPanel;
|
||||
import org.adempiere.webui.panel.InfoProductPanel;
|
||||
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
|
@ -73,19 +72,19 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
super(new Searchbox(), gridField);
|
||||
|
||||
lookup = gridField.getLookup();
|
||||
|
||||
|
||||
if (lookup != null)
|
||||
columnName = lookup.getColumnName();
|
||||
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Searchbox getComponent() {
|
||||
return (Searchbox) super.getComponent();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isReadWrite() {
|
||||
return getComponent().isEnabled();
|
||||
|
@ -124,7 +123,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
}
|
||||
|
||||
public WSearchEditor(String columnName, boolean mandatory, boolean readonly, boolean updateable,
|
||||
Lookup lookup)
|
||||
Lookup lookup)
|
||||
{
|
||||
super(new Searchbox(), null, null, mandatory, readonly, updateable);
|
||||
|
||||
|
@ -148,7 +147,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
{
|
||||
|
||||
columnName = this.getColumnName();
|
||||
|
||||
|
||||
if (columnName.equals("C_BPartner_ID"))
|
||||
{
|
||||
popupMenu = new WEditorPopupMenu(true, true, true, true, true);
|
||||
|
@ -164,7 +163,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
popupMenu = new WEditorPopupMenu(true, true, true, false, false);
|
||||
getComponent().setButtonImage("/images/PickOpen10.png");
|
||||
}
|
||||
|
||||
|
||||
getComponent().getTextbox().setContext(popupMenu.getId());
|
||||
if (gridField != null && gridField.getGridTab() != null)
|
||||
{
|
||||
|
@ -234,7 +233,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
actionButton("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt)
|
||||
{
|
||||
|
@ -405,14 +404,14 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
ValueChangeEvent evt = new ValueChangeEvent(this, this.getColumnName(), getValue(), value);
|
||||
// -> ADTabpanel - valuechange
|
||||
fireValueChange(evt);
|
||||
|
||||
|
||||
// is the value updated ?
|
||||
boolean updated = false;
|
||||
if (value instanceof Object[] && ((Object[])value).length > 0)
|
||||
{
|
||||
value = ((Object[])value)[0];
|
||||
}
|
||||
|
||||
|
||||
if (value == null && getValue() == null)
|
||||
updated = true;
|
||||
else if (value != null && value.equals(getValue()))
|
||||
|
@ -427,12 +426,12 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
* Action - Special BPartner Screen
|
||||
* @param newRecord true if new record should be created
|
||||
*/
|
||||
|
||||
|
||||
private void actionBPartner (boolean newRecord)
|
||||
{
|
||||
WBPartner vbp = new WBPartner (lookup.getWindowNo());
|
||||
int BPartner_ID = 0;
|
||||
|
||||
|
||||
// if update, get current value
|
||||
if (!newRecord)
|
||||
{
|
||||
|
@ -443,31 +442,31 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
}
|
||||
|
||||
vbp.loadBPartner (BPartner_ID);
|
||||
|
||||
|
||||
|
||||
|
||||
vbp.setVisible(true);
|
||||
AEnv.showWindow(vbp);
|
||||
|
||||
|
||||
// get result
|
||||
int result = vbp.getC_BPartner_ID();
|
||||
|
||||
|
||||
if (result == 0 // 0 = not saved
|
||||
&& result == BPartner_ID) // the same
|
||||
return;
|
||||
|
||||
|
||||
// Maybe new BPartner - put in cache
|
||||
lookup.getDirect(new Integer(result), false, true);
|
||||
setValue(new Integer(result));
|
||||
actionCombo (new Integer(result)); // data binding
|
||||
|
||||
|
||||
//setValue(getValue());
|
||||
} // actionBPartner
|
||||
|
||||
|
||||
private void actionButton(String queryValue)
|
||||
{
|
||||
if (lookup == null)
|
||||
return; // leave button disabled
|
||||
|
||||
|
||||
/**
|
||||
* Three return options:
|
||||
* - Value Selected & OK pressed => store result => result has value
|
||||
|
@ -475,97 +474,33 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
* - Window closed -> ignore => result == null && !cancalled
|
||||
*/
|
||||
|
||||
Object result[] = null;
|
||||
boolean cancelled = false;
|
||||
|
||||
String col = lookup.getColumnName(); // fully qualified name
|
||||
|
||||
if (col.indexOf('.') != -1)
|
||||
col = col.substring(col.indexOf('.')+1);
|
||||
Object result[] = null;
|
||||
boolean cancelled = false;
|
||||
|
||||
// Zoom / Validation
|
||||
String whereClause = getWhereClause();
|
||||
|
||||
log.fine(col + ", Zoom=" + lookup.getZoom() + " (" + whereClause + ")");
|
||||
log.fine(lookup.getColumnName() + ", Zoom=" + lookup.getZoom() + " (" + whereClause + ")");
|
||||
|
||||
// boolean resetValue = false; // Reset value so that is always treated as new entry
|
||||
|
||||
if (col.equals("M_Product_ID"))
|
||||
{
|
||||
// Reset
|
||||
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_Product_ID", "0");
|
||||
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_AttributeSetInstance_ID", "0");
|
||||
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_Lookup_ID", "0");
|
||||
// Replace Value with name if no value exists
|
||||
if (queryValue.length() == 0 && getComponent().getText().length() > 0)
|
||||
queryValue = getComponent().getText();
|
||||
|
||||
// Replace Value with name if no value exists
|
||||
if (queryValue.length() == 0 && getComponent().getText().length() > 0)
|
||||
queryValue = "@" + getComponent().getText() + "@"; // Name indicator - otherwise Value
|
||||
if (m_tableName == null) // sets table name & key column
|
||||
getDirectAccessSQL("*");
|
||||
|
||||
int M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), lookup.getWindowNo(), "M_Warehouse_ID");
|
||||
int M_PriceList_ID = Env.getContextAsInt(Env.getCtx(), lookup.getWindowNo(), "M_PriceList_ID");
|
||||
|
||||
// Show Info
|
||||
InfoProductPanel ip = new InfoProductPanel (lookup.getWindowNo(),
|
||||
M_Warehouse_ID, M_PriceList_ID, true, queryValue, whereClause);
|
||||
|
||||
ip.setVisible(true);
|
||||
ip.setTitle("Product Info");
|
||||
ip.setStyle("border: 2px");
|
||||
ip.setClosable(true);
|
||||
ip.setAttribute("mode", "modal");
|
||||
ip.addValueChangeListener(this);
|
||||
infoPanel = ip;
|
||||
AEnv.showWindow(ip);
|
||||
|
||||
cancelled = ip.isCancelled();
|
||||
result = ip.getSelectedKeys();
|
||||
}
|
||||
else if (col.equals("C_BPartner_ID"))
|
||||
{
|
||||
// Replace Value with name if no value exists
|
||||
if (queryValue.length() == 0 && getComponent().getText().length() > 0)
|
||||
queryValue = getComponent().getText();
|
||||
|
||||
boolean isSOTrx = true; // default
|
||||
|
||||
if (Env.getContext(Env.getCtx(), lookup.getWindowNo(), "IsSOTrx").equals("N"))
|
||||
isSOTrx = false;
|
||||
|
||||
InfoBPartnerPanel ip = new InfoBPartnerPanel(queryValue, lookup.getWindowNo(), isSOTrx,false, whereClause);
|
||||
|
||||
ip.setVisible(true);
|
||||
ip.setTitle("Business Partner Info");
|
||||
ip.setStyle("border: 2px");
|
||||
ip.setClosable(true);
|
||||
ip.setAttribute("mode", "modal");
|
||||
ip.addValueChangeListener(this);
|
||||
infoPanel = ip;
|
||||
AEnv.showWindow(ip);
|
||||
|
||||
cancelled = ip.isCancelled();
|
||||
result = ip.getSelectedKeys();
|
||||
}
|
||||
else // General Info
|
||||
{
|
||||
if (m_tableName == null) // sets table name & key column
|
||||
getDirectAccessSQL("*");
|
||||
|
||||
if (queryValue.length() == 0 && getComponent().getText().length() > 0)
|
||||
queryValue = getComponent().getText();
|
||||
|
||||
InfoPanel ig = InfoPanel.create(lookup.getWindowNo(), m_tableName,m_keyColumnName,queryValue, false, whereClause);
|
||||
ig.setVisible(true);
|
||||
ig.setStyle("border: 2px");
|
||||
ig.setClosable(true);
|
||||
ig.setAttribute("mode", "modal");
|
||||
ig.addValueChangeListener(this);
|
||||
infoPanel = ig;
|
||||
AEnv.showWindow(ig);
|
||||
|
||||
cancelled = ig.isCancelled();
|
||||
result = ig.getSelectedKeys();
|
||||
|
||||
}
|
||||
InfoPanel ip = InfoManager.create(lookup, gridField, m_tableName, m_keyColumnName, queryValue, false, whereClause);
|
||||
ip.setVisible(true);
|
||||
ip.setStyle("border: 2px");
|
||||
ip.setClosable(true);
|
||||
ip.setAttribute("mode", "modal");
|
||||
ip.addValueChangeListener(this);
|
||||
infoPanel = ip;
|
||||
AEnv.showWindow(ip);
|
||||
cancelled = ip.isCancelled();
|
||||
result = ip.getSelectedKeys();
|
||||
|
||||
infoPanel = null;
|
||||
// Result
|
||||
|
@ -586,7 +521,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
{
|
||||
log.config(getColumnName() + " - Result = null (not cancelled)");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -601,7 +536,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
private String getDirectAccessSQL (String text)
|
||||
{
|
||||
String m_columnName = getColumnName();
|
||||
|
||||
|
||||
StringBuffer sql = new StringBuffer();
|
||||
m_tableName = m_columnName.substring(0, m_columnName.length()-3);
|
||||
m_keyColumnName = m_columnName;
|
||||
|
@ -653,35 +588,35 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
{
|
||||
sql.append("SELECT AD_User_ID FROM AD_User WHERE UPPER(Name) LIKE ")
|
||||
.append(DB.TO_STRING(text));
|
||||
|
||||
|
||||
m_tableName = "AD_User";
|
||||
m_keyColumnName = "AD_User_ID";
|
||||
}
|
||||
|
||||
|
||||
// Predefined
|
||||
|
||||
|
||||
if (sql.length() > 0)
|
||||
{
|
||||
String wc = getWhereClause();
|
||||
|
||||
|
||||
if (wc != null && wc.length() > 0)
|
||||
sql.append(" AND ").append(wc);
|
||||
|
||||
|
||||
sql.append(" AND IsActive='Y'");
|
||||
// ***
|
||||
|
||||
|
||||
log.finest(m_columnName + " (predefined) " + sql.toString());
|
||||
|
||||
|
||||
return MRole.getDefault().addAccessSQL(sql.toString(),
|
||||
m_tableName, MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
||||
}
|
||||
|
||||
|
||||
// Check if it is a Table Reference
|
||||
|
||||
|
||||
if (lookup != null && lookup instanceof MLookup)
|
||||
{
|
||||
int AD_Reference_ID = ((MLookup)lookup).getAD_Reference_Value_ID();
|
||||
|
||||
|
||||
if (AD_Reference_ID != 0)
|
||||
{
|
||||
boolean isValueDisplayed = false;
|
||||
|
@ -691,17 +626,17 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
+ " INNER JOIN AD_Column dc ON (rt.AD_Display=dc.AD_Column_ID)"
|
||||
+ " INNER JOIN AD_Table t ON (rt.AD_Table_ID=t.AD_Table_ID) "
|
||||
+ "WHERE rt.AD_Reference_ID=?";
|
||||
|
||||
|
||||
String displayColumnName = null;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(query, null);
|
||||
pstmt.setInt(1, AD_Reference_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
|
||||
|
||||
if (rs.next())
|
||||
{
|
||||
m_keyColumnName = rs.getString(1);
|
||||
|
@ -719,8 +654,8 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
{
|
||||
DB.close(rs, pstmt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (displayColumnName != null)
|
||||
{
|
||||
sql = new StringBuffer();
|
||||
|
@ -735,24 +670,24 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
}
|
||||
sql.append(")");
|
||||
sql.append(" AND IsActive='Y'");
|
||||
|
||||
|
||||
String wc = getWhereClause();
|
||||
|
||||
|
||||
if (wc != null && wc.length() > 0)
|
||||
sql.append(" AND ").append(wc);
|
||||
|
||||
|
||||
// ***
|
||||
|
||||
|
||||
log.finest(m_columnName + " (Table) " + sql.toString());
|
||||
|
||||
|
||||
return MRole.getDefault().addAccessSQL(sql.toString(),
|
||||
m_tableName, MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
||||
}
|
||||
} // Table Reference
|
||||
} // MLookup
|
||||
|
||||
|
||||
/** Check Well Known Columns of Table - assumes TableDir **/
|
||||
|
||||
|
||||
String query = "SELECT t.TableName, c.ColumnName "
|
||||
+ "FROM AD_Column c "
|
||||
+ " INNER JOIN AD_Table t ON (c.AD_Table_ID=t.AD_Table_ID AND t.IsView='N') "
|
||||
|
@ -760,26 +695,26 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
+ " AND c.AD_Reference_ID IN (10,14)"
|
||||
+ " AND EXISTS (SELECT * FROM AD_Column cc WHERE cc.AD_Table_ID=t.AD_Table_ID"
|
||||
+ " AND cc.IsKey='Y' AND cc.ColumnName=?)";
|
||||
|
||||
|
||||
m_keyColumnName = m_columnName;
|
||||
sql = new StringBuffer();
|
||||
PreparedStatement pstmt = null;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(query, null);
|
||||
pstmt.setString(1, m_keyColumnName);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
|
||||
|
||||
while (rs.next())
|
||||
{
|
||||
if (sql.length() != 0)
|
||||
sql.append(" OR ");
|
||||
|
||||
|
||||
m_tableName = rs.getString(1);
|
||||
sql.append("UPPER(").append(rs.getString(2)).append(") LIKE ").append(DB.TO_STRING(text));
|
||||
}
|
||||
|
||||
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
|
@ -788,7 +723,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
{
|
||||
log.log(Level.SEVERE, query, ex);
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
|
@ -809,9 +744,9 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
.append(m_columnName).append(" FROM ").append(m_tableName)
|
||||
.append(" WHERE ").append(sql)
|
||||
.append(" AND IsActive='Y'");
|
||||
|
||||
|
||||
String wc = getWhereClause();
|
||||
|
||||
|
||||
if (wc != null && wc.length() > 0)
|
||||
retValue.append(" AND ").append(wc);
|
||||
// ***
|
||||
|
@ -819,7 +754,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
return MRole.getDefault().addAccessSQL(retValue.toString(),
|
||||
m_tableName, MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
||||
}
|
||||
|
||||
|
||||
private String getWhereClause()
|
||||
{
|
||||
String whereClause = "";
|
||||
|
@ -888,7 +823,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
int AD_Column_ID = 3499; // C_Invoice.C_BPartner_ID
|
||||
try
|
||||
{
|
||||
Lookup lookup = MLookupFactory.get (Env.getCtx(), windowNo,
|
||||
Lookup lookup = MLookupFactory.get (Env.getCtx(), windowNo,
|
||||
0, AD_Column_ID, DisplayType.Search);
|
||||
return new WSearchEditor ("C_BPartner_ID", false, false, true, lookup);
|
||||
}
|
||||
|
@ -901,13 +836,13 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
|
||||
/**
|
||||
* @param windowNo
|
||||
* @return WSearchEditor
|
||||
* @return WSearchEditor
|
||||
*/
|
||||
public static WSearchEditor createProduct(int windowNo) {
|
||||
int AD_Column_ID = 3840; // C_InvoiceLine.M_Product_ID
|
||||
try
|
||||
{
|
||||
Lookup lookup = MLookupFactory.get (Env.getCtx(), windowNo, 0,
|
||||
Lookup lookup = MLookupFactory.get (Env.getCtx(), windowNo, 0,
|
||||
AD_Column_ID, DisplayType.Search);
|
||||
return new WSearchEditor("M_Product_ID", false, false, true, lookup);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2010 Heng Sin Low *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.webui.factory;
|
||||
|
||||
import org.adempiere.webui.panel.InfoAssetPanel;
|
||||
import org.adempiere.webui.panel.InfoAssignmentPanel;
|
||||
import org.adempiere.webui.panel.InfoBPartnerPanel;
|
||||
import org.adempiere.webui.panel.InfoCashLinePanel;
|
||||
import org.adempiere.webui.panel.InfoGeneralPanel;
|
||||
import org.adempiere.webui.panel.InfoInOutPanel;
|
||||
import org.adempiere.webui.panel.InfoInvoicePanel;
|
||||
import org.adempiere.webui.panel.InfoOrderPanel;
|
||||
import org.adempiere.webui.panel.InfoPanel;
|
||||
import org.adempiere.webui.panel.InfoPaymentPanel;
|
||||
import org.adempiere.webui.panel.InfoProductPanel;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class DefaultInfoFactory implements IInfoFactory {
|
||||
|
||||
@Override
|
||||
public InfoPanel create(int WindowNo, String tableName, String keyColumn,
|
||||
String value, boolean multiSelection, String whereClause, boolean lookup) {
|
||||
InfoPanel info = null;
|
||||
|
||||
if (tableName.equals("C_BPartner"))
|
||||
info = new InfoBPartnerPanel (value,WindowNo, !Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"),
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("M_Product"))
|
||||
info = new InfoProductPanel ( WindowNo,
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_Warehouse_ID"),
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_PriceList_ID"),
|
||||
multiSelection, value,whereClause, lookup);
|
||||
else if (tableName.equals("C_Invoice"))
|
||||
info = new InfoInvoicePanel ( WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("A_Asset"))
|
||||
info = new InfoAssetPanel (WindowNo, 0, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("C_Order"))
|
||||
info = new InfoOrderPanel ( WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("M_InOut"))
|
||||
info = new InfoInOutPanel (WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("C_Payment"))
|
||||
info = new InfoPaymentPanel (WindowNo, value, multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("C_CashLine"))
|
||||
info = new InfoCashLinePanel (WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else if (tableName.equals("S_ResourceAssigment"))
|
||||
info = new InfoAssignmentPanel (WindowNo, value,
|
||||
multiSelection, whereClause, lookup);
|
||||
else
|
||||
info = new InfoGeneralPanel (value, WindowNo,
|
||||
tableName, keyColumn,
|
||||
multiSelection, whereClause, lookup);
|
||||
//
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfoPanel create(Lookup lookup, GridField field, String tableName,
|
||||
String keyColumn, String queryValue, boolean multiSelection,
|
||||
String whereClause) {
|
||||
InfoPanel info = null;
|
||||
String col = lookup.getColumnName(); // fully qualified name
|
||||
|
||||
if (col.indexOf('.') != -1)
|
||||
col = col.substring(col.indexOf('.')+1);
|
||||
if (col.equals("M_Product_ID"))
|
||||
{
|
||||
// Reset
|
||||
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_Product_ID", "0");
|
||||
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_AttributeSetInstance_ID", "0");
|
||||
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_Lookup_ID", "0");
|
||||
|
||||
int M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), lookup.getWindowNo(), "M_Warehouse_ID");
|
||||
int M_PriceList_ID = Env.getContextAsInt(Env.getCtx(), lookup.getWindowNo(), "M_PriceList_ID");
|
||||
|
||||
// Show Info
|
||||
info = new InfoProductPanel (lookup.getWindowNo(),
|
||||
M_Warehouse_ID, M_PriceList_ID, true, queryValue, whereClause);
|
||||
|
||||
info.setTitle("Product Info");
|
||||
}
|
||||
else if (col.equals("C_BPartner_ID"))
|
||||
{
|
||||
boolean isSOTrx = true; // default
|
||||
|
||||
if (Env.getContext(Env.getCtx(), lookup.getWindowNo(), "IsSOTrx").equals("N"))
|
||||
isSOTrx = false;
|
||||
|
||||
info = new InfoBPartnerPanel(queryValue, lookup.getWindowNo(), isSOTrx,false, whereClause);
|
||||
info.setTitle("Business Partner Info");
|
||||
}
|
||||
else // General Info
|
||||
{
|
||||
info = create(lookup.getWindowNo(), tableName, keyColumn, queryValue, false, whereClause, true);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2010 Heng Sin Low *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.webui.factory;
|
||||
|
||||
import org.adempiere.webui.panel.InfoPanel;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public interface IInfoFactory {
|
||||
|
||||
public InfoPanel create (int WindowNo,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup);
|
||||
|
||||
public InfoPanel create (Lookup lookup, GridField field,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2010 Heng Sin Low *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.webui.factory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.adempiere.base.Service;
|
||||
import org.adempiere.webui.panel.InfoPanel;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class InfoManager
|
||||
{
|
||||
public static InfoPanel create (int WindowNo,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
InfoPanel info = null;
|
||||
|
||||
List<IInfoFactory> factoryList = Service.list(IInfoFactory.class);
|
||||
for(IInfoFactory factory : factoryList)
|
||||
{
|
||||
info = factory.create(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, lookup);
|
||||
if (info != null)
|
||||
break;
|
||||
}
|
||||
//
|
||||
return info;
|
||||
}
|
||||
|
||||
public static InfoPanel create(Lookup lookup, GridField field, String tableName,
|
||||
String keyColumn, String queryValue, boolean multiSelection,
|
||||
String whereClause)
|
||||
{
|
||||
InfoPanel ip = null;
|
||||
List<IInfoFactory> factoryList = Service.list(IInfoFactory.class);
|
||||
for(IInfoFactory factory : factoryList)
|
||||
{
|
||||
ip = factory.create(lookup, field, tableName, keyColumn, queryValue, false, whereClause);
|
||||
if (ip != null)
|
||||
break;
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
}
|
|
@ -57,29 +57,29 @@ import org.zkoss.zul.Vbox;
|
|||
|
||||
/**
|
||||
* Based on InfoCashLine written by Jorg Janke
|
||||
*
|
||||
*
|
||||
* @author Niraj Sohun
|
||||
* Aug 03, 2007
|
||||
*
|
||||
*
|
||||
* Zk Port
|
||||
* @author Elaine
|
||||
* @version InfoCashLine.java Adempiere Swing UI 3.4.1
|
||||
* @version InfoCashLine.java Adempiere Swing UI 3.4.1
|
||||
*/
|
||||
|
||||
public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener, EventListener
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3042929765363185887L;
|
||||
private Textbox fName = new Textbox();
|
||||
private Textbox fAmtTo = new Textbox();
|
||||
private Textbox fAmtFrom = new Textbox();
|
||||
|
||||
|
||||
private WEditor fCashBook_ID;
|
||||
private WEditor fInvoice_ID;
|
||||
private WEditor fBankAccount_ID;
|
||||
|
||||
|
||||
private Datebox fDateFrom = new Datebox();
|
||||
private Datebox fDateTo = new Datebox();
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
private Label lName = new Label(Msg.translate(Env.getCtx(), "Name"));
|
||||
private Label lDateFrom = new Label(Msg.translate(Env.getCtx(), "StatementDate"));
|
||||
private Label lDateTo = new Label("-");
|
||||
private Label lAmtFrom = new Label(Msg.translate(Env.getCtx(), "Amount"));
|
||||
private Label lAmtFrom = new Label(Msg.translate(Env.getCtx(), "Amount"));
|
||||
private Label lAmtTo = new Label("-");
|
||||
private Borderlayout layout;
|
||||
private Vbox southBody;
|
||||
|
@ -124,18 +124,18 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
|
||||
/**
|
||||
* Detail Protected Constructor
|
||||
*
|
||||
*
|
||||
* @param WindowNo window no
|
||||
* @param value query value
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoCashLinePanel( int WindowNo, String value,
|
||||
public InfoCashLinePanel( int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Detail Protected Constructor
|
||||
*
|
||||
|
@ -144,7 +144,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoCashLinePanel( int WindowNo, String value,
|
||||
public InfoCashLinePanel( int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (WindowNo, "cl", "C_CashLine_ID", multiSelection, whereClause, lookup);
|
||||
|
@ -164,19 +164,19 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
int no = contentPanel.getRowCount();
|
||||
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
|
||||
setStatusDB(Integer.toString(no));
|
||||
|
||||
|
||||
if (value != null && value.length() > 0)
|
||||
{
|
||||
fName .setValue(value);
|
||||
executeQuery();
|
||||
}
|
||||
} // InfoCashLinePanel
|
||||
|
||||
|
||||
/**
|
||||
* Static Setup - add fields to parameterPanel
|
||||
* @throws Exception if Lookups cannot be created
|
||||
*/
|
||||
|
||||
|
||||
private void statInit() throws Exception
|
||||
{
|
||||
fName.setWidth("180px");
|
||||
|
@ -184,38 +184,38 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
fDateTo.setWidth("165px");
|
||||
fAmtFrom.setWidth("180px");
|
||||
fAmtTo.setWidth("180px");
|
||||
|
||||
|
||||
fName.addEventListener(Events.ON_CHANGE, this);
|
||||
|
||||
|
||||
// 5249 - C_Cash.C_CashBook_ID
|
||||
fCashBook_ID = new WSearchEditor(
|
||||
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 5249, DisplayType.TableDir),
|
||||
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 5249, DisplayType.TableDir),
|
||||
Msg.translate(Env.getCtx(), "C_CashBook_ID"), "", false, false, true);
|
||||
fCashBook_ID.addValueChangeListener(this);
|
||||
|
||||
|
||||
// 5354 - C_CashLine.C_Invoice_ID
|
||||
fInvoice_ID = new WSearchEditor(
|
||||
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 5354, DisplayType.Search),
|
||||
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 5354, DisplayType.Search),
|
||||
Msg.translate(Env.getCtx(), "C_Invoice_ID"), "", false, false, true);
|
||||
fInvoice_ID.addValueChangeListener(this);
|
||||
|
||||
|
||||
// 5295 - C_CashLine.C_BankAccount_ID
|
||||
fBankAccount_ID = new WSearchEditor(
|
||||
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 5295, DisplayType.TableDir),
|
||||
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 5295, DisplayType.TableDir),
|
||||
Msg.translate(Env.getCtx(), "C_BankAccount_ID"), "", false, false, true);
|
||||
fBankAccount_ID.addValueChangeListener(this);
|
||||
|
||||
|
||||
// 5296 - C_CashLine.C_Charge_ID
|
||||
// 5291 - C_CashLine.C_Cash_ID
|
||||
|
||||
cbAbsolute.setLabel(Msg.translate(Env.getCtx(), "AbsoluteAmt"));
|
||||
cbAbsolute.addEventListener(Events.ON_CHECK, this);
|
||||
|
||||
|
||||
Grid grid = GridFactory.newGridLayout();
|
||||
|
||||
|
||||
Rows rows = new Rows();
|
||||
grid.appendChild(rows);
|
||||
|
||||
|
||||
Row row = new Row();
|
||||
rows.appendChild(row);
|
||||
row.appendChild(fCashBook_ID.getLabel().rightAlign());
|
||||
|
@ -223,7 +223,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
row.appendChild(lName.rightAlign());
|
||||
row.appendChild(fName);
|
||||
row.appendChild(cbAbsolute);
|
||||
|
||||
|
||||
row = new Row();
|
||||
row.setSpans("1, 1, 1, 2");
|
||||
rows.appendChild(row);
|
||||
|
@ -232,10 +232,10 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
row.appendChild(lDateFrom.rightAlign());
|
||||
Hbox hbox = new Hbox();
|
||||
hbox.appendChild(fDateFrom);
|
||||
hbox.appendChild(lDateTo);
|
||||
hbox.appendChild(lDateTo);
|
||||
hbox.appendChild(fDateTo);
|
||||
row.appendChild(hbox);
|
||||
|
||||
|
||||
row = new Row();
|
||||
row.setSpans("1, 1, 1, 2");
|
||||
rows.appendChild(row);
|
||||
|
@ -247,7 +247,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
hbox.appendChild(lAmtTo);
|
||||
hbox.appendChild(fAmtTo);
|
||||
row.appendChild(hbox);
|
||||
|
||||
|
||||
layout = new Borderlayout();
|
||||
layout.setWidth("100%");
|
||||
layout.setHeight("100%");
|
||||
|
@ -273,7 +273,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
contentPanel.setVflex(true);
|
||||
div.setStyle("width :100%; height: 100%");
|
||||
center.appendChild(div);
|
||||
|
||||
|
||||
South south = new South();
|
||||
layout.appendChild(south);
|
||||
southBody = new Vbox();
|
||||
|
@ -283,7 +283,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
southBody.appendChild(new Separator());
|
||||
southBody.appendChild(statusBar);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* General Init
|
||||
* @return true, if success
|
||||
|
@ -292,42 +292,42 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
{
|
||||
// Prepare table
|
||||
StringBuffer where = new StringBuffer("cl.IsActive='Y'");
|
||||
|
||||
|
||||
if (p_whereClause.length() > 0)
|
||||
where.append(" AND ").append(Util.replace(p_whereClause, "C_CashLine.", "cl."));
|
||||
|
||||
|
||||
prepareTable ( s_cashLayout, "C_CashLine cl INNER JOIN C_Cash c ON (cl.C_Cash_ID=c.C_Cash_ID)",
|
||||
where.toString(), "2,3,cl.Line");
|
||||
|
||||
return true;
|
||||
} // initInfo
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Construct SQL Where Clause and define parameters
|
||||
* (setParameters needs to set parameters)
|
||||
* Includes first AND
|
||||
* @return sql where clause
|
||||
*/
|
||||
|
||||
|
||||
protected String getSQLWhere()
|
||||
{
|
||||
StringBuffer sql = new StringBuffer();
|
||||
|
||||
|
||||
if (fName.getText().length() > 0)
|
||||
sql.append(" AND UPPER(c.Name) LIKE ?");
|
||||
|
||||
if (fCashBook_ID.getDisplay() != "")
|
||||
sql.append(" AND c.C_CashBook_ID=?");
|
||||
|
||||
|
||||
if (fInvoice_ID.getDisplay() != "")
|
||||
sql.append(" AND cl.C_Invoice_ID=?");
|
||||
|
||||
|
||||
if (fDateFrom.getValue() != null || fDateTo.getValue() != null)
|
||||
{
|
||||
Date f = fDateFrom.getValue();
|
||||
Timestamp from = new Timestamp(f.getTime());
|
||||
|
||||
|
||||
Date t = fDateTo.getValue();
|
||||
Timestamp to = new Timestamp(t.getTime());
|
||||
|
||||
|
@ -343,7 +343,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
{
|
||||
BigDecimal from = isEmpty(fAmtFrom.getValue()) ? null : new BigDecimal(fAmtFrom.getValue());
|
||||
BigDecimal to = isEmpty(fAmtTo.getValue()) ? null : new BigDecimal(fAmtTo.getValue());
|
||||
|
||||
|
||||
if (cbAbsolute .isChecked())
|
||||
sql.append(" AND ABS(cl.Amount)");
|
||||
else
|
||||
|
@ -377,7 +377,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
* @param forCount for counting records
|
||||
* @throws SQLException
|
||||
*/
|
||||
|
||||
|
||||
protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
|
||||
{
|
||||
int index = 1;
|
||||
|
@ -402,12 +402,12 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
{
|
||||
Date f = fDateFrom.getValue();
|
||||
Timestamp from = new Timestamp(f.getTime());
|
||||
|
||||
|
||||
Date t = fDateTo.getValue();
|
||||
Timestamp to = new Timestamp(t.getTime());
|
||||
|
||||
log.fine("Date From=" + from + ", To=" + to);
|
||||
|
||||
|
||||
if (from == null && to != null)
|
||||
pstmt.setTimestamp(index++, to);
|
||||
else if (from != null && to == null)
|
||||
|
@ -431,9 +431,9 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
if (to != null)
|
||||
to = to.abs();
|
||||
}
|
||||
|
||||
|
||||
log.fine("Amt From=" + from + ", To=" + to + ", Absolute=" + cbAbsolute.isChecked());
|
||||
|
||||
|
||||
if (from == null && to != null)
|
||||
pstmt.setBigDecimal(index++, to);
|
||||
else if (from != null && to == null)
|
||||
|
@ -456,33 +456,33 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
|
|||
* @param f field
|
||||
* @return Upper case text with % at the end
|
||||
*/
|
||||
|
||||
|
||||
private String getSQLText (Textbox f)
|
||||
{
|
||||
String s = f.getText().toUpperCase();
|
||||
|
||||
|
||||
if (!s.endsWith("%"))
|
||||
s += "%";
|
||||
|
||||
|
||||
log.fine( "String=" + s);
|
||||
|
||||
|
||||
return s;
|
||||
} // getSQLText
|
||||
|
||||
public void valueChange(ValueChangeEvent evt)
|
||||
public void valueChange(ValueChangeEvent evt)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void tableChanged(WTableModelEvent event)
|
||||
public void tableChanged(WTableModelEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void insertPagingComponent()
|
||||
{
|
||||
southBody.insertBefore(paging, southBody.getFirstChild());
|
||||
layout.invalidate();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -52,46 +52,51 @@ import org.zkoss.zul.Vbox;
|
|||
/**
|
||||
* Zk Port
|
||||
* @author Elaine
|
||||
* @version InfoGeneral.java Adempiere Swing UI 3.4.1
|
||||
* @version InfoGeneral.java Adempiere Swing UI 3.4.1
|
||||
*/
|
||||
public class InfoGeneralPanel extends InfoPanel implements EventListener
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -665127800885078238L;
|
||||
private Textbox txt1;
|
||||
private Textbox txt2;
|
||||
private Textbox txt3;
|
||||
private Textbox txt4;
|
||||
|
||||
|
||||
private Label lbl1;
|
||||
private Label lbl2;
|
||||
private Label lbl3;
|
||||
private Label lbl4;
|
||||
|
||||
|
||||
/** String Array of Column Info */
|
||||
private ColumnInfo[] m_generalLayout;
|
||||
|
||||
|
||||
/** list of query columns */
|
||||
private ArrayList<String> m_queryColumns = new ArrayList<String>();
|
||||
|
||||
|
||||
/** list of query columns (SQL) */
|
||||
private ArrayList<String> m_queryColumnsSql = new ArrayList<String>();
|
||||
private Borderlayout layout;
|
||||
private Vbox southBody;
|
||||
|
||||
public InfoGeneralPanel(String queryValue, int windowNo,String tableName,String keyColumn, boolean isSOTrx, String whereClause)
|
||||
|
||||
public InfoGeneralPanel(String queryValue, int windowNo,String tableName,String keyColumn, boolean isSOTrx, String whereClause)
|
||||
{
|
||||
this(queryValue, windowNo, tableName, keyColumn, isSOTrx, whereClause, true);
|
||||
}
|
||||
|
||||
public InfoGeneralPanel(String queryValue, int windowNo,String tableName,String keyColumn, boolean isSOTrx, String whereClause, boolean lookup)
|
||||
{
|
||||
super(windowNo, tableName, keyColumn, false,whereClause);
|
||||
|
||||
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "Info"));
|
||||
|
||||
try
|
||||
{
|
||||
init();
|
||||
initComponents();
|
||||
|
||||
|
||||
if (queryValue != null && queryValue.length() > 0)
|
||||
{
|
||||
txt1.setValue(queryValue);
|
||||
|
@ -109,22 +114,22 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
|
||||
setStatusDB(Integer.toString(no));
|
||||
//
|
||||
|
||||
|
||||
if (queryValue != null && queryValue.length() > 0)
|
||||
{
|
||||
executeQuery();
|
||||
renderItems();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void initComponents()
|
||||
{
|
||||
Grid grid = GridFactory.newGridLayout();
|
||||
|
||||
|
||||
Rows rows = new Rows();
|
||||
grid.appendChild(rows);
|
||||
|
||||
|
||||
Row row = new Row();
|
||||
rows.appendChild(row);
|
||||
row.appendChild(lbl1.rightAlign());
|
||||
|
@ -135,7 +140,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
row.appendChild(txt3);
|
||||
row.appendChild(lbl4.rightAlign());
|
||||
row.appendChild(txt4);
|
||||
|
||||
|
||||
layout = new Borderlayout();
|
||||
layout.setWidth("100%");
|
||||
layout.setHeight("100%");
|
||||
|
@ -148,7 +153,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
North north = new North();
|
||||
layout.appendChild(north);
|
||||
north.appendChild(grid);
|
||||
|
||||
|
||||
Center center = new Center();
|
||||
layout.appendChild(center);
|
||||
center.setFlex(true);
|
||||
|
@ -161,7 +166,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
contentPanel.setVflex(true);
|
||||
div.setStyle("width :100%; height: 100%");
|
||||
center.appendChild(div);
|
||||
|
||||
|
||||
South south = new South();
|
||||
layout.appendChild(south);
|
||||
southBody = new Vbox();
|
||||
|
@ -178,30 +183,30 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
txt2 = new Textbox();
|
||||
txt3 = new Textbox();
|
||||
txt4 = new Textbox();
|
||||
|
||||
|
||||
lbl1 = new Label();
|
||||
lbl2 = new Label();
|
||||
lbl3 = new Label();
|
||||
lbl4 = new Label();
|
||||
}
|
||||
|
||||
|
||||
private boolean initInfo ()
|
||||
{
|
||||
if (!initInfoTable())
|
||||
return false;
|
||||
|
||||
// Prepare table
|
||||
|
||||
|
||||
StringBuffer where = new StringBuffer("IsActive='Y'");
|
||||
|
||||
|
||||
if (p_whereClause.length() > 0)
|
||||
where.append(" AND ").append(p_whereClause);
|
||||
prepareTable(m_generalLayout, p_tableName, where.toString(), "2");
|
||||
|
||||
// Set & enable Fields
|
||||
|
||||
|
||||
lbl1.setValue(Util.cleanAmp(Msg.translate(Env.getCtx(), m_queryColumns.get(0).toString())));
|
||||
|
||||
|
||||
if (m_queryColumns.size() > 1)
|
||||
{
|
||||
lbl2.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(1).toString()));
|
||||
|
@ -211,7 +216,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
lbl2.setVisible(false);
|
||||
txt2.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
if (m_queryColumns.size() > 2)
|
||||
{
|
||||
lbl3.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(2).toString()));
|
||||
|
@ -221,7 +226,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
lbl3.setVisible(false);
|
||||
txt3.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
if (m_queryColumns.size() > 3)
|
||||
{
|
||||
lbl4.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(3).toString()));
|
||||
|
@ -237,7 +242,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
private boolean initInfoTable ()
|
||||
{
|
||||
// Get Query Columns
|
||||
|
||||
|
||||
String sql = "SELECT c.ColumnName, t.AD_Table_ID, t.TableName, c.ColumnSql "
|
||||
+ "FROM AD_Table t"
|
||||
+ " INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID)"
|
||||
|
@ -248,26 +253,26 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
+ "WHERE f.AD_Column_ID=c.AD_Column_ID"
|
||||
+ " AND f.IsDisplayed='Y' AND f.IsEncrypted='N' AND f.ObscureType IS NULL) "
|
||||
+ "ORDER BY c.IsIdentifier DESC, c.SeqNo";
|
||||
|
||||
|
||||
int AD_Table_ID = 0;
|
||||
String tableName = null;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setString(1, p_tableName);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
|
||||
|
||||
while (rs.next())
|
||||
{
|
||||
m_queryColumns.add(rs.getString(1));
|
||||
String columnSql = rs.getString(4);
|
||||
|
||||
|
||||
if (columnSql != null && columnSql.length() > 0)
|
||||
m_queryColumnsSql.add(columnSql);
|
||||
else
|
||||
m_queryColumnsSql.add(rs.getString(1));
|
||||
|
||||
|
||||
if (AD_Table_ID == 0)
|
||||
{
|
||||
AD_Table_ID = rs.getInt(2);
|
||||
|
@ -282,34 +287,34 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
log.log(Level.SEVERE, sql, e);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Miminum check
|
||||
if (m_queryColumns.size() == 0)
|
||||
{
|
||||
log.log(Level.SEVERE, "No query columns found");
|
||||
return false;
|
||||
}
|
||||
|
||||
log.finest("Table " + tableName + ", ID=" + AD_Table_ID
|
||||
|
||||
log.finest("Table " + tableName + ", ID=" + AD_Table_ID
|
||||
+ ", QueryColumns #" + m_queryColumns.size());
|
||||
|
||||
|
||||
// Only 4 Query Columns
|
||||
while (m_queryColumns.size() > 4)
|
||||
while (m_queryColumns.size() > 4)
|
||||
{
|
||||
m_queryColumns.remove(m_queryColumns.size()-1);
|
||||
m_queryColumnsSql.remove(m_queryColumnsSql.size()-1);
|
||||
}
|
||||
|
||||
|
||||
// Set Title
|
||||
String title = Msg.translate(Env.getCtx(), tableName + "_ID"); // best bet
|
||||
|
||||
|
||||
if (title.endsWith("_ID"))
|
||||
title = Msg.translate(Env.getCtx(), tableName); // second best bet
|
||||
|
||||
|
||||
setTitle(getTitle() + " " + title);
|
||||
|
||||
// Get Display Columns
|
||||
|
||||
|
||||
ArrayList<ColumnInfo> list = new ArrayList<ColumnInfo>();
|
||||
sql = "SELECT c.ColumnName, c.AD_Reference_ID, c.IsKey, f.IsDisplayed, c.AD_Reference_Value_ID, c.ColumnSql "
|
||||
+ "FROM AD_Column c"
|
||||
|
@ -320,7 +325,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
+ " AND (c.IsKey='Y' OR "
|
||||
+ " (f.IsEncrypted='N' AND f.ObscureType IS NULL)) "
|
||||
+ "ORDER BY c.IsKey DESC, f.SeqNo";
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
|
@ -337,11 +342,11 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
|
||||
if (columnSql == null || columnSql.length() == 0)
|
||||
columnSql = columnName;
|
||||
|
||||
|
||||
// Default
|
||||
StringBuffer colSql = new StringBuffer(columnSql);
|
||||
Class<?> colClass = null;
|
||||
|
||||
|
||||
if (isKey)
|
||||
colClass = IDColumn.class;
|
||||
else if (!isDisplayed)
|
||||
|
@ -390,24 +395,24 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
log.log(Level.SEVERE, sql, e);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (list.size() == 0)
|
||||
{
|
||||
FDialog.error(p_WindowNo, this, "Error", "No Info Columns");
|
||||
log.log(Level.SEVERE, "No Info for AD_Table_ID=" + AD_Table_ID + " - " + sql);
|
||||
return false;
|
||||
}
|
||||
|
||||
log.finest("InfoColumns #" + list.size());
|
||||
|
||||
log.finest("InfoColumns #" + list.size());
|
||||
|
||||
// Convert ArrayList to Array
|
||||
m_generalLayout = new ColumnInfo[list.size()];
|
||||
list.toArray(m_generalLayout);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getSQLWhere()
|
||||
public String getSQLWhere()
|
||||
{
|
||||
StringBuffer sql = new StringBuffer();
|
||||
addSQLWhere (sql, 0, txt1.getText().toUpperCase());
|
||||
|
@ -416,7 +421,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
addSQLWhere (sql, 3, txt4.getText().toUpperCase());
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
|
||||
private void addSQLWhere(StringBuffer sql, int index, String value)
|
||||
{
|
||||
if (!(value.equals("") || value.equals("%")) && index < m_queryColumns.size())
|
||||
|
@ -463,7 +468,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
public void tableChanged(WTableModelEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void insertPagingComponent()
|
||||
{
|
||||
|
|
|
@ -57,10 +57,10 @@ import org.zkoss.zul.Vbox;
|
|||
|
||||
/**
|
||||
* Based on InfoInOut written by Jorg Janke
|
||||
*
|
||||
*
|
||||
* @author Niraj Sohun
|
||||
* Aug 03, 2007
|
||||
*
|
||||
*
|
||||
* Zk Port
|
||||
* @author Elaine
|
||||
* @version InfoInOut.java Adempiere Swing UI 3.4.1
|
||||
|
@ -69,7 +69,7 @@ import org.zkoss.zul.Vbox;
|
|||
public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, EventListener
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3927370377224858985L;
|
||||
|
||||
|
@ -109,18 +109,18 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
|
||||
/**
|
||||
* Detail Protected Constructor
|
||||
*
|
||||
*
|
||||
* @param WindowNo window no
|
||||
* @param value query value
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoInOutPanel( int WindowNo, String value,
|
||||
public InfoInOutPanel( int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Detail Protected Constructor
|
||||
*
|
||||
|
@ -129,7 +129,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoInOutPanel( int WindowNo, String value,
|
||||
public InfoInOutPanel( int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super (WindowNo, "i", "M_InOut_ID", multiSelection, whereClause, lookup);
|
||||
|
@ -149,7 +149,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
int no = contentPanel.getRowCount();
|
||||
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
|
||||
setStatusDB(Integer.toString(no));
|
||||
|
||||
|
||||
if (value != null && value.length() > 0)
|
||||
{
|
||||
fDocumentNo.setValue(value);
|
||||
|
@ -161,7 +161,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
* Static Setup - add fields to parameterPanel
|
||||
* @throws Exception if Lookups cannot be initialized
|
||||
*/
|
||||
|
||||
|
||||
private void statInit() throws Exception
|
||||
{
|
||||
fDocumentNo.setWidth("100%");
|
||||
|
@ -169,7 +169,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
fPOReference.setWidth("100%");
|
||||
fDateFrom.setWidth("165px");
|
||||
fDateTo.setWidth("165px");
|
||||
|
||||
|
||||
fDocumentNo.addEventListener(Events.ON_CHANGE, this);
|
||||
fDescription.addEventListener(Events.ON_CHANGE, this);
|
||||
fPOReference.addEventListener(Events.ON_CHANGE, this);
|
||||
|
@ -177,17 +177,17 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
fIsSOTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx"));
|
||||
fIsSOTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
|
||||
fIsSOTrx.addEventListener(Events.ON_CHECK, this);
|
||||
|
||||
|
||||
fBPartner_ID = new WSearchEditor(
|
||||
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search),
|
||||
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search),
|
||||
Msg.translate(Env.getCtx(), "BPartner"), "", false, false, true);
|
||||
fBPartner_ID.addValueChangeListener(this);
|
||||
|
||||
|
||||
Grid grid = GridFactory.newGridLayout();
|
||||
|
||||
|
||||
Rows rows = new Rows();
|
||||
grid.appendChild(rows);
|
||||
|
||||
|
||||
Row row = new Row();
|
||||
rows.appendChild(row);
|
||||
row.appendChild(lDocumentNo.rightAlign());
|
||||
|
@ -195,7 +195,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
row.appendChild(fBPartner_ID.getLabel().rightAlign());
|
||||
row.appendChild(fBPartner_ID.getComponent());
|
||||
row.appendChild(fIsSOTrx);
|
||||
|
||||
|
||||
row = new Row();
|
||||
row.setSpans("1, 1, 1, 2");
|
||||
rows.appendChild(row);
|
||||
|
@ -207,14 +207,14 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
hbox.appendChild(lDateTo);
|
||||
hbox.appendChild(fDateTo);
|
||||
row.appendChild(hbox);
|
||||
|
||||
|
||||
row = new Row();
|
||||
row.setSpans("1, 1, 3");
|
||||
rows.appendChild(row);
|
||||
row.appendChild(lPOReference.rightAlign());
|
||||
row.appendChild(fPOReference);
|
||||
row.appendChild(fPOReference);
|
||||
row.appendChild(new Label());
|
||||
|
||||
|
||||
layout = new Borderlayout();
|
||||
layout.setWidth("100%");
|
||||
layout.setHeight("100%");
|
||||
|
@ -223,11 +223,11 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
layout.setStyle("position: absolute");
|
||||
}
|
||||
this.appendChild(layout);
|
||||
|
||||
|
||||
North north = new North();
|
||||
layout.appendChild(north);
|
||||
north.appendChild(grid);
|
||||
|
||||
|
||||
Center center = new Center();
|
||||
layout.appendChild(center);
|
||||
center.setFlex(true);
|
||||
|
@ -240,7 +240,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
contentPanel.setVflex(true);
|
||||
div.setStyle("width :100%; height: 100%");
|
||||
center.appendChild(div);
|
||||
|
||||
|
||||
South south = new South();
|
||||
layout.appendChild(south);
|
||||
southBody = new Vbox();
|
||||
|
@ -250,27 +250,27 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
southBody.appendChild(new Separator());
|
||||
southBody.appendChild(statusBar);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* General Init
|
||||
* @return true, if success
|
||||
*/
|
||||
|
||||
|
||||
private boolean initInfo ()
|
||||
{
|
||||
// Set Defaults
|
||||
String bp = Env.getContext(Env.getCtx(), p_WindowNo, "C_BPartner_ID");
|
||||
|
||||
|
||||
if (bp != null && bp.length() != 0)
|
||||
fBPartner_ID.setValue(new Integer(bp));
|
||||
|
||||
// Prepare table
|
||||
|
||||
|
||||
StringBuffer where = new StringBuffer("i.IsActive='Y'");
|
||||
|
||||
|
||||
if (p_whereClause.length() > 0)
|
||||
where.append(" AND ").append(Util.replace(p_whereClause, "M_InOut.", "i."));
|
||||
|
||||
|
||||
prepareTable(s_invoiceLayout, " M_InOut i", where.toString(), "2,3,4");
|
||||
|
||||
return true;
|
||||
|
@ -284,17 +284,17 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
* Includes first AND
|
||||
* @return where clause
|
||||
*/
|
||||
|
||||
|
||||
protected String getSQLWhere()
|
||||
{
|
||||
StringBuffer sql = new StringBuffer();
|
||||
|
||||
|
||||
if (fDocumentNo.getText().length() > 0)
|
||||
sql.append(" AND UPPER(i.DocumentNo) LIKE ?");
|
||||
|
||||
|
||||
if (fDescription.getText().length() > 0)
|
||||
sql.append(" AND UPPER(i.Description) LIKE ?");
|
||||
|
||||
|
||||
if (fPOReference.getText().length() > 0)
|
||||
sql.append(" AND UPPER(i.POReference) LIKE ?");
|
||||
|
||||
|
@ -305,7 +305,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
{
|
||||
Date f = fDateFrom.getValue();
|
||||
Timestamp from = new Timestamp(f.getTime());
|
||||
|
||||
|
||||
Date t = fDateTo.getValue();
|
||||
Timestamp to = new Timestamp(t.getTime());
|
||||
|
||||
|
@ -328,17 +328,17 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
* @param forCount for counting records
|
||||
* @throws SQLException
|
||||
*/
|
||||
|
||||
|
||||
protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
|
||||
{
|
||||
int index = 1;
|
||||
|
||||
|
||||
if (fDocumentNo.getText().length() > 0)
|
||||
pstmt.setString(index++, getSQLText(fDocumentNo));
|
||||
|
||||
|
||||
if (fDescription.getText().length() > 0)
|
||||
pstmt.setString(index++, getSQLText(fDescription));
|
||||
|
||||
|
||||
if (fPOReference.getText().length() > 0)
|
||||
pstmt.setString(index++, getSQLText(fPOReference));
|
||||
|
||||
|
@ -353,12 +353,12 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
{
|
||||
Date f = fDateFrom.getValue();
|
||||
Timestamp from = new Timestamp(f.getTime());
|
||||
|
||||
|
||||
Date t = fDateTo.getValue();
|
||||
Timestamp to = new Timestamp(t.getTime());
|
||||
|
||||
log.fine("Date From=" + from + ", To=" + to);
|
||||
|
||||
|
||||
if (from == null && to != null)
|
||||
pstmt.setTimestamp(index++, to);
|
||||
else if (from != null && to == null)
|
||||
|
@ -377,14 +377,14 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
* @param f field
|
||||
* @return sql part
|
||||
*/
|
||||
|
||||
|
||||
private String getSQLText (Textbox f)
|
||||
{
|
||||
String s = f.getText().toUpperCase();
|
||||
|
||||
|
||||
if (!s.endsWith("%"))
|
||||
s += "%";
|
||||
|
||||
|
||||
log.fine( "String=" + s);
|
||||
return s;
|
||||
} // getSQLText
|
||||
|
@ -406,18 +406,18 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
AEnv.zoom (AD_WindowNo, query);
|
||||
} // zoom
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* Has Zoom
|
||||
* @return true
|
||||
*/
|
||||
|
||||
|
||||
protected boolean hasZoom()
|
||||
{
|
||||
return true;
|
||||
} // hasZoom
|
||||
|
||||
public void valueChange(ValueChangeEvent evt)
|
||||
public void valueChange(ValueChangeEvent evt)
|
||||
{
|
||||
if (fBPartner_ID.equals(evt.getSource()))
|
||||
{
|
||||
|
@ -425,9 +425,9 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
|
|||
}
|
||||
}
|
||||
|
||||
public void tableChanged(WTableModelEvent event)
|
||||
public void tableChanged(WTableModelEvent event)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -65,12 +65,12 @@ import org.zkoss.zul.Vbox;
|
|||
*
|
||||
* Zk Port
|
||||
* @author Elaine
|
||||
* @version InfoInvoice.java Adempiere Swing UI 3.4.1
|
||||
* @version InfoInvoice.java Adempiere Swing UI 3.4.1
|
||||
**/
|
||||
public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5632526399922930978L;
|
||||
|
||||
|
@ -82,12 +82,12 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
* @param whereClause where clause
|
||||
*
|
||||
*/
|
||||
protected InfoInvoicePanel(int WindowNo, String value,
|
||||
public InfoInvoicePanel(int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Detail protected constructor
|
||||
* @param WindowNo window no
|
||||
|
@ -96,16 +96,16 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
* @param whereClause where clause
|
||||
*
|
||||
*/
|
||||
protected InfoInvoicePanel(int WindowNo, String value,
|
||||
public InfoInvoicePanel(int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super ( WindowNo, "i", "C_Invoice_ID", multiSelection, whereClause, lookup);
|
||||
|
||||
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoInvoice"));
|
||||
//
|
||||
initComponents();
|
||||
init();
|
||||
|
||||
|
||||
p_loadedOK = initInfo ();
|
||||
int no = contentPanel.getRowCount();
|
||||
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
|
||||
|
@ -123,24 +123,24 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
private Label lblDescription;
|
||||
private Label lblDateInvoiced;
|
||||
private Label lblGrandTotal;
|
||||
|
||||
|
||||
private Textbox txtDocumentNo;
|
||||
private Textbox txtDescription;
|
||||
|
||||
|
||||
private Datebox dateFrom;
|
||||
private Datebox dateTo;
|
||||
|
||||
|
||||
private NumberBox amountFrom;
|
||||
private NumberBox amountTo;
|
||||
|
||||
|
||||
private WSearchEditor editorBPartner;
|
||||
private WSearchEditor editorOrder;
|
||||
|
||||
|
||||
private Checkbox isSoTrx;
|
||||
private Checkbox isPaid;
|
||||
private Borderlayout layout;
|
||||
private Vbox southBody;
|
||||
|
||||
|
||||
/** Array of Column Info */
|
||||
private static final ColumnInfo[] s_invoiceLayout = {
|
||||
new ColumnInfo(" ", "i.C_Invoice_ID", IDColumn.class),
|
||||
|
@ -157,25 +157,25 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
new ColumnInfo(Msg.translate(Env.getCtx(), "POReference"), "i.POReference", String.class),
|
||||
new ColumnInfo("", "''", KeyNamePair.class, "i.C_InvoicePaySchedule_ID")
|
||||
};
|
||||
|
||||
|
||||
private static int INDEX_PAYSCHEDULE = s_invoiceLayout.length - 1; // last item
|
||||
|
||||
|
||||
private void initComponents()
|
||||
{
|
||||
lblDocumentNo = new Label(Util.cleanAmp(Msg.translate(Env.getCtx(), "DocumentNo")));
|
||||
lblDescription = new Label(Msg.translate(Env.getCtx(), "Description"));
|
||||
lblDateInvoiced = new Label(Msg.translate(Env.getCtx(), "DateInvoiced"));
|
||||
lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal"));
|
||||
|
||||
|
||||
txtDocumentNo = new Textbox();
|
||||
txtDescription = new Textbox();
|
||||
|
||||
|
||||
dateFrom = new Datebox();
|
||||
dateTo= new Datebox();
|
||||
|
||||
|
||||
amountFrom = new NumberBox(false);
|
||||
amountTo = new NumberBox(false);
|
||||
|
||||
|
||||
isPaid = new Checkbox();
|
||||
isPaid.setLabel(Msg.translate(Env.getCtx(), "IsPaid"));
|
||||
isPaid.setChecked(false);
|
||||
|
@ -187,14 +187,14 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
editorBPartner = new WSearchEditor(lookupBP, Msg.translate(
|
||||
Env.getCtx(), "C_BPartner_ID"), "", false, false, true);
|
||||
editorBPartner.addValueChangeListener(this);
|
||||
|
||||
|
||||
MLookup lookupOrder = MLookupFactory.get(Env.getCtx(), p_WindowNo,
|
||||
0, 4247, DisplayType.Search);
|
||||
editorOrder = new WSearchEditor(lookupOrder, Msg.translate(
|
||||
Env.getCtx(), "C_Order_ID"), "", false, false, true);
|
||||
editorOrder.addValueChangeListener(this);
|
||||
}
|
||||
|
||||
|
||||
private void init()
|
||||
{
|
||||
txtDocumentNo.setWidth("100%");
|
||||
|
@ -203,12 +203,12 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
dateTo.setWidth("165px");
|
||||
amountFrom.getDecimalbox().setWidth("155px");
|
||||
amountTo.getDecimalbox().setWidth("155px");
|
||||
|
||||
|
||||
Grid grid = GridFactory.newGridLayout();
|
||||
|
||||
|
||||
Rows rows = new Rows();
|
||||
grid.appendChild(rows);
|
||||
|
||||
|
||||
Row row = new Row();
|
||||
rows.appendChild(row);
|
||||
row.appendChild(lblDocumentNo.rightAlign());
|
||||
|
@ -217,7 +217,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
row.appendChild(editorBPartner.getComponent());
|
||||
row.appendChild(isSoTrx);
|
||||
row.appendChild(isPaid);
|
||||
|
||||
|
||||
row = new Row();
|
||||
row.setSpans("1, 1, 1, 3");
|
||||
rows.appendChild(row);
|
||||
|
@ -229,7 +229,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
hbox.appendChild(new Label("-"));
|
||||
hbox.appendChild(dateTo);
|
||||
row.appendChild(hbox);
|
||||
|
||||
|
||||
row = new Row();
|
||||
row.setSpans("1, 1, 1, 3");
|
||||
rows.appendChild(row);
|
||||
|
@ -241,7 +241,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
hbox.appendChild(new Label("-"));
|
||||
hbox.appendChild(amountTo);
|
||||
row.appendChild(hbox);
|
||||
|
||||
|
||||
layout = new Borderlayout();
|
||||
layout.setWidth("100%");
|
||||
layout.setHeight("100%");
|
||||
|
@ -267,7 +267,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
contentPanel.setVflex(true);
|
||||
div.setStyle("width :100%; height: 100%");
|
||||
center.appendChild(div);
|
||||
|
||||
|
||||
South south = new South();
|
||||
layout.appendChild(south);
|
||||
southBody = new Vbox();
|
||||
|
@ -277,7 +277,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
southBody.appendChild(new Separator());
|
||||
southBody.appendChild(statusBar);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* General Init
|
||||
* @return true, if success
|
||||
|
@ -299,7 +299,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
"2,3,4");
|
||||
//
|
||||
return true;
|
||||
|
||||
|
||||
} // initInfo
|
||||
@Override
|
||||
public String getSQLWhere()
|
||||
|
@ -323,7 +323,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (WrongValueException e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -331,7 +331,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (WrongValueException e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
if (fromDate == null && toDate != null)
|
||||
{
|
||||
|
@ -356,7 +356,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if (!Util.isEmpty(amountTo.getText()))
|
||||
|
@ -367,7 +367,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if (fromAmount == null && toAmount != null)
|
||||
|
@ -396,7 +396,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
pstmt.setString(index++, getSQLText(txtDocumentNo));
|
||||
if (txtDescription.getText().length() > 0)
|
||||
pstmt.setString(index++, getSQLText(txtDescription));
|
||||
|
||||
|
||||
//
|
||||
if (editorBPartner.getValue() != null)
|
||||
{
|
||||
|
@ -425,7 +425,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (WrongValueException e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -437,9 +437,9 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (WrongValueException e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
log.fine("Date From=" + from + ", To=" + to);
|
||||
if (from == null && to != null)
|
||||
{
|
||||
|
@ -454,13 +454,13 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
pstmt.setTimestamp(index++, from);
|
||||
pstmt.setTimestamp(index++, to);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
BigDecimal fromBD = null;
|
||||
BigDecimal toBD = null;
|
||||
Double fromAmt = null;
|
||||
Double toAmt = null;
|
||||
|
||||
|
||||
if (!Util.isEmpty(amountFrom.getText()))
|
||||
{
|
||||
try
|
||||
|
@ -470,10 +470,10 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!Util.isEmpty(amountTo.getText()))
|
||||
{
|
||||
try
|
||||
|
@ -483,10 +483,10 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (fromBD == null && toBD != null)
|
||||
{
|
||||
pstmt.setBigDecimal(index++, toBD);
|
||||
|
@ -502,7 +502,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
pstmt.setString(index++,isPaid.isChecked() ? "Y" : "N");
|
||||
pstmt.setString(index++,isSoTrx.isChecked() ? "Y" : "N");
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -518,7 +518,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
log.fine("String=" + s);
|
||||
return s;
|
||||
} // getSQLText
|
||||
|
||||
|
||||
// Elaine 2008/12/16
|
||||
/**
|
||||
* Zoom
|
||||
|
@ -545,10 +545,10 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
return true;
|
||||
} // hasZoom
|
||||
//
|
||||
|
||||
|
||||
public void tableChanged(WTableModelEvent event)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
public void valueChange(ValueChangeEvent evt)
|
||||
{
|
||||
|
|
|
@ -59,10 +59,10 @@ import org.zkoss.zul.Vbox;
|
|||
/**
|
||||
* Search Order info and return selection
|
||||
* Based on InfoOrder by Jorg Janke
|
||||
*
|
||||
*
|
||||
* @author Sendy Yagambrum
|
||||
* @date July 27, 2007
|
||||
*
|
||||
*
|
||||
* Zk Port
|
||||
* @author Elaine
|
||||
* @version InfoOrder.java Adempiere Swing UI 3.4.1
|
||||
|
@ -70,7 +70,7 @@ import org.zkoss.zul.Vbox;
|
|||
public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8725276769956103867L;
|
||||
private Label lblDocumentNo;
|
||||
|
@ -78,23 +78,23 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
private Label lblDateOrdered;
|
||||
private Label lblOrderRef;
|
||||
private Label lblGrandTotal;
|
||||
|
||||
|
||||
private Textbox txtDocumentNo;
|
||||
private Textbox txtDescription;
|
||||
private Textbox txtOrderRef;
|
||||
|
||||
|
||||
private Datebox dateFrom;
|
||||
private Datebox dateTo;
|
||||
|
||||
|
||||
private NumberBox amountFrom;
|
||||
private NumberBox amountTo;
|
||||
|
||||
|
||||
private WSearchEditor editorBPartner;
|
||||
|
||||
|
||||
private Checkbox isSoTrx;
|
||||
private Borderlayout layout;
|
||||
private Vbox southBody;
|
||||
|
||||
|
||||
/** Array of Column Info */
|
||||
private static final ColumnInfo[] s_invoiceLayout = {
|
||||
new ColumnInfo(" ", "o.C_Order_ID", IDColumn.class),
|
||||
|
@ -108,21 +108,21 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
new ColumnInfo(Msg.translate(Env.getCtx(), "Description"), "o.Description", String.class),
|
||||
new ColumnInfo(Msg.translate(Env.getCtx(), "POReference"), "o.POReference", String.class)
|
||||
};
|
||||
|
||||
protected InfoOrderPanel(int WindowNo, String value,
|
||||
|
||||
public InfoOrderPanel(int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
protected InfoOrderPanel(int WindowNo, String value,
|
||||
public InfoOrderPanel(int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super ( WindowNo, "o", "C_Order_ID", multiSelection, whereClause, lookup);
|
||||
log.info( "InfoOrder");
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoOrder"));
|
||||
//
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
initComponents();
|
||||
|
@ -133,7 +133,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int no = contentPanel.getRowCount();
|
||||
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
|
||||
setStatusDB(Integer.toString(no));
|
||||
|
@ -153,17 +153,17 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
lblDateOrdered = new Label(Msg.translate(Env.getCtx(), "DateOrdered"));
|
||||
lblOrderRef = new Label(Msg.translate(Env.getCtx(), "POReference"));
|
||||
lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal"));
|
||||
|
||||
|
||||
txtDocumentNo = new Textbox();
|
||||
txtDescription = new Textbox();
|
||||
txtOrderRef = new Textbox();
|
||||
|
||||
|
||||
dateFrom = new Datebox();
|
||||
dateTo= new Datebox();
|
||||
|
||||
|
||||
amountFrom = new NumberBox(false);
|
||||
amountTo = new NumberBox(false);
|
||||
|
||||
|
||||
isSoTrx = new Checkbox();
|
||||
isSoTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx"));
|
||||
isSoTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
|
||||
|
@ -172,9 +172,9 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
editorBPartner = new WSearchEditor(lookupBP, Msg.translate(
|
||||
Env.getCtx(), "C_BPartner_ID"), "", true, false, true);
|
||||
editorBPartner.addValueChangeListener(this);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void init()
|
||||
{
|
||||
txtDocumentNo.setWidth("100%");
|
||||
|
@ -184,12 +184,12 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
dateTo.setWidth("165px");
|
||||
amountFrom.getDecimalbox().setWidth("155px");
|
||||
amountTo.getDecimalbox().setWidth("155px");
|
||||
|
||||
|
||||
Grid grid = GridFactory.newGridLayout();
|
||||
|
||||
|
||||
Rows rows = new Rows();
|
||||
grid.appendChild(rows);
|
||||
|
||||
|
||||
Row row = new Row();
|
||||
rows.appendChild(row);
|
||||
row.appendChild(lblDocumentNo.rightAlign());
|
||||
|
@ -197,7 +197,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
row.appendChild(editorBPartner.getLabel().rightAlign());
|
||||
row.appendChild(editorBPartner.getComponent());
|
||||
row.appendChild(isSoTrx);
|
||||
|
||||
|
||||
row = new Row();
|
||||
row.setSpans("1, 1, 1, 2");
|
||||
rows.appendChild(row);
|
||||
|
@ -209,7 +209,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
hbox.appendChild(new Label("-"));
|
||||
hbox.appendChild(dateTo);
|
||||
row.appendChild(hbox);
|
||||
|
||||
|
||||
row = new Row();
|
||||
row.setSpans("1, 1, 1, 2");
|
||||
rows.appendChild(row);
|
||||
|
@ -221,7 +221,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
hbox.appendChild(new Label("-"));
|
||||
hbox.appendChild(amountTo);
|
||||
row.appendChild(hbox);
|
||||
|
||||
|
||||
layout = new Borderlayout();
|
||||
layout.setWidth("100%");
|
||||
layout.setHeight("100%");
|
||||
|
@ -247,7 +247,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
contentPanel.setVflex(true);
|
||||
div.setStyle("width :100%; height: 100%");
|
||||
center.appendChild(div);
|
||||
|
||||
|
||||
South south = new South();
|
||||
layout.appendChild(south);
|
||||
southBody = new Vbox();
|
||||
|
@ -301,7 +301,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (WrongValueException e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -309,7 +309,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (WrongValueException e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
if (fromDate == null && toDate != null)
|
||||
{
|
||||
|
@ -320,7 +320,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
sql.append(" AND TRUNC(o.DateOrdered) >= ?");
|
||||
}
|
||||
else if (fromDate != null && toDate != null)
|
||||
{
|
||||
{
|
||||
sql.append(" AND TRUNC(o.DateOrdered) BETWEEN ? AND ?");
|
||||
}
|
||||
//
|
||||
|
@ -334,7 +334,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if (amountTo.getText() != null && amountTo.getText().trim().length() > 0)
|
||||
|
@ -345,7 +345,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if (fromAmount == null && toAmount != null)
|
||||
|
@ -384,7 +384,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
log.fine("BPartner=" + bp);
|
||||
}
|
||||
//
|
||||
|
||||
|
||||
Date fromD = null;
|
||||
Date toD = null;
|
||||
Timestamp from = null;
|
||||
|
@ -399,7 +399,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (WrongValueException e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -411,9 +411,9 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (WrongValueException e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
log.fine("Date From=" + from + ", To=" + to);
|
||||
if (from == null && to != null)
|
||||
{
|
||||
|
@ -428,13 +428,13 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
pstmt.setTimestamp(index++, from);
|
||||
pstmt.setTimestamp(index++, to);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
BigDecimal fromBD = null;
|
||||
BigDecimal toBD = null;
|
||||
Double fromAmt = null;
|
||||
Double toAmt = null;
|
||||
|
||||
|
||||
if (amountFrom.getText() != null && amountFrom.getText().trim().length() > 0)
|
||||
{
|
||||
try
|
||||
|
@ -444,10 +444,10 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (amountTo.getText() != null && amountTo.getText().trim().length() > 0)
|
||||
{
|
||||
try
|
||||
|
@ -457,10 +457,10 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (fromBD == null && toBD != null)
|
||||
{
|
||||
pstmt.setBigDecimal(index++, toBD);
|
||||
|
@ -474,9 +474,9 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
pstmt.setBigDecimal(index++, fromBD);
|
||||
pstmt.setBigDecimal(index++, toBD);
|
||||
}
|
||||
|
||||
|
||||
pstmt.setString(index++, isSoTrx.isChecked() ? "Y" : "N");
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -492,7 +492,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
log.fine("String=" + s);
|
||||
return s;
|
||||
} // getSQLText
|
||||
|
||||
|
||||
// Elaine 2008/12/16
|
||||
/**
|
||||
* Zoom
|
||||
|
@ -522,16 +522,16 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
|
||||
public void tableChanged(WTableModelEvent event)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void valueChange(ValueChangeEvent evt)
|
||||
{
|
||||
if (editorBPartner.equals(evt.getSource()))
|
||||
{
|
||||
editorBPartner.setValue(evt.getNewValue());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,10 +41,20 @@ import org.adempiere.webui.event.ValueChangeEvent;
|
|||
import org.adempiere.webui.event.ValueChangeListener;
|
||||
import org.adempiere.webui.event.WTableModelEvent;
|
||||
import org.adempiere.webui.event.WTableModelListener;
|
||||
import org.adempiere.webui.factory.InfoManager;
|
||||
import org.adempiere.webui.part.ITabOnSelectHandler;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.compiere.minigrid.ColumnInfo;
|
||||
import org.compiere.minigrid.IDColumn;
|
||||
import org.compiere.model.I_A_Asset;
|
||||
import org.compiere.model.I_C_BPartner;
|
||||
import org.compiere.model.I_C_CashLine;
|
||||
import org.compiere.model.I_C_Invoice;
|
||||
import org.compiere.model.I_C_Order;
|
||||
import org.compiere.model.I_C_Payment;
|
||||
import org.compiere.model.I_M_InOut;
|
||||
import org.compiere.model.I_M_Product;
|
||||
import org.compiere.model.I_S_ResourceAssignment;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.util.CLogger;
|
||||
|
@ -67,71 +77,37 @@ import org.zkoss.zul.event.ZulEvents;
|
|||
/**
|
||||
* Search Information and return selection - Base Class.
|
||||
* Based on Info written by Jorg Janke
|
||||
*
|
||||
*
|
||||
* @author Sendy Yagambrum
|
||||
*
|
||||
*
|
||||
* Zk Port
|
||||
* @author Elaine
|
||||
* @version Info.java Adempiere Swing UI 3.4.1
|
||||
*/
|
||||
public abstract class InfoPanel extends Window implements EventListener, WTableModelListener, ListModelExt
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* generated serial version ID
|
||||
*/
|
||||
private static final long serialVersionUID = 325050327514511004L;
|
||||
private final static int PAGE_SIZE = 100;
|
||||
|
||||
|
||||
public static InfoPanel create (int WindowNo,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
InfoPanel info = null;
|
||||
{
|
||||
return InfoManager.create(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
if (tableName.equals("C_BPartner"))
|
||||
info = new InfoBPartnerPanel (value,WindowNo, !Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"),
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("M_Product"))
|
||||
info = new InfoProductPanel ( WindowNo, 0,0,
|
||||
multiSelection, value,whereClause);
|
||||
else if (tableName.equals("C_Invoice"))
|
||||
info = new InfoInvoicePanel ( WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("A_Asset"))
|
||||
info = new InfoAssetPanel (WindowNo, 0, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("C_Order"))
|
||||
info = new InfoOrderPanel ( WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("M_InOut"))
|
||||
info = new InfoInOutPanel (WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("C_Payment"))
|
||||
info = new InfoPaymentPanel (WindowNo, value, multiSelection, whereClause);
|
||||
else if (tableName.equals("C_CashLine"))
|
||||
info = new InfoCashLinePanel (WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else if (tableName.equals("S_ResourceAssigment"))
|
||||
info = new InfoAssignmentPanel (WindowNo, value,
|
||||
multiSelection, whereClause);
|
||||
else
|
||||
info = new InfoGeneralPanel (value, WindowNo,
|
||||
tableName, keyColumn,
|
||||
multiSelection, whereClause);
|
||||
//
|
||||
return info;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show BPartner Info (non modal)
|
||||
* @param WindowNo window no
|
||||
*/
|
||||
public static void showBPartner (int WindowNo)
|
||||
{
|
||||
InfoBPartnerPanel info = new InfoBPartnerPanel ( "", WindowNo,
|
||||
!Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"),false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo, I_C_BPartner.Table_Name,
|
||||
I_C_BPartner.COLUMNNAME_C_BPartner_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showBPartner
|
||||
|
||||
|
@ -142,7 +118,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showAsset (int WindowNo)
|
||||
{
|
||||
InfoPanel info = new InfoAssetPanel (WindowNo, 0, "", false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_A_Asset.Table_Name, I_A_Asset.COLUMNNAME_A_Asset_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showBPartner
|
||||
|
||||
|
@ -153,13 +130,11 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showProduct (int WindowNo)
|
||||
{
|
||||
InfoPanel info = new InfoProductPanel(WindowNo,
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_Warehouse_ID"),
|
||||
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_PriceList_ID"),
|
||||
false, "", "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_M_Product.Table_Name, I_M_Product.COLUMNNAME_M_Product_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showProduct
|
||||
|
||||
|
||||
/**
|
||||
* Show Order Info (non modal)
|
||||
* @param frame Parent Frame
|
||||
|
@ -168,7 +143,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showOrder (int WindowNo, String value)
|
||||
{
|
||||
InfoPanel info = new InfoOrderPanel(WindowNo, "", false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_C_Order.Table_Name, I_C_Order.COLUMNNAME_C_Order_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showOrder
|
||||
|
||||
|
@ -180,7 +156,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showInvoice (int WindowNo, String value)
|
||||
{
|
||||
InfoPanel info = new InfoInvoicePanel(WindowNo, "", false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_C_Invoice.Table_Name, I_C_Invoice.COLUMNNAME_C_Invoice_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showInvoice
|
||||
|
||||
|
@ -192,8 +169,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showInOut (int WindowNo, String value)
|
||||
{
|
||||
InfoPanel info = new InfoInOutPanel (WindowNo, value,
|
||||
false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_M_InOut.Table_Name, I_M_InOut.COLUMNNAME_M_InOut_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showInOut
|
||||
|
||||
|
@ -205,8 +182,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showPayment (int WindowNo, String value)
|
||||
{
|
||||
InfoPanel info = new InfoPaymentPanel (WindowNo, value,
|
||||
false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_C_Payment.Table_Name, I_C_Payment.COLUMNNAME_C_Payment_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showPayment
|
||||
|
||||
|
@ -218,8 +195,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showCashLine (int WindowNo, String value)
|
||||
{
|
||||
InfoPanel info = new InfoCashLinePanel (WindowNo, value,
|
||||
false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_C_CashLine.Table_Name, I_C_CashLine.COLUMNNAME_C_CashLine_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showCashLine
|
||||
|
||||
|
@ -231,8 +208,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
*/
|
||||
public static void showAssignment (int WindowNo, String value)
|
||||
{
|
||||
InfoPanel info = new InfoAssignmentPanel (WindowNo, value,
|
||||
false, "", false);
|
||||
InfoPanel info = InfoManager.create(WindowNo,
|
||||
I_S_ResourceAssignment.Table_Name, I_S_ResourceAssignment.COLUMNNAME_S_ResourceAssignment_ID, "", false, "", false);
|
||||
AEnv.showWindow(info);
|
||||
} // showAssignment
|
||||
|
||||
|
@ -241,10 +218,10 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
private boolean m_lookup;
|
||||
|
||||
/**************************************************
|
||||
* Detail Constructor
|
||||
* Detail Constructor
|
||||
* @param WindowNo WindowNo
|
||||
* @param tableName tableName
|
||||
* @param keyColumn keyColumn
|
||||
* @param keyColumn keyColumn
|
||||
* @param whereClause whereClause
|
||||
*/
|
||||
protected InfoPanel (int WindowNo,
|
||||
|
@ -253,7 +230,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
{
|
||||
this(WindowNo, tableName, keyColumn, multipleSelection, whereClause, true);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************
|
||||
* Detail Constructor
|
||||
* @param WindowNo WindowNo
|
||||
|
@ -272,7 +249,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
p_keyColumn = keyColumn;
|
||||
p_multipleSelection = multipleSelection;
|
||||
m_lookup = lookup;
|
||||
|
||||
|
||||
if (whereClause == null || whereClause.indexOf('@') == -1)
|
||||
p_whereClause = whereClause;
|
||||
else
|
||||
|
@ -282,14 +259,14 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
log.log(Level.SEVERE, "Cannot parse context= " + whereClause);
|
||||
}
|
||||
init();
|
||||
|
||||
|
||||
this.setAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY, new ITabOnSelectHandler() {
|
||||
public void onSelect() {
|
||||
scrollToSelectedRow();
|
||||
}
|
||||
});
|
||||
} // InfoPanel
|
||||
|
||||
|
||||
private void init()
|
||||
{
|
||||
if (isLookup())
|
||||
|
@ -311,24 +288,24 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
setHeight("100%");
|
||||
setStyle("position: absolute");
|
||||
}
|
||||
|
||||
|
||||
confirmPanel = new ConfirmPanel(true, true, false, true, true, true); // Elaine 2008/12/16
|
||||
confirmPanel.addActionListener(Events.ON_CLICK, this);
|
||||
confirmPanel.setStyle("border-top: 2px groove #444; padding-top: 4px");
|
||||
|
||||
|
||||
// Elaine 2008/12/16
|
||||
confirmPanel.getButton(ConfirmPanel.A_CUSTOMIZE).setVisible(hasCustomize());
|
||||
confirmPanel.getButton(ConfirmPanel.A_HISTORY).setVisible(hasHistory());
|
||||
confirmPanel.getButton(ConfirmPanel.A_ZOOM).setVisible(hasZoom());
|
||||
confirmPanel.getButton(ConfirmPanel.A_ZOOM).setVisible(hasZoom());
|
||||
//
|
||||
if (!isLookup())
|
||||
if (!isLookup())
|
||||
{
|
||||
confirmPanel.getButton(ConfirmPanel.A_OK).setVisible(false);
|
||||
}
|
||||
|
||||
this.setSizable(true);
|
||||
|
||||
this.setSizable(true);
|
||||
this.setMaximizable(true);
|
||||
|
||||
|
||||
this.addEventListener(Events.ON_OK, this);
|
||||
|
||||
contentPanel.setOddRowSclass(null);
|
||||
|
@ -353,7 +330,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
private boolean m_cancel = false;
|
||||
/** Result IDs */
|
||||
private ArrayList<Integer> m_results = new ArrayList<Integer>(3);
|
||||
|
||||
|
||||
private ListModelTable model;
|
||||
/** Layout of Grid */
|
||||
protected ColumnInfo[] p_layout;
|
||||
|
@ -375,7 +352,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
|
||||
/** Logger */
|
||||
protected CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
|
||||
protected WListbox contentPanel = new WListbox();
|
||||
protected Paging paging;
|
||||
protected int pageNo;
|
||||
|
@ -384,7 +361,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
private int cacheEnd;
|
||||
private boolean m_useDatabasePaging = false;
|
||||
private BusyDialog progressWindow;
|
||||
|
||||
|
||||
private static final String[] lISTENER_EVENTS = {};
|
||||
|
||||
/**
|
||||
|
@ -415,9 +392,9 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
statusBar.setStatusDB(text);
|
||||
} // setStatusDB
|
||||
|
||||
protected void prepareTable (ColumnInfo[] layout,
|
||||
String from,
|
||||
String where,
|
||||
protected void prepareTable (ColumnInfo[] layout,
|
||||
String from,
|
||||
String where,
|
||||
String orderBy)
|
||||
{
|
||||
String sql =contentPanel.prepareTable(layout, from,
|
||||
|
@ -430,10 +407,10 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
m_sqlOrder = "";
|
||||
m_sqlUserOrder = "";
|
||||
if (orderBy != null && orderBy.length() > 0)
|
||||
m_sqlOrder = " ORDER BY " + orderBy;
|
||||
m_sqlOrder = " ORDER BY " + orderBy;
|
||||
} // prepareTable
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Execute Query
|
||||
*/
|
||||
|
@ -446,7 +423,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
testCount();
|
||||
m_useDatabasePaging = (m_count > 1000);
|
||||
if (m_useDatabasePaging)
|
||||
{
|
||||
{
|
||||
return ;
|
||||
}
|
||||
else
|
||||
|
@ -454,7 +431,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
readLine(0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void readData(ResultSet rs) throws SQLException {
|
||||
int colOffset = 1; // columns start with 1
|
||||
List<Object> data = new ArrayList<Object>();
|
||||
|
@ -466,7 +443,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
if (c == IDColumn.class)
|
||||
{
|
||||
value = new IDColumn(rs.getInt(colIndex));
|
||||
|
||||
|
||||
}
|
||||
else if (c == Boolean.class)
|
||||
value = new Boolean("Y".equals(rs.getString(colIndex)));
|
||||
|
@ -494,14 +471,14 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
}
|
||||
line.add(data);
|
||||
}
|
||||
|
||||
|
||||
protected void renderItems()
|
||||
{
|
||||
if (m_count > 0)
|
||||
{
|
||||
if (m_count > PAGE_SIZE)
|
||||
{
|
||||
if (paging == null)
|
||||
if (paging == null)
|
||||
{
|
||||
paging = new Paging();
|
||||
paging.setPageSize(PAGE_SIZE);
|
||||
|
@ -520,12 +497,12 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
model.setSorter(this);
|
||||
model.addTableModelListener(this);
|
||||
contentPanel.setData(model, null);
|
||||
|
||||
|
||||
pageNo = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (paging != null)
|
||||
if (paging != null)
|
||||
{
|
||||
paging.setTotalSize(m_count);
|
||||
paging.setActivePage(0);
|
||||
|
@ -540,10 +517,10 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
int no = m_count;
|
||||
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
|
||||
setStatusDB(Integer.toString(no));
|
||||
|
||||
|
||||
addDoubleClickListener();
|
||||
}
|
||||
|
||||
|
||||
private List<Object> readLine(int start, int end) {
|
||||
//cacheStart & cacheEnd - 1 based index, start & end - 0 based index
|
||||
if (cacheStart >= 1 && cacheEnd > cacheStart)
|
||||
|
@ -660,15 +637,15 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
}
|
||||
contentPanel.addEventListener(Events.ON_DOUBLE_CLICK, this);
|
||||
}
|
||||
|
||||
|
||||
protected void insertPagingComponent() {
|
||||
contentPanel.getParent().insertBefore(paging, contentPanel.getNextSibling());
|
||||
}
|
||||
|
||||
|
||||
public Vector<String> getColumnHeader(ColumnInfo[] p_layout)
|
||||
{
|
||||
Vector<String> columnHeader = new Vector<String>();
|
||||
|
||||
|
||||
for (ColumnInfo info: p_layout)
|
||||
{
|
||||
columnHeader.add(info.getColHeader());
|
||||
|
@ -684,25 +661,25 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
long start = System.currentTimeMillis();
|
||||
String dynWhere = getSQLWhere();
|
||||
StringBuffer sql = new StringBuffer (m_sqlCount);
|
||||
|
||||
|
||||
if (dynWhere.length() > 0)
|
||||
sql.append(dynWhere); // includes first AND
|
||||
|
||||
|
||||
String countSql = Msg.parseTranslation(Env.getCtx(), sql.toString()); // Variables
|
||||
countSql = MRole.getDefault().addAccessSQL (countSql, getTableName(),
|
||||
countSql = MRole.getDefault().addAccessSQL (countSql, getTableName(),
|
||||
MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
|
||||
log.finer(countSql);
|
||||
m_count = -1;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(countSql, null);
|
||||
setParameters (pstmt, true);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
|
||||
|
||||
if (rs.next())
|
||||
m_count = rs.getInt(1);
|
||||
|
||||
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
|
@ -711,17 +688,17 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
log.log(Level.SEVERE, countSql, e);
|
||||
m_count = -2;
|
||||
}
|
||||
|
||||
|
||||
log.fine("#" + m_count + " - " + (System.currentTimeMillis()-start) + "ms");
|
||||
|
||||
|
||||
//Armen: add role checking (Patch #1694788 )
|
||||
//MRole role = MRole.getDefault();
|
||||
//MRole role = MRole.getDefault();
|
||||
//if (role.isQueryMax(no))
|
||||
// return ADialog.ask(p_WindowNo, this, "InfoHighRecordCount", String.valueOf(no));
|
||||
|
||||
|
||||
return true;
|
||||
} // testCount
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Save Selection - Called by dispose
|
||||
|
@ -733,7 +710,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
return;
|
||||
|
||||
log.config( "OK=" + m_ok);
|
||||
|
||||
|
||||
if (!m_ok) // did not press OK
|
||||
{
|
||||
m_results.clear();
|
||||
|
@ -753,12 +730,12 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
if (data != null)
|
||||
m_results.add(data);
|
||||
}
|
||||
|
||||
|
||||
log.config(getSelectedSQL());
|
||||
|
||||
// Save Settings of detail info screens
|
||||
saveSelectionDetail();
|
||||
|
||||
|
||||
} // saveSelection
|
||||
|
||||
/**
|
||||
|
@ -768,10 +745,10 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
protected Integer getSelectedRowKey()
|
||||
{
|
||||
Integer key = contentPanel.getSelectedRowKey();
|
||||
|
||||
return key;
|
||||
|
||||
return key;
|
||||
} // getSelectedRowKey
|
||||
|
||||
|
||||
/**
|
||||
* Get the keys of selected row/s based on layout defined in prepareTable
|
||||
* @return IDs if selection present
|
||||
|
@ -780,12 +757,12 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
protected ArrayList<Integer> getSelectedRowKeys()
|
||||
{
|
||||
ArrayList<Integer> selectedDataList = new ArrayList<Integer>();
|
||||
|
||||
|
||||
if (contentPanel.getKeyColumnIndex() == -1)
|
||||
{
|
||||
return selectedDataList;
|
||||
}
|
||||
|
||||
|
||||
if (p_multipleSelection)
|
||||
{
|
||||
int[] rows = contentPanel.getSelectedIndices();
|
||||
|
@ -803,7 +780,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (selectedDataList.size() == 0)
|
||||
{
|
||||
int row = contentPanel.getSelectedRow();
|
||||
|
@ -816,7 +793,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
selectedDataList.add((Integer)data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return selectedDataList;
|
||||
} // getSelectedRowKeys
|
||||
|
||||
|
@ -863,7 +840,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
Object[] keys = getSelectedKeys();
|
||||
if (keys == null || keys.length == 0)
|
||||
{
|
||||
log.config("No Results - OK="
|
||||
log.config("No Results - OK="
|
||||
+ m_ok + ", Cancel=" + m_cancel);
|
||||
return "";
|
||||
}
|
||||
|
@ -889,8 +866,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
return sb.toString();
|
||||
} // getSelectedSQL;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get Table name Synonym
|
||||
* @return table name
|
||||
|
@ -909,12 +886,12 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
return p_keyColumn;
|
||||
} // getKeyColumn
|
||||
|
||||
|
||||
|
||||
public String[] getEvents()
|
||||
{
|
||||
return InfoPanel.lISTENER_EVENTS;
|
||||
}
|
||||
|
||||
|
||||
// Elaine 2008/11/28
|
||||
/**
|
||||
* Enable OK, History, Zoom if row/s selected
|
||||
|
@ -926,21 +903,21 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
{
|
||||
boolean enable = (contentPanel.getSelectedCount() == 1);
|
||||
confirmPanel.getOKButton().setEnabled(contentPanel.getSelectedCount() > 0);
|
||||
|
||||
|
||||
if (hasHistory())
|
||||
confirmPanel.getButton(ConfirmPanel.A_HISTORY).setEnabled(enable);
|
||||
if (hasZoom())
|
||||
confirmPanel.getButton(ConfirmPanel.A_ZOOM).setEnabled(enable);
|
||||
} // enableButtons
|
||||
//
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Get dynamic WHERE part of SQL
|
||||
* To be overwritten by concrete classes
|
||||
* @return WHERE clause
|
||||
*/
|
||||
protected abstract String getSQLWhere();
|
||||
|
||||
|
||||
/**
|
||||
* Set Parameters for Query
|
||||
* To be overwritten by concrete classes
|
||||
|
@ -948,7 +925,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
* @param forCount for counting records
|
||||
* @throws SQLException
|
||||
*/
|
||||
protected abstract void setParameters (PreparedStatement pstmt, boolean forCount)
|
||||
protected abstract void setParameters (PreparedStatement pstmt, boolean forCount)
|
||||
throws SQLException;
|
||||
/**
|
||||
* notify to search editor of a value change in the selection info
|
||||
|
@ -1034,7 +1011,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
return m_PO_Window_ID;
|
||||
return m_SO_Window_ID;
|
||||
} // getAD_Window_ID
|
||||
|
||||
|
||||
public void onEvent(Event event)
|
||||
{
|
||||
if (event!=null)
|
||||
|
@ -1085,11 +1062,11 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
else if (event.getTarget() == paging)
|
||||
{
|
||||
int pgNo = paging.getActivePage();
|
||||
if (pageNo != pgNo)
|
||||
if (pageNo != pgNo)
|
||||
{
|
||||
|
||||
|
||||
contentPanel.clearSelection();
|
||||
|
||||
|
||||
pageNo = pgNo;
|
||||
int start = pageNo * PAGE_SIZE;
|
||||
int end = start + PAGE_SIZE;
|
||||
|
@ -1100,7 +1077,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
model.setSorter(this);
|
||||
model.addTableModelListener(this);
|
||||
contentPanel.setData(model, null);
|
||||
|
||||
|
||||
contentPanel.setSelectedIndex(0);
|
||||
}
|
||||
}
|
||||
|
@ -1145,15 +1122,15 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
hideBusyDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void onOk()
|
||||
|
||||
private void onOk()
|
||||
{
|
||||
if (!contentPanel.getChildren().isEmpty() && contentPanel.getSelectedRowKey()!=null)
|
||||
{
|
||||
dispose(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onDoubleClick()
|
||||
{
|
||||
if (isLookup())
|
||||
|
@ -1171,7 +1148,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
{
|
||||
enableButtons();
|
||||
}
|
||||
|
||||
|
||||
public void zoom()
|
||||
{
|
||||
if (listeners != null && listeners.size() > 0)
|
||||
|
@ -1186,7 +1163,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
int AD_Table_ID = MTable.getTable_ID(p_tableName);
|
||||
if (AD_Table_ID <= 0)
|
||||
{
|
||||
if (p_keyColumn.endsWith("_ID"))
|
||||
if (p_keyColumn.endsWith("_ID"))
|
||||
{
|
||||
AD_Table_ID = MTable.getTable_ID(p_keyColumn.substring(0, p_keyColumn.length() - 3));
|
||||
}
|
||||
|
@ -1195,17 +1172,17 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
AEnv.zoom(AD_Table_ID, recordId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addValueChangeListener(ValueChangeListener listener)
|
||||
{
|
||||
if (listener == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
|
||||
public void fireValueChange(ValueChangeEvent event)
|
||||
{
|
||||
for (ValueChangeListener listener : listeners)
|
||||
|
@ -1232,7 +1209,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
else
|
||||
this.detach();
|
||||
} // dispose
|
||||
|
||||
|
||||
public void sort(Comparator cmpr, boolean ascending) {
|
||||
WListItemRenderer.ColumnComparator lsc = (WListItemRenderer.ColumnComparator) cmpr;
|
||||
if (m_useDatabasePaging)
|
||||
|
|
|
@ -58,10 +58,10 @@ import org.zkoss.zul.Vbox;
|
|||
|
||||
/**
|
||||
* Based on InfoPayment written by Jorg Janke
|
||||
*
|
||||
*
|
||||
* @author Niraj Sohun
|
||||
* Aug, 02, 2007
|
||||
*
|
||||
*
|
||||
* Zk Port
|
||||
* @author Elaine
|
||||
* @version InfoPayment.java Adempiere Swing UI 3.4.1
|
||||
|
@ -70,7 +70,7 @@ import org.zkoss.zul.Vbox;
|
|||
public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener, EventListener
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -7346527589727807179L;
|
||||
private Textbox fDocumentNo = new Textbox();
|
||||
|
@ -83,7 +83,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
private Datebox fDateFrom = new Datebox();
|
||||
|
||||
private Checkbox fIsReceipt = new Checkbox();
|
||||
|
||||
|
||||
private Label lDocumentNo = new Label(Msg.translate(Env.getCtx(), "DocumentNo"));
|
||||
private Label lDateFrom = new Label(Msg.translate(Env.getCtx(), "DateTrx"));
|
||||
private Label lDateTo = new Label("-");
|
||||
|
@ -118,22 +118,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
new ColumnInfo(Msg.translate(Env.getCtx(), "IsAllocated"),
|
||||
"p.IsAllocated", Boolean.class)
|
||||
};
|
||||
|
||||
/**
|
||||
* Detail Protected Constructor
|
||||
*
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param value query value
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoPaymentPanel(int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Detail Protected Constructor
|
||||
*
|
||||
|
@ -143,11 +128,26 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
protected InfoPaymentPanel(int WindowNo, String value,
|
||||
public InfoPaymentPanel(int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
{
|
||||
this(WindowNo, value, multiSelection, whereClause, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detail Protected Constructor
|
||||
*
|
||||
* @param modal modal
|
||||
* @param WindowNo window no
|
||||
* @param value query value
|
||||
* @param multiSelection multiple selections
|
||||
* @param whereClause where clause
|
||||
*/
|
||||
public InfoPaymentPanel(int WindowNo, String value,
|
||||
boolean multiSelection, String whereClause, boolean lookup)
|
||||
{
|
||||
super(WindowNo, "p", "C_Payment_ID", multiSelection, whereClause, lookup);
|
||||
|
||||
|
||||
log.info( "InfoPaymentPanel");
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoPayment"));
|
||||
|
||||
|
@ -162,10 +162,10 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
}
|
||||
|
||||
int no = contentPanel.getRowCount();
|
||||
|
||||
|
||||
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
|
||||
setStatusDB(Integer.toString(no));
|
||||
|
||||
|
||||
if (value != null && value.length() > 0)
|
||||
{
|
||||
fDocumentNo .setValue(value);
|
||||
|
@ -177,7 +177,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
* Static Setup - add fields to parameterPanel
|
||||
* @throws Exception if Lookups cannot be created
|
||||
*/
|
||||
|
||||
|
||||
private void statInit() throws Exception
|
||||
{
|
||||
fDocumentNo.setWidth("100%");
|
||||
|
@ -185,23 +185,23 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
fDateTo.setWidth("165px");
|
||||
fAmtFrom.setWidth("180px");
|
||||
fAmtTo.setWidth("180px");
|
||||
|
||||
|
||||
fDocumentNo.addEventListener(Events.ON_CHANGE, this);
|
||||
|
||||
|
||||
fIsReceipt.setLabel(Msg.translate(Env.getCtx(), "IsReceipt"));
|
||||
fIsReceipt.addEventListener(Events.ON_CHECK, this);
|
||||
fIsReceipt.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
|
||||
|
||||
fBPartner_ID = new WSearchEditor(
|
||||
MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search),
|
||||
|
||||
fBPartner_ID = new WSearchEditor(
|
||||
MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search),
|
||||
Msg.translate(Env.getCtx(), "C_BPartner_ID"), "", false, false, true);
|
||||
fBPartner_ID.addValueChangeListener(this);
|
||||
|
||||
|
||||
Grid grid = GridFactory.newGridLayout();
|
||||
|
||||
|
||||
Rows rows = new Rows();
|
||||
grid.appendChild(rows);
|
||||
|
||||
|
||||
Row row = new Row();
|
||||
rows.appendChild(row);
|
||||
row.appendChild(lDocumentNo.rightAlign());
|
||||
|
@ -209,7 +209,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
row.appendChild(fBPartner_ID.getLabel().rightAlign());
|
||||
row.appendChild(fBPartner_ID.getComponent());
|
||||
row.appendChild(fIsReceipt);
|
||||
|
||||
|
||||
row = new Row();
|
||||
row.setSpans("3, 2");
|
||||
rows.appendChild(row);
|
||||
|
@ -219,7 +219,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
hbox.appendChild(lDateTo);
|
||||
hbox.appendChild(fDateTo);
|
||||
row.appendChild(hbox);
|
||||
|
||||
|
||||
row = new Row();
|
||||
row.setSpans("3, 2");
|
||||
rows.appendChild(row);
|
||||
|
@ -229,7 +229,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
hbox.appendChild(lAmtTo);
|
||||
hbox.appendChild(fAmtTo);
|
||||
row.appendChild(hbox);
|
||||
|
||||
|
||||
layout = new Borderlayout();
|
||||
layout.setWidth("100%");
|
||||
layout.setHeight("100%");
|
||||
|
@ -255,7 +255,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
contentPanel.setVflex(true);
|
||||
div.setStyle("width :100%; height: 100%");
|
||||
center.appendChild(div);
|
||||
|
||||
|
||||
South south = new South();
|
||||
layout.appendChild(south);
|
||||
southBody = new Vbox();
|
||||
|
@ -265,43 +265,43 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
southBody.appendChild(new Separator());
|
||||
southBody.appendChild(statusBar);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* General Init
|
||||
* @return true, if success
|
||||
*/
|
||||
|
||||
|
||||
private boolean initInfo ()
|
||||
{
|
||||
// Set Defaults
|
||||
String bp = Env.getContext(Env.getCtx(), p_WindowNo, "C_BPartner_ID");
|
||||
|
||||
|
||||
if (bp != null && bp.length() != 0)
|
||||
fBPartner_ID.setValue(new Integer(bp));
|
||||
|
||||
// Prepare table
|
||||
StringBuffer where = new StringBuffer("p.IsActive='Y'");
|
||||
|
||||
|
||||
if (p_whereClause.length() > 0)
|
||||
where.append(" AND ").append(Util.replace(p_whereClause, "C_Payment.", "p."));
|
||||
|
||||
|
||||
prepareTable(s_paymentLayout, " C_Payment_v p", where.toString(), "2,3,4");
|
||||
|
||||
|
||||
return true;
|
||||
} // initInfo
|
||||
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Construct SQL Where Clause and define parameters
|
||||
* (setParameters needs to set parameters)
|
||||
* Includes first AND
|
||||
* @return sql where clause
|
||||
*/
|
||||
|
||||
|
||||
protected String getSQLWhere()
|
||||
{
|
||||
StringBuffer sql = new StringBuffer();
|
||||
|
||||
|
||||
if (fDocumentNo.getText().length() > 0)
|
||||
sql.append(" AND UPPER(p.DocumentNo) LIKE ?");
|
||||
|
||||
|
@ -312,7 +312,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
{
|
||||
Date f = fDateFrom.getValue();
|
||||
Timestamp from = new Timestamp(f.getTime());
|
||||
|
||||
|
||||
Date t = fDateTo.getValue();
|
||||
Timestamp to = new Timestamp(t.getTime());
|
||||
|
||||
|
@ -328,7 +328,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
{
|
||||
BigDecimal from = new BigDecimal(fAmtFrom.getValue());
|
||||
BigDecimal to = new BigDecimal(fAmtTo.getValue());
|
||||
|
||||
|
||||
if (from == null && to != null)
|
||||
sql.append(" AND p.PayAmt <= ?");
|
||||
else if (from != null && to == null)
|
||||
|
@ -336,7 +336,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
else if (from != null && to != null)
|
||||
sql.append(" AND p.PayAmt BETWEEN ? AND ?");
|
||||
}
|
||||
|
||||
|
||||
sql.append(" AND p.IsReceipt=?");
|
||||
|
||||
log.fine(sql.toString());
|
||||
|
@ -350,11 +350,11 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
* @param forCount for counting records
|
||||
* @throws SQLException
|
||||
*/
|
||||
|
||||
|
||||
protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
|
||||
{
|
||||
int index = 1;
|
||||
|
||||
|
||||
if (fDocumentNo.getText().length() > 0)
|
||||
pstmt.setString(index++, getSQLText(fDocumentNo));
|
||||
|
||||
|
@ -369,12 +369,12 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
{
|
||||
Date f = fDateFrom.getValue();
|
||||
Timestamp from = new Timestamp(f.getTime());
|
||||
|
||||
|
||||
Date t = fDateTo.getValue();
|
||||
Timestamp to = new Timestamp(t.getTime());
|
||||
|
||||
|
||||
log.fine("Date From=" + from + ", To=" + to);
|
||||
|
||||
|
||||
if (from == null && to != null)
|
||||
pstmt.setTimestamp(index++, to);
|
||||
else if (from != null && to == null)
|
||||
|
@ -391,7 +391,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
BigDecimal from = new BigDecimal(fAmtFrom.getValue());
|
||||
BigDecimal to = new BigDecimal(fAmtTo.getValue());
|
||||
log.fine("Amt From=" + from + ", To=" + to);
|
||||
|
||||
|
||||
if (from == null && to != null)
|
||||
pstmt.setBigDecimal(index++, to);
|
||||
else if (from != null && to == null)
|
||||
|
@ -402,7 +402,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
pstmt.setBigDecimal(index++, to);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pstmt.setString(index++, fIsReceipt.isChecked() ? "Y" : "N");
|
||||
} // setParameters
|
||||
|
||||
|
@ -411,16 +411,16 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
* @param f field
|
||||
* @return Upper case text with % at the end
|
||||
*/
|
||||
|
||||
|
||||
private String getSQLText (Textbox f)
|
||||
{
|
||||
String s = f.getText().toUpperCase();
|
||||
|
||||
|
||||
if (!s.endsWith("%"))
|
||||
s += "%";
|
||||
|
||||
|
||||
log.fine( "String=" + s);
|
||||
|
||||
|
||||
return s;
|
||||
} // getSQLText
|
||||
|
||||
|
@ -441,17 +441,17 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
AEnv.zoom (AD_WindowNo, query);
|
||||
} // zoom
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* Has Zoom
|
||||
* @return true
|
||||
*/
|
||||
|
||||
|
||||
protected boolean hasZoom()
|
||||
{
|
||||
return true;
|
||||
} // hasZoom
|
||||
|
||||
|
||||
public void valueChange(ValueChangeEvent evt)
|
||||
{
|
||||
if (fBPartner_ID.equals(evt.getSource()))
|
||||
|
@ -463,7 +463,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
|
|||
public void tableChanged(WTableModelEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void insertPagingComponent()
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="org.adempiere.webui.Form" name="Web Form" schema="schema/org.adempiere.webui.Form.exsd"/>
|
||||
<extension-point id="org.adempiere.webui.factory.IInfoFactory" name="Info Factory extension" schema="schema/org.adempiere.webui.factory.IInfoFactory.exsd"/>
|
||||
<extension
|
||||
point="org.compiere.print.ReportViewerProvider">
|
||||
<provider
|
||||
|
@ -26,5 +27,14 @@
|
|||
class="org.compiere.interfaces.impl.StatusBean">
|
||||
</interface>
|
||||
</extension>
|
||||
<extension
|
||||
id="org.adempiere.webui.factory.DefaultInfoFactory"
|
||||
name="Default Info Factory"
|
||||
point="org.adempiere.webui.factory.IInfoFactory">
|
||||
<factory
|
||||
class="org.adempiere.webui.factory.DefaultInfoFactory"
|
||||
priority="0">
|
||||
</factory>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.ui.zk" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.ui.zk" id="org.adempiere.webui.factory.IInfoFactory" name="Info Factory extension"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="factory"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="factory">
|
||||
<complexType>
|
||||
<attribute name="priority" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
numeric priority value. bigger number have higher priority.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.adempiere.webui.factory.IInfoFactory"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter the first release in which this extension point appears.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter extension point usage example here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter API information here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter information about supplied implementation of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
|
||||
</schema>
|
Loading…
Reference in New Issue