* minor: improve layout.
This commit is contained in:
parent
671a543f62
commit
127b89e9a0
|
@ -1,500 +1,469 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Posterita Ajax UI *
|
* Product: Posterita Ajax UI *
|
||||||
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
|
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* 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 *
|
* 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 *
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU General Public License for more details. *
|
* See the GNU General Public License for more details. *
|
||||||
* You should have received a copy of the GNU General Public License along *
|
* 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., *
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
* For the text or an alternative of this public license, you may reach us *
|
* For the text or an alternative of this public license, you may reach us *
|
||||||
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
|
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
|
||||||
* or via info@posterita.org or http://www.posterita.org/ *
|
* or via info@posterita.org or http://www.posterita.org/ *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
package org.adempiere.webui.panel;
|
package org.adempiere.webui.panel;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.adempiere.webui.component.Checkbox;
|
import org.adempiere.webui.component.Checkbox;
|
||||||
import org.adempiere.webui.component.Datebox;
|
import org.adempiere.webui.component.Datebox;
|
||||||
import org.adempiere.webui.component.Label;
|
import org.adempiere.webui.component.Grid;
|
||||||
import org.adempiere.webui.component.NumberBox;
|
import org.adempiere.webui.component.GridFactory;
|
||||||
import org.adempiere.webui.component.Panel;
|
import org.adempiere.webui.component.Label;
|
||||||
import org.adempiere.webui.component.Textbox;
|
import org.adempiere.webui.component.NumberBox;
|
||||||
import org.adempiere.webui.component.WListbox;
|
import org.adempiere.webui.component.Panel;
|
||||||
import org.adempiere.webui.editor.WSearchEditor;
|
import org.adempiere.webui.component.Row;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.component.Rows;
|
||||||
import org.adempiere.webui.event.ValueChangeListener;
|
import org.adempiere.webui.component.Textbox;
|
||||||
import org.adempiere.webui.event.WTableModelEvent;
|
import org.adempiere.webui.component.WListbox;
|
||||||
import org.compiere.minigrid.ColumnInfo;
|
import org.adempiere.webui.editor.WSearchEditor;
|
||||||
import org.compiere.minigrid.IDColumn;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.compiere.model.MLookup;
|
import org.adempiere.webui.event.ValueChangeListener;
|
||||||
import org.compiere.model.MLookupFactory;
|
import org.adempiere.webui.event.WTableModelEvent;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.minigrid.ColumnInfo;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.minigrid.IDColumn;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.model.MLookup;
|
||||||
import org.compiere.util.Util;
|
import org.compiere.model.MLookupFactory;
|
||||||
import org.zkoss.zk.ui.WrongValueException;
|
import org.compiere.util.DisplayType;
|
||||||
import org.zkoss.zul.Hbox;
|
import org.compiere.util.Env;
|
||||||
import org.zkoss.zul.Separator;
|
import org.compiere.util.Msg;
|
||||||
import org.zkoss.zul.Vbox;
|
import org.compiere.util.Util;
|
||||||
|
import org.zkoss.zk.ui.WrongValueException;
|
||||||
/**
|
import org.zkoss.zul.Separator;
|
||||||
* Search Order info and return selection
|
|
||||||
* Based on InfoOrder by Jorg Janke
|
/**
|
||||||
*
|
* Search Order info and return selection
|
||||||
* @author Sendy Yagambrum
|
* Based on InfoOrder by Jorg Janke
|
||||||
* @date July 27, 2007
|
*
|
||||||
**/
|
* @author Sendy Yagambrum
|
||||||
public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
* @date July 27, 2007
|
||||||
{
|
**/
|
||||||
|
public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
||||||
private static final long serialVersionUID = 1L;
|
{
|
||||||
|
|
||||||
private Label lblDocumentNo;
|
private static final long serialVersionUID = 1L;
|
||||||
private Label lblDescription;
|
|
||||||
private Label lblBPartner;
|
private Label lblDocumentNo;
|
||||||
private Label lblSalesTransaction;
|
private Label lblDescription;
|
||||||
private Label lblDateOrdered;
|
private Label lblBPartner;
|
||||||
private Label lblOrderRef;
|
private Label lblSalesTransaction;
|
||||||
private Label lblGrandTotal;
|
private Label lblDateOrdered;
|
||||||
|
private Label lblOrderRef;
|
||||||
private Textbox txtDocumentNo;
|
private Label lblGrandTotal;
|
||||||
private Textbox txtDescription;
|
|
||||||
private Textbox txtOrderRef;
|
private Textbox txtDocumentNo;
|
||||||
|
private Textbox txtDescription;
|
||||||
private Datebox dateFrom;
|
private Textbox txtOrderRef;
|
||||||
private Datebox dateTo;
|
|
||||||
|
private Datebox dateFrom;
|
||||||
private NumberBox amountFrom;
|
private Datebox dateTo;
|
||||||
private NumberBox amountTo;
|
|
||||||
|
private NumberBox amountFrom;
|
||||||
private WSearchEditor editorBPartner;
|
private NumberBox amountTo;
|
||||||
|
|
||||||
private Checkbox isSoTrx;
|
private WSearchEditor editorBPartner;
|
||||||
|
|
||||||
/** Array of Column Info */
|
private Checkbox isSoTrx;
|
||||||
private static final ColumnInfo[] s_invoiceLayout = {
|
|
||||||
new ColumnInfo(" ", "o.C_Order_ID", IDColumn.class),
|
/** Array of Column Info */
|
||||||
new ColumnInfo(Msg.translate(Env.getCtx(), "C_BPartner_ID"), "(SELECT Name FROM C_BPartner bp WHERE bp.C_BPartner_ID=o.C_BPartner_ID)", String.class),
|
private static final ColumnInfo[] s_invoiceLayout = {
|
||||||
new ColumnInfo(Msg.translate(Env.getCtx(), "DateOrdered"), "o.DateOrdered", Timestamp.class),
|
new ColumnInfo(" ", "o.C_Order_ID", IDColumn.class),
|
||||||
new ColumnInfo(Msg.translate(Env.getCtx(), "DocumentNo"), "o.DocumentNo", String.class),
|
new ColumnInfo(Msg.translate(Env.getCtx(), "C_BPartner_ID"), "(SELECT Name FROM C_BPartner bp WHERE bp.C_BPartner_ID=o.C_BPartner_ID)", String.class),
|
||||||
new ColumnInfo(Msg.translate(Env.getCtx(), "C_Currency_ID"), "(SELECT ISO_Code FROM C_Currency c WHERE c.C_Currency_ID=o.C_Currency_ID)", String.class),
|
new ColumnInfo(Msg.translate(Env.getCtx(), "DateOrdered"), "o.DateOrdered", Timestamp.class),
|
||||||
new ColumnInfo(Msg.translate(Env.getCtx(), "GrandTotal"), "o.GrandTotal", BigDecimal.class),
|
new ColumnInfo(Msg.translate(Env.getCtx(), "DocumentNo"), "o.DocumentNo", String.class),
|
||||||
new ColumnInfo(Msg.translate(Env.getCtx(), "ConvertedAmount"), "currencyBase(o.GrandTotal,o.C_Currency_ID,o.DateAcct, o.AD_Client_ID,o.AD_Org_ID)", BigDecimal.class),
|
new ColumnInfo(Msg.translate(Env.getCtx(), "C_Currency_ID"), "(SELECT ISO_Code FROM C_Currency c WHERE c.C_Currency_ID=o.C_Currency_ID)", String.class),
|
||||||
new ColumnInfo(Msg.translate(Env.getCtx(), "IsSOTrx"), "o.IsSOTrx", Boolean.class),
|
new ColumnInfo(Msg.translate(Env.getCtx(), "GrandTotal"), "o.GrandTotal", BigDecimal.class),
|
||||||
new ColumnInfo(Msg.translate(Env.getCtx(), "Description"), "o.Description", String.class),
|
new ColumnInfo(Msg.translate(Env.getCtx(), "ConvertedAmount"), "currencyBase(o.GrandTotal,o.C_Currency_ID,o.DateAcct, o.AD_Client_ID,o.AD_Org_ID)", BigDecimal.class),
|
||||||
new ColumnInfo(Msg.translate(Env.getCtx(), "POReference"), "o.POReference", String.class)
|
new ColumnInfo(Msg.translate(Env.getCtx(), "IsSOTrx"), "o.IsSOTrx", Boolean.class),
|
||||||
};
|
new ColumnInfo(Msg.translate(Env.getCtx(), "Description"), "o.Description", String.class),
|
||||||
|
new ColumnInfo(Msg.translate(Env.getCtx(), "POReference"), "o.POReference", String.class)
|
||||||
protected InfoOrderPanel(int WindowNo, String value,
|
};
|
||||||
boolean multiSelection, String whereClause)
|
|
||||||
{
|
protected InfoOrderPanel(int WindowNo, String value,
|
||||||
super ( WindowNo, "o", "C_Order_ID", multiSelection, whereClause);
|
boolean multiSelection, String whereClause)
|
||||||
log.info( "InfoOrder");
|
{
|
||||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoOrder"));
|
super ( WindowNo, "o", "C_Order_ID", multiSelection, whereClause);
|
||||||
//
|
log.info( "InfoOrder");
|
||||||
initComponents();
|
setTitle(Msg.getMsg(Env.getCtx(), "InfoOrder"));
|
||||||
init();
|
//
|
||||||
|
initComponents();
|
||||||
p_loadedOK = initInfo ();
|
init();
|
||||||
int no = contentPanel.getRowCount();
|
|
||||||
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
|
p_loadedOK = initInfo ();
|
||||||
setStatusDB(Integer.toString(no));
|
int no = contentPanel.getRowCount();
|
||||||
//
|
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
|
||||||
if (value != null && value.length() > 0)
|
setStatusDB(Integer.toString(no));
|
||||||
{
|
//
|
||||||
String values[] = value.split("_");
|
if (value != null && value.length() > 0)
|
||||||
txtDocumentNo.setText(values[0]);
|
{
|
||||||
executeQuery();
|
String values[] = value.split("_");
|
||||||
renderItems();
|
txtDocumentNo.setText(values[0]);
|
||||||
}
|
executeQuery();
|
||||||
}
|
renderItems();
|
||||||
public void initComponents()
|
}
|
||||||
{
|
}
|
||||||
|
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));
|
lblDocumentNo = new Label(Msg.translate(Env.getCtx(), "DocumentNo").substring(1));
|
||||||
lblSalesTransaction = new Label(Msg.translate(Env.getCtx(), "IsSOTrx"));
|
lblDescription = new Label(Msg.translate(Env.getCtx(), "Description"));
|
||||||
lblDateOrdered = new Label(Msg.translate(Env.getCtx(), "DateOrdered"));
|
lblBPartner = new Label(Msg.translate(Env.getCtx(), "BPartner").substring(1));
|
||||||
lblOrderRef = new Label(Msg.translate(Env.getCtx(), "POReference"));
|
lblSalesTransaction = new Label(Msg.translate(Env.getCtx(), "IsSOTrx"));
|
||||||
lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal"));
|
lblDateOrdered = new Label(Msg.translate(Env.getCtx(), "DateOrdered"));
|
||||||
|
lblOrderRef = new Label(Msg.translate(Env.getCtx(), "POReference"));
|
||||||
txtDocumentNo = new Textbox();
|
lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal"));
|
||||||
txtDescription = new Textbox();
|
|
||||||
txtOrderRef = new Textbox();
|
txtDocumentNo = new Textbox();
|
||||||
|
txtDescription = new Textbox();
|
||||||
dateFrom = new Datebox();
|
txtOrderRef = new Textbox();
|
||||||
dateFrom.setWidth("180px");
|
|
||||||
dateTo= new Datebox();
|
dateFrom = new Datebox();
|
||||||
dateTo.setWidth("180px");
|
dateTo= new Datebox();
|
||||||
|
|
||||||
amountFrom = new NumberBox(false);
|
amountFrom = new NumberBox(false);
|
||||||
amountFrom.setWidth("180px");
|
amountTo = new NumberBox(false);
|
||||||
amountTo = new NumberBox(false);
|
|
||||||
amountTo.setWidth("180px");
|
isSoTrx = new Checkbox();
|
||||||
|
isSoTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
|
||||||
isSoTrx = new Checkbox();
|
MLookup lookupBP = MLookupFactory.get(Env.getCtx(), p_WindowNo,
|
||||||
isSoTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
|
0, 3499, DisplayType.Search);
|
||||||
MLookup lookupBP = MLookupFactory.get(Env.getCtx(), p_WindowNo,
|
editorBPartner = new WSearchEditor(lookupBP, Msg.translate(
|
||||||
0, 3499, DisplayType.Search);
|
Env.getCtx(), "C_BPartner_ID"), "", true, false, true);
|
||||||
editorBPartner = new WSearchEditor(lookupBP, Msg.translate(
|
editorBPartner.addValueChangeListener(this);
|
||||||
Env.getCtx(), "C_BPartner_ID"), "", true, false, true);
|
contentPanel = new WListbox();
|
||||||
editorBPartner.addValueChangeListener(this);
|
contentPanel.setWidth("99%");
|
||||||
contentPanel = new WListbox();
|
contentPanel.setHeight("400px");
|
||||||
contentPanel.setWidth("99%");
|
contentPanel.setVflex(true);
|
||||||
contentPanel.setHeight("400px");
|
contentPanel.setFixedLayout(true);
|
||||||
contentPanel.setVflex(true);
|
}
|
||||||
}
|
|
||||||
|
public void init()
|
||||||
public void init()
|
{
|
||||||
{
|
Grid parameterPanel = GridFactory.newGridLayout();
|
||||||
Panel pnlDocumentNo = new Panel();
|
Rows rows = parameterPanel.newRows();
|
||||||
pnlDocumentNo.appendChild(lblDocumentNo);
|
Row row = rows.newRow();
|
||||||
pnlDocumentNo.appendChild(txtDocumentNo);
|
row.appendChild(lblDocumentNo.rightAlign());
|
||||||
pnlDocumentNo.setAlign("right");
|
row.appendChild(txtDocumentNo);
|
||||||
|
row.appendChild(lblBPartner.rightAlign());
|
||||||
Panel pnlDescription = new Panel();
|
row.appendChild(editorBPartner.getComponent());
|
||||||
pnlDescription.appendChild(lblDescription);
|
Panel pnlSalesTrx = new Panel();
|
||||||
pnlDescription.appendChild(txtDescription);
|
pnlSalesTrx.appendChild(isSoTrx);
|
||||||
pnlDescription.setAlign("right");
|
isSoTrx.setStyle("margin-left: 5px");
|
||||||
|
pnlSalesTrx.appendChild(lblSalesTransaction);
|
||||||
Panel pnlOrderRef = new Panel();
|
lblSalesTransaction.setStyle("margin-left: 2px");
|
||||||
pnlOrderRef.appendChild(lblOrderRef);
|
row.appendChild(pnlSalesTrx);
|
||||||
pnlOrderRef.appendChild(txtOrderRef);
|
|
||||||
pnlOrderRef.setAlign("right");
|
row = rows.newRow();
|
||||||
|
row.appendChild(lblDescription.rightAlign());
|
||||||
Hbox pnlBPartner = new Hbox();
|
row.appendChild(txtDescription);
|
||||||
pnlBPartner.appendChild(lblBPartner);
|
row.appendChild(lblDateOrdered.rightAlign());
|
||||||
pnlBPartner.appendChild(editorBPartner.getComponent());
|
Panel pnlDate = new Panel();
|
||||||
pnlBPartner.setStyle("text-align:right");
|
pnlDate.appendChild(dateFrom);
|
||||||
pnlBPartner.setWidth("100%");
|
Label symbol = new Label("-");
|
||||||
|
symbol.setStyle("margin-left: 5px; margin-right: 5px");
|
||||||
Hbox hboxDateOrdered = new Hbox();
|
pnlDate.appendChild(symbol);
|
||||||
Panel pnlDateOrdered = new Panel();
|
pnlDate.appendChild(dateTo);
|
||||||
pnlDateOrdered.appendChild(lblDateOrdered);
|
row.appendChild(pnlDate);
|
||||||
pnlDateOrdered.appendChild(dateFrom);
|
row.setSpans("1,1,1,2");
|
||||||
pnlDateOrdered.setAlign("right");
|
|
||||||
hboxDateOrdered.appendChild(pnlDateOrdered);
|
row = rows.newRow();
|
||||||
hboxDateOrdered.setStyle("text-align:right");
|
row.appendChild(lblOrderRef.rightAlign());
|
||||||
hboxDateOrdered.setWidth("100%");
|
row.appendChild(txtOrderRef);
|
||||||
|
row.appendChild(lblGrandTotal.rightAlign());
|
||||||
Hbox pnlGrandTotal = new Hbox();
|
Panel pnlamt = new Panel();
|
||||||
pnlGrandTotal.appendChild(lblGrandTotal);
|
pnlamt.appendChild(amountFrom);
|
||||||
pnlGrandTotal.appendChild(amountFrom);
|
symbol = new Label("-");
|
||||||
pnlGrandTotal.setStyle("text-align:right");
|
symbol.setStyle("margin-left: 5px; margin-right: 5px");
|
||||||
pnlGrandTotal.setWidth("100%");
|
pnlamt.appendChild(symbol);
|
||||||
Panel pnlIsSoTrx = new Panel();
|
pnlamt.appendChild(amountTo);
|
||||||
|
row.appendChild(pnlamt);
|
||||||
pnlIsSoTrx.appendChild(isSoTrx);
|
row.setSpans("1,1,1,2");
|
||||||
pnlIsSoTrx.appendChild(lblSalesTransaction);
|
|
||||||
pnlIsSoTrx.setAlign("left");
|
parameterPanel.setWidth("100%");
|
||||||
|
parameterPanel.setInnerWidth("auto");
|
||||||
Panel pnlDateTo = new Panel();
|
|
||||||
pnlDateTo.appendChild(dateTo);
|
Panel mainPanel = new Panel();
|
||||||
pnlDateTo.setAlign("left");
|
mainPanel.setWidth("100%");
|
||||||
|
mainPanel.appendChild(parameterPanel);
|
||||||
Panel pnlAmountTo = new Panel();
|
mainPanel.appendChild(new Separator());
|
||||||
pnlAmountTo.appendChild(amountTo);
|
mainPanel.appendChild(contentPanel);
|
||||||
pnlAmountTo.setAlign("left");
|
mainPanel.appendChild(new Separator());
|
||||||
|
mainPanel.appendChild(confirmPanel);
|
||||||
Vbox vbox1 = new Vbox();
|
mainPanel.appendChild(new Separator());
|
||||||
vbox1.setWidth("100%");
|
mainPanel.appendChild(statusBar);
|
||||||
vbox1.appendChild(pnlDocumentNo);
|
|
||||||
vbox1.appendChild(pnlDescription);
|
this.appendChild(mainPanel);
|
||||||
vbox1.appendChild(pnlOrderRef);
|
this.setBorder("normal");
|
||||||
|
this.setWidth("850px");
|
||||||
Vbox vbox2 = new Vbox();
|
}
|
||||||
vbox2.setWidth("100%");
|
|
||||||
vbox2.appendChild(pnlBPartner);
|
/**
|
||||||
vbox2.appendChild(pnlDateOrdered);
|
* General Init
|
||||||
vbox2.appendChild(pnlGrandTotal);
|
* @return true, if success
|
||||||
|
*/
|
||||||
Vbox vbox3 = new Vbox();
|
private boolean initInfo ()
|
||||||
vbox3.setWidth("100%");
|
{
|
||||||
vbox3.appendChild(pnlIsSoTrx);
|
// Set Defaults
|
||||||
vbox3.appendChild(pnlDateTo);
|
String bp = Env.getContext(Env.getCtx(), p_WindowNo, "C_BPartner_ID");
|
||||||
vbox3.appendChild(pnlAmountTo);
|
if (bp != null && bp.length() != 0)
|
||||||
|
editorBPartner.setValue(new Integer(bp));
|
||||||
Hbox parameterPanel = new Hbox();
|
|
||||||
parameterPanel.appendChild(vbox1);
|
// prepare table
|
||||||
parameterPanel.appendChild(vbox2);
|
StringBuffer where = new StringBuffer("o.IsActive='Y'");
|
||||||
parameterPanel.appendChild(vbox3);
|
if (p_whereClause.length() > 0)
|
||||||
parameterPanel.setWidth("100%");
|
where.append(" AND ").append(Util.replace(p_whereClause, "C_Order.", "o."));
|
||||||
|
prepareTable(s_invoiceLayout,
|
||||||
Panel mainPanel = new Panel();
|
" C_Order o",
|
||||||
mainPanel.setWidth("100%");
|
where.toString(),"2,3,4");
|
||||||
mainPanel.appendChild(parameterPanel);
|
|
||||||
mainPanel.appendChild(new Separator());
|
return true;
|
||||||
mainPanel.appendChild(contentPanel);
|
} // initInfo
|
||||||
mainPanel.appendChild(new Separator());
|
@Override
|
||||||
mainPanel.appendChild(confirmPanel);
|
public String getSQLWhere()
|
||||||
mainPanel.appendChild(new Separator());
|
{
|
||||||
mainPanel.appendChild(statusBar);
|
StringBuffer sql = new StringBuffer();
|
||||||
|
if (txtDocumentNo.getText().length() > 0)
|
||||||
this.appendChild(mainPanel);
|
sql.append(" AND UPPER(o.DocumentNo) LIKE ?");
|
||||||
this.setBorder("normal");
|
if (txtDescription.getText().length() > 0)
|
||||||
this.setWidth("850px");
|
sql.append(" AND UPPER(o.Description) LIKE ?");
|
||||||
}
|
if (txtOrderRef.getText().length() > 0)
|
||||||
|
sql.append(" AND UPPER(o.POReference) LIKE ?");
|
||||||
/**
|
//
|
||||||
* General Init
|
if (editorBPartner.getValue() != null)
|
||||||
* @return true, if success
|
sql.append(" AND o.C_BPartner_ID=?");
|
||||||
*/
|
//
|
||||||
private boolean initInfo ()
|
Date fromDate = null;
|
||||||
{
|
Date toDate = null;
|
||||||
// Set Defaults
|
try
|
||||||
String bp = Env.getContext(Env.getCtx(), p_WindowNo, "C_BPartner_ID");
|
{
|
||||||
if (bp != null && bp.length() != 0)
|
fromDate = dateFrom.getValue();
|
||||||
editorBPartner.setValue(new Integer(bp));
|
}
|
||||||
|
catch (WrongValueException e)
|
||||||
// prepare table
|
{
|
||||||
StringBuffer where = new StringBuffer("o.IsActive='Y'");
|
|
||||||
if (p_whereClause.length() > 0)
|
}
|
||||||
where.append(" AND ").append(Util.replace(p_whereClause, "C_Order.", "o."));
|
try
|
||||||
prepareTable(s_invoiceLayout,
|
{
|
||||||
" C_Order o",
|
toDate = dateTo.getValue();
|
||||||
where.toString(),"2,3,4");
|
}
|
||||||
|
catch (WrongValueException e)
|
||||||
return true;
|
{
|
||||||
} // initInfo
|
|
||||||
@Override
|
}
|
||||||
public String getSQLWhere()
|
if (fromDate == null && toDate != null)
|
||||||
{
|
{
|
||||||
StringBuffer sql = new StringBuffer();
|
sql.append(" AND TRUNC(o.DateOrdered) <= ?");
|
||||||
if (txtDocumentNo.getText().length() > 0)
|
}
|
||||||
sql.append(" AND UPPER(o.DocumentNo) LIKE ?");
|
else if (fromDate != null && toDate == null)
|
||||||
if (txtDescription.getText().length() > 0)
|
{
|
||||||
sql.append(" AND UPPER(o.Description) LIKE ?");
|
sql.append(" AND TRUNC(o.DateOrdered) >= ?");
|
||||||
if (txtOrderRef.getText().length() > 0)
|
}
|
||||||
sql.append(" AND UPPER(o.POReference) LIKE ?");
|
else if (fromDate != null && toDate != null)
|
||||||
//
|
{
|
||||||
if (editorBPartner.getValue() != null)
|
sql.append(" AND TRUNC(o.DateOrdered) BETWEEN ? AND ?");
|
||||||
sql.append(" AND o.C_BPartner_ID=?");
|
}
|
||||||
//
|
//
|
||||||
Date fromDate = null;
|
Double fromAmount = null;
|
||||||
Date toDate = null;
|
Double toAmount = null;
|
||||||
try
|
if (amountFrom.getText() != null && amountFrom.getText().trim().length() > 0)
|
||||||
{
|
{
|
||||||
fromDate = dateFrom.getValue();
|
try
|
||||||
}
|
{
|
||||||
catch (WrongValueException e)
|
fromAmount = Double.parseDouble(amountFrom.getText());
|
||||||
{
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
}
|
{
|
||||||
try
|
|
||||||
{
|
}
|
||||||
toDate = dateTo.getValue();
|
}
|
||||||
}
|
if (amountTo.getText() != null && amountTo.getText().trim().length() > 0)
|
||||||
catch (WrongValueException e)
|
{
|
||||||
{
|
try
|
||||||
|
{
|
||||||
}
|
toAmount = Double.parseDouble(amountTo.getText());
|
||||||
if (fromDate == null && toDate != null)
|
}
|
||||||
{
|
catch (NumberFormatException e)
|
||||||
sql.append(" AND TRUNC(o.DateOrdered) <= ?");
|
{
|
||||||
}
|
|
||||||
else if (fromDate != null && toDate == null)
|
}
|
||||||
{
|
}
|
||||||
sql.append(" AND TRUNC(o.DateOrdered) >= ?");
|
if (fromAmount == null && toAmount != null)
|
||||||
}
|
{
|
||||||
else if (fromDate != null && toDate != null)
|
sql.append(" AND o.GrandTotal <= ?");
|
||||||
{
|
}
|
||||||
sql.append(" AND TRUNC(o.DateOrdered) BETWEEN ? AND ?");
|
else if (fromAmount != null && toAmount == null)
|
||||||
}
|
{
|
||||||
//
|
sql.append(" AND o.GrandTotal >= ?");
|
||||||
Double fromAmount = null;
|
}
|
||||||
Double toAmount = null;
|
else if (fromAmount != null && toAmount != null)
|
||||||
if (amountFrom.getText() != null && amountFrom.getText().trim().length() > 0)
|
{
|
||||||
{
|
sql.append(" AND o.GrandTotal BETWEEN ? AND ?");
|
||||||
try
|
}
|
||||||
{
|
sql.append(" AND o.IsSOTrx=?");
|
||||||
fromAmount = Double.parseDouble(amountFrom.getText());
|
|
||||||
}
|
log.finer(sql.toString());
|
||||||
catch (NumberFormatException e)
|
return sql.toString();
|
||||||
{
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
}
|
protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
|
||||||
if (amountTo.getText() != null && amountTo.getText().trim().length() > 0)
|
{
|
||||||
{
|
int index = 1;
|
||||||
try
|
if (txtDocumentNo.getText().length() > 0)
|
||||||
{
|
pstmt.setString(index++, getSQLText(txtDocumentNo));
|
||||||
toAmount = Double.parseDouble(amountTo.getText());
|
if (txtDescription.getText().length() > 0)
|
||||||
}
|
pstmt.setString(index++, getSQLText(txtDescription));
|
||||||
catch (NumberFormatException e)
|
if (txtOrderRef.getText().length() > 0)
|
||||||
{
|
pstmt.setString(index++, getSQLText(txtOrderRef));
|
||||||
|
//
|
||||||
}
|
if (editorBPartner.getValue() != null)
|
||||||
}
|
{
|
||||||
if (fromAmount == null && toAmount != null)
|
Integer bp = (Integer)editorBPartner.getValue();
|
||||||
{
|
pstmt.setInt(index++, bp.intValue());
|
||||||
sql.append(" AND o.GrandTotal <= ?");
|
log.fine("BPartner=" + bp);
|
||||||
}
|
}
|
||||||
else if (fromAmount != null && toAmount == null)
|
//
|
||||||
{
|
|
||||||
sql.append(" AND o.GrandTotal >= ?");
|
Date fromD = null;
|
||||||
}
|
Date toD = null;
|
||||||
else if (fromAmount != null && toAmount != null)
|
Timestamp from = null;
|
||||||
{
|
Timestamp to = null;
|
||||||
sql.append(" AND o.GrandTotal BETWEEN ? AND ?");
|
try
|
||||||
}
|
{
|
||||||
sql.append(" AND o.IsSOTrx=?");
|
if (dateFrom.getValue() != null)
|
||||||
|
{
|
||||||
log.finer(sql.toString());
|
fromD = dateFrom.getValue();
|
||||||
return sql.toString();
|
from = new Timestamp(fromD.getTime());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
catch (WrongValueException e)
|
||||||
protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
|
{
|
||||||
{
|
|
||||||
int index = 1;
|
}
|
||||||
if (txtDocumentNo.getText().length() > 0)
|
try
|
||||||
pstmt.setString(index++, getSQLText(txtDocumentNo));
|
{
|
||||||
if (txtDescription.getText().length() > 0)
|
if (dateTo.getValue() != null)
|
||||||
pstmt.setString(index++, getSQLText(txtDescription));
|
{
|
||||||
if (txtOrderRef.getText().length() > 0)
|
toD = dateTo.getValue();
|
||||||
pstmt.setString(index++, getSQLText(txtOrderRef));
|
to = new Timestamp(toD.getTime());
|
||||||
//
|
}
|
||||||
if (editorBPartner.getValue() != null)
|
}
|
||||||
{
|
catch (WrongValueException e)
|
||||||
Integer bp = (Integer)editorBPartner.getValue();
|
{
|
||||||
pstmt.setInt(index++, bp.intValue());
|
|
||||||
log.fine("BPartner=" + bp);
|
}
|
||||||
}
|
|
||||||
//
|
log.fine("Date From=" + from + ", To=" + to);
|
||||||
|
if (from == null && to != null)
|
||||||
Date fromD = null;
|
{
|
||||||
Date toD = null;
|
pstmt.setTimestamp(index++, to);
|
||||||
Timestamp from = null;
|
}
|
||||||
Timestamp to = null;
|
else if (from != null && to == null)
|
||||||
try
|
{
|
||||||
{
|
pstmt.setTimestamp(index++, from);
|
||||||
if (dateFrom.getValue() != null)
|
}
|
||||||
{
|
else if (from != null && to != null)
|
||||||
fromD = dateFrom.getValue();
|
{
|
||||||
from = new Timestamp(fromD.getTime());
|
pstmt.setTimestamp(index++, from);
|
||||||
}
|
pstmt.setTimestamp(index++, to);
|
||||||
}
|
}
|
||||||
catch (WrongValueException e)
|
|
||||||
{
|
//
|
||||||
|
BigDecimal fromBD = null;
|
||||||
}
|
BigDecimal toBD = null;
|
||||||
try
|
Double fromAmt = null;
|
||||||
{
|
Double toAmt = null;
|
||||||
if (dateTo.getValue() != null)
|
|
||||||
{
|
if (amountFrom.getText() != null && amountFrom.getText().trim().length() > 0)
|
||||||
toD = dateTo.getValue();
|
{
|
||||||
to = new Timestamp(toD.getTime());
|
try
|
||||||
}
|
{
|
||||||
}
|
fromAmt = Double.parseDouble(amountFrom.getText());
|
||||||
catch (WrongValueException e)
|
fromBD = BigDecimal.valueOf(fromAmt);
|
||||||
{
|
}
|
||||||
|
catch (Exception e)
|
||||||
}
|
{
|
||||||
|
|
||||||
log.fine("Date From=" + from + ", To=" + to);
|
}
|
||||||
if (from == null && to != null)
|
}
|
||||||
{
|
|
||||||
pstmt.setTimestamp(index++, to);
|
if (amountTo.getText() != null && amountTo.getText().trim().length() > 0)
|
||||||
}
|
{
|
||||||
else if (from != null && to == null)
|
try
|
||||||
{
|
{
|
||||||
pstmt.setTimestamp(index++, from);
|
toAmt = Double.parseDouble(amountTo.getText());
|
||||||
}
|
toBD = BigDecimal.valueOf(toAmt);
|
||||||
else if (from != null && to != null)
|
}
|
||||||
{
|
catch (Exception e)
|
||||||
pstmt.setTimestamp(index++, from);
|
{
|
||||||
pstmt.setTimestamp(index++, to);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//
|
|
||||||
BigDecimal fromBD = null;
|
if (fromBD == null && toBD != null)
|
||||||
BigDecimal toBD = null;
|
{
|
||||||
Double fromAmt = null;
|
pstmt.setBigDecimal(index++, toBD);
|
||||||
Double toAmt = null;
|
}
|
||||||
|
else if (fromBD != null && toBD == null)
|
||||||
if (amountFrom.getText() != null && amountFrom.getText().trim().length() > 0)
|
{
|
||||||
{
|
pstmt.setBigDecimal(index++, fromBD);
|
||||||
try
|
}
|
||||||
{
|
else if (fromBD != null && toBD != null)
|
||||||
fromAmt = Double.parseDouble(amountFrom.getText());
|
{
|
||||||
fromBD = BigDecimal.valueOf(fromAmt);
|
pstmt.setBigDecimal(index++, fromBD);
|
||||||
}
|
pstmt.setBigDecimal(index++, toBD);
|
||||||
catch (Exception e)
|
}
|
||||||
{
|
|
||||||
|
pstmt.setString(index++, isSoTrx.isChecked() ? "Y" : "N");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amountTo.getText() != null && amountTo.getText().trim().length() > 0)
|
/**
|
||||||
{
|
* Get SQL WHERE parameter
|
||||||
try
|
* @param f field
|
||||||
{
|
* @return sql
|
||||||
toAmt = Double.parseDouble(amountTo.getText());
|
*/
|
||||||
toBD = BigDecimal.valueOf(toAmt);
|
private String getSQLText (Textbox f)
|
||||||
}
|
{
|
||||||
catch (Exception e)
|
String s = f.getText().toUpperCase();
|
||||||
{
|
if (!s.endsWith("%"))
|
||||||
|
s += "%";
|
||||||
}
|
log.fine("String=" + s);
|
||||||
}
|
return s;
|
||||||
|
} // getSQLText
|
||||||
if (fromBD == null && toBD != null)
|
|
||||||
{
|
|
||||||
pstmt.setBigDecimal(index++, toBD);
|
public void tableChanged(WTableModelEvent event)
|
||||||
}
|
{
|
||||||
else if (fromBD != null && toBD == null)
|
// TODO Auto-generated method stub
|
||||||
{
|
|
||||||
pstmt.setBigDecimal(index++, fromBD);
|
}
|
||||||
}
|
|
||||||
else if (fromBD != null && toBD != null)
|
public void valueChange(ValueChangeEvent evt)
|
||||||
{
|
{
|
||||||
pstmt.setBigDecimal(index++, fromBD);
|
if (editorBPartner.equals(evt.getSource()))
|
||||||
pstmt.setBigDecimal(index++, toBD);
|
{
|
||||||
}
|
editorBPartner.setValue(evt.getNewValue());
|
||||||
|
}
|
||||||
pstmt.setString(index++, isSoTrx.isChecked() ? "Y" : "N");
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Get SQL WHERE parameter
|
|
||||||
* @param f field
|
|
||||||
* @return sql
|
|
||||||
*/
|
|
||||||
private String getSQLText (Textbox f)
|
|
||||||
{
|
|
||||||
String s = f.getText().toUpperCase();
|
|
||||||
if (!s.endsWith("%"))
|
|
||||||
s += "%";
|
|
||||||
log.fine("String=" + s);
|
|
||||||
return s;
|
|
||||||
} // getSQLText
|
|
||||||
|
|
||||||
|
|
||||||
public void tableChanged(WTableModelEvent event)
|
|
||||||
{
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void valueChange(ValueChangeEvent evt)
|
|
||||||
{
|
|
||||||
if (editorBPartner.equals(evt.getSource()))
|
|
||||||
{
|
|
||||||
editorBPartner.setValue(evt.getNewValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue