Apply Swing client 3.4 to 3.5 changes

This commit is contained in:
Heng Sin Low 2008-12-16 08:22:09 +00:00
parent 64b6ffee38
commit 7a75e02680
16 changed files with 1617 additions and 826 deletions

View File

@ -15,7 +15,6 @@ package org.adempiere.webui.component;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Timebox; import org.zkoss.zul.Timebox;
@ -127,4 +126,20 @@ public class DatetimeBox extends Panel {
public void setDateFormat(SimpleDateFormat dateFormat) { public void setDateFormat(SimpleDateFormat dateFormat) {
dateBox.setFormat(dateFormat.toPattern()); dateBox.setFormat(dateFormat.toPattern());
} }
/**
* @return dateBox
*/
public Datebox getDatebox()
{
return dateBox;
}
/**
* @return timeBox
*/
public Timebox getTimebox()
{
return timeBox;
}
} }

View File

@ -408,4 +408,13 @@ public class NumberBox extends Div
{ {
decimalBox.focus(); decimalBox.focus();
} }
/**
*
* @return decimalBox
*/
public Decimalbox getDecimalbox()
{
return decimalBox;
}
} }

View File

@ -21,9 +21,13 @@ import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.VerticalBox;
import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WSearchEditor; import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeEvent;
@ -32,12 +36,12 @@ import org.adempiere.webui.event.WTableModelEvent;
import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn; import org.compiere.minigrid.IDColumn;
import org.compiere.model.MLookupFactory; import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Separator; import org.zkoss.zul.Separator;
/** /**
@ -45,6 +49,10 @@ import org.zkoss.zul.Separator;
* *
* @author Niraj Sohun * @author Niraj Sohun
* Aug, 02, 2007 * Aug, 02, 2007
*
* Zk Port
* @author Elaine
* @version InfoAsset.java Adempiere Swing UI 3.4.1
*/ */
public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, EventListener public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, EventListener
@ -105,16 +113,10 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev
setStatusDB(Integer.toString(no)); setStatusDB(Integer.toString(no));
// AutoQuery // AutoQuery
if (value != null && value.length() > 0) if (value != null && value.length() > 0)
executeQuery(); executeQuery();
p_loadedOK = true; p_loadedOK = true;
// Focus
// fieldValue.requestFocus();
//AEnv.positionCenterWindow(frame, this);
} // InfoProduct } // InfoProduct
/** /**
@ -123,73 +125,52 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev
private void statInit() private void statInit()
{ {
Hbox boxValue = new Hbox(); fieldValue.setWidth("100%");
fieldName.setWidth("100%");
labelValue.setValue(Msg.getMsg(Env.getCtx(), "Value")); labelValue.setValue(Msg.getMsg(Env.getCtx(), "Value"));
fieldValue.addEventListener(Events.ON_CHANGE, this); fieldValue.addEventListener(Events.ON_CHANGE, this);
boxValue.setWidth("100%");
boxValue.setWidths("40%, 60%");
boxValue.appendChild(labelValue);
boxValue.appendChild(fieldValue);
Hbox boxName = new Hbox();
labelName.setValue(Msg.getMsg(Env.getCtx(), "Name")); labelName.setValue(Msg.getMsg(Env.getCtx(), "Name"));
fieldName.addEventListener(Events.ON_CANCEL, this); fieldName.addEventListener(Events.ON_CANCEL, this);
// From A_Asset.
boxName.setWidth("100%");
boxName.setWidths("40%, 60%");
boxName.appendChild(labelName);
boxName.appendChild(fieldName);
// From A_Asset.
Hbox boxBPartner = new Hbox();
fBPartner_ID = new WSearchEditor( fBPartner_ID = new WSearchEditor(
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 8065, DisplayType.Search), MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 8065, DisplayType.Search),
Msg.translate(Env.getCtx(), "C_BPartner_ID"), "", false, false, true); Msg.translate(Env.getCtx(), "C_BPartner_ID"), "", false, false, true);
fBPartner_ID.addValueChangeListener(this); fBPartner_ID.addValueChangeListener(this);
boxBPartner.setWidth("100%");
boxBPartner.setWidths("40%, ");
boxBPartner.appendChild(fBPartner_ID.getLabel());
boxBPartner.appendChild(fBPartner_ID.getComponent());
Hbox boxProduct = new Hbox();
fProduct_ID = new WSearchEditor( fProduct_ID = new WSearchEditor(
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 8047, DisplayType.Search), MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 8047, DisplayType.Search),
Msg.translate(Env.getCtx(), "M_Product_ID"), "", false, false, true); Msg.translate(Env.getCtx(), "M_Product_ID"), "", false, false, true);
fProduct_ID.addValueChangeListener(this); fProduct_ID.addValueChangeListener(this);
boxProduct.appendChild(fProduct_ID.getLabel()); Grid grid = GridFactory.newGridLayout();
boxProduct.appendChild(fProduct_ID.getComponent());
VerticalBox boxCol1 = new VerticalBox(); Rows rows = new Rows();
boxCol1.appendChild(boxValue); grid.appendChild(rows);
boxCol1.appendChild(new Separator());
boxCol1.appendChild(boxName);
VerticalBox boxCol2 = new VerticalBox(); Row row = new Row();
boxCol2.appendChild(boxBPartner); rows.appendChild(row);
boxCol2.appendChild(new Separator()); row.appendChild(labelValue.rightAlign());
boxCol2.appendChild(boxProduct); row.appendChild(fieldValue);
row.appendChild(fBPartner_ID.getLabel().rightAlign());
row.appendChild(fBPartner_ID.getComponent());
Hbox mainBox = new Hbox(); row = new Row();
mainBox.setWidth("100%"); rows.appendChild(row);
mainBox.setWidths("30%, 70%"); row.appendChild(labelName.rightAlign());
mainBox.appendChild(boxCol1); row.appendChild(fieldName);
mainBox.appendChild(boxCol2); row.appendChild(fProduct_ID.getLabel().rightAlign());
row.appendChild(fProduct_ID.getComponent());
contentPanel.setWidth("99%");
contentPanel.setHeight("400px");
contentPanel.setVflex(true);
this.setWidth("850px"); this.setWidth("850px");
// this.setTitle("Info Asset");
this.setClosable(true); this.setClosable(true);
this.setBorder("normal"); this.setBorder("normal");
this.appendChild(mainBox); this.appendChild(grid);
this.appendChild(new Separator()); this.appendChild(new Separator());
this.appendChild(contentPanel); this.appendChild(contentPanel);
this.appendChild(new Separator()); this.appendChild(new Separator());
@ -207,7 +188,6 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev
private void initInfo (String value, int A_Asset_ID, String whereClause) private void initInfo (String value, int A_Asset_ID, String whereClause)
{ {
// Create Grid // Create Grid
StringBuffer where = new StringBuffer(); StringBuffer where = new StringBuffer();
where.append("a.IsActive='Y'"); where.append("a.IsActive='Y'");
@ -217,7 +197,6 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev
prepareTable(s_assetLayout, s_assetFROM, where.toString(), "a.Value"); prepareTable(s_assetLayout, s_assetFROM, where.toString(), "a.Value");
// Set Value // Set Value
if (value == null) if (value == null)
value = "%"; value = "%";
@ -352,11 +331,11 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev
return false; return false;
} // hasHistory } // hasHistory
// Elaine 2008/12/16
/** /**
* Zoom * Zoom
*/ */
public void zoom()
/* public void zoom()
{ {
log.info( "InfoAsset.zoom"); log.info( "InfoAsset.zoom");
Integer A_Asset_ID = getSelectedRowKey(); Integer A_Asset_ID = getSelectedRowKey();
@ -369,9 +348,10 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev
query.setRecordCount(1); query.setRecordCount(1);
int AD_WindowNo = getAD_Window_ID("A_Asset", true); int AD_WindowNo = getAD_Window_ID("A_Asset", true);
super.zoom (AD_WindowNo, query); AEnv.zoom(AD_WindowNo, query);
} // zoom } // zoom
*/ //
/** /**
* Has Zoom * Has Zoom
* @return true * @return true

View File

@ -26,8 +26,11 @@ import java.util.logging.Level;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Datebox; import org.adempiere.webui.component.Datebox;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.VerticalBox; import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WSearchEditor; import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeEvent;
@ -44,7 +47,7 @@ import org.compiere.util.Msg;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Hbox; import org.zkoss.zul.Div;
import org.zkoss.zul.Separator; import org.zkoss.zul.Separator;
/** /**
@ -52,6 +55,10 @@ import org.zkoss.zul.Separator;
* *
* @author Niraj Sohun * @author Niraj Sohun
* Aug 06, 2007 * Aug 06, 2007
*
* Zk Port
* @author Elaine
* @version InfoAssignment.java Adempiere Swing UI 3.4.1
*/ */
public class InfoAssignmentPanel extends InfoPanel implements EventListener, ValueChangeListener public class InfoAssignmentPanel extends InfoPanel implements EventListener, ValueChangeListener
@ -115,14 +122,8 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val
int no = contentPanel.getRowCount(); int no = contentPanel.getRowCount();
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false); setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
setStatusDB(Integer.toString(no)); setStatusDB(Integer.toString(no));
// AutoQuery
// if (value != null && value.length() > 0)
// executeQuery();
p_loadedOK = true; p_loadedOK = true;
//AEnv.positionCenterWindow(frame, this);
} // InfoAssignmentPanel } // InfoAssignmentPanel
/** /**
@ -166,44 +167,46 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val
private void statInit() private void statInit()
{ {
VerticalBox boxResourceType = new VerticalBox(); fieldFrom.setWidth("180px");
boxResourceType.appendChild(fieldResourceType.getLabel()); fieldTo.setWidth("180px");
boxResourceType.appendChild(fieldResourceType.getComponent());
VerticalBox boxResource = new VerticalBox();
boxResource.appendChild(fieldResource.getLabel());
boxResource.appendChild(fieldResource.getComponent());
VerticalBox boxFrom = new VerticalBox();
boxFrom.appendChild(labelFrom);
boxFrom.appendChild(fieldFrom);
VerticalBox boxTo = new VerticalBox();
boxTo.appendChild(labelTo);
boxTo.appendChild(fieldTo);
// parameterPanel.add(labelPhone, null);
// parameterPanel.add(checkFuzzy, null);
Hbox mainBox = new Hbox();
bNew.addEventListener(Events.ON_CLICK, this); bNew.addEventListener(Events.ON_CLICK, this);
mainBox.setWidth("100%"); Grid grid = GridFactory.newGridLayout();
mainBox.setWidths("30%, 30%, 17%, 17%, 6%");
mainBox.appendChild(boxResourceType);
mainBox.appendChild(boxResource);
mainBox.appendChild(boxFrom);
mainBox.appendChild(boxTo);
mainBox.appendChild(bNew);
// parameterPanel.add(checkCustomer, null); Rows rows = new Rows();
grid.appendChild(rows);
Row row = new Row();
rows.appendChild(row);
row.appendChild(fieldResourceType.getLabel().rightAlign());
row.appendChild(fieldResource.getLabel().rightAlign());
row.appendChild(labelFrom.rightAlign());
row.appendChild(labelTo.rightAlign());
row.appendChild(new Label());
row = new Row();
rows.appendChild(row);
row.appendChild(fieldResourceType.getComponent());
row.appendChild(fieldResource.getComponent());
Div div = new Div();
div.setAlign("right");
div.appendChild(fieldFrom);
row.appendChild(div);
div = new Div();
div.setAlign("right");
div.appendChild(fieldTo);
row.appendChild(div);
row.appendChild(bNew);
contentPanel.setWidth("99%");
contentPanel.setHeight("400px");
contentPanel.setVflex(true);
this.setWidth("850px"); this.setWidth("850px");
// this.setTitle("Info Asset");
this.setClosable(true); this.setClosable(true);
this.setBorder("normal"); this.setBorder("normal");
this.appendChild(mainBox); this.appendChild(grid);
this.appendChild(new Separator()); this.appendChild(new Separator());
this.appendChild(contentPanel); this.appendChild(contentPanel);
this.appendChild(new Separator()); this.appendChild(new Separator());

View File

@ -22,30 +22,36 @@ import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.WListbox;
import org.adempiere.webui.event.WTableModelEvent; import org.adempiere.webui.event.WTableModelEvent;
import org.adempiere.webui.event.WTableModelListener; import org.adempiere.webui.event.WTableModelListener;
import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn; import org.compiere.minigrid.IDColumn;
import org.compiere.model.MQuery;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Intbox; import org.zkoss.zul.Intbox;
import org.zkoss.zul.Separator; import org.zkoss.zul.Separator;
import org.zkoss.zul.Vbox;
/** /**
* Search Business Partner and return selection * Search Business Partner and return selection
* Based on InfoBPartner written by Jorg Janke * Based on InfoBPartner written by Jorg Janke
* @author Sendy Yagambrum * @author Sendy Yagambrum
*
* Zk Port
* @author Elaine
* @version InfoBPartner.java Adempiere Swing UI 3.4.1
*/ */
@ -69,7 +75,8 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl
private Checkbox checkAND ; private Checkbox checkAND ;
private Checkbox checkCustomer; private Checkbox checkCustomer;
private Checkbox checkVendor; private Checkbox checkVendor;
private int m_AD_User_ID_index = -1; // Elaine 2008/12/16
private int m_C_BPartner_Location_ID_index = -1; private int m_C_BPartner_Location_ID_index = -1;
/** SalesOrder Trx */ /** SalesOrder Trx */
@ -109,14 +116,13 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl
* @param whereClause where clause * @param whereClause where clause
*/ */
public InfoBPartnerPanel(String queryValue,int windowNo, boolean isSOTrx,boolean multipleSelection, String whereClause) public InfoBPartnerPanel(String queryValue,int windowNo, boolean isSOTrx,boolean multipleSelection, String whereClause)
{ {
super (windowNo, "C_BPartner", "C_BPartner_ID",multipleSelection, whereClause); super (windowNo, "C_BPartner", "C_BPartner_ID",multipleSelection, whereClause);
setTitle(Msg.getMsg(Env.getCtx(), "InfoBPartner"));
m_isSOTrx = isSOTrx; m_isSOTrx = isSOTrx;
initComponents(); initComponents();
init(); init();
initInfo(queryValue, whereClause); initInfo(queryValue, whereClause);
setTitle(Msg.getMsg(Env.getCtx(), "InfoBPartner"));
int no = contentPanel.getRowCount(); int no = contentPanel.getRowCount();
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false); setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
@ -160,16 +166,18 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl
fieldPhone.setMaxlength(40); fieldPhone.setMaxlength(40);
checkAND = new Checkbox(); checkAND = new Checkbox();
checkAND.addEventListener(Events.ON_CHECK, this); checkAND.setLabel(Msg.getMsg(Env.getCtx(), "SearchAND"));
checkAND.setChecked(true); checkAND.setChecked(true);
checkAND.addEventListener(Events.ON_CHECK, this);
checkCustomer = new Checkbox(); checkCustomer = new Checkbox();
checkCustomer.setLabel(Msg.getMsg(Env.getCtx(), "OnlyCustomers"));
checkCustomer.setChecked(true); checkCustomer.setChecked(true);
checkCustomer.addEventListener(Events.ON_CHECK, this); checkCustomer.addEventListener(Events.ON_CHECK, this);
checkVendor = new Checkbox(); checkVendor = new Checkbox();
checkVendor.setChecked(true); checkVendor.setChecked(true);
checkVendor.setLabel(Msg.getMsg(Env.getCtx(), "OnlyVendors"));
checkVendor.addEventListener(Events.ON_CHECK, this); checkVendor.addEventListener(Events.ON_CHECK, this);
contentPanel = new WListbox();
contentPanel.setWidth("99%"); contentPanel.setWidth("99%");
contentPanel.setHeight("400px"); contentPanel.setHeight("400px");
contentPanel.setVflex(true); contentPanel.setVflex(true);
@ -177,101 +185,48 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl
private void init() private void init()
{ {
fieldValue.setWidth("100%");
fieldContact.setWidth("100%");
fieldPhone.setWidth("100%");
Panel pnlValue = new Panel(); fieldName.setWidth("100%");
pnlValue.appendChild(lblValue); fieldEMail.setWidth("100%");
pnlValue.appendChild(fieldValue); fieldPostal.setWidth("100%");
pnlValue.setAlign("right");
Panel pnlName = new Panel(); Grid grid = GridFactory.newGridLayout();
pnlName.appendChild(lblName);
pnlName.appendChild(fieldName);
pnlName.setAlign("right");
Panel pnlContact = new Panel(); Rows rows = new Rows();
pnlContact.appendChild(lblContact); grid.appendChild(rows);
pnlContact.appendChild(fieldContact);
pnlContact.setAlign("right");
Panel pnlEMail = new Panel(); Row row = new Row();
pnlEMail.appendChild(lblEMail); rows.appendChild(row);
pnlEMail.appendChild(fieldEMail); row.appendChild(lblValue.rightAlign());
pnlEMail.setAlign("right"); row.appendChild(fieldValue);
row.appendChild(lblContact.rightAlign());
row.appendChild(fieldContact);
row.appendChild(lblPhone.rightAlign());
row.appendChild(fieldPhone);
row.appendChild(m_isSOTrx ? checkCustomer : checkVendor);
Panel pnlPostal = new Panel(); row = new Row();
pnlPostal.appendChild(lblPostal); rows.appendChild(row);
pnlPostal.appendChild(fieldPostal); row.appendChild(lblName.rightAlign());
pnlPostal.setAlign("right"); row.appendChild(fieldName);
row.appendChild(lblEMail.rightAlign());
Panel pnlPhone = new Panel(); row.appendChild(fieldEMail);
pnlPhone.appendChild(lblPhone); row.appendChild(lblPostal.rightAlign());
pnlPhone.appendChild(fieldPhone); row.appendChild(fieldPostal);
pnlPhone.setAlign("right"); row.appendChild(checkAND);
Panel pnlCheckAND = new Panel();
Label lblAND = new Label();
lblAND.setValue("All/Any");
pnlCheckAND.appendChild(checkAND);
pnlCheckAND.appendChild(lblAND);
pnlCheckAND.setAlign("left");
Panel pnlCheckCust = new Panel();
Label lblCheckCust = new Label();
lblCheckCust.setValue("Customers Only");
pnlCheckCust.appendChild(checkCustomer);
pnlCheckCust.appendChild(lblCheckCust);
pnlCheckCust.setAlign("right");
Panel pnlCheckVendor = new Panel();
Label lblCheckVendor = new Label();
lblCheckVendor.setValue("Vendors Only");
pnlCheckVendor.appendChild(checkVendor);
pnlCheckVendor.appendChild(lblCheckVendor);
pnlCheckVendor.setAlign("right");
Vbox vbox1 = new Vbox();
vbox1.appendChild(pnlValue);
vbox1.appendChild(pnlName);
Vbox vbox2 = new Vbox();
vbox2.appendChild(pnlContact);
vbox2.appendChild(pnlEMail);
Vbox vbox3 = new Vbox();
vbox3.appendChild(pnlPostal);
vbox3.appendChild(pnlPhone);
Vbox vbox4 = new Vbox();
vbox4.appendChild(pnlCheckAND);
if (m_isSOTrx)
{
vbox4.appendChild(pnlCheckCust);
}
else
{
vbox4.appendChild(pnlCheckVendor);
}
Hbox parameterPanel = new Hbox();
parameterPanel.appendChild(vbox1);
parameterPanel.appendChild(vbox2);
parameterPanel.appendChild(vbox3);
parameterPanel.appendChild(vbox4);
Panel mainPanel = new Panel();
mainPanel.appendChild(parameterPanel);
mainPanel.setWidth("100%"); this.appendChild(grid);
mainPanel.appendChild(new Separator()); this.appendChild(new Separator());
mainPanel.appendChild(contentPanel); this.appendChild(contentPanel);
mainPanel.appendChild(new Separator()); this.appendChild(new Separator());
mainPanel.appendChild(confirmPanel); this.appendChild(confirmPanel);
mainPanel.appendChild(new Separator()); this.appendChild(new Separator());
mainPanel.appendChild(statusBar); this.appendChild(statusBar);
this.appendChild(mainPanel);
this.setClosable(true);
this.setBorder("normal"); this.setBorder("normal");
this.setWidth("1000px"); this.setWidth("1000px");
@ -301,9 +256,13 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl
prepareTable(s_partnerLayout, s_partnerFROM, where.toString(), "C_BPartner.Value"); prepareTable(s_partnerLayout, s_partnerFROM, where.toString(), "C_BPartner.Value");
// Get indexes // Get indexes
for (int i = 0; i < p_layout.length; i++) for (int i = 0; i < p_layout.length; i++)
{ {
// Elaine 2008/12/16
if (p_layout[i].getKeyPairColSQL().indexOf("AD_User_ID") != -1)
m_AD_User_ID_index = i;
//
if (p_layout[i].getKeyPairColSQL().indexOf("C_BPartner_Location_ID") != -1) if (p_layout[i].getKeyPairColSQL().indexOf("C_BPartner_Location_ID") != -1)
m_C_BPartner_Location_ID_index = i; m_C_BPartner_Location_ID_index = i;
} }
@ -478,10 +437,15 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl
int AD_User_ID = 0; int AD_User_ID = 0;
int C_BPartner_Location_ID = 0; int C_BPartner_Location_ID = 0;
AD_User_ID = ((KeyNamePair)contentPanel.getValueAt(row, 3)).getKey(); // Elaine 2008/12/16
if (m_AD_User_ID_index != -1)
{
Object data =contentPanel.getValueAt(row, m_AD_User_ID_index);
if (data instanceof KeyNamePair)
AD_User_ID = ((KeyNamePair)data).getKey();
}
//
if (m_C_BPartner_Location_ID_index != -1) if (m_C_BPartner_Location_ID_index != -1)
{ {
Object data =contentPanel.getValueAt(row, m_C_BPartner_Location_ID_index); Object data =contentPanel.getValueAt(row, m_C_BPartner_Location_ID_index);
@ -495,7 +459,77 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_BPartner_Location_ID", String.valueOf(C_BPartner_Location_ID)); Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_BPartner_Location_ID", String.valueOf(C_BPartner_Location_ID));
} // saveSelectionDetail } // saveSelectionDetail
// Elaine 2008/12/16
/**************************************************************************
* Show History
*/
protected void showHistory()
{
log.info("");
Integer C_BPartner_ID = getSelectedRowKey();
if (C_BPartner_ID == null)
return;
InvoiceHistory ih = new InvoiceHistory (this, C_BPartner_ID.intValue(),
0, 0, 0);
ih.setVisible(true);
ih = null;
} // showHistory
/**
* Has History
* @return true
*/
protected boolean hasHistory()
{
return true;
} // hasHistory
/**
* Zoom
*/
public void zoom()
{
log.info( "InfoBPartner.zoom");
Integer C_BPartner_ID = getSelectedRowKey();
if (C_BPartner_ID == null)
return;
// AEnv.zoom(MBPartner.Table_ID, C_BPartner_ID.intValue(), true); // SO
MQuery query = new MQuery("C_BPartner");
query.addRestriction("C_BPartner_ID", MQuery.EQUAL, C_BPartner_ID);
query.setRecordCount(1);
int AD_WindowNo = getAD_Window_ID("C_BPartner", true); // SO
AEnv.zoom (AD_WindowNo, query);
} // zoom
/**
* Has Zoom
* @return true
*/
protected boolean hasZoom()
{
return true;
} // hasZoom
/**
* Customize
*/
protected void customize()
{
log.info( "InfoBPartner.customize");
} // customize
/**
* Has Customize
* @return false
*/
protected boolean hasCustomize()
{
return false; // for now
} // hasCustomize
//
public void tableChanged(WTableModelEvent event) public void tableChanged(WTableModelEvent event)
{ {

View File

@ -21,14 +21,16 @@ import java.math.BigDecimal;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Datebox; import org.adempiere.webui.component.Datebox;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.VerticalBox;
import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WSearchEditor; import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeEvent;
@ -52,21 +54,16 @@ import org.zkoss.zul.Separator;
* *
* @author Niraj Sohun * @author Niraj Sohun
* Aug 03, 2007 * Aug 03, 2007
*
* Zk Port
* @author Elaine
* @version InfoCashLine.java Adempiere Swing UI 3.4.1
*/ */
public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener, EventListener public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener, EventListener
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** list of query columns */
private ArrayList m_queryColumns = new ArrayList();
/** Table Name */
private String m_tableName;
/** Key Column Name */
private String m_keyColumn;
private Textbox fName = new Textbox(); private Textbox fName = new Textbox();
private Textbox fAmtTo = new Textbox(); private Textbox fAmtTo = new Textbox();
private Textbox fAmtFrom = new Textbox(); private Textbox fAmtFrom = new Textbox();
@ -97,8 +94,6 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
"c.StatementDate", Timestamp.class), "c.StatementDate", Timestamp.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "Line"), new ColumnInfo(Msg.translate(Env.getCtx(), "Line"),
"cl.Line", Integer.class), "cl.Line", Integer.class),
// new ColumnInfo(Msg.translate(Env.getCtx(), "C_Currency_ID"),
// "(SELECT ISO_Code FROM C_Currency c WHERE c.C_Currency_ID=cl.C_Currency_ID)", String.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "Amount"), new ColumnInfo(Msg.translate(Env.getCtx(), "Amount"),
"cl.Amount", BigDecimal.class, true, true, null), "cl.Amount", BigDecimal.class, true, true, null),
new ColumnInfo(Msg.translate(Env.getCtx(), "C_Invoice_ID"), new ColumnInfo(Msg.translate(Env.getCtx(), "C_Invoice_ID"),
@ -152,11 +147,6 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
fName .setValue(value); fName .setValue(value);
executeQuery(); executeQuery();
} }
//pack();
// Focus
// fName.requestFocus();
} // InfoCashLinePanel } // InfoCashLinePanel
/** /**
@ -166,120 +156,83 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
private void statInit() throws Exception private void statInit() throws Exception
{ {
Hbox boxName = new Hbox(); fName.setWidth("180px");
fDateFrom.setWidth("165px");
fDateTo.setWidth("165px");
fAmtFrom.setWidth("180px");
fAmtTo.setWidth("180px");
fName.addEventListener(Events.ON_CHANGE, this); fName.addEventListener(Events.ON_CHANGE, this);
boxName.setWidth("100%"); // 5249 - C_Cash.C_CashBook_ID
boxName.setWidths("40%, 60%");
boxName.appendChild(lName );
boxName.appendChild(fName);
// fOrg_ID = new VLookup("AD_Org_ID", false, false, true,
// MLookupFactory.create(Env.getCtx(), 3486, m_WindowNo, DisplayType.TableDir, false),
// DisplayType.TableDir, m_WindowNo);
// lOrg_ID.setLabelFor(fOrg_ID);
// fOrg_ID.setBackground(AdempierePLAF.getInfoBackground());
// 5249 - C_Cash.C_CashBook_ID
Hbox boxCashBook = new Hbox();
fCashBook_ID = new WSearchEditor( 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); Msg.translate(Env.getCtx(), "C_CashBook_ID"), "", false, false, true);
fCashBook_ID.addValueChangeListener(this); fCashBook_ID.addValueChangeListener(this);
boxCashBook.appendChild(fCashBook_ID.getLabel());
boxCashBook.appendChild(fCashBook_ID.getComponent());
Hbox boxInvoice = new Hbox();
// 5354 - C_CashLine.C_Invoice_ID // 5354 - C_CashLine.C_Invoice_ID
fInvoice_ID = new WSearchEditor( 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); Msg.translate(Env.getCtx(), "C_Invoice_ID"), "", false, false, true);
fInvoice_ID.addValueChangeListener(this); fInvoice_ID.addValueChangeListener(this);
boxInvoice.appendChild(fInvoice_ID.getLabel());
boxInvoice.appendChild(fInvoice_ID.getComponent());
Hbox boxBankAcct = new Hbox();
// 5295 - C_CashLine.C_BankAccount_ID // 5295 - C_CashLine.C_BankAccount_ID
fBankAccount_ID = new WSearchEditor( 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); Msg.translate(Env.getCtx(), "C_BankAccount_ID"), "", false, false, true);
fBankAccount_ID.addValueChangeListener(this); fBankAccount_ID.addValueChangeListener(this);
boxBankAcct.appendChild(fBankAccount_ID.getLabel());
boxBankAcct.appendChild(fBankAccount_ID.getComponent());
// 5296 - C_CashLine.C_Charge_ID // 5296 - C_CashLine.C_Charge_ID
// 5291 - C_CashLine.C_Cash_ID // 5291 - C_CashLine.C_Cash_ID
cbAbsolute.setLabel(Msg.translate(Env.getCtx(), "AbsoluteAmt")); cbAbsolute.setLabel(Msg.translate(Env.getCtx(), "AbsoluteAmt"));
cbAbsolute.addEventListener(Events.ON_CHECK, this); cbAbsolute.addEventListener(Events.ON_CHECK, this);
Hbox boxDateFrom = new Hbox(); Grid grid = GridFactory.newGridLayout();
boxDateFrom.setWidth("100%");
boxDateFrom.setWidths("40%, 60%");
boxDateFrom.appendChild(lDateFrom);
boxDateFrom.appendChild(fDateFrom);
Hbox boxDateTo = new Hbox();
boxDateTo.setWidth("100%");
boxDateTo.setWidths("10%, 90%");
boxDateTo.appendChild(lDateTo);
boxDateTo.appendChild(fDateTo);
Hbox boxAmtFrom = new Hbox();
boxAmtFrom.setWidth("100%");
boxAmtFrom.setWidths("40%, 60%");
boxAmtFrom.appendChild(lAmtFrom);
boxAmtFrom.appendChild(fAmtFrom);
Hbox boxAmtTo = new Hbox();
boxAmtTo.setWidth("100%");
boxAmtTo.setWidths("10%, 90%");
boxAmtTo.appendChild(lAmtTo);
boxAmtTo.appendChild(fAmtTo);
VerticalBox boxCol1 = new VerticalBox();
boxCol1.appendChild(boxCashBook);
boxCol1.appendChild(new Separator());
boxCol1.appendChild(boxInvoice);
boxCol1.appendChild(new Separator());
boxCol1.appendChild(boxBankAcct);
VerticalBox boxCol2 = new VerticalBox(); Rows rows = new Rows();
boxCol2.appendChild(boxName); grid.appendChild(rows);
boxCol2.appendChild(new Separator());
boxCol2.appendChild(boxDateFrom);
boxCol2.appendChild(new Separator());
boxCol2.appendChild(boxAmtFrom);
VerticalBox boxCol3 = new VerticalBox(); Row row = new Row();
boxCol3.appendChild(cbAbsolute); rows.appendChild(row);
boxCol3.appendChild(new Separator()); row.appendChild(fCashBook_ID.getLabel().rightAlign());
boxCol3.appendChild(boxDateTo); row.appendChild(fCashBook_ID.getComponent());
boxCol3.appendChild(new Separator()); row.appendChild(lName.rightAlign());
boxCol3.appendChild(boxAmtTo); row.appendChild(fName);
row.appendChild(cbAbsolute);
// parameterPanel.add(lOrg_ID, null); row = new Row();
// parameterPanel.add(fOrg_ID, null); row.setSpans("1, 1, 1, 2");
rows.appendChild(row);
row.appendChild(fInvoice_ID.getLabel().rightAlign());
row.appendChild(fInvoice_ID.getComponent());
row.appendChild(lDateFrom.rightAlign());
Hbox hbox = new Hbox();
hbox.appendChild(fDateFrom);
hbox.appendChild(lDateTo);
hbox.appendChild(fDateTo);
row.appendChild(hbox);
Hbox mainBox = new Hbox(); row = new Row();
mainBox.setWidth("100%"); row.setSpans("1, 1, 1, 2");
mainBox.setWidths("40%, 50%, 10%"); rows.appendChild(row);
mainBox.appendChild(boxCol1); row.appendChild(fBankAccount_ID.getLabel().rightAlign());
mainBox.appendChild(boxCol2); row.appendChild(fBankAccount_ID.getComponent());
mainBox.appendChild(boxCol3); row.appendChild(lAmtFrom.rightAlign());
hbox = new Hbox();
hbox.appendChild(fAmtFrom);
hbox.appendChild(lAmtTo);
hbox.appendChild(fAmtTo);
row.appendChild(hbox);
contentPanel.setWidth("99%");
contentPanel.setHeight("400px");
contentPanel.setVflex(true);
this.setWidth("850px"); this.setWidth("850px");
// this.setTitle("CashLine Info");
this.setClosable(true); this.setClosable(true);
this.setBorder("normal"); this.setBorder("normal");
this.appendChild(mainBox); this.appendChild(grid);
this.appendChild(new Separator()); this.appendChild(new Separator());
this.appendChild(contentPanel); this.appendChild(contentPanel);
this.appendChild(new Separator()); this.appendChild(new Separator());

View File

@ -25,10 +25,13 @@ import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.WListbox;
import org.adempiere.webui.event.WTableModelEvent; import org.adempiere.webui.event.WTableModelEvent;
import org.adempiere.webui.window.FDialog; import org.adempiere.webui.window.FDialog;
import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.ColumnInfo;
@ -38,9 +41,13 @@ import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Separator; import org.zkoss.zul.Separator;
/**
* Zk Port
* @author Elaine
* @version InfoGeneral.java Adempiere Swing UI 3.4.1
*/
public class InfoGeneralPanel extends InfoPanel implements EventListener public class InfoGeneralPanel extends InfoPanel implements EventListener
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -67,16 +74,26 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
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)
{ {
super(windowNo, tableName, keyColumn, false,whereClause); super(windowNo, tableName, keyColumn, false,whereClause);
//log.info(tableName + " - " + keyColumn + " - " + whereClause);
setTitle(Msg.getMsg(Env.getCtx(), "Info")); setTitle(Msg.getMsg(Env.getCtx(), "Info"));
init(); try
initComponents(); {
init();
p_loadedOK = initInfo (); initComponents();
p_loadedOK = initInfo ();
}
catch (Exception e)
{
return;
}
// Elaine 2008/12/15
int no = contentPanel.getRowCount();
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
setStatusDB(Integer.toString(no));
//
if (queryValue != null && queryValue.length() > 0) if (queryValue != null && queryValue.length() > 0)
{ {
@ -88,34 +105,39 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
private void initComponents() private void initComponents()
{ {
Hbox parameterPanel = new Hbox(); Grid grid = GridFactory.newGridLayout();
parameterPanel.setWidth("100%");
parameterPanel.appendChild(lbl1); Rows rows = new Rows();
parameterPanel.appendChild(txt1); grid.appendChild(rows);
parameterPanel.appendChild(lbl2);
parameterPanel.appendChild(txt2); Row row = new Row();
parameterPanel.appendChild(lbl3); rows.appendChild(row);
parameterPanel.appendChild(txt3); row.appendChild(lbl1.rightAlign());
parameterPanel.appendChild(lbl4); row.appendChild(txt1);
parameterPanel.appendChild(txt4); row.appendChild(lbl2.rightAlign());
row.appendChild(txt2);
row.appendChild(lbl3.rightAlign());
row.appendChild(txt3);
row.appendChild(lbl4.rightAlign());
row.appendChild(txt4);
Panel mainPanel = new Panel(); Panel mainPanel = new Panel();
mainPanel.setWidth("100%"); mainPanel.setWidth("100%");
mainPanel.appendChild(parameterPanel); mainPanel.appendChild(grid);
contentPanel.setWidth("99%");
contentPanel.setHeight("400px");
contentPanel.setVflex(true);
mainPanel.appendChild(new Separator()); mainPanel.appendChild(new Separator());
mainPanel.appendChild(contentPanel); mainPanel.appendChild(contentPanel);
mainPanel.appendChild(new Separator()); mainPanel.appendChild(new Separator());
mainPanel.appendChild(confirmPanel); mainPanel.appendChild(confirmPanel);
// Elaine 2008/12/15
mainPanel.appendChild(new Separator());
mainPanel.appendChild(statusBar);
//
this.appendChild(mainPanel); this.appendChild(mainPanel);
this.setBorder("normal"); this.setClosable(true);
this.setBorder("normal");
this.setWidth("900px"); this.setWidth("900px");
//this.setHeight("500px");
} }
private void init() private void init()
@ -129,9 +151,10 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
lbl2 = new Label(); lbl2 = new Label();
lbl3 = new Label(); lbl3 = new Label();
lbl4 = new Label(); lbl4 = new Label();
contentPanel = new WListbox(); contentPanel.setWidth("99%");
contentPanel.setWidth("100%"); contentPanel.setHeight("400px");
contentPanel.setVflex(true);
} }
private boolean initInfo () private boolean initInfo ()
@ -150,12 +173,10 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
// Set & enable Fields // Set & enable Fields
lbl1.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(0).toString()).substring(1)); lbl1.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(0).toString()).substring(1));
//txt1.addActionListener(this);
if (m_queryColumns.size() > 1) if (m_queryColumns.size() > 1)
{ {
lbl2.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(1).toString())); lbl2.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(1).toString()));
//txt2.addActionListener(this);
} }
else else
{ {
@ -166,7 +187,6 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
if (m_queryColumns.size() > 2) if (m_queryColumns.size() > 2)
{ {
lbl3.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(2).toString())); lbl3.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(2).toString()));
//txt3.addActionListener(this);
} }
else else
{ {
@ -177,7 +197,6 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
if (m_queryColumns.size() > 3) if (m_queryColumns.size() > 3)
{ {
lbl4.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(3).toString())); lbl4.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(3).toString()));
//txt4.addActionListener(this);
} }
else else
{ {
@ -271,7 +290,6 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
+ " INNER JOIN AD_Field f ON (tab.AD_Tab_ID=f.AD_Tab_ID AND f.AD_Column_ID=c.AD_Column_ID) " + " INNER JOIN AD_Field f ON (tab.AD_Tab_ID=f.AD_Tab_ID AND f.AD_Column_ID=c.AD_Column_ID) "
+ "WHERE t.AD_Table_ID=? " + "WHERE t.AD_Table_ID=? "
+ " AND (c.IsKey='Y' OR " + " AND (c.IsKey='Y' OR "
// + " (f.IsDisplayed='Y' AND f.IsEncrypted='N' AND f.ObscureType IS NULL)) "
+ " (f.IsEncrypted='N' AND f.ObscureType IS NULL)) " + " (f.IsEncrypted='N' AND f.ObscureType IS NULL)) "
+ "ORDER BY c.IsKey DESC, f.SeqNo"; + "ORDER BY c.IsKey DESC, f.SeqNo";
@ -313,9 +331,6 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
else if (DisplayType.isDate(displayType)) else if (DisplayType.isDate(displayType))
colClass = Timestamp.class; colClass = Timestamp.class;
// ignore Binary, Button, ID, RowID // ignore Binary, Button, ID, RowID
// else if (displayType == DisplayType.Account)
// else if (displayType == DisplayType.Location)
// else if (displayType == DisplayType.Locator)
else if (displayType == DisplayType.List) else if (displayType == DisplayType.List)
{ {
if (Env.isBaseLanguage(Env.getCtx(), "AD_Ref_List")) if (Env.isBaseLanguage(Env.getCtx(), "AD_Ref_List"))
@ -330,8 +345,6 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
.append("') AS ").append(columnName); .append("') AS ").append(columnName);
colClass = String.class; colClass = String.class;
} }
// else if (displayType == DisplayType.Table)
// else if (displayType == DisplayType.TableDir || displayType == DisplayType.Search)
if (colClass != null) if (colClass != null)
{ {
@ -393,7 +406,6 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
@Override @Override
protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
{ {
int index = 1;
} }
public void tableChanged(WTableModelEvent event) public void tableChanged(WTableModelEvent event)

View File

@ -20,14 +20,17 @@ package org.adempiere.webui.panel;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Datebox; import org.adempiere.webui.component.Datebox;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.VerticalBox;
import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WSearchEditor; import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeEvent;
@ -36,6 +39,7 @@ import org.adempiere.webui.event.WTableModelEvent;
import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn; import org.compiere.minigrid.IDColumn;
import org.compiere.model.MLookupFactory; import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
@ -50,24 +54,16 @@ import org.zkoss.zul.Separator;
* *
* @author Niraj Sohun * @author Niraj Sohun
* Aug 03, 2007 * Aug 03, 2007
*
* Zk Port
* @author Elaine
* @version InfoInOut.java Adempiere Swing UI 3.4.1
*/ */
public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, EventListener public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, EventListener
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** String Array of Column Info */
private ColumnInfo[] m_generalLayout;
/** list of query columns */
private ArrayList m_queryColumns = new ArrayList();
/** Table Name */
private String m_tableName;
/** Key Column Name */
private String m_keyColumn;
private Textbox fDocumentNo = new Textbox(); private Textbox fDocumentNo = new Textbox();
private WEditor fBPartner_ID; private WEditor fBPartner_ID;
@ -133,11 +129,6 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
fDocumentNo.setValue(value); fDocumentNo.setValue(value);
executeQuery(); executeQuery();
} }
//pack();
// Focus
//fDocumentNo.requestFocus();
} // InfoInOutPanel } // InfoInOutPanel
/** /**
@ -147,94 +138,65 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
private void statInit() throws Exception private void statInit() throws Exception
{ {
Hbox boxDocumentNo = new Hbox(); fDocumentNo.setWidth("100%");
fDescription.setWidth("100%");
fPOReference.setWidth("100%");
fDateFrom.setWidth("165px");
fDateTo.setWidth("165px");
fDocumentNo.addEventListener(Events.ON_CHANGE, this); fDocumentNo.addEventListener(Events.ON_CHANGE, this);
boxDocumentNo.setWidth("100%");
boxDocumentNo.setWidths("40%, 60%");
boxDocumentNo.appendChild(lDocumentNo);
boxDocumentNo.appendChild(fDocumentNo);
Hbox boxDescription = new Hbox();
fDescription.addEventListener(Events.ON_CHANGE, this); fDescription.addEventListener(Events.ON_CHANGE, this);
boxDescription.setWidth("100%");
boxDescription.setWidths("40%, 60%");
boxDescription.appendChild(lDescription);
boxDescription.appendChild(fDescription);
Hbox boxPORef = new Hbox();
fPOReference.addEventListener(Events.ON_CHANGE, this); fPOReference.addEventListener(Events.ON_CHANGE, this);
boxPORef.setWidth("100%");
boxPORef.setWidths("40%, 60%");
boxPORef.appendChild(lPOReference);
boxPORef.appendChild(fPOReference);
fIsSOTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx")); fIsSOTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx"));
fIsSOTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx"))); fIsSOTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
fIsSOTrx.addEventListener(Events.ON_CHECK, this); fIsSOTrx.addEventListener(Events.ON_CHECK, this);
// fOrg_ID = new VLookup("AD_Org_ID", false, false, true,
// MLookupFactory.create(Env.getCtx(), 3486, m_WindowNo, DisplayType.TableDir, false),
// DisplayType.TableDir, m_WindowNo);
// lOrg_ID.setLabelFor(fOrg_ID);
// fOrg_ID.setBackground(AdempierePLAF.getInfoBackground());
Hbox boxBPartner = new Hbox();
fBPartner_ID = new WSearchEditor( 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); Msg.translate(Env.getCtx(), "BPartner"), "", false, false, true);
fBPartner_ID.addValueChangeListener(this); fBPartner_ID.addValueChangeListener(this);
boxBPartner.appendChild(fBPartner_ID.getLabel());
boxBPartner.appendChild(fBPartner_ID.getComponent());
Hbox boxDateFrom = new Hbox(); Grid grid = GridFactory.newGridLayout();
boxDateFrom.setWidth("100%");
boxDateFrom.setWidths("40%, 60%");
boxDateFrom.appendChild(lDateFrom);
boxDateFrom.appendChild(fDateFrom);
Hbox boxDateTo = new Hbox(); Rows rows = new Rows();
boxDateTo.setWidth("100%"); grid.appendChild(rows);
boxDateTo.setWidths("10%, 90%");
boxDateTo.appendChild(lDateTo);
boxDateTo.appendChild(fDateTo);
VerticalBox boxCol1 = new VerticalBox();
boxCol1.appendChild(boxDocumentNo);
boxCol1.appendChild(new Separator());
boxCol1.appendChild(boxDescription);
boxCol1.appendChild(new Separator());
boxCol1.appendChild(boxPORef);
VerticalBox boxCol2 = new VerticalBox(); Row row = new Row();
boxCol2.appendChild(boxBPartner); rows.appendChild(row);
boxCol2.appendChild(new Separator()); row.appendChild(lDocumentNo.rightAlign());
boxCol2.appendChild(boxDateFrom); row.appendChild(fDocumentNo);
row.appendChild(fBPartner_ID.getLabel().rightAlign());
row.appendChild(fBPartner_ID.getComponent());
row.appendChild(fIsSOTrx);
VerticalBox boxCol3 = new VerticalBox(); row = new Row();
boxCol3.appendChild(fIsSOTrx); row.setSpans("1, 1, 1, 2");
boxCol3.appendChild(new Separator()); rows.appendChild(row);
boxCol3.appendChild(boxDateTo); row.appendChild(lDescription.rightAlign());
row.appendChild(fDescription);
row.appendChild(lDateFrom.rightAlign());
Hbox hbox = new Hbox();
hbox.appendChild(fDateFrom);
hbox.appendChild(lDateTo);
hbox.appendChild(fDateTo);
row.appendChild(hbox);
Hbox mainBox = new Hbox(); row = new Row();
mainBox.setWidth("100%"); row.setSpans("1, 1, 3");
mainBox.setWidths("40%, 50%, 10%"); rows.appendChild(row);
mainBox.appendChild(boxCol1); row.appendChild(lPOReference.rightAlign());
mainBox.appendChild(boxCol2); row.appendChild(fPOReference);
mainBox.appendChild(boxCol3); row.appendChild(new Label());
contentPanel.setWidth("99%");
contentPanel.setHeight("400px");
contentPanel.setVflex(true);
this.setWidth("850px"); this.setWidth("850px");
// this.setTitle("InOut Info");
this.setClosable(true); this.setClosable(true);
this.setBorder("normal"); this.setBorder("normal");
this.appendChild(mainBox); this.appendChild(grid);
this.appendChild(new Separator()); this.appendChild(new Separator());
this.appendChild(contentPanel); this.appendChild(contentPanel);
this.appendChild(new Separator()); this.appendChild(new Separator());
@ -310,7 +272,6 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
} }
sql.append(" AND i.IsSOTrx=?"); sql.append(" AND i.IsSOTrx=?");
// log.fine( "InfoInOut.setWhereClause", sql.toString());
return sql.toString(); return sql.toString();
} // getSQLWhere } // getSQLWhere
@ -382,6 +343,24 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
return s; return s;
} // getSQLText } // getSQLText
// Elaine 2008/12/16
/**
* Zoom
*/
public void zoom()
{
log.info( "InfoInOut.zoom");
Integer M_InOut_ID = getSelectedRowKey();
if (M_InOut_ID == null)
return;
MQuery query = new MQuery("M_InOut");
query.addRestriction("M_InOut_ID", MQuery.EQUAL, M_InOut_ID);
query.setRecordCount(1);
int AD_WindowNo = getAD_Window_ID("M_InOut", fIsSOTrx.isSelected());
AEnv.zoom (AD_WindowNo, query);
} // zoom
//
/** /**
* Has Zoom * Has Zoom
* @return true * @return true

View File

@ -23,13 +23,17 @@ import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Datebox; import org.adempiere.webui.component.Datebox;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.NumberBox; import org.adempiere.webui.component.NumberBox;
import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.WListbox;
import org.adempiere.webui.editor.WSearchEditor; import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener; import org.adempiere.webui.event.ValueChangeListener;
@ -38,6 +42,7 @@ import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn; import org.compiere.minigrid.IDColumn;
import org.compiere.model.MLookup; import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory; import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
@ -46,13 +51,16 @@ import org.compiere.util.Util;
import org.zkoss.zk.ui.WrongValueException; import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zul.Hbox; import org.zkoss.zul.Hbox;
import org.zkoss.zul.Separator; import org.zkoss.zul.Separator;
import org.zkoss.zul.Vbox;
/** /**
* Search Invoice and return selection * Search Invoice and return selection
* Based on InfoInvoice by Jorg Janke * Based on InfoInvoice by Jorg Janke
* @author Sendy Yagambrum * @author Sendy Yagambrum
* @date July 30, 2007 * @date July 30, 2007
*
* Zk Port
* @author Elaine
* @version InfoInvoice.java Adempiere Swing UI 3.4.1
**/ **/
public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
{ {
@ -89,10 +97,6 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
private Label lblDocumentNo; private Label lblDocumentNo;
private Label lblDescription; private Label lblDescription;
private Label lblBPartner;
private Label lblOrder;
private Label lblIsSOTrx;
private Label lblIsPaid;
private Label lblDateInvoiced; private Label lblDateInvoiced;
private Label lblGrandTotal; private Label lblGrandTotal;
@ -134,32 +138,25 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
private void initComponents() private void initComponents()
{ {
lblDocumentNo = new Label(Msg.translate(Env.getCtx(), "DocumentNo").substring(1)); lblDocumentNo = new Label(Msg.translate(Env.getCtx(), "DocumentNo").substring(1));
lblDescription = new Label(Msg.translate(Env.getCtx(), "Description")); lblDescription = new Label(Msg.translate(Env.getCtx(), "Description"));
lblBPartner = new Label(Msg.translate(Env.getCtx(), "BPartner").substring(1));
lblIsSOTrx = new Label(Msg.translate(Env.getCtx(), "IsSOTrx"));
lblIsPaid = new Label(Msg.translate(Env.getCtx(), "IsPaid"));
lblDateInvoiced = new Label(Msg.translate(Env.getCtx(), "DateInvoiced")); lblDateInvoiced = new Label(Msg.translate(Env.getCtx(), "DateInvoiced"));
lblOrder = new Label(Msg.translate(Env.getCtx(), "POReference"));
lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal")); lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal"));
txtDocumentNo = new Textbox(); txtDocumentNo = new Textbox();
txtDescription = new Textbox(); txtDescription = new Textbox();
dateFrom = new Datebox(); dateFrom = new Datebox();
dateFrom.setWidth("180px");
dateTo= new Datebox(); dateTo= new Datebox();
dateTo.setWidth("180px");
amountFrom = new NumberBox(false); amountFrom = new NumberBox(false);
amountFrom.setWidth("180px");
amountTo = new NumberBox(false); amountTo = new NumberBox(false);
amountTo.setWidth("180px");
isPaid = new Checkbox(); isPaid = new Checkbox();
isPaid.setLabel(Msg.translate(Env.getCtx(), "IsPaid"));
isPaid.setChecked(false); isPaid.setChecked(false);
isSoTrx = new Checkbox(); isSoTrx = new Checkbox();
isSoTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx"));
isSoTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx"))); isSoTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
MLookup lookupBP = MLookupFactory.get(Env.getCtx(), p_WindowNo, MLookup lookupBP = MLookupFactory.get(Env.getCtx(), p_WindowNo,
0, 3499, DisplayType.Search); 0, 3499, DisplayType.Search);
@ -173,7 +170,6 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
Env.getCtx(), "C_Order_ID"), "", false, false, true); Env.getCtx(), "C_Order_ID"), "", false, false, true);
editorOrder.addValueChangeListener(this); editorOrder.addValueChangeListener(this);
contentPanel = new WListbox();
contentPanel.setWidth("99%"); contentPanel.setWidth("99%");
contentPanel.setHeight("400px"); contentPanel.setHeight("400px");
contentPanel.setVflex(true); contentPanel.setVflex(true);
@ -181,94 +177,54 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
private void init() private void init()
{ {
Hbox pnlDocumentNo = new Hbox(); txtDocumentNo.setWidth("100%");
pnlDocumentNo.appendChild(lblDocumentNo); txtDescription.setWidth("100%");
pnlDocumentNo.appendChild(txtDocumentNo); dateFrom.setWidth("165px");
pnlDocumentNo.setStyle("text-align:right"); dateTo.setWidth("165px");
amountFrom.getDecimalbox().setWidth("155px");
Hbox pnlDescription = new Hbox(); amountTo.getDecimalbox().setWidth("155px");
pnlDescription.appendChild(lblDescription);
pnlDescription.appendChild(txtDescription); Grid grid = GridFactory.newGridLayout();
pnlDescription.setStyle("text-align:right");
pnlDescription.setWidth("100%"); Rows rows = new Rows();
grid.appendChild(rows);
Hbox pnlOrder = new Hbox();
pnlOrder.appendChild(editorOrder.getLabel()); Row row = new Row();
pnlOrder.appendChild(editorOrder.getComponent()); rows.appendChild(row);
pnlOrder.setStyle("text-align:right"); row.appendChild(lblDocumentNo.rightAlign());
pnlOrder.setWidth("100%"); row.appendChild(txtDocumentNo);
row.appendChild(editorBPartner.getLabel().rightAlign());
Hbox pnlBPartner = new Hbox(); row.appendChild(editorBPartner.getComponent());
pnlBPartner.appendChild(lblBPartner); row.appendChild(isSoTrx);
pnlBPartner.appendChild(editorBPartner.getComponent()); row.appendChild(isPaid);
pnlBPartner.setStyle("text-align:right");
pnlBPartner.setWidth("100%"); row = new Row();
row.setSpans("1, 1, 1, 3");
Hbox hboxDateOrdered = new Hbox(); rows.appendChild(row);
Panel pnlDateOrdered = new Panel(); row.appendChild(lblDescription.rightAlign());
pnlDateOrdered.appendChild(lblDateInvoiced); row.appendChild(txtDescription);
pnlDateOrdered.appendChild(dateFrom); row.appendChild(lblDateInvoiced.rightAlign());
pnlDateOrdered.setAlign("right"); Hbox hbox = new Hbox();
hboxDateOrdered.appendChild(pnlDateOrdered); hbox.appendChild(dateFrom);
hboxDateOrdered.setStyle("text-align:right"); hbox.appendChild(new Label("-"));
hboxDateOrdered.setWidth("100%"); hbox.appendChild(dateTo);
row.appendChild(hbox);
Hbox pnlGrandTotal = new Hbox();
pnlGrandTotal.appendChild(lblGrandTotal); row = new Row();
pnlGrandTotal.appendChild(amountFrom); row.setSpans("1, 1, 1, 3");
pnlGrandTotal.setStyle("text-align:right"); rows.appendChild(row);
pnlGrandTotal.setWidth("100%"); row.appendChild(editorOrder.getLabel().rightAlign());
row.appendChild(editorOrder.getComponent());
Hbox pnlCheckbox = new Hbox(); row.appendChild(lblGrandTotal.rightAlign());
Panel pnlIsSoTrx = new Panel(); hbox = new Hbox();
pnlIsSoTrx.appendChild(isSoTrx); hbox.appendChild(amountFrom);
pnlIsSoTrx.appendChild(lblIsSOTrx); hbox.appendChild(new Label("-"));
pnlIsSoTrx.setAlign("left"); hbox.appendChild(amountTo);
row.appendChild(hbox);
Panel pnlIsPaid = new Panel();
pnlIsPaid.appendChild(isPaid);
pnlIsPaid.appendChild(lblIsPaid);
pnlIsPaid.setAlign("left");
pnlCheckbox.appendChild(pnlIsSoTrx);
pnlCheckbox.appendChild(pnlIsPaid);
Panel pnlDateTo = new Panel();
pnlDateTo.appendChild(dateTo);
pnlDateTo.setAlign("left");
Panel pnlAmountTo = new Panel();
pnlAmountTo.appendChild(amountTo);
pnlAmountTo.setAlign("left");
Vbox vbox1 = new Vbox();
vbox1.setWidth("100%");
vbox1.appendChild(pnlDocumentNo);
vbox1.appendChild(pnlDescription);
vbox1.appendChild(pnlOrder);
Vbox vbox2 = new Vbox();
vbox2.setWidth("100%");
vbox2.appendChild(pnlBPartner);
vbox2.appendChild(pnlDateOrdered);
vbox2.appendChild(pnlGrandTotal);
Vbox vbox3 = new Vbox();
vbox3.setWidth("100%");
vbox3.appendChild(pnlCheckbox);
vbox3.appendChild(pnlDateTo);
vbox3.appendChild(pnlAmountTo);
Hbox parameterPanel = new Hbox();
parameterPanel.appendChild(vbox1);
parameterPanel.appendChild(vbox2);
parameterPanel.appendChild(vbox3);
parameterPanel.setWidth("100%");
Panel mainPanel = new Panel(); Panel mainPanel = new Panel();
mainPanel.setWidth("100%"); mainPanel.setWidth("100%");
mainPanel.appendChild(parameterPanel); mainPanel.appendChild(grid);
mainPanel.appendChild(new Separator()); mainPanel.appendChild(new Separator());
mainPanel.appendChild(contentPanel); mainPanel.appendChild(contentPanel);
mainPanel.appendChild(new Separator()); mainPanel.appendChild(new Separator());
@ -277,7 +233,8 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
mainPanel.appendChild(statusBar); mainPanel.appendChild(statusBar);
this.appendChild(mainPanel); this.appendChild(mainPanel);
this.setBorder("normal"); this.setClosable(true);
this.setBorder("normal");
this.setWidth("850px"); this.setWidth("850px");
} }
@ -301,7 +258,6 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
where.toString(), where.toString(),
"2,3,4"); "2,3,4");
// //
// MAllocationLine.setIsPaid(Env.getCtx(), 0, null);
return true; return true;
} // initInfo } // initInfo
@ -313,8 +269,6 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
sql.append(" AND UPPER(i.DocumentNo) LIKE ?"); sql.append(" AND UPPER(i.DocumentNo) LIKE ?");
if (txtDescription.getText().length() > 0) if (txtDescription.getText().length() > 0)
sql.append(" AND UPPER(i.Description) LIKE ?"); sql.append(" AND UPPER(i.Description) LIKE ?");
// if (fPOReference.getText().length() > 0)
// sql.append(" AND UPPER(i.POReference) LIKE ?");
// //
if (editorBPartner.getValue() != null) if (editorBPartner.getValue() != null)
sql.append(" AND i.C_BPartner_ID=?"); sql.append(" AND i.C_BPartner_ID=?");
@ -525,6 +479,33 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
return s; return s;
} // getSQLText } // getSQLText
// Elaine 2008/12/16
/**
* Zoom
*/
public void zoom()
{
log.info( "InfoInvoice.zoom");
Integer C_Invoice_ID = getSelectedRowKey();
if (C_Invoice_ID == null)
return;
MQuery query = new MQuery("C_Invoice");
query.addRestriction("C_Invoice_ID", MQuery.EQUAL, C_Invoice_ID);
query.setRecordCount(1);
int AD_WindowNo = getAD_Window_ID("C_Invoice", isSoTrx.isSelected());
AEnv.zoom (AD_WindowNo, query);
} // zoom
/**
* Has Zoom
* @return true
*/
protected boolean hasZoom()
{
return true;
} // hasZoom
//
public void tableChanged(WTableModelEvent event) public void tableChanged(WTableModelEvent event)
{ {
@ -560,7 +541,4 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
else else
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_InvoicePaySchedule_ID", String.valueOf(C_InvoicePaySchedule_ID)); Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_InvoicePaySchedule_ID", String.valueOf(C_InvoicePaySchedule_ID));
} }
} }

View File

@ -23,6 +23,7 @@ import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Datebox; import org.adempiere.webui.component.Datebox;
import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.Grid;
@ -33,7 +34,6 @@ import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.WListbox;
import org.adempiere.webui.editor.WSearchEditor; import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener; import org.adempiere.webui.event.ValueChangeListener;
@ -42,11 +42,13 @@ import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn; import org.compiere.minigrid.IDColumn;
import org.compiere.model.MLookup; import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory; import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.Util; import org.compiere.util.Util;
import org.zkoss.zk.ui.WrongValueException; import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Separator; import org.zkoss.zul.Separator;
/** /**
@ -55,16 +57,17 @@ import org.zkoss.zul.Separator;
* *
* @author Sendy Yagambrum * @author Sendy Yagambrum
* @date July 27, 2007 * @date July 27, 2007
*
* Zk Port
* @author Elaine
* @version InfoOrder.java Adempiere Swing UI 3.4.1
**/ **/
public class InfoOrderPanel extends InfoPanel implements ValueChangeListener public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Label lblDocumentNo; private Label lblDocumentNo;
private Label lblDescription; private Label lblDescription;
private Label lblBPartner;
private Label lblSalesTransaction;
private Label lblDateOrdered; private Label lblDateOrdered;
private Label lblOrderRef; private Label lblOrderRef;
private Label lblGrandTotal; private Label lblGrandTotal;
@ -100,33 +103,38 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
protected InfoOrderPanel(int WindowNo, String value, protected InfoOrderPanel(int WindowNo, String value,
boolean multiSelection, String whereClause) boolean multiSelection, String whereClause)
{ {
super ( WindowNo, "o", "C_Order_ID", multiSelection, whereClause); super ( WindowNo, "o", "C_Order_ID", multiSelection, whereClause);
log.info( "InfoOrder"); log.info( "InfoOrder");
setTitle(Msg.getMsg(Env.getCtx(), "InfoOrder")); setTitle(Msg.getMsg(Env.getCtx(), "InfoOrder"));
// //
initComponents();
init(); try
{
p_loadedOK = initInfo (); initComponents();
int no = contentPanel.getRowCount(); init();
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false); p_loadedOK = initInfo ();
setStatusDB(Integer.toString(no)); }
// catch (Exception e)
if (value != null && value.length() > 0) {
{ return;
String values[] = value.split("_"); }
txtDocumentNo.setText(values[0]);
executeQuery(); int no = contentPanel.getRowCount();
renderItems(); setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
} setStatusDB(Integer.toString(no));
//
if (value != null && value.length() > 0)
{
String values[] = value.split("_");
txtDocumentNo.setText(values[0]);
executeQuery();
renderItems();
}
} }
public void initComponents() public void initComponents()
{ {
lblDocumentNo = new Label(Msg.translate(Env.getCtx(), "DocumentNo").substring(1)); lblDocumentNo = new Label(Msg.translate(Env.getCtx(), "DocumentNo").substring(1));
lblDescription = new Label(Msg.translate(Env.getCtx(), "Description")); lblDescription = new Label(Msg.translate(Env.getCtx(), "Description"));
lblBPartner = new Label(Msg.translate(Env.getCtx(), "BPartner").substring(1));
lblSalesTransaction = new Label(Msg.translate(Env.getCtx(), "IsSOTrx"));
lblDateOrdered = new Label(Msg.translate(Env.getCtx(), "DateOrdered")); lblDateOrdered = new Label(Msg.translate(Env.getCtx(), "DateOrdered"));
lblOrderRef = new Label(Msg.translate(Env.getCtx(), "POReference")); lblOrderRef = new Label(Msg.translate(Env.getCtx(), "POReference"));
lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal")); lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal"));
@ -142,67 +150,69 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
amountTo = new NumberBox(false); amountTo = new NumberBox(false);
isSoTrx = new Checkbox(); isSoTrx = new Checkbox();
isSoTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx"));
isSoTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx"))); isSoTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
MLookup lookupBP = MLookupFactory.get(Env.getCtx(), p_WindowNo, MLookup lookupBP = MLookupFactory.get(Env.getCtx(), p_WindowNo,
0, 3499, DisplayType.Search); 0, 3499, DisplayType.Search);
editorBPartner = new WSearchEditor(lookupBP, Msg.translate( editorBPartner = new WSearchEditor(lookupBP, Msg.translate(
Env.getCtx(), "C_BPartner_ID"), "", true, false, true); Env.getCtx(), "C_BPartner_ID"), "", true, false, true);
editorBPartner.addValueChangeListener(this); editorBPartner.addValueChangeListener(this);
contentPanel = new WListbox();
contentPanel.setWidth("99%"); contentPanel.setWidth("99%");
contentPanel.setHeight("400px"); contentPanel.setHeight("400px");
contentPanel.setVflex(true); contentPanel.setVflex(true);
contentPanel.setFixedLayout(true);
} }
public void init() public void init()
{ {
Grid parameterPanel = GridFactory.newGridLayout(); txtDocumentNo.setWidth("100%");
Rows rows = parameterPanel.newRows(); txtDescription.setWidth("100%");
Row row = rows.newRow(); txtOrderRef.setWidth("100%");
row.appendChild(lblDocumentNo.rightAlign()); dateFrom.setWidth("165px");
row.appendChild(txtDocumentNo); dateTo.setWidth("165px");
row.appendChild(lblBPartner.rightAlign()); amountFrom.getDecimalbox().setWidth("155px");
row.appendChild(editorBPartner.getComponent()); amountTo.getDecimalbox().setWidth("155px");
Panel pnlSalesTrx = new Panel();
pnlSalesTrx.appendChild(isSoTrx); Grid grid = GridFactory.newGridLayout();
isSoTrx.setStyle("margin-left: 5px");
pnlSalesTrx.appendChild(lblSalesTransaction); Rows rows = new Rows();
lblSalesTransaction.setStyle("margin-left: 2px"); grid.appendChild(rows);
row.appendChild(pnlSalesTrx);
Row row = new Row();
row = rows.newRow(); rows.appendChild(row);
row.appendChild(lblDescription.rightAlign()); row.appendChild(lblDocumentNo.rightAlign());
row.appendChild(txtDescription); row.appendChild(txtDocumentNo);
row.appendChild(lblDateOrdered.rightAlign()); row.appendChild(editorBPartner.getLabel().rightAlign());
Panel pnlDate = new Panel(); row.appendChild(editorBPartner.getComponent());
pnlDate.appendChild(dateFrom); row.appendChild(isSoTrx);
Label symbol = new Label("-");
symbol.setStyle("margin-left: 5px; margin-right: 5px"); row = new Row();
pnlDate.appendChild(symbol); row.setSpans("1, 1, 1, 2");
pnlDate.appendChild(dateTo); rows.appendChild(row);
row.appendChild(pnlDate); row.appendChild(lblDescription.rightAlign());
row.setSpans("1,1,1,2"); row.appendChild(txtDescription);
row.appendChild(lblDateOrdered.rightAlign());
row = rows.newRow(); Hbox hbox = new Hbox();
row.appendChild(lblOrderRef.rightAlign()); hbox.appendChild(dateFrom);
row.appendChild(txtOrderRef); hbox.appendChild(new Label("-"));
row.appendChild(lblGrandTotal.rightAlign()); hbox.appendChild(dateTo);
Panel pnlamt = new Panel(); row.appendChild(hbox);
pnlamt.appendChild(amountFrom);
symbol = new Label("-"); row = new Row();
symbol.setStyle("margin-left: 5px; margin-right: 5px"); row.setSpans("1, 1, 1, 2");
pnlamt.appendChild(symbol); rows.appendChild(row);
pnlamt.appendChild(amountTo); row.appendChild(lblOrderRef.rightAlign());
row.appendChild(pnlamt); row.appendChild(txtOrderRef);
row.setSpans("1,1,1,2"); row.appendChild(lblGrandTotal.rightAlign());
hbox = new Hbox();
parameterPanel.setWidth("100%"); hbox.appendChild(amountFrom);
parameterPanel.setInnerWidth("auto"); hbox.appendChild(new Label("-"));
hbox.appendChild(amountTo);
row.appendChild(hbox);
Panel mainPanel = new Panel(); Panel mainPanel = new Panel();
mainPanel.setWidth("100%"); mainPanel.setWidth("100%");
mainPanel.appendChild(parameterPanel); mainPanel.appendChild(grid);
mainPanel.appendChild(new Separator()); mainPanel.appendChild(new Separator());
mainPanel.appendChild(contentPanel); mainPanel.appendChild(contentPanel);
mainPanel.appendChild(new Separator()); mainPanel.appendChild(new Separator());
@ -211,7 +221,8 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
mainPanel.appendChild(statusBar); mainPanel.appendChild(statusBar);
this.appendChild(mainPanel); this.appendChild(mainPanel);
this.setBorder("normal"); this.setClosable(true);
this.setBorder("normal");
this.setWidth("850px"); this.setWidth("850px");
} }
@ -450,10 +461,35 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
return s; return s;
} // getSQLText } // getSQLText
// Elaine 2008/12/16
/**
* Zoom
*/
public void zoom()
{
log.info("");
Integer C_Order_ID = getSelectedRowKey();
if (C_Order_ID == null)
return;
MQuery query = new MQuery("C_Order");
query.addRestriction("C_Order_ID", MQuery.EQUAL, C_Order_ID);
query.setRecordCount(1);
int AD_WindowNo = getAD_Window_ID("C_Order", isSoTrx.isSelected());
AEnv.zoom (AD_WindowNo, query);
} // zoom
/**
* Has Zoom
* @return true
*/
protected boolean hasZoom()
{
return true;
} // hasZoom
//
public void tableChanged(WTableModelEvent event) public void tableChanged(WTableModelEvent event)
{ {
// TODO Auto-generated method stub
} }

