Merge with e76509b9044277fe04d201ce43aabf9f1734b22e
This commit is contained in:
commit
63ea8a38a2
|
@ -0,0 +1,10 @@
|
|||
-- Jul 16, 2012 5:38:59 AM AST
|
||||
-- IDEMPIERE-320 - Make Swing CTextArea consistent with ZK
|
||||
INSERT INTO AD_SysConfig (AD_SysConfig_ID,EntityType,ConfigurationLevel,Value,Description,AD_SysConfig_UU,Created,Updated,AD_Client_ID,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name) VALUES (200012,'D','C','N','Override Text Area behaviour, ENTER to change value, TAB to focus next, Shift-ENTER for new line','b8634904-e4d1-48da-8b86-cc46d12cb52d',TO_DATE('2012-07-16 05:38:58','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-07-16 05:38:58','YYYY-MM-DD HH24:MI:SS'),0,0,100,'Y',100,'SWING_OVERRIDE_TEXT_AREA_BEHAVIOUR')
|
||||
;
|
||||
|
||||
UPDATE AD_System
|
||||
SET LastMigrationScriptApplied='851_IDEMPIERE-320.sql'
|
||||
WHERE LastMigrationScriptApplied<'851_IDEMPIERE-320.sql'
|
||||
OR LastMigrationScriptApplied IS NULL
|
||||
;
|
|
@ -0,0 +1,11 @@
|
|||
-- Jul 16, 2012 5:38:59 AM AST
|
||||
-- IDEMPIERE-320 - Make Swing CTextArea consistent with ZK
|
||||
INSERT INTO AD_SysConfig (AD_SysConfig_ID,EntityType,ConfigurationLevel,Value,Description,AD_SysConfig_UU,Created,Updated,AD_Client_ID,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name) VALUES (200012,'D','C','N','Override Text Area behaviour, ENTER to change value, TAB to focus next, Shift-ENTER for new line','b8634904-e4d1-48da-8b86-cc46d12cb52d',TO_TIMESTAMP('2012-07-16 05:38:58','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-07-16 05:38:58','YYYY-MM-DD HH24:MI:SS'),0,0,100,'Y',100,'SWING_OVERRIDE_TEXT_AREA_BEHAVIOUR')
|
||||
;
|
||||
|
||||
UPDATE AD_System
|
||||
SET LastMigrationScriptApplied='851_IDEMPIERE-320.sql'
|
||||
WHERE LastMigrationScriptApplied<'851_IDEMPIERE-320.sql'
|
||||
OR LastMigrationScriptApplied IS NULL
|
||||
;
|
||||
|
|
@ -26,9 +26,12 @@ import java.util.Properties;
|
|||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.compiere.print.MPrintFormat;
|
||||
import org.compiere.print.ReportEngine;
|
||||
import org.compiere.process.DocAction;
|
||||
import org.compiere.process.DocumentEngine;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.process.ServerProcessCtl;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -616,6 +619,21 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.SHIPMENT, getM_InOut_ID(), get_TrxName());
|
||||
if (re == null)
|
||||
return null;
|
||||
MPrintFormat format = re.getPrintFormat();
|
||||
// We have a Jasper Print Format
|
||||
// ==============================
|
||||
if(format.getJasperProcess_ID() > 0)
|
||||
{
|
||||
ProcessInfo pi = new ProcessInfo ("", format.getJasperProcess_ID());
|
||||
pi.setRecord_ID ( getM_InOut_ID() );
|
||||
pi.setIsBatch(true);
|
||||
|
||||
ServerProcessCtl.process(null, pi, null);
|
||||
|
||||
return pi.getPDFReport();
|
||||
}
|
||||
// Standard Print Format (Non-Jasper)
|
||||
// ==================================
|
||||
return re.getPDF(file);
|
||||
} // createPDF
|
||||
|
||||
|
|
|
@ -30,9 +30,12 @@ import java.util.logging.Level;
|
|||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.exceptions.BPartnerNoAddressException;
|
||||
import org.adempiere.exceptions.DBException;
|
||||
import org.compiere.print.MPrintFormat;
|
||||
import org.compiere.print.ReportEngine;
|
||||
import org.compiere.process.DocAction;
|
||||
import org.compiere.process.DocumentEngine;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.process.ServerProcessCtl;
|
||||
import org.compiere.util.CCache;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
|
@ -1272,6 +1275,21 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.INVOICE, getC_Invoice_ID(), get_TrxName());
|
||||
if (re == null)
|
||||
return null;
|
||||
MPrintFormat format = re.getPrintFormat();
|
||||
// We have a Jasper Print Format
|
||||
// ==============================
|
||||
if(format.getJasperProcess_ID() > 0)
|
||||
{
|
||||
ProcessInfo pi = new ProcessInfo ("", format.getJasperProcess_ID());
|
||||
pi.setRecord_ID ( getC_Invoice_ID() );
|
||||
pi.setIsBatch(true);
|
||||
|
||||
ServerProcessCtl.process(null, pi, null);
|
||||
|
||||
return pi.getPDFReport();
|
||||
}
|
||||
// Standard Print Format (Non-Jasper)
|
||||
// ==================================
|
||||
return re.getPDF(file);
|
||||
} // createPDF
|
||||
|
||||
|
|
|
@ -30,15 +30,16 @@ import java.util.Vector;
|
|||
import java.util.logging.Level;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.mail.internet.AddressException;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.exceptions.BPartnerNoBillToAddressException;
|
||||
import org.adempiere.exceptions.BPartnerNoShipToAddressException;
|
||||
import org.adempiere.exceptions.FillMandatoryException;
|
||||
import org.compiere.print.MPrintFormat;
|
||||
import org.compiere.print.ReportEngine;
|
||||
import org.compiere.process.DocAction;
|
||||
import org.compiere.process.DocumentEngine;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.process.ServerProcessCtl;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
|
@ -618,6 +619,21 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.ORDER, getC_Order_ID(), get_TrxName());
|
||||
if (re == null)
|
||||
return null;
|
||||
MPrintFormat format = re.getPrintFormat();
|
||||
// We have a Jasper Print Format
|
||||
// ==============================
|
||||
if(format.getJasperProcess_ID() > 0)
|
||||
{
|
||||
ProcessInfo pi = new ProcessInfo ("", format.getJasperProcess_ID());
|
||||
pi.setRecord_ID ( getC_Order_ID() );
|
||||
pi.setIsBatch(true);
|
||||
|
||||
ServerProcessCtl.process(null, pi, null);
|
||||
|
||||
return pi.getPDFReport();
|
||||
}
|
||||
// Standard Print Format (Non-Jasper)
|
||||
// ==================================
|
||||
return re.getPDF(file);
|
||||
} // createPDF
|
||||
|
||||
|
|
|
@ -25,7 +25,10 @@ import java.util.ArrayList;
|
|||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.print.MPrintFormat;
|
||||
import org.compiere.print.ReportEngine;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.process.ServerProcessCtl;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.EMail;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -286,6 +289,21 @@ public class MRfQResponse extends X_C_RfQResponse
|
|||
ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.RFQ, getC_RfQResponse_ID());
|
||||
if (re == null)
|
||||
return null;
|
||||
MPrintFormat format = re.getPrintFormat();
|
||||
// We have a Jasper Print Format
|
||||
// ==============================
|
||||
if(format.getJasperProcess_ID() > 0)
|
||||
{
|
||||
ProcessInfo pi = new ProcessInfo ("", format.getJasperProcess_ID());
|
||||
pi.setRecord_ID ( getC_RfQResponse_ID() );
|
||||
pi.setIsBatch(true);
|
||||
|
||||
ServerProcessCtl.process(null, pi, null);
|
||||
|
||||
return pi.getPDFReport();
|
||||
}
|
||||
// Standard Print Format (Non-Jasper)
|
||||
// ==================================
|
||||
return re.getPDF(file);
|
||||
} // getPDF
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@ Bundle-Name: org.adempiere.server
|
|||
Bundle-SymbolicName: org.adempiere.server;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Require-Bundle: org.adempiere.base;bundle-version="1.0.0",
|
||||
org.eclipse.equinox.app;bundle-version="1.3.0"
|
||||
org.eclipse.equinox.app;bundle-version="1.3.0",
|
||||
org.adempiere.report.jasper;bundle-version="1.0.0",
|
||||
org.adempiere.report.jasper.library;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Web-ContextPath: /
|
||||
Bundle-ClassPath: WEB-INF/lib/jardiff.jar,
|
||||
|
|
|
@ -38,9 +38,11 @@ import org.compiere.model.MScheduler;
|
|||
import org.compiere.model.MSchedulerLog;
|
||||
import org.compiere.model.MSchedulerPara;
|
||||
import org.compiere.model.MUser;
|
||||
import org.compiere.print.MPrintFormat;
|
||||
import org.compiere.print.ReportEngine;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.process.ProcessInfoUtil;
|
||||
import org.compiere.process.ServerProcessCtl;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.TimeUtil;
|
||||
|
@ -218,11 +220,26 @@ public class Scheduler extends AdempiereServer
|
|||
if (isReport) {
|
||||
// Report
|
||||
ReportEngine re = ReportEngine.get(m_schedulerctx, pi);
|
||||
if (re == null)
|
||||
return "Cannot create Report AD_Process_ID=" + process.getAD_Process_ID()
|
||||
+ " - " + process.getName();
|
||||
report = re.getPDF();
|
||||
|
||||
|
||||
if(process.getJasperReport() != null
|
||||
|| (re != null && re.getPrintFormat().getJasperProcess_ID() > 0))
|
||||
{
|
||||
// We have a Jasper Print Format
|
||||
// ==============================
|
||||
ProcessInfo jasperpi = new ProcessInfo ("", process.getAD_Process_ID());
|
||||
jasperpi.setIsBatch(true);
|
||||
ServerProcessCtl.process(null, jasperpi, null);
|
||||
report = jasperpi.getPDFReport();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Standard Print Format (Non-Jasper)
|
||||
// ==================================
|
||||
if (re == null)
|
||||
return "Cannot create Report AD_Process_ID=" + process.getAD_Process_ID()
|
||||
+ " - " + process.getName();
|
||||
report = re.getPDF();
|
||||
}
|
||||
}
|
||||
|
||||
if (notice) {
|
||||
|
|
|
@ -80,9 +80,9 @@ import org.jdesktop.swingx.JXTaskPane;
|
|||
public class InfoProduct extends Info implements ActionListener, ChangeListener
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 2076229793041196087L;
|
||||
private static final long serialVersionUID = -2119729271332154941L;
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
|
@ -152,7 +152,6 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
|
||||
/** Array of Column Info */
|
||||
private static Info_Column[] s_productLayout = null;
|
||||
private static int s_productLayoutRole = -1;
|
||||
private static int INDEX_NAME = 0;
|
||||
private static int INDEX_PATTRIBUTE = 0;
|
||||
|
||||
|
@ -192,6 +191,10 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
private int m_M_Product_ID = 0;
|
||||
int mWindowNo = 0;
|
||||
//End - fer_luck @ centuryon
|
||||
|
||||
//IDEMPIERE-339
|
||||
MiniTable productpriceTbl = new MiniTable();
|
||||
String m_sqlProductprice;
|
||||
|
||||
/** Search Button */
|
||||
private CButton m_InfoPAttributeButton = new CButton(Env.getImageIcon("PAttribute16.gif"));
|
||||
|
@ -351,13 +354,37 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
m_tableAtp.setRowSelectionAllowed(false);
|
||||
m_tableAtp.setMultiSelection(false);
|
||||
|
||||
//IDEMPIERE-339
|
||||
ArrayList<ColumnInfo> list = new ArrayList<ColumnInfo>();
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceListVersion"), "plv.Name", String.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "ValidFrom"), "plv.ValidFrom", Timestamp.class));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3027/*PriceList*/, false))
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceList"), "bomPriceList(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS PriceList", Double.class));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false))
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "bomPriceStd(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS PriceStd", Double.class));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false) && MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false))
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "Margin"), "bomPriceStd(pp.M_Product_ID, pp.M_PriceList_Version_ID)-bomPriceLimit(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS Margin", Double.class));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false))
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceLimit"), "bomPriceLimit(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS PriceLimit", Double.class));
|
||||
ColumnInfo[] s_layoutProductPrice = new ColumnInfo[list.size()];
|
||||
list.toArray(s_layoutProductPrice);
|
||||
s_sqlFrom = "M_ProductPrice pp INNER JOIN M_PriceList_Version plv ON pp.M_PriceList_Version_ID = plv.M_PriceList_Version_ID";
|
||||
s_sqlWhere = "pp.M_Product_ID = ? AND plv.IsActive = 'Y' AND pp.IsActive = 'Y'";
|
||||
m_sqlProductprice = productpriceTbl.prepareTable(s_layoutProductPrice, s_sqlFrom, s_sqlWhere, false, "pp") + " ORDER BY plv.ValidFrom DESC";
|
||||
productpriceTbl.setRowSelectionAllowed(false);
|
||||
productpriceTbl.setMultiSelection(false);
|
||||
productpriceTbl.addMouseListener(this);
|
||||
productpriceTbl.getSelectionModel().addListSelectionListener(this);
|
||||
productpriceTbl.autoSize();
|
||||
|
||||
CTabbedPane jTab = new CTabbedPane();
|
||||
jTab.addTab(Msg.translate(Env.getCtx(), "Warehouse"), new JScrollPane(warehouseTbl));
|
||||
jTab.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 250 : 105));
|
||||
jTab.addTab(Msg.translate(Env.getCtx(), "Description"), new JScrollPane(fieldDescription));
|
||||
jTab.addTab(Msg.translate(Env.getCtx(), "Substitute_ID"), new JScrollPane(substituteTbl));
|
||||
jTab.addTab(Msg.translate(Env.getCtx(), "RelatedProduct_ID"), new JScrollPane(relatedTbl));
|
||||
jTab.addTab (Msg.getMsg(Env.getCtx(), "ATP"), new JScrollPane(m_tableAtp));
|
||||
jTab.addTab(Msg.getMsg(Env.getCtx(), "ATP"), new JScrollPane(m_tableAtp));
|
||||
jTab.addTab(Msg.translate(Env.getCtx(), "Price"), new JScrollPane(productpriceTbl));
|
||||
jTab.addChangeListener(this);
|
||||
tablePanel.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 255 : 110));
|
||||
tablePanel.add(jTab);
|
||||
|
@ -465,6 +492,24 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
rs = null; pstmt = null;
|
||||
}
|
||||
initAtpTab(M_Warehouse_ID);
|
||||
|
||||
// IDEMPIERE-339
|
||||
sql = m_sqlProductprice;
|
||||
log.finest(sql);
|
||||
try {
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, m_M_Product_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
productpriceTbl.loadTable(rs);
|
||||
rs.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
} // refresh
|
||||
//End - fer_luck @ centuryon
|
||||
|
||||
|
@ -497,10 +542,15 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
setPriceListVersion (M_PriceList_Version_ID);
|
||||
|
||||
// Create Grid
|
||||
String orderBy = null;
|
||||
StringBuffer where = new StringBuffer();
|
||||
where.append("p.IsActive='Y'");
|
||||
if (M_Warehouse_ID != 0)
|
||||
{
|
||||
where.append(" AND p.IsSummary='N'");
|
||||
orderBy = "QtyAvailable DESC";
|
||||
}
|
||||
|
||||
// dynamic Where Clause
|
||||
if (p_whereClause != null && p_whereClause.length() > 0)
|
||||
where.append(" AND ") // replace fully qualified name with alias
|
||||
|
@ -509,7 +559,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
prepareTable(getProductLayout(),
|
||||
s_productFrom,
|
||||
where.toString(),
|
||||
"QtyAvailable DESC");
|
||||
orderBy);
|
||||
p_table.setShowTotals(false);
|
||||
//
|
||||
pickWarehouse.addActionListener(this);
|
||||
|
@ -873,9 +923,34 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
// don't requery if fieldValue and fieldName are empty
|
||||
if ((e.getSource() == pickWarehouse || e.getSource() == pickPriceList)
|
||||
&& (fieldValue.getText().length() == 0 && fieldName.getText().length() == 0))
|
||||
return;
|
||||
if (e.getSource() == pickWarehouse || e.getSource() == pickPriceList)
|
||||
{
|
||||
// IDEMPIERE-337 - Improve Info Product Window
|
||||
boolean execute = true;
|
||||
if (fieldValue.getText().length() == 0 && fieldName.getText().length() == 0 && p_table.getRowCount() == 0)
|
||||
execute = false;
|
||||
p_table.setRowCount(0);
|
||||
((DefaultTableModel)p_table.getModel()).setColumnCount(0);
|
||||
int M_Warehouse_ID = ((KeyNamePair)pickWarehouse.getSelectedItem()).getKey();
|
||||
// Create Grid
|
||||
StringBuffer where = new StringBuffer();
|
||||
where.append("p.IsActive='Y'");
|
||||
if (M_Warehouse_ID != 0)
|
||||
where.append(" AND p.IsSummary='N'");
|
||||
// dynamic Where Clause
|
||||
if (p_whereClause != null && p_whereClause.length() > 0)
|
||||
where.append(" AND ") // replace fully qualified name with alias
|
||||
.append(Util.replace(p_whereClause, "M_Product.", "p."));
|
||||
//
|
||||
p_table.removeMouseListener(this);
|
||||
prepareTable(getProductLayout(),
|
||||
s_productFrom,
|
||||
where.toString(),
|
||||
"");
|
||||
p_table.setShowTotals(false);
|
||||
if (!execute)
|
||||
return;
|
||||
}
|
||||
|
||||
// Product Attribute Search
|
||||
if (e.getSource().equals(m_InfoPAttributeButton))
|
||||
|
@ -906,7 +981,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
//
|
||||
super.actionPerformed(e);
|
||||
} // actionPerformed
|
||||
|
||||
|
||||
/**
|
||||
* Enable PAttribute if row selected/changed
|
||||
*/
|
||||
|
@ -1053,33 +1128,46 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
*/
|
||||
protected Info_Column[] getProductLayout()
|
||||
{
|
||||
if (s_productLayout != null && s_productLayoutRole == MRole.getDefault().getAD_Role_ID())
|
||||
return s_productLayout;
|
||||
// IDEMPIERE-337
|
||||
//if (s_productLayout != null && s_productLayoutRole == MRole.getDefault().getAD_Role_ID())
|
||||
// return s_productLayout;
|
||||
//
|
||||
s_productLayout = null;
|
||||
s_productLayoutRole = MRole.getDefault().getAD_Role_ID();
|
||||
// IDEMPIERE_337
|
||||
int M_Warehouse_ID = 0;
|
||||
KeyNamePair warehouse = (KeyNamePair)pickWarehouse.getSelectedItem();
|
||||
M_Warehouse_ID = warehouse.getKey();
|
||||
int M_PriceList_ID = 0;
|
||||
KeyNamePair pricelist = (KeyNamePair)pickPriceList.getSelectedItem();
|
||||
M_PriceList_ID = pricelist.getKey();
|
||||
|
||||
ArrayList<Info_Column> list = new ArrayList<Info_Column>();
|
||||
list.add(new Info_Column(" ", "p.M_Product_ID", IDColumn.class, !p_multiSelection));
|
||||
list.add(new Info_Column(" ", "DISTINCT p.M_Product_ID", IDColumn.class, !p_multiSelection));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "Discontinued").substring(0, 1), "p.Discontinued", Boolean.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "Value"), "p.Value", String.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "Name"), "p.Name", String.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyAvailable"), "case when p.IsBOM='N' and (p.ProductType!='I' OR p.IsStocked='N') then to_number(get_Sysconfig('QTY_TO_SHOW_FOR_SERVICES', '99999', p.ad_client_id, 0), '99999999999') else bomQtyAvailable(p.M_Product_ID,?,0) end AS QtyAvailable", Double.class, true, true, null));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3027/*PriceList*/, false))
|
||||
// IDEMPIERE-337
|
||||
if (M_Warehouse_ID != 0)
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyAvailable"), "case when p.IsBOM='N' and (p.ProductType!='I' OR p.IsStocked='N') then to_number(get_Sysconfig('QTY_TO_SHOW_FOR_SERVICES', '99999', p.ad_client_id, 0), '99999999999') else bomQtyAvailable(p.M_Product_ID,?,0) end AS QtyAvailable", Double.class, true, true, null));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3027/*PriceList*/, false) && M_PriceList_ID != 0)
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "PriceList"), "bomPriceList(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceList", BigDecimal.class));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false))
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false) && M_PriceList_ID !=0)
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "PriceStd"), "bomPriceStd(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceStd", BigDecimal.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyOnHand"), "case when p.IsBOM='N' and (p.ProductType!='I' OR p.IsStocked='N') then to_number(get_Sysconfig('QTY_TO_SHOW_FOR_SERVICES', '99999', p.ad_client_id, 0), '99999999999') else bomQtyOnHand(p.M_Product_ID,?,0) end AS QtyOnHand", Double.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyReserved"), "bomQtyReserved(p.M_Product_ID,?,0) AS QtyReserved", Double.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyOrdered"), "bomQtyOrdered(p.M_Product_ID,?,0) AS QtyOrdered", Double.class));
|
||||
if (isUnconfirmed())
|
||||
if (M_Warehouse_ID != 0)
|
||||
{
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyUnconfirmed"), "(SELECT SUM(c.TargetQty) FROM M_InOutLineConfirm c INNER JOIN M_InOutLine il ON (c.M_InOutLine_ID=il.M_InOutLine_ID) INNER JOIN M_InOut i ON (il.M_InOut_ID=i.M_InOut_ID) WHERE c.Processed='N' AND i.M_Warehouse_ID=? AND il.M_Product_ID=p.M_Product_ID) AS QtyUnconfirmed", Double.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyUnconfirmedMove"), "(SELECT SUM(c.TargetQty) FROM M_MovementLineConfirm c INNER JOIN M_MovementLine ml ON (c.M_MovementLine_ID=ml.M_MovementLine_ID) INNER JOIN M_Locator l ON (ml.M_LocatorTo_ID=l.M_Locator_ID) WHERE c.Processed='N' AND l.M_Warehouse_ID=? AND ml.M_Product_ID=p.M_Product_ID) AS QtyUnconfirmedMove", Double.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyOnHand"), "case when p.IsBOM='N' and (p.ProductType!='I' OR p.IsStocked='N') then to_number(get_Sysconfig('QTY_TO_SHOW_FOR_SERVICES', '99999', p.ad_client_id, 0), '99999999999') else bomQtyOnHand(p.M_Product_ID,?,0) end AS QtyOnHand", Double.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyReserved"), "bomQtyReserved(p.M_Product_ID,?,0) AS QtyReserved", Double.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyOrdered"), "bomQtyOrdered(p.M_Product_ID,?,0) AS QtyOrdered", Double.class));
|
||||
if (isUnconfirmed())
|
||||
{
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyUnconfirmed"), "(SELECT SUM(c.TargetQty) FROM M_InOutLineConfirm c INNER JOIN M_InOutLine il ON (c.M_InOutLine_ID=il.M_InOutLine_ID) INNER JOIN M_InOut i ON (il.M_InOut_ID=i.M_InOut_ID) WHERE c.Processed='N' AND i.M_Warehouse_ID=? AND il.M_Product_ID=p.M_Product_ID) AS QtyUnconfirmed", Double.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyUnconfirmedMove"), "(SELECT SUM(c.TargetQty) FROM M_MovementLineConfirm c INNER JOIN M_MovementLine ml ON (c.M_MovementLine_ID=ml.M_MovementLine_ID) INNER JOIN M_Locator l ON (ml.M_LocatorTo_ID=l.M_Locator_ID) WHERE c.Processed='N' AND l.M_Warehouse_ID=? AND ml.M_Product_ID=p.M_Product_ID) AS QtyUnconfirmedMove", Double.class));
|
||||
}
|
||||
}
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false) && MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false))
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false) && MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false) && M_PriceList_ID != 0)
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "Margin"), "bomPriceStd(p.M_Product_ID, pr.M_PriceList_Version_ID)-bomPriceLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS Margin", BigDecimal.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "Vendor"), "bp.Name", String.class));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false))
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false) && M_PriceList_ID != 0)
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "PriceLimit"), "bomPriceLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceLimit", BigDecimal.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "IsInstanceAttribute"), "pa.IsInstanceAttribute", Boolean.class));
|
||||
s_productLayout = new Info_Column[list.size()];
|
||||
|
|
|
@ -17,19 +17,31 @@
|
|||
package org.compiere.swing;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.InputMethodListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.im.InputMethodRequests;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.ActionMap;
|
||||
import javax.swing.FocusManager;
|
||||
import javax.swing.InputMap;
|
||||
import javax.swing.InputVerifier;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.text.Document;
|
||||
|
||||
import org.adempiere.plaf.AdempierePLAF;
|
||||
import org.compiere.model.MSysConfig;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
* Adempiere TextArea - A ScrollPane with a JTextArea.
|
||||
|
@ -45,6 +57,12 @@ public class CTextArea extends JScrollPane
|
|||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6208738910767859872L;
|
||||
|
||||
// IDEMPIERE-320
|
||||
private static final String FIRE_CHANGE = "fire-change";
|
||||
private static final String INSERT_BREAK = "insert-break";
|
||||
private static final String TAB_PRESS = "tab-press";
|
||||
private static final String SHIFT_TAB_PRESS = "shift-tab-press";
|
||||
|
||||
/**
|
||||
* Constructs a new TextArea. A default model is set, the initial string
|
||||
|
@ -140,6 +158,60 @@ public class CTextArea extends JScrollPane
|
|||
m_textArea.setWrapStyleWord(true);
|
||||
// Overwrite default Tab
|
||||
m_textArea.firePropertyChange("editable", !isEditable(), isEditable());
|
||||
|
||||
// IDEMPIERE-320
|
||||
boolean taBehaviour = MSysConfig.getBooleanValue("SWING_OVERRIDE_TEXT_AREA_BEHAVIOUR", false, Env.getAD_Client_ID(Env.getCtx()));
|
||||
if (taBehaviour)
|
||||
{
|
||||
InputMap im = m_textArea.getInputMap();
|
||||
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_DOWN_MASK), INSERT_BREAK);
|
||||
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), FIRE_CHANGE);
|
||||
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), TAB_PRESS);
|
||||
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_DOWN_MASK), SHIFT_TAB_PRESS);
|
||||
|
||||
ActionMap am = m_textArea.getActionMap();
|
||||
am.put(FIRE_CHANGE, new AbstractAction() {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -4599908611347627047L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
m_textArea.dispatchEvent(new FocusEvent(m_textArea, FocusEvent.FOCUS_LOST));
|
||||
m_textArea.requestFocus();
|
||||
}
|
||||
});
|
||||
|
||||
am.put(TAB_PRESS, new AbstractAction() {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -410878209760495750L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
FocusManager.getCurrentKeyboardFocusManager()
|
||||
.focusNextComponent();
|
||||
}
|
||||
});
|
||||
|
||||
am.put(SHIFT_TAB_PRESS, new AbstractAction() {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8279987397360805855L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
FocusManager.getCurrentKeyboardFocusManager()
|
||||
.focusPreviousComponent();
|
||||
}
|
||||
});
|
||||
}
|
||||
} // CTextArea
|
||||
|
||||
/** Text Area */
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.adempiere.webui.window.InfoSchedule;
|
|||
import org.compiere.model.MRole;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
|
@ -53,7 +54,7 @@ public class DPViews extends DashboardPanel implements EventListener {
|
|||
if (MRole.getDefault().isAllow_Info_Product())
|
||||
{
|
||||
ToolBarButton btnViewItem = new ToolBarButton("InfoProduct");
|
||||
btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoProduct"));
|
||||
btnViewItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "InfoProduct")));
|
||||
btnViewItem.setImage("/images/InfoProduct16.png");
|
||||
btnViewItem.addEventListener(Events.ON_CLICK, this);
|
||||
vbox.appendChild(btnViewItem);
|
||||
|
@ -61,7 +62,7 @@ public class DPViews extends DashboardPanel implements EventListener {
|
|||
if (MRole.getDefault().isAllow_Info_BPartner())
|
||||
{
|
||||
ToolBarButton btnViewItem = new ToolBarButton("InfoBPartner");
|
||||
btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoBPartner"));
|
||||
btnViewItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "InfoBPartner")));
|
||||
btnViewItem.setImage("/images/InfoBPartner16.png");
|
||||
btnViewItem.addEventListener(Events.ON_CLICK, this);
|
||||
vbox.appendChild(btnViewItem);
|
||||
|
@ -69,7 +70,7 @@ public class DPViews extends DashboardPanel implements EventListener {
|
|||
if (MRole.getDefault().isShowAcct() && MRole.getDefault().isAllow_Info_Account())
|
||||
{
|
||||
ToolBarButton btnViewItem = new ToolBarButton("InfoAccount");
|
||||
btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoAccount"));
|
||||
btnViewItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "InfoAccount")));
|
||||
btnViewItem.setImage("/images/InfoAccount16.png");
|
||||
btnViewItem.addEventListener(Events.ON_CLICK, this);
|
||||
vbox.appendChild(btnViewItem);
|
||||
|
@ -77,7 +78,7 @@ public class DPViews extends DashboardPanel implements EventListener {
|
|||
if (MRole.getDefault().isAllow_Info_Schedule())
|
||||
{
|
||||
ToolBarButton btnViewItem = new ToolBarButton("InfoSchedule");
|
||||
btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoSchedule"));
|
||||
btnViewItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "InfoSchedule")));
|
||||
btnViewItem.setImage("/images/InfoSchedule16.png");
|
||||
btnViewItem.addEventListener(Events.ON_CLICK, this);
|
||||
vbox.appendChild(btnViewItem);
|
||||
|
@ -86,7 +87,7 @@ public class DPViews extends DashboardPanel implements EventListener {
|
|||
if (MRole.getDefault().isAllow_Info_Order())
|
||||
{
|
||||
ToolBarButton btnViewItem = new ToolBarButton("InfoOrder");
|
||||
btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoOrder"));
|
||||
btnViewItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "InfoOrder")));
|
||||
btnViewItem.setImage("/images/Info16.png");
|
||||
btnViewItem.addEventListener(Events.ON_CLICK, this);
|
||||
vbox.appendChild(btnViewItem);
|
||||
|
@ -94,7 +95,7 @@ public class DPViews extends DashboardPanel implements EventListener {
|
|||
if (MRole.getDefault().isAllow_Info_Invoice())
|
||||
{
|
||||
ToolBarButton btnViewItem = new ToolBarButton("InfoInvoice");
|
||||
btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoInvoice"));
|
||||
btnViewItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "InfoInvoice")));
|
||||
btnViewItem.setImage("/images/Info16.png");
|
||||
btnViewItem.addEventListener(Events.ON_CLICK, this);
|
||||
vbox.appendChild(btnViewItem);
|
||||
|
@ -102,7 +103,7 @@ public class DPViews extends DashboardPanel implements EventListener {
|
|||
if (MRole.getDefault().isAllow_Info_InOut())
|
||||
{
|
||||
ToolBarButton btnViewItem = new ToolBarButton("InfoInOut");
|
||||
btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoInOut"));
|
||||
btnViewItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "InfoInOut")));
|
||||
btnViewItem.setImage("/images/Info16.png");
|
||||
btnViewItem.addEventListener(Events.ON_CLICK, this);
|
||||
vbox.appendChild(btnViewItem);
|
||||
|
@ -110,7 +111,7 @@ public class DPViews extends DashboardPanel implements EventListener {
|
|||
if (MRole.getDefault().isAllow_Info_Payment())
|
||||
{
|
||||
ToolBarButton btnViewItem = new ToolBarButton("InfoPayment");
|
||||
btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoPayment"));
|
||||
btnViewItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "InfoPayment")));
|
||||
btnViewItem.setImage("/images/Info16.png");
|
||||
btnViewItem.addEventListener(Events.ON_CLICK, this);
|
||||
vbox.appendChild(btnViewItem);
|
||||
|
@ -118,7 +119,7 @@ public class DPViews extends DashboardPanel implements EventListener {
|
|||
if (MRole.getDefault().isAllow_Info_CashJournal())
|
||||
{
|
||||
ToolBarButton btnViewItem = new ToolBarButton("InfoCashLine");
|
||||
btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoCashLine"));
|
||||
btnViewItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "InfoCashLine")));
|
||||
btnViewItem.setImage("/images/Info16.png");
|
||||
btnViewItem.addEventListener(Events.ON_CLICK, this);
|
||||
vbox.appendChild(btnViewItem);
|
||||
|
@ -126,7 +127,7 @@ public class DPViews extends DashboardPanel implements EventListener {
|
|||
if (MRole.getDefault().isAllow_Info_Resource())
|
||||
{
|
||||
ToolBarButton btnViewItem = new ToolBarButton("InfoAssignment");
|
||||
btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoAssignment"));
|
||||
btnViewItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "InfoAssignment")));
|
||||
btnViewItem.setImage("/images/Info16.png");
|
||||
btnViewItem.addEventListener(Events.ON_CLICK, this);
|
||||
vbox.appendChild(btnViewItem);
|
||||
|
@ -134,7 +135,7 @@ public class DPViews extends DashboardPanel implements EventListener {
|
|||
if (MRole.getDefault().isAllow_Info_Asset())
|
||||
{
|
||||
ToolBarButton btnViewItem = new ToolBarButton("InfoAsset");
|
||||
btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoAsset"));
|
||||
btnViewItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "InfoAsset")));
|
||||
btnViewItem.setImage("/images/Info16.png");
|
||||
btnViewItem.addEventListener(Events.ON_CLICK, this);
|
||||
vbox.appendChild(btnViewItem);
|
||||
|
|
|
@ -94,9 +94,10 @@ import org.zkoss.zul.South;
|
|||
public class InfoProductPanel extends InfoPanel implements EventListener
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6804975825156657866L;
|
||||
private static final long serialVersionUID = 3728242035878883637L;
|
||||
|
||||
private Label lblValue = new Label();
|
||||
private Textbox fieldValue = new Textbox();
|
||||
private Label lblName = new Label();
|
||||
|
@ -134,6 +135,10 @@ public class InfoProductPanel extends InfoPanel implements EventListener
|
|||
int mWindowNo = 0;
|
||||
//
|
||||
|
||||
//IDEMPIERE-337
|
||||
WListbox productpriceTbl = ListboxFactory.newDataTable();
|
||||
String m_sqlProductprice;
|
||||
|
||||
/** Search Button */
|
||||
private Button m_InfoPAttributeButton = new Button();
|
||||
/** Instance Button */
|
||||
|
@ -148,7 +153,6 @@ public class InfoProductPanel extends InfoPanel implements EventListener
|
|||
|
||||
/** Array of Column Info */
|
||||
private static ColumnInfo[] s_productLayout = null;
|
||||
private static int s_productLayoutRole = -1;
|
||||
private static int INDEX_NAME = 0;
|
||||
private static int INDEX_PATTRIBUTE = 0;
|
||||
|
||||
|
@ -160,7 +164,7 @@ public class InfoProductPanel extends InfoPanel implements EventListener
|
|||
|
||||
private String m_pAttributeWhere = null;
|
||||
private int m_C_BPartner_ID = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
* @param WindowNo window no
|
||||
|
@ -413,6 +417,27 @@ public class InfoProductPanel extends InfoPanel implements EventListener
|
|||
//Available to Promise Tab
|
||||
m_tableAtp.setMultiSelection(false);
|
||||
|
||||
//IDEMPIERE-337
|
||||
ArrayList<ColumnInfo> list = new ArrayList<ColumnInfo>();
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceListVersion"), "plv.Name", String.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "ValidFrom"), "plv.ValidFrom", Timestamp.class));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3027/*PriceList*/, false))
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceList"), "bomPriceList(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS PriceList", Double.class));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false))
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "bomPriceStd(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS PriceStd", Double.class));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false) && MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false))
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "Margin"), "bomPriceStd(pp.M_Product_ID, pp.M_PriceList_Version_ID)-bomPriceLimit(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS Margin", Double.class));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false))
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceLimit"), "bomPriceLimit(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS PriceLimit", Double.class));
|
||||
ColumnInfo[] s_layoutProductPrice = new ColumnInfo[list.size()];
|
||||
list.toArray(s_layoutProductPrice);
|
||||
s_sqlFrom = "M_ProductPrice pp INNER JOIN M_PriceList_Version plv ON pp.M_PriceList_Version_ID = plv.M_PriceList_Version_ID";
|
||||
s_sqlWhere = "pp.M_Product_ID = ? AND plv.IsActive = 'Y' AND pp.IsActive = 'Y'";
|
||||
m_sqlProductprice = productpriceTbl.prepareTable(s_layoutProductPrice, s_sqlFrom, s_sqlWhere, false, "pp") + " ORDER BY plv.ValidFrom DESC";
|
||||
productpriceTbl.setMultiSelection(false);
|
||||
productpriceTbl.autoSize();
|
||||
productpriceTbl.getModel().addTableModelListener(this);
|
||||
|
||||
tabbedPane.setHeight("100%");
|
||||
Tabpanels tabPanels = new Tabpanels();
|
||||
tabbedPane.appendChild(tabPanels);
|
||||
|
@ -455,6 +480,13 @@ public class InfoProductPanel extends InfoPanel implements EventListener
|
|||
desktopTabPanel.setHeight("100%");
|
||||
desktopTabPanel.appendChild(m_tableAtp);
|
||||
tabPanels.appendChild(desktopTabPanel);
|
||||
|
||||
tab = new Tab(Msg.translate(Env.getCtx(), "Price"));
|
||||
tabs.appendChild(tab);
|
||||
desktopTabPanel = new Tabpanel();
|
||||
desktopTabPanel.setHeight("100%");
|
||||
desktopTabPanel.appendChild(productpriceTbl);
|
||||
tabPanels.appendChild(desktopTabPanel);
|
||||
//
|
||||
int height = SessionManager.getAppDesktop().getClientInfo().desktopHeight * 90 / 100;
|
||||
int width = SessionManager.getAppDesktop().getClientInfo().desktopWidth * 80 / 100;
|
||||
|
@ -505,7 +537,7 @@ public class InfoProductPanel extends InfoPanel implements EventListener
|
|||
this.setHeight(height + "px");
|
||||
}
|
||||
|
||||
contentPanel.addActionListener(new EventListener() {
|
||||
contentPanel.addActionListener(new EventListener<Event>() {
|
||||
public void onEvent(Event event) throws Exception {
|
||||
int row = contentPanel.getSelectedRow();
|
||||
if (row >= 0) {
|
||||
|
@ -526,6 +558,79 @@ public class InfoProductPanel extends InfoPanel implements EventListener
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* IDEMPIERE-337
|
||||
* Override InfoPanel.testCount() to allow counting distinct rows
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected boolean testCount() {
|
||||
long start = System.currentTimeMillis();
|
||||
String dynWhere = getSQLWhere();
|
||||
|
||||
int M_Warehouse_ID = 0;
|
||||
ListItem listitem = pickWarehouse.getSelectedItem();
|
||||
if (listitem != null)
|
||||
M_Warehouse_ID = (Integer)listitem.getValue();
|
||||
|
||||
StringBuffer where = new StringBuffer();
|
||||
where.append("p.IsActive='Y'");
|
||||
if (M_Warehouse_ID != 0)
|
||||
where.append(" AND p.IsSummary='N'");
|
||||
// dynamic Where Clause
|
||||
if (p_whereClause != null && p_whereClause.length() > 0)
|
||||
where.append(" AND ") // replace fully qualified name with alias
|
||||
.append(Util.replace(p_whereClause, "M_Product.", "p."));
|
||||
|
||||
StringBuffer sqlMain = new StringBuffer("SELECT ");
|
||||
int colIndex = 0;
|
||||
ColumnInfo[] layout = getProductLayout();
|
||||
for (colIndex = 0; colIndex < layout.length; colIndex++)
|
||||
{
|
||||
if (colIndex > 0)
|
||||
sqlMain.append(", ");
|
||||
sqlMain.append(layout[colIndex].getColSQL());
|
||||
if (layout[colIndex].isKeyPairCol())
|
||||
sqlMain.append(",").append(layout[colIndex].getKeyPairColSQL());
|
||||
}
|
||||
|
||||
sqlMain.append(" FROM ").append(s_productFrom);
|
||||
sqlMain.append(" WHERE ").append(where);
|
||||
|
||||
if (dynWhere.length() > 0)
|
||||
sqlMain.append(dynWhere);
|
||||
|
||||
String countSql = Msg.parseTranslation(Env.getCtx(), sqlMain.toString()); // Variables
|
||||
countSql = MRole.getDefault().addAccessSQL (countSql, getTableName(),
|
||||
MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
|
||||
String sqlCount = "SELECT COUNT(*) FROM (" + countSql + ") AS ProductInfo";
|
||||
|
||||
log.finer(sqlCount);
|
||||
m_count = -1;
|
||||
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sqlCount, null);
|
||||
setParameters (pstmt, false);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
|
||||
if (rs.next())
|
||||
m_count = rs.getInt(1);
|
||||
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sqlCount, e);
|
||||
m_count = -2;
|
||||
}
|
||||
|
||||
log.fine("#" + m_count + " - " + (System.currentTimeMillis()-start) + "ms");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertPagingComponent() {
|
||||
North north = new North();
|
||||
|
@ -605,6 +710,24 @@ public class InfoProductPanel extends InfoPanel implements EventListener
|
|||
rs = null; pstmt = null;
|
||||
}
|
||||
initAtpTab(M_Warehouse_ID);
|
||||
|
||||
//IDEMPIERE-337
|
||||
sql = m_sqlProductprice;
|
||||
log.fine(sql);
|
||||
try {
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, m_M_Product_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
productpriceTbl.loadTable(rs);
|
||||
rs.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
} // refresh
|
||||
|
||||
/**
|
||||
|
@ -628,10 +751,14 @@ public class InfoProductPanel extends InfoPanel implements EventListener
|
|||
setPriceListVersion (M_PriceList_Version_ID);
|
||||
|
||||
// Create Grid
|
||||
String orderBy = null;
|
||||
StringBuffer where = new StringBuffer();
|
||||
where.append("p.IsActive='Y'");
|
||||
if (M_Warehouse_ID != 0)
|
||||
{
|
||||
where.append(" AND p.IsSummary='N'");
|
||||
orderBy = "QtyAvailable DESC";
|
||||
}
|
||||
// dynamic Where Clause
|
||||
if (p_whereClause != null && p_whereClause.length() > 0)
|
||||
where.append(" AND ") // replace fully qalified name with alias
|
||||
|
@ -640,7 +767,7 @@ public class InfoProductPanel extends InfoPanel implements EventListener
|
|||
prepareTable(getProductLayout(),
|
||||
s_productFrom,
|
||||
where.toString(),
|
||||
"QtyAvailable DESC");
|
||||
orderBy);
|
||||
|
||||
} // initInfo
|
||||
|
||||
|
@ -1119,33 +1246,48 @@ public class InfoProductPanel extends InfoPanel implements EventListener
|
|||
*/
|
||||
protected ColumnInfo[] getProductLayout()
|
||||
{
|
||||
if (s_productLayout != null && s_productLayoutRole == MRole.getDefault().getAD_Role_ID())
|
||||
return s_productLayout;
|
||||
// IDEMPIERE-337 - zkwebui - Improve Info Product window
|
||||
//if (s_productLayout != null && s_productLayoutRole == MRole.getDefault().getAD_Role_ID())
|
||||
// return s_productLayout;
|
||||
//
|
||||
s_productLayout = null;
|
||||
s_productLayoutRole = MRole.getDefault().getAD_Role_ID();
|
||||
int M_Warehouse_ID = 0;
|
||||
ListItem listitem = pickWarehouse.getSelectedItem();
|
||||
if (listitem != null)
|
||||
M_Warehouse_ID = (Integer)listitem.getValue();
|
||||
int M_PriceList_ID = 0;
|
||||
listitem = pickPriceList.getSelectedItem();
|
||||
if (listitem != null)
|
||||
M_PriceList_ID = (Integer)listitem.getValue();
|
||||
|
||||
|
||||
ArrayList<ColumnInfo> list = new ArrayList<ColumnInfo>();
|
||||
list.add(new ColumnInfo(" ", "p.M_Product_ID", IDColumn.class));
|
||||
list.add(new ColumnInfo(" ", "DISTINCT p.M_Product_ID", IDColumn.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "Discontinued").substring(0, 1), "p.Discontinued", Boolean.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "Value"), "p.Value", String.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "p.Name", String.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "bomQtyAvailable(p.M_Product_ID,?,0) AS QtyAvailable", Double.class, true, true, null));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3027/*PriceList*/, false))
|
||||
// IDEMPIERE-337
|
||||
if (M_Warehouse_ID != 0)
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "bomQtyAvailable(p.M_Product_ID,?,0) AS QtyAvailable", Double.class, true, true, null));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3027/*PriceList*/, false) && M_PriceList_ID != 0)
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceList"), "bomPriceList(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceList", BigDecimal.class));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false))
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false) && M_PriceList_ID != 0)
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "bomPriceStd(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceStd", BigDecimal.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "bomQtyOnHand(p.M_Product_ID,?,0) AS QtyOnHand", Double.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "bomQtyReserved(p.M_Product_ID,?,0) AS QtyReserved", Double.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOrdered"), "bomQtyOrdered(p.M_Product_ID,?,0) AS QtyOrdered", Double.class));
|
||||
if (isUnconfirmed())
|
||||
if (M_Warehouse_ID != 0)
|
||||
{
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "QtyUnconfirmed"), "(SELECT SUM(c.TargetQty) FROM M_InOutLineConfirm c INNER JOIN M_InOutLine il ON (c.M_InOutLine_ID=il.M_InOutLine_ID) INNER JOIN M_InOut i ON (il.M_InOut_ID=i.M_InOut_ID) WHERE c.Processed='N' AND i.M_Warehouse_ID=? AND il.M_Product_ID=p.M_Product_ID) AS QtyUnconfirmed", Double.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "QtyUnconfirmedMove"), "(SELECT SUM(c.TargetQty) FROM M_MovementLineConfirm c INNER JOIN M_MovementLine ml ON (c.M_MovementLine_ID=ml.M_MovementLine_ID) INNER JOIN M_Locator l ON (ml.M_LocatorTo_ID=l.M_Locator_ID) WHERE c.Processed='N' AND l.M_Warehouse_ID=? AND ml.M_Product_ID=p.M_Product_ID) AS QtyUnconfirmedMove", Double.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "bomQtyOnHand(p.M_Product_ID,?,0) AS QtyOnHand", Double.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "bomQtyReserved(p.M_Product_ID,?,0) AS QtyReserved", Double.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOrdered"), "bomQtyOrdered(p.M_Product_ID,?,0) AS QtyOrdered", Double.class));
|
||||
if (isUnconfirmed())
|
||||
{
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "QtyUnconfirmed"), "(SELECT SUM(c.TargetQty) FROM M_InOutLineConfirm c INNER JOIN M_InOutLine il ON (c.M_InOutLine_ID=il.M_InOutLine_ID) INNER JOIN M_InOut i ON (il.M_InOut_ID=i.M_InOut_ID) WHERE c.Processed='N' AND i.M_Warehouse_ID=? AND il.M_Product_ID=p.M_Product_ID) AS QtyUnconfirmed", Double.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "QtyUnconfirmedMove"), "(SELECT SUM(c.TargetQty) FROM M_MovementLineConfirm c INNER JOIN M_MovementLine ml ON (c.M_MovementLine_ID=ml.M_MovementLine_ID) INNER JOIN M_Locator l ON (ml.M_LocatorTo_ID=l.M_Locator_ID) WHERE c.Processed='N' AND l.M_Warehouse_ID=? AND ml.M_Product_ID=p.M_Product_ID) AS QtyUnconfirmedMove", Double.class));
|
||||
}
|
||||
}
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false) && MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false))
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false) && MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false) && M_PriceList_ID != 0)
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "Margin"), "bomPriceStd(p.M_Product_ID, pr.M_PriceList_Version_ID)-bomPriceLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS Margin", BigDecimal.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "Vendor"), "bp.Name", String.class));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false))
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false) && M_PriceList_ID != 0)
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceLimit"), "bomPriceLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceLimit", BigDecimal.class));
|
||||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "IsInstanceAttribute"), "pa.IsInstanceAttribute", Boolean.class));
|
||||
s_productLayout = new ColumnInfo[list.size()];
|
||||
|
@ -1179,10 +1321,35 @@ public class InfoProductPanel extends InfoPanel implements EventListener
|
|||
|
||||
// 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;
|
||||
//
|
||||
// IDEMPIERE-337 - zkwebui - Improve Info Product window
|
||||
if (e.getTarget() == pickWarehouse || e.getTarget() == pickPriceList)
|
||||
{
|
||||
boolean execute = true;
|
||||
if (fieldValue.getText().length() == 0 && fieldName.getText().length() == 0 && contentPanel.getRowCount() == 0)
|
||||
execute = false;
|
||||
// Remove existing headers
|
||||
contentPanel.getListhead().detach();
|
||||
// Create Grid
|
||||
int M_Warehouse_ID = 0;
|
||||
ListItem listitem = pickWarehouse.getSelectedItem();
|
||||
if (listitem != null)
|
||||
M_Warehouse_ID = (Integer)listitem.getValue();
|
||||
StringBuffer where = new StringBuffer();
|
||||
where.append("p.IsActive='Y'");
|
||||
if (M_Warehouse_ID != 0)
|
||||
where.append(" AND p.IsSummary='N'");
|
||||
// dynamic Where Clause
|
||||
if (p_whereClause != null && p_whereClause.length() > 0)
|
||||
where.append(" AND ") // replace fully qalified name with alias
|
||||
.append(Util.replace(p_whereClause, "M_Product.", "p."));
|
||||
//
|
||||
prepareTable(getProductLayout(),
|
||||
s_productFrom,
|
||||
where.toString(),
|
||||
"");
|
||||
if (!execute)
|
||||
return;
|
||||
}
|
||||
|
||||
if(component == m_InfoPAttributeButton)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue