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.util.Date;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Timebox;
@ -127,4 +126,20 @@ public class DatetimeBox extends Panel {
public void setDateFormat(SimpleDateFormat dateFormat) {
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();
}
/**
*
* @return decimalBox
*/
public Decimalbox getDecimalbox()
{
return decimalBox;
}
}

View File

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

View File

@ -26,8 +26,11 @@ import java.util.logging.Level;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Button;
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.VerticalBox;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WSearchEditor;
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.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Div;
import org.zkoss.zul.Separator;
/**
@ -52,6 +55,10 @@ import org.zkoss.zul.Separator;
*
* @author Niraj Sohun
* Aug 06, 2007
*
* Zk Port
* @author Elaine
* @version InfoAssignment.java Adempiere Swing UI 3.4.1
*/
public class InfoAssignmentPanel extends InfoPanel implements EventListener, ValueChangeListener
@ -116,13 +123,7 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
setStatusDB(Integer.toString(no));
// AutoQuery
// if (value != null && value.length() > 0)
// executeQuery();
p_loadedOK = true;
//AEnv.positionCenterWindow(frame, this);
} // InfoAssignmentPanel
/**
@ -166,44 +167,46 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val
private void statInit()
{
VerticalBox boxResourceType = new VerticalBox();
boxResourceType.appendChild(fieldResourceType.getLabel());
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();
fieldFrom.setWidth("180px");
fieldTo.setWidth("180px");
bNew.addEventListener(Events.ON_CLICK, this);
mainBox.setWidth("100%");
mainBox.setWidths("30%, 30%, 17%, 17%, 6%");
mainBox.appendChild(boxResourceType);
mainBox.appendChild(boxResource);
mainBox.appendChild(boxFrom);
mainBox.appendChild(boxTo);
mainBox.appendChild(bNew);
Grid grid = GridFactory.newGridLayout();
// 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.setTitle("Info Asset");
this.setClosable(true);
this.setBorder("normal");
this.appendChild(mainBox);
this.appendChild(grid);
this.appendChild(new Separator());
this.appendChild(contentPanel);
this.appendChild(new Separator());

View File

@ -22,30 +22,36 @@ import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import org.adempiere.webui.apps.AEnv;
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.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.WListbox;
import org.adempiere.webui.event.WTableModelEvent;
import org.adempiere.webui.event.WTableModelListener;
import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn;
import org.compiere.model.MQuery;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Intbox;
import org.zkoss.zul.Separator;
import org.zkoss.zul.Vbox;
/**
* Search Business Partner and return selection
* Based on InfoBPartner written by Jorg Janke
* @author Sendy Yagambrum
*
* Zk Port
* @author Elaine
* @version InfoBPartner.java Adempiere Swing UI 3.4.1
*/
@ -70,6 +76,7 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl
private Checkbox checkCustomer;
private Checkbox checkVendor;
private int m_AD_User_ID_index = -1; // Elaine 2008/12/16
private int m_C_BPartner_Location_ID_index = -1;
/** SalesOrder Trx */
@ -110,13 +117,12 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl
*/
public InfoBPartnerPanel(String queryValue,int windowNo, boolean isSOTrx,boolean multipleSelection, String whereClause)
{
super (windowNo, "C_BPartner", "C_BPartner_ID",multipleSelection, whereClause);
setTitle(Msg.getMsg(Env.getCtx(), "InfoBPartner"));
m_isSOTrx = isSOTrx;
initComponents();
init();
initInfo(queryValue, whereClause);
setTitle(Msg.getMsg(Env.getCtx(), "InfoBPartner"));
int no = contentPanel.getRowCount();
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);
checkAND = new Checkbox();
checkAND.addEventListener(Events.ON_CHECK, this);
checkAND.setLabel(Msg.getMsg(Env.getCtx(), "SearchAND"));
checkAND.setChecked(true);
checkAND.addEventListener(Events.ON_CHECK, this);
checkCustomer = new Checkbox();
checkCustomer.setLabel(Msg.getMsg(Env.getCtx(), "OnlyCustomers"));
checkCustomer.setChecked(true);
checkCustomer.addEventListener(Events.ON_CHECK, this);
checkVendor = new Checkbox();
checkVendor.setChecked(true);
checkVendor.setLabel(Msg.getMsg(Env.getCtx(), "OnlyVendors"));
checkVendor.addEventListener(Events.ON_CHECK, this);
contentPanel = new WListbox();
contentPanel.setWidth("99%");
contentPanel.setHeight("400px");
contentPanel.setVflex(true);
@ -177,101 +185,48 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl
private void init()
{
fieldValue.setWidth("100%");
fieldContact.setWidth("100%");
fieldPhone.setWidth("100%");
Panel pnlValue = new Panel();
pnlValue.appendChild(lblValue);
pnlValue.appendChild(fieldValue);
pnlValue.setAlign("right");
fieldName.setWidth("100%");
fieldEMail.setWidth("100%");
fieldPostal.setWidth("100%");
Panel pnlName = new Panel();
pnlName.appendChild(lblName);
pnlName.appendChild(fieldName);
pnlName.setAlign("right");
Grid grid = GridFactory.newGridLayout();
Panel pnlContact = new Panel();
pnlContact.appendChild(lblContact);
pnlContact.appendChild(fieldContact);
pnlContact.setAlign("right");
Rows rows = new Rows();
grid.appendChild(rows);
Panel pnlEMail = new Panel();
pnlEMail.appendChild(lblEMail);
pnlEMail.appendChild(fieldEMail);
pnlEMail.setAlign("right");
Row row = new Row();
rows.appendChild(row);
row.appendChild(lblValue.rightAlign());
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();
pnlPostal.appendChild(lblPostal);
pnlPostal.appendChild(fieldPostal);
pnlPostal.setAlign("right");
row = new Row();
rows.appendChild(row);
row.appendChild(lblName.rightAlign());
row.appendChild(fieldName);
row.appendChild(lblEMail.rightAlign());
row.appendChild(fieldEMail);
row.appendChild(lblPostal.rightAlign());
row.appendChild(fieldPostal);
row.appendChild(checkAND);
Panel pnlPhone = new Panel();
pnlPhone.appendChild(lblPhone);
pnlPhone.appendChild(fieldPhone);
pnlPhone.setAlign("right");
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%");
mainPanel.appendChild(new Separator());
mainPanel.appendChild(contentPanel);
mainPanel.appendChild(new Separator());
mainPanel.appendChild(confirmPanel);
mainPanel.appendChild(new Separator());
mainPanel.appendChild(statusBar);
this.appendChild(mainPanel);
this.appendChild(grid);
this.appendChild(new Separator());
this.appendChild(contentPanel);
this.appendChild(new Separator());
this.appendChild(confirmPanel);
this.appendChild(new Separator());
this.appendChild(statusBar);
this.setClosable(true);
this.setBorder("normal");
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");
// Get indexes
// Get indexes
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)
m_C_BPartner_Location_ID_index = i;
}
@ -479,9 +438,14 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl
int AD_User_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)
{
Object data =contentPanel.getValueAt(row, m_C_BPartner_Location_ID_index);
@ -496,6 +460,76 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl
} // 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)
{

View File

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

View File

@ -25,10 +25,13 @@ import java.sql.Timestamp;
import java.util.ArrayList;
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.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.WListbox;
import org.adempiere.webui.event.WTableModelEvent;
import org.adempiere.webui.window.FDialog;
import org.compiere.minigrid.ColumnInfo;
@ -38,9 +41,13 @@ import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Hbox;
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
{
private static final long serialVersionUID = 1L;
@ -68,15 +75,25 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
{
super(windowNo, tableName, keyColumn, false,whereClause);
//log.info(tableName + " - " + keyColumn + " - " + whereClause);
setTitle(Msg.getMsg(Env.getCtx(), "Info"));
try
{
init();
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)
{
@ -88,34 +105,39 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
private void initComponents()
{
Hbox parameterPanel = new Hbox();
parameterPanel.setWidth("100%");
parameterPanel.appendChild(lbl1);
parameterPanel.appendChild(txt1);
parameterPanel.appendChild(lbl2);
parameterPanel.appendChild(txt2);
parameterPanel.appendChild(lbl3);
parameterPanel.appendChild(txt3);
parameterPanel.appendChild(lbl4);
parameterPanel.appendChild(txt4);
Grid grid = GridFactory.newGridLayout();
Rows rows = new Rows();
grid.appendChild(rows);
Row row = new Row();
rows.appendChild(row);
row.appendChild(lbl1.rightAlign());
row.appendChild(txt1);
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();
mainPanel.setWidth("100%");
mainPanel.appendChild(parameterPanel);
contentPanel.setWidth("99%");
contentPanel.setHeight("400px");
contentPanel.setVflex(true);
mainPanel.appendChild(grid);
mainPanel.appendChild(new Separator());
mainPanel.appendChild(contentPanel);
mainPanel.appendChild(new Separator());
mainPanel.appendChild(confirmPanel);
// Elaine 2008/12/15
mainPanel.appendChild(new Separator());
mainPanel.appendChild(statusBar);
//
this.appendChild(mainPanel);
this.setClosable(true);
this.setBorder("normal");
this.setWidth("900px");
//this.setHeight("500px");
}
private void init()
@ -130,8 +152,9 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
lbl3 = new Label();
lbl4 = new Label();
contentPanel = new WListbox();
contentPanel.setWidth("100%");
contentPanel.setWidth("99%");
contentPanel.setHeight("400px");
contentPanel.setVflex(true);
}
private boolean initInfo ()
@ -150,12 +173,10 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
// Set & enable Fields
lbl1.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(0).toString()).substring(1));
//txt1.addActionListener(this);
if (m_queryColumns.size() > 1)
{
lbl2.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(1).toString()));
//txt2.addActionListener(this);
}
else
{
@ -166,7 +187,6 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
if (m_queryColumns.size() > 2)
{
lbl3.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(2).toString()));
//txt3.addActionListener(this);
}
else
{
@ -177,7 +197,6 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
if (m_queryColumns.size() > 3)
{
lbl4.setValue(Msg.translate(Env.getCtx(), m_queryColumns.get(3).toString()));
//txt4.addActionListener(this);
}
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) "
+ "WHERE t.AD_Table_ID=? "
+ " 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)) "
+ "ORDER BY c.IsKey DESC, f.SeqNo";
@ -313,9 +331,6 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
else if (DisplayType.isDate(displayType))
colClass = Timestamp.class;
// 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)
{
if (Env.isBaseLanguage(Env.getCtx(), "AD_Ref_List"))
@ -330,8 +345,6 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
.append("') AS ").append(columnName);
colClass = String.class;
}
// else if (displayType == DisplayType.Table)
// else if (displayType == DisplayType.TableDir || displayType == DisplayType.Search)
if (colClass != null)
{
@ -393,7 +406,6 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
@Override
protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
{
int index = 1;
}
public void tableChanged(WTableModelEvent event)

View File

@ -20,14 +20,17 @@ package org.adempiere.webui.panel;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Checkbox;
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.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.VerticalBox;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WSearchEditor;
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.IDColumn;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
@ -50,24 +54,16 @@ import org.zkoss.zul.Separator;
*
* @author Niraj Sohun
* Aug 03, 2007
*
* Zk Port
* @author Elaine
* @version InfoInOut.java Adempiere Swing UI 3.4.1
*/
public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, EventListener
{
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 WEditor fBPartner_ID;
@ -133,11 +129,6 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
fDocumentNo.setValue(value);
executeQuery();
}
//pack();
// Focus
//fDocumentNo.requestFocus();
} // InfoInOutPanel
/**
@ -147,94 +138,65 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
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);
boxDocumentNo.setWidth("100%");
boxDocumentNo.setWidths("40%, 60%");
boxDocumentNo.appendChild(lDocumentNo);
boxDocumentNo.appendChild(fDocumentNo);
Hbox boxDescription = new Hbox();
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);
boxPORef.setWidth("100%");
boxPORef.setWidths("40%, 60%");
boxPORef.appendChild(lPOReference);
boxPORef.appendChild(fPOReference);
fIsSOTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx"));
fIsSOTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
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(
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search),
Msg.translate(Env.getCtx(), "BPartner"), "", false, false, true);
fBPartner_ID.addValueChangeListener(this);
boxBPartner.appendChild(fBPartner_ID.getLabel());
boxBPartner.appendChild(fBPartner_ID.getComponent());
Grid grid = GridFactory.newGridLayout();
Hbox boxDateFrom = new Hbox();
boxDateFrom.setWidth("100%");
boxDateFrom.setWidths("40%, 60%");
boxDateFrom.appendChild(lDateFrom);
boxDateFrom.appendChild(fDateFrom);
Rows rows = new Rows();
grid.appendChild(rows);
Hbox boxDateTo = new Hbox();
boxDateTo.setWidth("100%");
boxDateTo.setWidths("10%, 90%");
boxDateTo.appendChild(lDateTo);
boxDateTo.appendChild(fDateTo);
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(fIsSOTrx);
VerticalBox boxCol1 = new VerticalBox();
boxCol1.appendChild(boxDocumentNo);
boxCol1.appendChild(new Separator());
boxCol1.appendChild(boxDescription);
boxCol1.appendChild(new Separator());
boxCol1.appendChild(boxPORef);
row = new Row();
row.setSpans("1, 1, 1, 2");
rows.appendChild(row);
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);
VerticalBox boxCol2 = new VerticalBox();
boxCol2.appendChild(boxBPartner);
boxCol2.appendChild(new Separator());
boxCol2.appendChild(boxDateFrom);
row = new Row();
row.setSpans("1, 1, 3");
rows.appendChild(row);
row.appendChild(lPOReference.rightAlign());
row.appendChild(fPOReference);
row.appendChild(new Label());
VerticalBox boxCol3 = new VerticalBox();
boxCol3.appendChild(fIsSOTrx);
boxCol3.appendChild(new Separator());
boxCol3.appendChild(boxDateTo);
Hbox mainBox = new Hbox();
mainBox.setWidth("100%");
mainBox.setWidths("40%, 50%, 10%");
mainBox.appendChild(boxCol1);
mainBox.appendChild(boxCol2);
mainBox.appendChild(boxCol3);
contentPanel.setWidth("99%");
contentPanel.setHeight("400px");
contentPanel.setVflex(true);
this.setWidth("850px");
// this.setTitle("InOut Info");
this.setClosable(true);
this.setBorder("normal");
this.appendChild(mainBox);
this.appendChild(grid);
this.appendChild(new Separator());
this.appendChild(contentPanel);
this.appendChild(new Separator());
@ -310,7 +272,6 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
}
sql.append(" AND i.IsSOTrx=?");
// log.fine( "InfoInOut.setWhereClause", sql.toString());
return sql.toString();
} // getSQLWhere
@ -382,6 +343,24 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
return s;
} // 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
* @return true

View File

@ -23,13 +23,17 @@ import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Date;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Checkbox;
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.NumberBox;
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.WListbox;
import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
@ -38,6 +42,7 @@ import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
@ -46,13 +51,16 @@ import org.compiere.util.Util;
import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Separator;
import org.zkoss.zul.Vbox;
/**
* Search Invoice and return selection
* Based on InfoInvoice by Jorg Janke
* @author Sendy Yagambrum
* @date July 30, 2007
*
* Zk Port
* @author Elaine
* @version InfoInvoice.java Adempiere Swing UI 3.4.1
**/
public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
{
@ -89,10 +97,6 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
private Label lblDocumentNo;
private Label lblDescription;
private Label lblBPartner;
private Label lblOrder;
private Label lblIsSOTrx;
private Label lblIsPaid;
private Label lblDateInvoiced;
private Label lblGrandTotal;
@ -134,32 +138,25 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
private void initComponents()
{
lblDocumentNo = new Label(Msg.translate(Env.getCtx(), "DocumentNo").substring(1));
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"));
lblOrder = new Label(Msg.translate(Env.getCtx(), "POReference"));
lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal"));
txtDocumentNo = new Textbox();
txtDescription = new Textbox();
dateFrom = new Datebox();
dateFrom.setWidth("180px");
dateTo= new Datebox();
dateTo.setWidth("180px");
amountFrom = new NumberBox(false);
amountFrom.setWidth("180px");
amountTo = new NumberBox(false);
amountTo.setWidth("180px");
isPaid = new Checkbox();
isPaid.setLabel(Msg.translate(Env.getCtx(), "IsPaid"));
isPaid.setChecked(false);
isSoTrx = new Checkbox();
isSoTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx"));
isSoTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
MLookup lookupBP = MLookupFactory.get(Env.getCtx(), p_WindowNo,
0, 3499, DisplayType.Search);
@ -173,7 +170,6 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
Env.getCtx(), "C_Order_ID"), "", false, false, true);
editorOrder.addValueChangeListener(this);
contentPanel = new WListbox();
contentPanel.setWidth("99%");
contentPanel.setHeight("400px");
contentPanel.setVflex(true);
@ -181,94 +177,54 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
private void init()
{
Hbox pnlDocumentNo = new Hbox();
pnlDocumentNo.appendChild(lblDocumentNo);
pnlDocumentNo.appendChild(txtDocumentNo);
pnlDocumentNo.setStyle("text-align:right");
txtDocumentNo.setWidth("100%");
txtDescription.setWidth("100%");
dateFrom.setWidth("165px");
dateTo.setWidth("165px");
amountFrom.getDecimalbox().setWidth("155px");
amountTo.getDecimalbox().setWidth("155px");
Hbox pnlDescription = new Hbox();
pnlDescription.appendChild(lblDescription);
pnlDescription.appendChild(txtDescription);
pnlDescription.setStyle("text-align:right");
pnlDescription.setWidth("100%");
Grid grid = GridFactory.newGridLayout();
Hbox pnlOrder = new Hbox();
pnlOrder.appendChild(editorOrder.getLabel());
pnlOrder.appendChild(editorOrder.getComponent());
pnlOrder.setStyle("text-align:right");
pnlOrder.setWidth("100%");
Rows rows = new Rows();
grid.appendChild(rows);
Hbox pnlBPartner = new Hbox();
pnlBPartner.appendChild(lblBPartner);
pnlBPartner.appendChild(editorBPartner.getComponent());
pnlBPartner.setStyle("text-align:right");
pnlBPartner.setWidth("100%");
Row row = new Row();
rows.appendChild(row);
row.appendChild(lblDocumentNo.rightAlign());
row.appendChild(txtDocumentNo);
row.appendChild(editorBPartner.getLabel().rightAlign());
row.appendChild(editorBPartner.getComponent());
row.appendChild(isSoTrx);
row.appendChild(isPaid);
Hbox hboxDateOrdered = new Hbox();
Panel pnlDateOrdered = new Panel();
pnlDateOrdered.appendChild(lblDateInvoiced);
pnlDateOrdered.appendChild(dateFrom);
pnlDateOrdered.setAlign("right");
hboxDateOrdered.appendChild(pnlDateOrdered);
hboxDateOrdered.setStyle("text-align:right");
hboxDateOrdered.setWidth("100%");
row = new Row();
row.setSpans("1, 1, 1, 3");
rows.appendChild(row);
row.appendChild(lblDescription.rightAlign());
row.appendChild(txtDescription);
row.appendChild(lblDateInvoiced.rightAlign());
Hbox hbox = new Hbox();
hbox.appendChild(dateFrom);
hbox.appendChild(new Label("-"));
hbox.appendChild(dateTo);
row.appendChild(hbox);
Hbox pnlGrandTotal = new Hbox();
pnlGrandTotal.appendChild(lblGrandTotal);
pnlGrandTotal.appendChild(amountFrom);
pnlGrandTotal.setStyle("text-align:right");
pnlGrandTotal.setWidth("100%");
Hbox pnlCheckbox = new Hbox();
Panel pnlIsSoTrx = new Panel();
pnlIsSoTrx.appendChild(isSoTrx);
pnlIsSoTrx.appendChild(lblIsSOTrx);
pnlIsSoTrx.setAlign("left");
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%");
row = new Row();
row.setSpans("1, 1, 1, 3");
rows.appendChild(row);
row.appendChild(editorOrder.getLabel().rightAlign());
row.appendChild(editorOrder.getComponent());
row.appendChild(lblGrandTotal.rightAlign());
hbox = new Hbox();
hbox.appendChild(amountFrom);
hbox.appendChild(new Label("-"));
hbox.appendChild(amountTo);
row.appendChild(hbox);
Panel mainPanel = new Panel();
mainPanel.setWidth("100%");
mainPanel.appendChild(parameterPanel);
mainPanel.appendChild(grid);
mainPanel.appendChild(new Separator());
mainPanel.appendChild(contentPanel);
mainPanel.appendChild(new Separator());
@ -277,6 +233,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
mainPanel.appendChild(statusBar);
this.appendChild(mainPanel);
this.setClosable(true);
this.setBorder("normal");
this.setWidth("850px");
}
@ -301,7 +258,6 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
where.toString(),
"2,3,4");
//
// MAllocationLine.setIsPaid(Env.getCtx(), 0, null);
return true;
} // initInfo
@ -313,8 +269,6 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
sql.append(" AND UPPER(i.DocumentNo) LIKE ?");
if (txtDescription.getText().length() > 0)
sql.append(" AND UPPER(i.Description) LIKE ?");
// if (fPOReference.getText().length() > 0)
// sql.append(" AND UPPER(i.POReference) LIKE ?");
//
if (editorBPartner.getValue() != null)
sql.append(" AND i.C_BPartner_ID=?");
@ -525,6 +479,33 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
return s;
} // 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)
{
@ -560,7 +541,4 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
else
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.util.Date;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Datebox;
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.Rows;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.WListbox;
import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
@ -42,11 +42,13 @@ import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Separator;
/**
@ -55,16 +57,17 @@ import org.zkoss.zul.Separator;
*
* @author Sendy Yagambrum
* @date July 27, 2007
*
* Zk Port
* @author Elaine
* @version InfoOrder.java Adempiere Swing UI 3.4.1
**/
public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
{
private static final long serialVersionUID = 1L;
private Label lblDocumentNo;
private Label lblDescription;
private Label lblBPartner;
private Label lblSalesTransaction;
private Label lblDateOrdered;
private Label lblOrderRef;
private Label lblGrandTotal;
@ -104,10 +107,18 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
log.info( "InfoOrder");
setTitle(Msg.getMsg(Env.getCtx(), "InfoOrder"));
//
try
{
initComponents();
init();
p_loadedOK = initInfo ();
}
catch (Exception e)
{
return;
}
int no = contentPanel.getRowCount();
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
setStatusDB(Integer.toString(no));
@ -122,11 +133,8 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
}
public void initComponents()
{
lblDocumentNo = new Label(Msg.translate(Env.getCtx(), "DocumentNo").substring(1));
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"));
lblOrderRef = new Label(Msg.translate(Env.getCtx(), "POReference"));
lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal"));
@ -142,67 +150,69 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
amountTo = new NumberBox(false);
isSoTrx = new Checkbox();
isSoTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx"));
isSoTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
MLookup lookupBP = MLookupFactory.get(Env.getCtx(), p_WindowNo,
0, 3499, DisplayType.Search);
editorBPartner = new WSearchEditor(lookupBP, Msg.translate(
Env.getCtx(), "C_BPartner_ID"), "", true, false, true);
editorBPartner.addValueChangeListener(this);
contentPanel = new WListbox();
contentPanel.setWidth("99%");
contentPanel.setHeight("400px");
contentPanel.setVflex(true);
contentPanel.setFixedLayout(true);
}
public void init()
{
Grid parameterPanel = GridFactory.newGridLayout();
Rows rows = parameterPanel.newRows();
Row row = rows.newRow();
txtDocumentNo.setWidth("100%");
txtDescription.setWidth("100%");
txtOrderRef.setWidth("100%");
dateFrom.setWidth("165px");
dateTo.setWidth("165px");
amountFrom.getDecimalbox().setWidth("155px");
amountTo.getDecimalbox().setWidth("155px");
Grid grid = GridFactory.newGridLayout();
Rows rows = new Rows();
grid.appendChild(rows);
Row row = new Row();
rows.appendChild(row);
row.appendChild(lblDocumentNo.rightAlign());
row.appendChild(txtDocumentNo);
row.appendChild(lblBPartner.rightAlign());
row.appendChild(editorBPartner.getLabel().rightAlign());
row.appendChild(editorBPartner.getComponent());
Panel pnlSalesTrx = new Panel();
pnlSalesTrx.appendChild(isSoTrx);
isSoTrx.setStyle("margin-left: 5px");
pnlSalesTrx.appendChild(lblSalesTransaction);
lblSalesTransaction.setStyle("margin-left: 2px");
row.appendChild(pnlSalesTrx);
row.appendChild(isSoTrx);
row = rows.newRow();
row = new Row();
row.setSpans("1, 1, 1, 2");
rows.appendChild(row);
row.appendChild(lblDescription.rightAlign());
row.appendChild(txtDescription);
row.appendChild(lblDateOrdered.rightAlign());
Panel pnlDate = new Panel();
pnlDate.appendChild(dateFrom);
Label symbol = new Label("-");
symbol.setStyle("margin-left: 5px; margin-right: 5px");
pnlDate.appendChild(symbol);
pnlDate.appendChild(dateTo);
row.appendChild(pnlDate);
row.setSpans("1,1,1,2");
Hbox hbox = new Hbox();
hbox.appendChild(dateFrom);
hbox.appendChild(new Label("-"));
hbox.appendChild(dateTo);
row.appendChild(hbox);
row = rows.newRow();
row = new Row();
row.setSpans("1, 1, 1, 2");
rows.appendChild(row);
row.appendChild(lblOrderRef.rightAlign());
row.appendChild(txtOrderRef);
row.appendChild(lblGrandTotal.rightAlign());
Panel pnlamt = new Panel();
pnlamt.appendChild(amountFrom);
symbol = new Label("-");
symbol.setStyle("margin-left: 5px; margin-right: 5px");
pnlamt.appendChild(symbol);
pnlamt.appendChild(amountTo);
row.appendChild(pnlamt);
row.setSpans("1,1,1,2");
parameterPanel.setWidth("100%");
parameterPanel.setInnerWidth("auto");
hbox = new Hbox();
hbox.appendChild(amountFrom);
hbox.appendChild(new Label("-"));
hbox.appendChild(amountTo);
row.appendChild(hbox);
Panel mainPanel = new Panel();
mainPanel.setWidth("100%");
mainPanel.appendChild(parameterPanel);
mainPanel.appendChild(grid);
mainPanel.appendChild(new Separator());
mainPanel.appendChild(contentPanel);
mainPanel.appendChild(new Separator());
@ -211,6 +221,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
mainPanel.appendChild(statusBar);
this.appendChild(mainPanel);
this.setClosable(true);
this.setBorder("normal");
this.setWidth("850px");
}
@ -450,10 +461,35 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
return s;
} // 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)
{
// TODO Auto-generated method stub
}

View File

@ -56,6 +56,10 @@ import org.zkoss.zul.event.ZulEvents;
* Based on Info written by Jorg Janke
*
* @author Sendy Yagambrum
*
* Zk Port
* @author Elaine
* @version Info.java Adempiere Swing UI 3.4.1
*/
public abstract class InfoPanel extends Window implements EventListener, WTableModelListener
{
@ -250,10 +254,16 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
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.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.addEventListener(Events.ON_OK, this);
@ -489,9 +499,6 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
setStatusDB(Integer.toString(no));
//better performance
// contentPanel.setFixedLayout(true);
//workaround for scrollbar position problem
contentPanel.renderAll();
}
@ -822,24 +829,40 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
{
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)
{
dispose(true);
}
}
else if (event.getTarget().equals(confirmPanel.getButton("Refresh")))
else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_REFRESH)))
{
executeQuery();
renderItems();
}
else if (event.getTarget().equals(confirmPanel.getButton("Cancel")))
else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_CANCEL)))
{
m_cancel = true;
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)
{

View File

@ -21,14 +21,17 @@ import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Checkbox;
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.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.VerticalBox;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WSearchEditor;
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.IDColumn;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
@ -51,26 +55,16 @@ import org.zkoss.zul.Separator;
*
* @author Niraj Sohun
* Aug, 02, 2007
*
* Zk Port
* @author Elaine
* @version InfoPayment.java Adempiere Swing UI 3.4.1
*/
public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener, EventListener
{
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 fAmtTo = new Textbox();
private Textbox fAmtFrom = new Textbox();
@ -153,11 +147,6 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
fDocumentNo .setValue(value);
executeQuery();
}
//pack();
// Focus
//fDocumentNo.requestFocus();
} // InfoPaymentPanel
/**
@ -167,91 +156,64 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
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);
boxDocumentNo.setWidth("100%");
boxDocumentNo.setWidths("40%, 60%");
boxDocumentNo.appendChild(lDocumentNo);
boxDocumentNo.appendChild(fDocumentNo);
fIsReceipt.setLabel(Msg.translate(Env.getCtx(), "IsReceipt"));
fIsReceipt.addEventListener(Events.ON_CHECK, this);
fIsReceipt.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
Hbox boxBPartner = new Hbox();
fBPartner_ID = new WSearchEditor(
MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search),
Msg.translate(Env.getCtx(), "C_BPartner_ID"), "", false, false, true);
fBPartner_ID.addValueChangeListener(this);
boxBPartner.appendChild(fBPartner_ID.getLabel());
boxBPartner.appendChild(fBPartner_ID.getComponent());
Grid grid = GridFactory.newGridLayout();
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%");
boxDateFrom.setWidths("40%, 60%");
boxDateFrom.appendChild(lDateFrom);
boxDateFrom.appendChild(fDateFrom);
row = new Row();
row.setSpans("3, 2");
rows.appendChild(row);
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");
rows.appendChild(row);
row.appendChild(lAmtFrom.rightAlign());
hbox = new Hbox();
hbox.appendChild(fAmtFrom);
hbox.appendChild(lAmtTo);
hbox.appendChild(fAmtTo);
row.appendChild(hbox);
//fDateTo.setValue(new Date(System.currentTimeMillis()));
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.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.setTitle("Payment Info");
this.setClosable(true);
this.setBorder("normal");
this.appendChild(mainBox);
this.appendChild(grid);
this.appendChild(new Separator());
this.appendChild(contentPanel);
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");
// MPayment.setIsAllocated(Env.getCtx(), 0, null);
return true;
} // initInfo
@ -420,11 +380,11 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
return s;
} // getSQLText
// Elaine 2008/12/16
/**
* Zoom
*/
/* void zoom()
public void zoom()
{
log.info( "InfoPayment.zoom");
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.setRecordCount(1);
int AD_WindowNo = getAD_Window_ID("C_Payment", fIsReceipt.isSelected());
zoom (AD_WindowNo, query);
AEnv.zoom (AD_WindowNo, query);
} // zoom
*/
//
/**
* Has Zoom
* @return true
@ -456,7 +417,6 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
}
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.logging.Level;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Button;
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.ListItem;
import org.adempiere.webui.component.ListModelTable;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory;
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.Tabbox;
import org.adempiere.webui.component.Tabpanel;
@ -60,6 +66,7 @@ import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn;
import org.compiere.model.MClient;
import org.compiere.model.MDocType;
import org.compiere.model.MQuery;
import org.compiere.model.MRole;
import org.compiere.util.CLogMgt;
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.South;
import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Separator;
import org.zkoss.zul.Vbox;
/**
* Search Product and return selection
* This class is based on org.compiere.apps.search.InfoPAttribute written by Jorg Janke
* @author Elaine
*
* Zk Port
* @author Elaine
* @version InfoPayment.java Adempiere Swing UI 3.4.1
*/
public final class InfoProductPanel extends InfoPanel implements EventListener
{
@ -184,6 +192,11 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
tabbedPane.setSelectedIndex(0);
p_loadedOK = true;
//Begin - fer_luck @ centuryon
mWindowNo = windowNo; // Elaine 2008/12/16
//End - fer_luck @ centuryon
} // InfoProductPanel
/**
@ -248,85 +261,42 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
fieldVendor = new Textbox();
fieldVendor.setMaxlength(40);
contentPanel = new WListbox();
contentPanel.setWidth("99%");
contentPanel.setVflex(true);
} // initComponents
private void init()
{
Panel pnlValue = new Panel();
pnlValue.appendChild(lblValue);
pnlValue.appendChild(fieldValue);
pnlValue.setAlign("right");
Grid grid = GridFactory.newGridLayout();
Panel pnlName = new Panel();
pnlName.appendChild(lblName);
pnlName.appendChild(fieldName);
pnlName.setAlign("right");
Rows rows = new Rows();
grid.appendChild(rows);
Panel pnlUPC = new Panel();
pnlUPC.appendChild(lblUPC);
pnlUPC.appendChild(fieldUPC);
pnlUPC.setAlign("right");
Row row = new Row();
rows.appendChild(row);
row.appendChild(lblValue.rightAlign());
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();
pnlSKU.appendChild(lblSKU);
pnlSKU.appendChild(fieldSKU);
pnlSKU.setAlign("right");
Panel pnlPriceList = new Panel();
pnlPriceList.appendChild(lblPriceList);
pnlPriceList.appendChild(pickPriceList);
pnlPriceList.setAlign("right");
// Elaine 2008/11/21
Panel pnlProductCategory = new Panel();
pnlProductCategory.appendChild(lblProductCategory);
pnlProductCategory.appendChild(pickProductCategory);
pnlProductCategory.setAlign("right");
row = new Row();
row.setSpans("1, 1, 1, 1, 1, 1, 1, 2");
rows.appendChild(row);
row.appendChild(lblName.rightAlign());
row.appendChild(fieldName);
row.appendChild(lblSKU.rightAlign());
row.appendChild(fieldSKU);
row.appendChild(lblVendor.rightAlign());
row.appendChild(fieldVendor);
row.appendChild(lblProductCategory.rightAlign());
row.appendChild(pickProductCategory);
//
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
m_PAttributeButton = confirmPanel.createButton(ConfirmPanel.A_PATTRIBUTE);
confirmPanel.addComponentsLeft(m_PAttributeButton);
@ -458,13 +428,14 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
Panel mainPanel = new Panel();
mainPanel.setWidth("100%");
mainPanel.appendChild(parameterPanel);
mainPanel.appendChild(grid);
mainPanel.appendChild(new Separator());
mainPanel.appendChild(borderlayout);
mainPanel.appendChild(new Separator());
mainPanel.appendChild(confirmPanel);
this.appendChild(mainPanel);
this.setClosable(true);
this.setBorder("normal");
this.setWidth("1000px");
@ -651,7 +622,6 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
KeyNamePair kn = new KeyNamePair (rs.getInt(1), rs.getString(2));
pickPriceList.appendItem(rs.getString(2),new Integer(rs.getInt(1)));
}
rs.close();
@ -669,8 +639,6 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
rs = pstmt.executeQuery();
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")));
}
rs.close();
@ -841,7 +809,7 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
// => Vendor
String vendor = fieldVendor.getText().toUpperCase();
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();
} // getSQLWhere
@ -967,12 +935,14 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
*/
protected void showHistory()
{
/*log.info("");
log.info("");
Integer M_Product_ID = getSelectedRowKey();
if (M_Product_ID == null)
return;
KeyNamePair kn = (KeyNamePair)pickWarehouse.getSelectedItem();
int M_Warehouse_ID = kn.getKey();
int M_Warehouse_ID = 0;
ListItem listitem = pickWarehouse.getSelectedItem();
if (listitem != null)
M_Warehouse_ID = (Integer)listitem.getValue();
int M_AttributeSetInstance_ID = m_M_AttributeSetInstance_ID;
if (m_M_AttributeSetInstance_ID < -1) // not selected
M_AttributeSetInstance_ID = 0;
@ -980,7 +950,7 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
InvoiceHistory ih = new InvoiceHistory (this, 0,
M_Product_ID.intValue(), M_Warehouse_ID, M_AttributeSetInstance_ID);
ih.setVisible(true);
ih = null;*/
ih = null;
} // showHistory
/**
@ -993,6 +963,25 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
return true;
} // 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
* @return (has zoom)
@ -1067,7 +1056,6 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
{
final ColumnInfo[] frieLayout = {
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(), "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),
@ -1140,6 +1128,13 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
{
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)
{
cmd_InfoPAttribute();
@ -1344,12 +1339,8 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
}
// Table
m_tableAtp = ListboxFactory.newDataTable();
m_tableAtp.setMultiSelection(false);
m_tableAtp.getModel().setNoColumns(columnNames.size());
for(int i = 0; i < columnNames.size(); i++)
m_tableAtp.addColumn(columnNames.get(i));
ListModelTable model = new ListModelTable(data);
m_tableAtp.setData(model, columnNames);
//
m_tableAtp.setColumnClass(0, Timestamp.class, true); // Date
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.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
//

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;
import java.text.DateFormat;
import java.util.*;
import java.util.logging.*;
import java.util.Date;
import java.util.TimeZone;
import java.util.logging.Level;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.window.InfoSchedule;
import org.adempiere.webui.window.WAssignmentDialog;
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.Timeline;
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)
{
hourBand.setDate(date);
if (m_center == null || date.getTime() != m_center.getTime())
hourBand.scrollToCenter(date);
// Elaine 2008/12/12
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)
+ "&uuid=" + button.getUuid() + "&tlid=" + timeLine.getUuid();

View File

@ -17,15 +17,21 @@
package org.adempiere.webui.window;
import java.math.BigDecimal;
import java.sql.*;
import java.util.*;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Calendar;
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.component.Button;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.DatetimeBox;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem;
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.panel.StatusBarPanel;
import org.adempiere.webui.panel.WSchedule;
import org.compiere.model.*;
import org.compiere.util.*;
import org.compiere.model.MAssignmentSlot;
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.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Vbox;
@ -51,8 +66,12 @@ import org.zkoss.zul.Vbox;
*
* Zk Port
* @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
@ -68,7 +87,8 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
else
setAttribute("mode", "overlapped");
this.setWidth("600px");
this.setHeight("600px");
// this.setHeight("600px");
this.setClosable(true);
this.setBorder("normal");
this.setStyle("position: absolute");
if (mAssignment == null)
@ -113,12 +133,17 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
private static CLogger log = CLogger.getCLogger(InfoSchedule.class);
private Vbox mainLayout = new Vbox();
private Grid parameterPanel = new Grid();
private Grid parameterPanel = GridFactory.newGridLayout();
private Label labelResourceType = new Label();
private Listbox fieldResourceType = new Listbox();
private Label labelResource = new Label();
private Listbox fieldResource = new Listbox();
// Elaine 2008/12/12
private Button bPrevious = new Button();
private Label labelDate = new Label();
private DatetimeBox fieldDate = new DatetimeBox();
private Button bNext = new Button();
//
private WSchedule schedulePane = new WSchedule(this);
private StatusBarPanel statusBar = new StatusBarPanel();
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"));
labelDate.setValue(Msg.translate(Env.getCtx(), "Date"));
// Elaine 2008/12/12
bPrevious.setLabel("<");
bNext.setLabel(">");
//
mainLayout.appendChild(parameterPanel);
Rows rows = new Rows();
@ -151,6 +181,16 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
rows.appendChild(row);
row.appendChild(labelResource);
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);
@ -178,6 +218,15 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
fieldResourceType.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);
if (createNew) {
@ -322,8 +371,12 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
KeyNamePair pp = new KeyNamePair((Integer)listItem.getValue(), listItem.getLabel());
int S_Resource_ID = pp.getKey();
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
m_loading = true;
@ -379,6 +432,16 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
fillResource();
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"))
doAdd();
@ -386,6 +449,29 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
}
// 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() {
ListItem listItem = fieldResource.getSelectedItem();
if (listItem == null)
@ -461,6 +547,7 @@ public class InfoSchedule extends Window implements EventListener //, ChangeList
*/
public void dateCallback(Date date) {
m_dateFrom = new Timestamp(date.getTime());
fieldDate.setValue(m_dateFrom); // Elaine 2008/12/15
}