View File

@ -56,6 +56,10 @@ import org.zkoss.zul.event.ZulEvents;
* Based on Info written by Jorg Janke * Based on Info written by Jorg Janke
* *
* @author Sendy Yagambrum * @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 public abstract class InfoPanel extends Window implements EventListener, WTableModelListener
{ {
@ -250,10 +254,16 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
private void init() private void init()
{ {
confirmPanel = new ConfirmPanel(true,true,false,false,true,true); confirmPanel = new ConfirmPanel(true, true, false, true, true, true); // Elaine 2008/12/16
confirmPanel.addActionListener(Events.ON_CLICK, this); confirmPanel.addActionListener(Events.ON_CLICK, this);
confirmPanel.setStyle("border-top: 2px groove #444; padding-top: 4px"); 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());
//
this.setSizable(true); this.setSizable(true);
this.addEventListener(Events.ON_OK, this); this.addEventListener(Events.ON_OK, this);
@ -488,10 +498,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
int no = line.size(); int no = line.size();
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false); setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
setStatusDB(Integer.toString(no)); setStatusDB(Integer.toString(no));
//better performance
// contentPanel.setFixedLayout(true);
//workaround for scrollbar position problem //workaround for scrollbar position problem
contentPanel.renderAll(); contentPanel.renderAll();
} }
@ -822,24 +829,40 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
{ {
if (event!=null) if (event!=null)
{ {
if (event.getTarget().equals(confirmPanel.getButton("Ok"))) if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_OK)))
{ {
if (!contentPanel.getChildren().isEmpty() && contentPanel.getSelectedRowKey()!=null) if (!contentPanel.getChildren().isEmpty() && contentPanel.getSelectedRowKey()!=null)
{ {
dispose(true); dispose(true);
} }
} }
else if (event.getTarget().equals(confirmPanel.getButton("Refresh"))) else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_REFRESH)))
{ {
executeQuery(); executeQuery();
renderItems(); renderItems();
} }
else if (event.getTarget().equals(confirmPanel.getButton("Cancel"))) else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_CANCEL)))
{ {
m_cancel = true; m_cancel = true;
dispose(false); dispose(false);
} }
else if (event.getTarget().equals(confirmPanel.getButton("Zoom"))) // Elaine 2008/12/16
else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_HISTORY)))
{
if (!contentPanel.getChildren().isEmpty() && contentPanel.getSelectedRowKey()!=null)
{
showHistory();
}
}
else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_CUSTOMIZE)))
{
if (!contentPanel.getChildren().isEmpty() && contentPanel.getSelectedRowKey()!=null)
{
customize();
}
}
//
else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_ZOOM)))
{ {
if (!contentPanel.getChildren().isEmpty() && contentPanel.getSelectedRowKey()!=null) if (!contentPanel.getChildren().isEmpty() && contentPanel.getSelectedRowKey()!=null)
{ {

View File

@ -21,14 +21,17 @@ import java.math.BigDecimal;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Datebox; import org.adempiere.webui.component.Datebox;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.VerticalBox;
import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WSearchEditor; import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeEvent;
@ -37,6 +40,7 @@ import org.adempiere.webui.event.WTableModelEvent;
import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn; import org.compiere.minigrid.IDColumn;
import org.compiere.model.MLookupFactory; import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
@ -51,26 +55,16 @@ import org.zkoss.zul.Separator;
* *
* @author Niraj Sohun * @author Niraj Sohun
* Aug, 02, 2007 * Aug, 02, 2007
*
* Zk Port
* @author Elaine
* @version InfoPayment.java Adempiere Swing UI 3.4.1
*/ */
public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener, EventListener public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener, EventListener
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** String Array of Column Info */
private ColumnInfo[] m_generalLayout;
/** list of query columns */
private ArrayList m_queryColumns = new ArrayList();
/** Table Name */
private String m_tableName;
/** Key Column Name */
private String m_keyColumn;
//private WListbox p_table = new WListbox();
private Textbox fDocumentNo = new Textbox(); private Textbox fDocumentNo = new Textbox();
private Textbox fAmtTo = new Textbox(); private Textbox fAmtTo = new Textbox();
private Textbox fAmtFrom = new Textbox(); private Textbox fAmtFrom = new Textbox();
@ -153,11 +147,6 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
fDocumentNo .setValue(value); fDocumentNo .setValue(value);
executeQuery(); executeQuery();
} }
//pack();
// Focus
//fDocumentNo.requestFocus();
} // InfoPaymentPanel } // InfoPaymentPanel
/** /**
@ -167,91 +156,64 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
private void statInit() throws Exception private void statInit() throws Exception
{ {
Hbox boxDocumentNo = new Hbox(); fDocumentNo.setWidth("100%");
fDateFrom.setWidth("165px");
fDateTo.setWidth("165px");
fAmtFrom.setWidth("180px");
fAmtTo.setWidth("180px");
fDocumentNo.addEventListener(Events.ON_CHANGE, this); fDocumentNo.addEventListener(Events.ON_CHANGE, this);
boxDocumentNo.setWidth("100%");
boxDocumentNo.setWidths("40%, 60%");
boxDocumentNo.appendChild(lDocumentNo);
boxDocumentNo.appendChild(fDocumentNo);
fIsReceipt.setLabel(Msg.translate(Env.getCtx(), "IsReceipt")); fIsReceipt.setLabel(Msg.translate(Env.getCtx(), "IsReceipt"));
fIsReceipt.addEventListener(Events.ON_CHECK, this); fIsReceipt.addEventListener(Events.ON_CHECK, this);
fIsReceipt.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx"))); fIsReceipt.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
Hbox boxBPartner = new Hbox();
fBPartner_ID = new WSearchEditor( 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(), "C_BPartner_ID"), "", false, false, true); Msg.translate(Env.getCtx(), "C_BPartner_ID"), "", false, false, true);
fBPartner_ID.addValueChangeListener(this); fBPartner_ID.addValueChangeListener(this);
boxBPartner.appendChild(fBPartner_ID.getLabel()); Grid grid = GridFactory.newGridLayout();
boxBPartner.appendChild(fBPartner_ID.getComponent());
Hbox boxDateFrom = new Hbox(); Rows rows = new Rows();
grid.appendChild(rows);
//fDateFrom.setValue(new Date(System.currentTimeMillis())); Row row = new Row();
rows.appendChild(row);
row.appendChild(lDocumentNo.rightAlign());
row.appendChild(fDocumentNo);
row.appendChild(fBPartner_ID.getLabel().rightAlign());
row.appendChild(fBPartner_ID.getComponent());
row.appendChild(fIsReceipt);
boxDateFrom.setWidth("100%"); row = new Row();
boxDateFrom.setWidths("40%, 60%"); row.setSpans("3, 2");
boxDateFrom.appendChild(lDateFrom); rows.appendChild(row);
boxDateFrom.appendChild(fDateFrom); row.appendChild(lDateFrom.rightAlign());
Hbox hbox = new Hbox();
hbox.appendChild(fDateFrom);
hbox.appendChild(lDateTo);
hbox.appendChild(fDateTo);
row.appendChild(hbox);
Hbox boxDateTo = new Hbox(); row = new Row();
row.setSpans("3, 2");
//fDateTo.setValue(new Date(System.currentTimeMillis())); rows.appendChild(row);
row.appendChild(lAmtFrom.rightAlign());
boxDateTo.setWidth("100%"); hbox = new Hbox();
boxDateTo.setWidths("10%, 90%"); hbox.appendChild(fAmtFrom);
boxDateTo.appendChild(lDateTo); hbox.appendChild(lAmtTo);
boxDateTo.appendChild(fDateTo); hbox.appendChild(fAmtTo);
row.appendChild(hbox);
Hbox boxAmtFrom = new Hbox();
boxAmtFrom.setWidth("100%");
boxAmtFrom.setWidths("40%, 60%");
boxAmtFrom.appendChild(lAmtFrom);
boxAmtFrom.appendChild(fAmtFrom);
Hbox boxAmtTo = new Hbox();
boxAmtTo.setWidth("100%");
boxAmtTo.setWidths("10%, 90%");
boxAmtTo.appendChild(lAmtTo);
boxAmtTo.appendChild(fAmtTo);
VerticalBox boxCol1 = new VerticalBox();
//boxCol1.setWidth("100%");
boxCol1.appendChild(boxDocumentNo);
VerticalBox boxCol2 = new VerticalBox();
//boxCol2.setWidth("100%");
boxCol2.appendChild(boxBPartner);
boxCol2.appendChild(new Separator());
boxCol2.appendChild(boxDateFrom);
boxCol2.appendChild(new Separator());
boxCol2.appendChild(boxAmtFrom);
VerticalBox boxCol3 = new VerticalBox();
//boxCol3.setWidth("100%");
boxCol3.appendChild(fIsReceipt);
boxCol3.appendChild(new Separator());
boxCol3.appendChild(boxDateTo);
boxCol3.appendChild(new Separator());
boxCol3.appendChild(boxAmtTo);
Hbox mainBox = new Hbox();
mainBox.setWidth("100%");
mainBox.setWidths("42%, 50%, 8%");
mainBox.appendChild(boxCol1);
mainBox.appendChild(boxCol2);
mainBox.appendChild(boxCol3);
contentPanel.setWidth("99%");
contentPanel.setHeight("400px");
contentPanel.setVflex(true);
this.setWidth("850px"); this.setWidth("850px");
// this.setTitle("Payment Info");
this.setClosable(true); this.setClosable(true);
this.setBorder("normal"); this.setBorder("normal");
this.appendChild(mainBox); this.appendChild(grid);
this.appendChild(new Separator()); this.appendChild(new Separator());
this.appendChild(contentPanel); this.appendChild(contentPanel);
this.appendChild(new Separator()); this.appendChild(new Separator());
@ -281,8 +243,6 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
prepareTable(s_paymentLayout, " C_Payment_v p", where.toString(), "2,3,4"); prepareTable(s_paymentLayout, " C_Payment_v p", where.toString(), "2,3,4");
// MPayment.setIsAllocated(Env.getCtx(), 0, null);
return true; return true;
} // initInfo } // initInfo
@ -420,11 +380,11 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
return s; return s;
} // getSQLText } // getSQLText
// Elaine 2008/12/16
/** /**
* Zoom * Zoom
*/ */
public void zoom()
/* void zoom()
{ {
log.info( "InfoPayment.zoom"); log.info( "InfoPayment.zoom");
Integer C_Payment_ID = getSelectedRowKey(); Integer C_Payment_ID = getSelectedRowKey();
@ -434,9 +394,10 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
query.addRestriction("C_Payment_ID", MQuery.EQUAL, C_Payment_ID); query.addRestriction("C_Payment_ID", MQuery.EQUAL, C_Payment_ID);
query.setRecordCount(1); query.setRecordCount(1);
int AD_WindowNo = getAD_Window_ID("C_Payment", fIsReceipt.isSelected()); int AD_WindowNo = getAD_Window_ID("C_Payment", fIsReceipt.isSelected());
zoom (AD_WindowNo, query); AEnv.zoom (AD_WindowNo, query);
} // zoom } // zoom
*/ //
/** /**
* Has Zoom * Has Zoom
* @return true * @return true
@ -456,7 +417,6 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
} }
public void tableChanged(WTableModelEvent event) { public void tableChanged(WTableModelEvent event) {
// TODO Auto-generated method stub
} }

View File

@ -42,13 +42,19 @@ import java.util.ArrayList;
import java.util.Vector; import java.util.Vector;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem; import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.ListModelTable;
import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory; import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Tab; import org.adempiere.webui.component.Tab;
import org.adempiere.webui.component.Tabbox; import org.adempiere.webui.component.Tabbox;
import org.adempiere.webui.component.Tabpanel; import org.adempiere.webui.component.Tabpanel;
@ -60,6 +66,7 @@ import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn; import org.compiere.minigrid.IDColumn;
import org.compiere.model.MClient; import org.compiere.model.MClient;
import org.compiere.model.MDocType; import org.compiere.model.MDocType;
import org.compiere.model.MQuery;
import org.compiere.model.MRole; import org.compiere.model.MRole;
import org.compiere.util.CLogMgt; import org.compiere.util.CLogMgt;
import org.compiere.util.DB; import org.compiere.util.DB;
@ -75,15 +82,16 @@ import org.zkoss.zkex.zul.Borderlayout;
import org.zkoss.zkex.zul.Center; import org.zkoss.zkex.zul.Center;
import org.zkoss.zkex.zul.South; import org.zkoss.zkex.zul.South;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Separator; import org.zkoss.zul.Separator;
import org.zkoss.zul.Vbox;
/** /**
* Search Product and return selection * Search Product and return selection
* This class is based on org.compiere.apps.search.InfoPAttribute written by Jorg Janke * This class is based on org.compiere.apps.search.InfoPAttribute written by Jorg Janke
* @author Elaine * @author Elaine
* *
* Zk Port
* @author Elaine
* @version InfoPayment.java Adempiere Swing UI 3.4.1
*/ */
public final class InfoProductPanel extends InfoPanel implements EventListener public final class InfoProductPanel extends InfoPanel implements EventListener
{ {
@ -184,6 +192,11 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
tabbedPane.setSelectedIndex(0); tabbedPane.setSelectedIndex(0);
p_loadedOK = true; p_loadedOK = true;
//Begin - fer_luck @ centuryon
mWindowNo = windowNo; // Elaine 2008/12/16
//End - fer_luck @ centuryon
} // InfoProductPanel } // InfoProductPanel
/** /**
@ -248,84 +261,41 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
fieldVendor = new Textbox(); fieldVendor = new Textbox();
fieldVendor.setMaxlength(40); fieldVendor.setMaxlength(40);
contentPanel = new WListbox();
contentPanel.setWidth("99%"); contentPanel.setWidth("99%");
contentPanel.setVflex(true); contentPanel.setVflex(true);
} // initComponents } // initComponents
private void init() private void init()
{ {
Panel pnlValue = new Panel(); Grid grid = GridFactory.newGridLayout();
pnlValue.appendChild(lblValue);
pnlValue.appendChild(fieldValue);
pnlValue.setAlign("right");
Panel pnlName = new Panel(); Rows rows = new Rows();
pnlName.appendChild(lblName); grid.appendChild(rows);
pnlName.appendChild(fieldName);
pnlName.setAlign("right");
Panel pnlUPC = new Panel(); Row row = new Row();
pnlUPC.appendChild(lblUPC); rows.appendChild(row);
pnlUPC.appendChild(fieldUPC); row.appendChild(lblValue.rightAlign());
pnlUPC.setAlign("right"); row.appendChild(fieldValue);
row.appendChild(lblUPC.rightAlign());
row.appendChild(fieldUPC);
row.appendChild(lblWarehouse.rightAlign());
row.appendChild(pickWarehouse);
row.appendChild(lblPriceList.rightAlign());
row.appendChild(pickPriceList);
row.appendChild(m_InfoPAttributeButton);
Panel pnlSKU = new Panel(); row = new Row();
pnlSKU.appendChild(lblSKU); row.setSpans("1, 1, 1, 1, 1, 1, 1, 2");
pnlSKU.appendChild(fieldSKU); rows.appendChild(row);
pnlSKU.setAlign("right"); row.appendChild(lblName.rightAlign());
row.appendChild(fieldName);
Panel pnlPriceList = new Panel(); row.appendChild(lblSKU.rightAlign());
pnlPriceList.appendChild(lblPriceList); row.appendChild(fieldSKU);
pnlPriceList.appendChild(pickPriceList); row.appendChild(lblVendor.rightAlign());
pnlPriceList.setAlign("right"); row.appendChild(fieldVendor);
row.appendChild(lblProductCategory.rightAlign());
// Elaine 2008/11/21 row.appendChild(pickProductCategory);
Panel pnlProductCategory = new Panel();
pnlProductCategory.appendChild(lblProductCategory);
pnlProductCategory.appendChild(pickProductCategory);
pnlProductCategory.setAlign("right");
// //
Panel pnlWarehouse = new Panel();
pnlWarehouse.appendChild(lblWarehouse);
pnlWarehouse.appendChild(pickWarehouse);
pnlWarehouse.setAlign("right");
Panel pnlVendor = new Panel();
pnlVendor.appendChild(lblVendor);
pnlVendor.appendChild(fieldVendor);
pnlVendor.setAlign("right");
Panel pnlButton = new Panel();
pnlButton.appendChild(m_InfoPAttributeButton);
pnlButton.setAlign("left");
Vbox vbox1 = new Vbox();
vbox1.appendChild(pnlValue);
vbox1.appendChild(pnlName);
Vbox vbox2 = new Vbox();
vbox2.appendChild(pnlUPC);
vbox2.appendChild(pnlSKU);
Vbox vbox3 = new Vbox();
vbox3.appendChild(pnlWarehouse);
vbox3.appendChild(pnlVendor);
Vbox vbox4 = new Vbox();
vbox4.appendChild(pnlPriceList);
vbox4.appendChild(pnlProductCategory); // Elaine 2008/11/21
Vbox vbox5 = new Vbox();
vbox5.appendChild(pnlButton);
Hbox parameterPanel = new Hbox();
parameterPanel.appendChild(vbox1);
parameterPanel.appendChild(vbox2);
parameterPanel.appendChild(vbox3);
parameterPanel.appendChild(vbox4);
parameterPanel.appendChild(vbox5);
// Product Attribute Instance // Product Attribute Instance
m_PAttributeButton = confirmPanel.createButton(ConfirmPanel.A_PATTRIBUTE); m_PAttributeButton = confirmPanel.createButton(ConfirmPanel.A_PATTRIBUTE);
@ -458,13 +428,14 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
Panel mainPanel = new Panel(); Panel mainPanel = new Panel();
mainPanel.setWidth("100%"); mainPanel.setWidth("100%");
mainPanel.appendChild(parameterPanel); mainPanel.appendChild(grid);
mainPanel.appendChild(new Separator()); mainPanel.appendChild(new Separator());
mainPanel.appendChild(borderlayout); mainPanel.appendChild(borderlayout);
mainPanel.appendChild(new Separator()); mainPanel.appendChild(new Separator());
mainPanel.appendChild(confirmPanel); mainPanel.appendChild(confirmPanel);
this.appendChild(mainPanel); this.appendChild(mainPanel);
this.setClosable(true);
this.setBorder("normal"); this.setBorder("normal");
this.setWidth("1000px"); this.setWidth("1000px");
@ -651,7 +622,6 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {
KeyNamePair kn = new KeyNamePair (rs.getInt(1), rs.getString(2));
pickPriceList.appendItem(rs.getString(2),new Integer(rs.getInt(1))); pickPriceList.appendItem(rs.getString(2),new Integer(rs.getInt(1)));
} }
rs.close(); rs.close();
@ -669,8 +639,6 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {
KeyNamePair kn = new KeyNamePair
(rs.getInt("M_Warehouse_ID"), rs.getString("ValueName"));
pickWarehouse.appendItem(rs.getString("ValueName"), new Integer(rs.getInt("M_Warehouse_ID"))); pickWarehouse.appendItem(rs.getString("ValueName"), new Integer(rs.getInt("M_Warehouse_ID")));
} }
rs.close(); rs.close();
@ -841,7 +809,7 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
// => Vendor // => Vendor
String vendor = fieldVendor.getText().toUpperCase(); String vendor = fieldVendor.getText().toUpperCase();
if (!(vendor.equals("") || vendor.equals("%"))) if (!(vendor.equals("") || vendor.equals("%")))
where.append(" AND UPPER(bp.Name) LIKE ?"); where.append(" AND UPPER(bp.Name) LIKE ? AND ppo.IsCurrentVendor='Y'"); // Elaine 2008/12/16
return where.toString(); return where.toString();
} // getSQLWhere } // getSQLWhere
@ -967,12 +935,14 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
*/ */
protected void showHistory() protected void showHistory()
{ {
/*log.info(""); log.info("");
Integer M_Product_ID = getSelectedRowKey(); Integer M_Product_ID = getSelectedRowKey();
if (M_Product_ID == null) if (M_Product_ID == null)
return; return;
KeyNamePair kn = (KeyNamePair)pickWarehouse.getSelectedItem(); int M_Warehouse_ID = 0;
int M_Warehouse_ID = kn.getKey(); ListItem listitem = pickWarehouse.getSelectedItem();
if (listitem != null)
M_Warehouse_ID = (Integer)listitem.getValue();
int M_AttributeSetInstance_ID = m_M_AttributeSetInstance_ID; int M_AttributeSetInstance_ID = m_M_AttributeSetInstance_ID;
if (m_M_AttributeSetInstance_ID < -1) // not selected if (m_M_AttributeSetInstance_ID < -1) // not selected
M_AttributeSetInstance_ID = 0; M_AttributeSetInstance_ID = 0;
@ -980,7 +950,7 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
InvoiceHistory ih = new InvoiceHistory (this, 0, InvoiceHistory ih = new InvoiceHistory (this, 0,
M_Product_ID.intValue(), M_Warehouse_ID, M_AttributeSetInstance_ID); M_Product_ID.intValue(), M_Warehouse_ID, M_AttributeSetInstance_ID);
ih.setVisible(true); ih.setVisible(true);
ih = null;*/ ih = null;
} // showHistory } // showHistory
/** /**
@ -993,6 +963,25 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
return true; return true;
} // hasHistory } // hasHistory
// Elaine 2008/12/16
/**
* Zoom
*/
public void zoom()
{
log.info("");
Integer M_Product_ID = getSelectedRowKey();
if (M_Product_ID == null)
return;
MQuery query = new MQuery("M_Product");
query.addRestriction("M_Product_ID", MQuery.EQUAL, M_Product_ID);
query.setRecordCount(1);
int AD_WindowNo = getAD_Window_ID("M_Product", true); // SO
AEnv.zoom (AD_WindowNo, query);
} // zoom
//
/** /**
* Has Zoom * Has Zoom
* @return (has zoom) * @return (has zoom)
@ -1067,7 +1056,6 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
{ {
final ColumnInfo[] frieLayout = { final ColumnInfo[] frieLayout = {
new ColumnInfo(" ", "p.M_Product_ID", IDColumn.class), new ColumnInfo(" ", "p.M_Product_ID", IDColumn.class),
// new Info_Column(Msg.translate(Env.getCtx(), "Value"), "p.Value", String.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "p.Name", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "p.Name", String.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "bomQtyAvailable(p.M_Product_ID,?,0) AS QtyAvailable", Double.class, true, true, null), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "bomQtyAvailable(p.M_Product_ID,?,0) AS QtyAvailable", Double.class, true, true, null),
new ColumnInfo(Msg.translate(Env.getCtx(), "PriceList"), "bomPriceList(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceList", BigDecimal.class), new ColumnInfo(Msg.translate(Env.getCtx(), "PriceList"), "bomPriceList(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceList", BigDecimal.class),
@ -1140,6 +1128,13 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
{ {
Component component = e.getTarget(); Component component = e.getTarget();
// Elaine 2008/12/16
// don't requery if fieldValue and fieldName are empty
if ((e.getTarget() == pickWarehouse || e.getTarget() == pickPriceList)
&& (fieldValue.getText().length() == 0 && fieldName.getText().length() == 0))
return;
//
if(component == m_InfoPAttributeButton) if(component == m_InfoPAttributeButton)
{ {
cmd_InfoPAttribute(); cmd_InfoPAttribute();
@ -1343,13 +1338,9 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
rs = null; pstmt = null; rs = null; pstmt = null;
} }
// Table // Table
m_tableAtp = ListboxFactory.newDataTable(); ListModelTable model = new ListModelTable(data);
m_tableAtp.setMultiSelection(false); m_tableAtp.setData(model, columnNames);
m_tableAtp.getModel().setNoColumns(columnNames.size());
for(int i = 0; i < columnNames.size(); i++)
m_tableAtp.addColumn(columnNames.get(i));
// //
m_tableAtp.setColumnClass(0, Timestamp.class, true); // Date m_tableAtp.setColumnClass(0, Timestamp.class, true); // Date
m_tableAtp.setColumnClass(1, Double.class, true); // Quantity m_tableAtp.setColumnClass(1, Double.class, true); // Quantity
@ -1362,17 +1353,6 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
m_tableAtp.setColumnClass(8, String.class, true); // Warehouse m_tableAtp.setColumnClass(8, String.class, true); // Warehouse
// //
m_tableAtp.autoSize(); m_tableAtp.autoSize();
m_tableAtp.setRowCount(data.size());
for(int i = 0; i < data.size(); i++)
{
Vector<Object> record = data.get(i);
for(int j = 0; j < record.size(); j++)
{
Object value = record.get(j);
m_tableAtp.getModel().setDataAt(value, i, j);
}
}
} // initAtpTab } // initAtpTab
// //

View File

@ -0,0 +1,736 @@
/******************************************************************************
* Copyright (C) 2008 Elaine Tan
* Copyright (C) 2008 Idalica *
* 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.panel;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Vector;
import java.util.logging.Level;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListModelTable;
import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.Tab;
import org.adempiere.webui.component.Tabbox;
import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.Tabpanels;
import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.component.WListbox;
import org.adempiere.webui.component.Window;
import org.compiere.model.MDocType;
import org.compiere.model.MPriceList;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zkex.zul.Borderlayout;
import org.zkoss.zkex.zul.Center;
import org.zkoss.zkex.zul.North;
import org.zkoss.zkex.zul.South;
/**
* Price History for BPartner/Product
* This class is based on org.compiere.apps.search.InvoiceHistory written by Jorg Janke
* @author <a href="mailto:elaine.tan@idalica.com">Elaine</a>
*/
public class InvoiceHistory extends Window implements EventListener
{
private static final long serialVersionUID = 1L;
/**
* Show History
* @param C_BPartner_ID partner
* @param M_Product_ID product
* @param M_Warehouse_ID warehouse
* @param M_AttributeSetInstance_ID ASI
*/
public InvoiceHistory (Window parent,
int C_BPartner_ID, int M_Product_ID, int M_Warehouse_ID, int M_AttributeSetInstance_ID)
{
super();
setTitle(Msg.getMsg(Env.getCtx(), "PriceHistory"));
log.config("C_BPartner_ID=" + C_BPartner_ID
+ ", M_Product_ID=" + M_Product_ID
+ ", M_Warehouse_ID=" + M_Warehouse_ID
+ ", M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID);
m_C_BPartner_ID = C_BPartner_ID;
m_M_Product_ID = M_Product_ID;
m_M_Warehouse_ID = M_Warehouse_ID;
m_M_AttributeSetInstance_ID = M_AttributeSetInstance_ID;
try
{
jbInit();
dynInit();
}
catch(Exception ex)
{
log.log(Level.SEVERE, "", ex);
}
AEnv.showCenterWindow(parent, this);
} // InvoiceHistory
private int m_C_BPartner_ID;
private int m_M_Product_ID;
private int m_M_Warehouse_ID;
private int m_M_AttributeSetInstance_ID;
/** Logger */
private static CLogger log = CLogger.getCLogger(InvoiceHistory.class);
private Label label = new Label();
//
private ConfirmPanel confirmPanel = new ConfirmPanel();
private Tabbox tabbox = new Tabbox();
//
private Tabpanel pricePane = new Tabpanel();
private WListbox m_tablePrice = ListboxFactory.newDataTable();
private ListModelTable m_modelPrice = null;
private Tabpanel reservedPane = new Tabpanel();
private WListbox m_tableReserved = ListboxFactory.newDataTable();
private ListModelTable m_modelReserved = null;
private Tabpanel orderedPane = new Tabpanel();
private WListbox m_tableOrdered = ListboxFactory.newDataTable();
private ListModelTable m_modelOrdered = null;
private Tabpanel unconfirmedPane = new Tabpanel();
private WListbox m_tableUnconfirmed = ListboxFactory.newDataTable();
private ListModelTable m_modelUnconfirmed = null;
private Tabpanel atpPane = new Tabpanel();
private WListbox m_tableAtp = ListboxFactory.newDataTable();
private ListModelTable m_modelAtp = null;
/**
* Ststic Init
*/
void jbInit() throws Exception
{
label.setText("Label");
Tabs tabs = new Tabs();
tabbox.appendChild(tabs);
Tabpanels tabpanels = new Tabpanels();
tabbox.appendChild(tabpanels);
tabs.appendChild(new Tab(Msg.getMsg(Env.getCtx(), "PriceHistory")));
tabs.appendChild(new Tab(Msg.translate(Env.getCtx(), "QtyReserved")));
tabs.appendChild(new Tab(Msg.translate(Env.getCtx(), "QtyOrdered")));
tabs.appendChild(new Tab(Msg.getMsg(Env.getCtx(), "QtyUnconfirmed")));
if (m_M_Product_ID != 0)
tabs.appendChild(new Tab(Msg.getMsg(Env.getCtx(), "ATP")));
pricePane.setHeight("100%");
pricePane.appendChild(m_tablePrice);
tabpanels.appendChild(pricePane);
reservedPane.setHeight("100%");
reservedPane.appendChild(m_tableReserved);
tabpanels.appendChild(reservedPane);
orderedPane.setHeight("100%");
orderedPane.appendChild(m_tableOrdered);
tabpanels.appendChild(orderedPane);
unconfirmedPane.setHeight("100%");
unconfirmedPane.appendChild(m_tableUnconfirmed);
tabpanels.appendChild(unconfirmedPane);
if (m_M_Product_ID != 0)
{
atpPane.setHeight("100%");
atpPane.appendChild(m_tableAtp);
tabpanels.appendChild(atpPane);
}
tabbox.setSelectedIndex(0);
tabbox.addEventListener(Events.ON_SELECT, this);
confirmPanel.addActionListener(this);
Borderlayout borderlayout = new Borderlayout();
borderlayout.setWidth("700px");
borderlayout.setHeight("400px");
borderlayout.setStyle("border: none; position: relative");
this.appendChild(borderlayout);
North north = new North();
north.setStyle("border: none");
borderlayout.appendChild(north);
north.appendChild(label);
Center center = new Center();
center.setStyle("border: none");
center.setAutoscroll(true);
center.setFlex(true);
borderlayout.appendChild(center);
center.appendChild(tabbox);
South south = new South();
south.setStyle("border: none");
borderlayout.appendChild(south);
south.appendChild(confirmPanel);
} // jbInit
/**
* Dynamic Init for Price Tab
*/
private boolean dynInit()
{
// Header
Vector<String> columnNames = new Vector<String>();
columnNames.add(Msg.translate(Env.getCtx(), m_C_BPartner_ID == 0 ? "C_BPartner_ID" : "M_Product_ID"));
columnNames.add(Msg.translate(Env.getCtx(), "PriceActual"));
columnNames.add(Msg.translate(Env.getCtx(), "QtyInvoiced"));
columnNames.add(Msg.translate(Env.getCtx(), "Discount"));
columnNames.add(Msg.translate(Env.getCtx(), "DocumentNo"));
columnNames.add(Msg.translate(Env.getCtx(), "DateInvoiced"));
columnNames.add(Msg.translate(Env.getCtx(), "AD_Org_ID"));
// Fill Data
Vector<Vector<Object>> data = null;
if (m_C_BPartner_ID == 0)
data = queryBPartner(); // BPartner of Product
else
data = queryProduct(); // Product of BPartner
// Table
m_modelPrice = new ListModelTable(data);
m_tablePrice.setData(m_modelPrice, columnNames);
//
m_tablePrice.setColumnClass(0, String.class, true); // Product/Partner
m_tablePrice.setColumnClass(1, Double.class, true); // Price
m_tablePrice.setColumnClass(2, Double.class, true); // Quantity
m_tablePrice.setColumnClass(3, BigDecimal.class, true); // Discount (%) to limit precision
m_tablePrice.setColumnClass(4, String.class, true); // DocNo
m_tablePrice.setColumnClass(5, Timestamp.class, true); // Date
m_tablePrice.setColumnClass(6, String.class, true); // Org
//
m_tablePrice.autoSize();
//
return data.size() != 0;
} // dynInit
/**
* Get Info for Product for given Business Parner
*/
private Vector<Vector<Object>> queryProduct ()
{
String sql = "SELECT p.Name,l.PriceActual,l.PriceList,l.QtyInvoiced," // 1,2,3,4
+ "i.DateInvoiced,dt.PrintName || ' ' || i.DocumentNo As DocumentNo," // 5,6
+ "o.Name, " // 7
+ "NULL, i.M_PriceList_ID " // 8,9
+ "FROM C_Invoice i"
+ " INNER JOIN C_InvoiceLine l ON (i.C_Invoice_ID=l.C_Invoice_ID)"
+ " INNER JOIN C_DocType dt ON (i.C_DocType_ID=dt.C_DocType_ID)"
+ " INNER JOIN AD_Org o ON (i.AD_Org_ID=o.AD_Org_ID)"
+ " INNER JOIN M_Product p ON (l.M_Product_ID=p.M_Product_ID) "
+ "WHERE i.C_BPartner_ID=? "
+ "ORDER BY i.DateInvoiced DESC";
Vector<Vector<Object>> data = fillTable (sql, m_C_BPartner_ID);
sql = "SELECT Name from C_BPartner WHERE C_BPartner_ID=?";
fillLabel (sql, m_C_BPartner_ID);
return data;
} // queryProduct
/**
* Get Info for Business Partners for given Product
*/
private Vector<Vector<Object>> queryBPartner ()
{
String sql = "SELECT bp.Name,l.PriceActual,l.PriceList,l.QtyInvoiced," // 1,2,3,4
+ "i.DateInvoiced,dt.PrintName || ' ' || i.DocumentNo As DocumentNo," // 5,6
+ "o.Name," // 7
+ "NULL, i.M_PriceList_ID" // 8,9
+ " FROM C_Invoice i"
+ " INNER JOIN C_InvoiceLine l ON (i.C_Invoice_ID=l.C_Invoice_ID)"
+ " INNER JOIN C_DocType dt ON (i.C_DocType_ID=dt.C_DocType_ID)"
+ " INNER JOIN AD_Org o ON (i.AD_Org_ID=o.AD_Org_ID)"
+ " INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID) "
+ "WHERE l.M_Product_ID=? "
+ "ORDER BY i.DateInvoiced DESC";
Vector<Vector<Object>> data = fillTable (sql, m_M_Product_ID);
sql = "SELECT Name from M_Product WHERE M_Product_ID=?";
fillLabel (sql, m_M_Product_ID);
return data;
} // qyeryBPartner
/**
* Fill Table
*/
private Vector<Vector<Object>> fillTable (String sql, int parameter)
{
log.fine(sql + "; Parameter=" + parameter);
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, parameter);
rs = pstmt.executeQuery();
while (rs.next())
{
Vector<Object> line = new Vector<Object>(6);
// 0-Name, 1-PriceActual, 2-QtyInvoiced, 3-Discount, 4-DocumentNo, 5-DateInvoiced
line.add(rs.getString(1)); // Name
line.add(rs.getBigDecimal(2)); // Price
line.add(new Double(rs.getDouble(4))); // Qty
BigDecimal discountBD = rs.getBigDecimal(8);
if (discountBD == null) {
double priceList = rs.getDouble(3);
double priceActual = rs.getDouble(2);
if (priceList != 0) {
discountBD = new BigDecimal((priceList - priceActual)/priceList * 100);
// Rounding:
int precision = MPriceList.getStandardPrecision(Env.getCtx(), rs.getInt(9));
if (discountBD.scale() > precision)
discountBD = discountBD.setScale(precision, RoundingMode.HALF_UP);
}
else
discountBD = Env.ZERO;
}
line.add(discountBD); // Discount
line.add(rs.getString(6)); // DocNo
line.add(rs.getTimestamp(5)); // Date
line.add(rs.getString(7)); // Org/Warehouse
data.add(line);
}
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql, e);
}
finally {
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
log.fine("#" + data.size());
return data;
} // fillTable
/**
* Set Label
* to product or bp name
*/
private void fillLabel (String sql, int parameter)
{
log.fine(sql + "; Parameter=" + parameter);
String retValue = DB.getSQLValueString(null, sql, parameter);
if (retValue != null)
label.setText(retValue);
} // fillLabel
public void onEvent(Event e) throws Exception {
Component component = e.getTarget();
if (component.equals(confirmPanel.getButton(ConfirmPanel.A_OK)))
dispose();
else if(component instanceof Tab)
{
if (tabbox.getSelectedIndex() == 1)
initReservedOrderedTab(true);
else if (tabbox.getSelectedIndex() == 2)
initReservedOrderedTab(false);
else if (tabbox.getSelectedIndex() == 3)
initUnconfirmedTab();
else if (tabbox.getSelectedIndex() == 4)
initAtpTab();
}
}
/**
* Query Reserved/Ordered
* @param reserved po/so
*/
private void initReservedOrderedTab (boolean reserved)
{
// Done already
if (reserved && m_modelReserved != null)
return;
if (!reserved && m_modelOrdered != null)
return;
// Header
Vector<String> columnNames = new Vector<String>();
columnNames.add(Msg.translate(Env.getCtx(), m_C_BPartner_ID == 0 ? "C_BPartner_ID" : "M_Product_ID"));
columnNames.add(Msg.translate(Env.getCtx(), "PriceActual"));
columnNames.add(Msg.translate(Env.getCtx(), reserved ? "QtyReserved" : "QtyOrdered"));
columnNames.add(Msg.translate(Env.getCtx(), "Discount"));
columnNames.add(Msg.translate(Env.getCtx(), "DocumentNo"));
columnNames.add(Msg.translate(Env.getCtx(), "DateOrdered"));
columnNames.add(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));
// Fill Data
Vector<Vector<Object>> data = null;
if (m_C_BPartner_ID == 0)
{
String sql = "SELECT bp.Name, ol.PriceActual,ol.PriceList,ol.QtyReserved,"
+ "o.DateOrdered,dt.PrintName || ' ' || o.DocumentNo As DocumentNo, "
+ "w.Name,"
+ "ol.Discount, 0 " // 8,9=M_PriceList_ID
+ "FROM C_Order o"
+ " INNER JOIN C_OrderLine ol ON (o.C_Order_ID=ol.C_Order_ID)"
+ " INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID)"
+ " INNER JOIN M_Warehouse w ON (ol.M_Warehouse_ID=w.M_Warehouse_ID)"
+ " INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) "
+ "WHERE ol.QtyReserved<>0"
+ " AND ol.M_Product_ID=?"
+ " AND o.IsSOTrx=" + (reserved ? "'Y'" : "'N'")
+ " ORDER BY o.DateOrdered";
data = fillTable (sql, m_M_Product_ID); // Product By BPartner
}
else
{
String sql = "SELECT p.Name, ol.PriceActual,ol.PriceList,ol.QtyReserved,"
+ "o.DateOrdered,dt.PrintName || ' ' || o.DocumentNo As DocumentNo, "
+ "w.Name,"
+ "ol.Discount, 0 " // 8,9=M_PriceList_ID
+ "FROM C_Order o"
+ " INNER JOIN C_OrderLine ol ON (o.C_Order_ID=ol.C_Order_ID)"
+ " INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID)"
+ " INNER JOIN M_Warehouse w ON (ol.M_Warehouse_ID=w.M_Warehouse_ID)"
+ " INNER JOIN M_Product p ON (ol.M_Product_ID=p.M_Product_ID) "
+ "WHERE ol.QtyReserved<>0"
+ " AND o.C_BPartner_ID=?"
+ " AND o.IsSOTrx=" + (reserved ? "'Y'" : "'N'")
+ " ORDER BY o.DateOrdered";
data = fillTable (sql, m_C_BPartner_ID);// Product of BP
}
// Table
if (reserved)
{
m_modelReserved = new ListModelTable(data);
m_tableReserved.setData(m_modelReserved, columnNames);
//
m_tableReserved.setColumnClass(0, String.class, true); // Product/Partner
m_tableReserved.setColumnClass(1, BigDecimal.class, true); // Price
m_tableReserved.setColumnClass(2, Double.class, true); // Quantity
m_tableReserved.setColumnClass(3, BigDecimal.class, true); // Discount (%)
m_tableReserved.setColumnClass(4, String.class, true); // DocNo
m_tableReserved.setColumnClass(5, Timestamp.class, true); // Date
m_tableReserved.setColumnClass(6, String.class, true); // Warehouse
//
m_tableReserved.autoSize();
}
else
{
m_modelOrdered = new ListModelTable(data);
m_tableOrdered.setData(m_modelOrdered, columnNames);
//
m_tableOrdered.setColumnClass(0, String.class, true); // Product/Partner
m_tableOrdered.setColumnClass(1, BigDecimal.class, true); // Price
m_tableOrdered.setColumnClass(2, Double.class, true); // Quantity
m_tableOrdered.setColumnClass(3, BigDecimal.class, true); // Discount (%)
m_tableOrdered.setColumnClass(4, String.class, true); // DocNo
m_tableOrdered.setColumnClass(5, Timestamp.class, true); // Date
m_tableOrdered.setColumnClass(6, String.class, true); // Warehouse
//
m_tableOrdered.autoSize();
}
} // initReservedOrderedTab
/**
* Query Unconfirmed
*/
private void initUnconfirmedTab ()
{
// Done already
if (m_modelUnconfirmed != null)
return;
// Header
Vector<String> columnNames = new Vector<String>();
columnNames.add(Msg.translate(Env.getCtx(), m_C_BPartner_ID == 0 ? "C_BPartner_ID" : "M_Product_ID"));
columnNames.add(Msg.translate(Env.getCtx(), "MovementQty"));
columnNames.add(Msg.translate(Env.getCtx(), "MovementDate"));
columnNames.add(Msg.translate(Env.getCtx(), "IsSOTrx"));
columnNames.add(Msg.translate(Env.getCtx(), "DocumentNo"));
columnNames.add(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));
// Fill Data
String sql = null;
int parameter = 0;
if (m_C_BPartner_ID == 0)
{
sql = "SELECT bp.Name,"
+ " CASE WHEN io.IsSOTrx='Y' THEN iol.MovementQty*-1 ELSE iol.MovementQty END AS MovementQty,"
+ " io.MovementDate,io.IsSOTrx,"
+ " dt.PrintName || ' ' || io.DocumentNo As DocumentNo,"
+ " w.Name "
+ "FROM M_InOutLine iol"
+ " INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID)"
+ " INNER JOIN C_BPartner bp ON (io.C_BPartner_ID=bp.C_BPartner_ID)"
+ " INNER JOIN C_DocType dt ON (io.C_DocType_ID=dt.C_DocType_ID)"
+ " INNER JOIN M_Warehouse w ON (io.M_Warehouse_ID=w.M_Warehouse_ID)"
+ " INNER JOIN M_InOutLineConfirm lc ON (iol.M_InOutLine_ID=lc.M_InOutLine_ID) "
+ "WHERE iol.M_Product_ID=?"
+ " AND lc.Processed='N' "
+ "ORDER BY io.MovementDate,io.IsSOTrx";
parameter = m_M_Product_ID;
}
else
{
sql = "SELECT p.Name,"
+ " CASE WHEN io.IsSOTrx='Y' THEN iol.MovementQty*-1 ELSE iol.MovementQty END AS MovementQty,"
+ " io.MovementDate,io.IsSOTrx,"
+ " dt.PrintName || ' ' || io.DocumentNo As DocumentNo,"
+ " w.Name "
+ "FROM M_InOutLine iol"
+ " INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID)"
+ " INNER JOIN M_Product p ON (iol.M_Product_ID=p.M_Product_ID)"
+ " INNER JOIN C_DocType dt ON (io.C_DocType_ID=dt.C_DocType_ID)"
+ " INNER JOIN M_Warehouse w ON (io.M_Warehouse_ID=w.M_Warehouse_ID)"
+ " INNER JOIN M_InOutLineConfirm lc ON (iol.M_InOutLine_ID=lc.M_InOutLine_ID) "
+ "WHERE io.C_BPartner_ID=?"
+ " AND lc.Processed='N' "
+ "ORDER BY io.MovementDate,io.IsSOTrx";
parameter = m_C_BPartner_ID;
}
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, parameter);
rs = pstmt.executeQuery();
while (rs.next())
{
Vector<Object> line = new Vector<Object>(6);
// 1-Name, 2-MovementQty, 3-MovementDate, 4-IsSOTrx, 5-DocumentNo
line.add(rs.getString(1)); // Name
line.add(new Double(rs.getDouble(2))); // Qty
line.add(rs.getTimestamp(3)); // Date
line.add(new Boolean("Y".equals(rs.getString(4)))); // IsSOTrx
line.add(rs.getString(5)); // DocNo
line.add(rs.getString(6)); // Warehouse
data.add(line);
}
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql, e);
}
finally {
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
log.fine("#" + data.size());
// Table
m_modelUnconfirmed = new ListModelTable(data);
m_tableUnconfirmed.setData(m_modelUnconfirmed, columnNames);
//
m_tableUnconfirmed.setColumnClass(0, String.class, true); // Product/Partner
m_tableUnconfirmed.setColumnClass(1, Double.class, true); // MovementQty
m_tableUnconfirmed.setColumnClass(2, Timestamp.class, true); // MovementDate
m_tableUnconfirmed.setColumnClass(3, Boolean.class, true); // IsSOTrx
m_tableUnconfirmed.setColumnClass(4, String.class, true); // DocNo
//
m_tableUnconfirmed.autoSize();
} // initUnconfirmedTab
/**
* Query ATP
*/
private void initAtpTab ()
{
// Done already
if (m_modelAtp != null)
return;
// Header
Vector<String> columnNames = new Vector<String>();
columnNames.add(Msg.translate(Env.getCtx(), "Date"));
columnNames.add(Msg.translate(Env.getCtx(), "QtyOnHand"));
columnNames.add(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
columnNames.add(Msg.translate(Env.getCtx(), "QtyOrdered"));
columnNames.add(Msg.translate(Env.getCtx(), "QtyReserved"));
columnNames.add(Msg.translate(Env.getCtx(), "M_Locator_ID"));
columnNames.add(Msg.translate(Env.getCtx(), "M_AttributeSetInstance_ID"));
columnNames.add(Msg.translate(Env.getCtx(), "DocumentNo"));
columnNames.add(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));
// Fill Storage Data
boolean showDetail = CLogMgt.isLevelFine();
String sql = "SELECT s.QtyOnHand, s.QtyReserved, s.QtyOrdered,"
+ " productAttribute(s.M_AttributeSetInstance_ID), s.M_AttributeSetInstance_ID,";
if (!showDetail)
sql = "SELECT SUM(s.QtyOnHand), SUM(s.QtyReserved), SUM(s.QtyOrdered),"
+ " productAttribute(s.M_AttributeSetInstance_ID), 0,";
sql += " w.Name, l.Value "
+ "FROM M_Storage s"
+ " INNER JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID)"
+ " INNER JOIN M_Warehouse w ON (l.M_Warehouse_ID=w.M_Warehouse_ID) "
+ "WHERE M_Product_ID=?";
if (m_M_Warehouse_ID != 0)
sql += " AND l.M_Warehouse_ID=?";
if (m_M_AttributeSetInstance_ID > 0)
sql += " AND s.M_AttributeSetInstance_ID=?";
sql += " AND (s.QtyOnHand<>0 OR s.QtyReserved<>0 OR s.QtyOrdered<>0)";
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;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, m_M_Product_ID);
if (m_M_Warehouse_ID != 0)
pstmt.setInt(2, m_M_Warehouse_ID);
if (m_M_AttributeSetInstance_ID > 0)
pstmt.setInt(3, m_M_AttributeSetInstance_ID);
rs = pstmt.executeQuery();
while (rs.next())
{
Vector<Object> line = new Vector<Object>(9);
line.add(null); // Date
double qtyOnHand = rs.getDouble(1);
qty += qtyOnHand;
line.add(new Double(qtyOnHand)); // Qty
line.add(null); // BPartner
line.add(new Double(rs.getDouble(3))); // QtyOrdered
line.add(new Double(rs.getDouble(2))); // QtyReserved
line.add(rs.getString(7)); // Locator
String asi = rs.getString(4);
if (showDetail && (asi == null || asi.length() == 0))
asi = "{" + rs.getInt(5) + "}";
line.add(asi); // ASI
line.add(null); // DocumentNo
line.add(rs.getString(6)); // Warehouse
data.add(line);
}
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql, e);
}
finally {
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
// Orders
sql = "SELECT o.DatePromised, ol.QtyReserved,"
+ " productAttribute(ol.M_AttributeSetInstance_ID), ol.M_AttributeSetInstance_ID,"
+ " dt.DocBaseType, bp.Name,"
+ " dt.PrintName || ' ' || o.DocumentNo As DocumentNo, w.Name "
+ "FROM C_Order o"
+ " INNER JOIN C_OrderLine ol ON (o.C_Order_ID=ol.C_Order_ID)"
+ " INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID)"
+ " INNER JOIN M_Warehouse w ON (ol.M_Warehouse_ID=w.M_Warehouse_ID)"
+ " INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) "
+ "WHERE ol.QtyReserved<>0"
+ " AND ol.M_Product_ID=?";
if (m_M_Warehouse_ID != 0)
sql += " AND ol.M_Warehouse_ID=?";
if (m_M_AttributeSetInstance_ID > 0)
sql += " AND ol.M_AttributeSetInstance_ID=?";
sql += " ORDER BY o.DatePromised";
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, m_M_Product_ID);
if (m_M_Warehouse_ID != 0)
pstmt.setInt(2, m_M_Warehouse_ID);
if (m_M_AttributeSetInstance_ID > 0)
pstmt.setInt(3, m_M_AttributeSetInstance_ID);
rs = pstmt.executeQuery();
while (rs.next())
{
Vector<Object> line = new Vector<Object>(9);
line.add(rs.getTimestamp(1)); // Date
double oq = rs.getDouble(2);
String DocBaseType = rs.getString(5);
Double qtyReserved = null;
Double qtyOrdered = null;
if (MDocType.DOCBASETYPE_PurchaseOrder.equals(DocBaseType))
{
qtyOrdered = new Double(oq);
qty += oq;
}
else
{
qtyReserved = new Double(oq);
qty -= oq;
}
line.add(new Double(qty)); // Qty
line.add(rs.getString(6)); // BPartner
line.add(qtyOrdered); // QtyOrdered
line.add(qtyReserved); // QtyReserved
line.add(null); // Locator
String asi = rs.getString(3);
if (showDetail && (asi == null || asi.length() == 0))
asi = "{" + rs.getInt(4) + "}";
line.add(asi); // ASI
line.add(rs.getString(7)); // DocumentNo
line.add(rs.getString(8)); // Warehouse
data.add(line);
}
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql, e);
}
finally {
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
// Table
m_modelAtp = new ListModelTable(data);
m_tableAtp.setData(m_modelAtp, columnNames);
//
m_tableAtp.setColumnClass(0, Timestamp.class, true); // Date
m_tableAtp.setColumnClass(1, Double.class, true); // Quantity
m_tableAtp.setColumnClass(2, String.class, true); // Partner
m_tableAtp.setColumnClass(3, Double.class, true); // Quantity
m_tableAtp.setColumnClass(4, Double.class, true); // Quantity
m_tableAtp.setColumnClass(5, String.class, true); // Locator
m_tableAtp.setColumnClass(6, String.class, true); // ASI
m_tableAtp.setColumnClass(7, String.class, true); // DocNo
m_tableAtp.setColumnClass(8, String.class, true); // Warehouse
//
m_tableAtp.autoSize();
} // initAtpTab
} // InvoiceHistory

View File

@ -17,15 +17,17 @@
package org.adempiere.webui.panel; package org.adempiere.webui.panel;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.*; import java.util.Date;
import java.util.logging.*; import java.util.TimeZone;
import java.util.logging.Level;
import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.window.InfoSchedule; import org.adempiere.webui.window.InfoSchedule;
import org.adempiere.webui.window.WAssignmentDialog; import org.adempiere.webui.window.WAssignmentDialog;
import org.compiere.model.MResourceAssignment; import org.compiere.model.MResourceAssignment;
import org.compiere.util.*; import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.zkforge.timeline.Bandinfo; import org.zkforge.timeline.Bandinfo;
import org.zkforge.timeline.Timeline; import org.zkforge.timeline.Timeline;
import org.zkforge.timeline.event.BandScrollEvent; import org.zkforge.timeline.event.BandScrollEvent;
@ -153,8 +155,12 @@ public class WSchedule extends Panel implements EventListener
public void recreate (int S_Resource_ID, Date date) public void recreate (int S_Resource_ID, Date date)
{ {
hourBand.setDate(date); hourBand.setDate(date);
if (m_center == null || date.getTime() != m_center.getTime()) // Elaine 2008/12/12
hourBand.scrollToCenter(date); dayBand.setDate(date);
mthBand.setDate(date);
// if (m_center == null || date.getTime() != m_center.getTime())
// hourBand.scrollToCenter(date);
//
String feedUrl = "timeline?S_Resource_ID=" + S_Resource_ID + "&date=" + DateFormat.getInstance().format(date) String feedUrl = "timeline?S_Resource_ID=" + S_Resource_ID + "&date=" + DateFormat.getInstance().format(date)
+ "&uuid=" + button.getUuid() + "&tlid=" + timeLine.getUuid(); + "&uuid=" + button.getUuid() + "&tlid=" + timeLine.getUuid();

View File

@ -17,15 +17,21 @@
package org.adempiere.webui.window; package org.adempiere.webui.window;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.*; import java.sql.PreparedStatement;
import java.util.*; import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.logging.*; import java.util.GregorianCalendar;
import java.util.logging.Level;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.DatetimeBox;
import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem; import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Listbox;
@ -34,12 +40,21 @@ import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.panel.StatusBarPanel; import org.adempiere.webui.panel.StatusBarPanel;
import org.adempiere.webui.panel.WSchedule; import org.adempiere.webui.panel.WSchedule;
import org.compiere.model.*; import org.compiere.model.MAssignmentSlot;
import org.compiere.util.*; import org.compiere.model.MResourceAssignment;
import org.compiere.model.MRole;
import org.compiere.model.ScheduleUtil;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.compiere.util.TimeUtil;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Vbox; import org.zkoss.zul.Vbox;
@ -51,8 +66,12 @@ import org.zkoss.zul.Vbox;
* *
* Zk Port * Zk Port
* @author Low Heng Sin * @author Low Heng Sin
*
* Zk Port
* @author Elaine
* @version InfoSchedule.java Adempiere Swing UI 3.4.1
*/ */
public class InfoSchedule extends Window implements EventListener //, ChangeListener public class InfoSchedule extends Window implements EventListener
{ {
/** /**
* Constructor * Constructor
@ -68,7 +87,8 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
else else
setAttribute("mode", "overlapped"); setAttribute("mode", "overlapped");
this.setWidth("600px"); this.setWidth("600px");
this.setHeight("600px"); // this.setHeight("600px");
this.setClosable(true);
this.setBorder("normal"); this.setBorder("normal");
this.setStyle("position: absolute"); this.setStyle("position: absolute");
if (mAssignment == null) if (mAssignment == null)
@ -113,12 +133,17 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
private static CLogger log = CLogger.getCLogger(InfoSchedule.class); private static CLogger log = CLogger.getCLogger(InfoSchedule.class);
private Vbox mainLayout = new Vbox(); private Vbox mainLayout = new Vbox();
private Grid parameterPanel = new Grid(); private Grid parameterPanel = GridFactory.newGridLayout();
private Label labelResourceType = new Label(); private Label labelResourceType = new Label();
private Listbox fieldResourceType = new Listbox(); private Listbox fieldResourceType = new Listbox();
private Label labelResource = new Label(); private Label labelResource = new Label();
private Listbox fieldResource = new Listbox(); private Listbox fieldResource = new Listbox();
// Elaine 2008/12/12
private Button bPrevious = new Button();
private Label labelDate = new Label(); private Label labelDate = new Label();
private DatetimeBox fieldDate = new DatetimeBox();
private Button bNext = new Button();
//
private WSchedule schedulePane = new WSchedule(this); private WSchedule schedulePane = new WSchedule(this);
private StatusBarPanel statusBar = new StatusBarPanel(); private StatusBarPanel statusBar = new StatusBarPanel();
private ConfirmPanel confirmPanel = new ConfirmPanel(true); private ConfirmPanel confirmPanel = new ConfirmPanel(true);
@ -137,6 +162,11 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
labelResource.setValue(Msg.translate(Env.getCtx(), "S_Resource_ID")); labelResource.setValue(Msg.translate(Env.getCtx(), "S_Resource_ID"));
labelDate.setValue(Msg.translate(Env.getCtx(), "Date")); labelDate.setValue(Msg.translate(Env.getCtx(), "Date"));
// Elaine 2008/12/12
bPrevious.setLabel("<");
bNext.setLabel(">");
//
mainLayout.appendChild(parameterPanel); mainLayout.appendChild(parameterPanel);
Rows rows = new Rows(); Rows rows = new Rows();
@ -151,6 +181,16 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
rows.appendChild(row); rows.appendChild(row);
row.appendChild(labelResource); row.appendChild(labelResource);
row.appendChild(fieldResource); row.appendChild(fieldResource);
// Elaine 2008/12/12
row = new Row();
rows.appendChild(row);
row.appendChild(labelDate);
Hbox hbox = new Hbox();
hbox.appendChild(bPrevious);
hbox.appendChild(fieldDate);
hbox.appendChild(bNext);
row.appendChild(hbox);
// //
mainLayout.appendChild(schedulePane); mainLayout.appendChild(schedulePane);
@ -178,6 +218,15 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
fieldResourceType.addEventListener(Events.ON_SELECT, this); fieldResourceType.addEventListener(Events.ON_SELECT, this);
fieldResource.addEventListener(Events.ON_SELECT, this); fieldResource.addEventListener(Events.ON_SELECT, this);
// Date - Elaine 2008/12/12
fieldDate.setValue(m_dateFrom);
fieldDate.getDatebox().addEventListener(Events.ON_BLUR, this);
fieldDate.getTimebox().addEventListener(Events.ON_BLUR, this);
// fieldDate.addEventListener(Events.ON_BLUR, this);
bPrevious.addEventListener(Events.ON_CLICK, this);
bNext.addEventListener(Events.ON_CLICK, this);
//
// //
confirmPanel.addActionListener(Events.ON_CLICK, this); confirmPanel.addActionListener(Events.ON_CLICK, this);
if (createNew) { if (createNew) {
@ -322,8 +371,12 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
KeyNamePair pp = new KeyNamePair((Integer)listItem.getValue(), listItem.getLabel()); KeyNamePair pp = new KeyNamePair((Integer)listItem.getValue(), listItem.getLabel());
int S_Resource_ID = pp.getKey(); int S_Resource_ID = pp.getKey();
m_mAssignment.setS_Resource_ID(S_Resource_ID); m_mAssignment.setS_Resource_ID(S_Resource_ID);
// Date date = fieldDate.getValue();
Date date = m_dateFrom; // Elaine 2008/12/12
Date date = fieldDate.getValue();
if (date == null) date = new Timestamp(System.currentTimeMillis());
// Date date = m_dateFrom;
//
// Set Info // Set Info
m_loading = true; m_loading = true;
@ -379,12 +432,45 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
fillResource(); fillResource();
displayCalendar(); displayCalendar();
} }
// Elaine 2008/12/12
else if (event.getTarget()== fieldResource
|| event.getTarget() == fieldDate.getDatebox()
|| event.getTarget() == fieldDate.getTimebox())
displayCalendar();
//
else if (event.getTarget() == bPrevious)
adjustDate(-1);
else if (event.getTarget() == bNext)
adjustDate(+1);
// //
else if (event.getTarget().getId().equals("New")) else if (event.getTarget().getId().equals("New"))
doAdd(); doAdd();
// //
} }
// Elaine 2008/12/12
/**
* Adjust Date
* @param diff difference
*/
private void adjustDate (int diff)
{
Date date = fieldDate.getValue();
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(date);
// if (timePane.getSelectedIndex() == 0)
cal.add(java.util.Calendar.DAY_OF_YEAR, diff);
// else if (timePane.getSelectedIndex() == 1)
// cal.add(java.util.Calendar.WEEK_OF_YEAR, diff);
// else
// cal.add(java.util.Calendar.MONTH, diff);
//
fieldDate.setValue(new Timestamp(cal.getTimeInMillis()));
displayCalendar ();
} // adjustDate
//
private void doAdd() { private void doAdd() {
ListItem listItem = fieldResource.getSelectedItem(); ListItem listItem = fieldResource.getSelectedItem();
@ -461,6 +547,7 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
*/ */
public void dateCallback(Date date) { public void dateCallback(Date date) {
m_dateFrom = new Timestamp(date.getTime()); m_dateFrom = new Timestamp(date.getTime());
fieldDate.setValue(m_dateFrom); // Elaine 2008/12/15
} }