BF [ 2412212 ] Fix Activity Control Report Window

Thanks Ioan Bogdan.
This commit is contained in:
teo_sarca 2008-12-09 19:42:25 +00:00
parent 678b640ba2
commit b50595a845
3 changed files with 144 additions and 176 deletions

View File

@ -1,197 +1,72 @@
/******************************************************************************
* The contents of this file are subject to the Compiere License Version 1.1
* ("License"); You may not use this file except in compliance with the License
* You may obtain a copy of the License at http://www.compiere.org/license.html
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial
* Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke
* are Copyright (C) 1999-2005 Jorg Janke.
* All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved.
* Contributor(s): ______________________________________.
* Product: Adempiere ERP & CRM Smart Business Solution *
* 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. *
* For the text or an alternative of this public license, you may reach us *
* Copyright (C) 2003-2007 e-Evolution,SC. All Rights Reserved. *
* Contributor(s): Victor Perez www.e-evolution.com *
* Teo Sarca, www.arhipac.ro *
*****************************************************************************/
package org.eevolution.model;
import java.math.*;
import java.sql.*;
import java.util.*;
import java.util.logging.*;
import org.compiere.util.*;
import org.compiere.model.*;
import org.eevolution.model.*;
import java.util.Properties;
import org.compiere.model.CalloutEngine;
import org.compiere.model.GridField;
import org.compiere.model.GridTab;
/**
* Order Callouts.
*
* @author Jorg Janke
* @version $Id: CalloutOrder.java,v 1.31 2005/04/20 04:55:24 jjanke Exp $
* Cost Collector Callout
*
* @author Victor Perez www.e-evolution.com
* @author Teo Sarca, www.arhipac.ro
*/
public class CalloutCostCollector extends CalloutEngine
{
/** Debug Steps */
private boolean steps = false;
/**
* Order Line - Quantity.
* - called from C_UOM_ID, QtyEntered, QtyOrdered
* - enforces qty UOM relationship
* @param ctx Context
* @param WindowNo current Window No
* @param mTab Model Tab
* @param mField Model Field
* @param value The new value
*/
public String Manufacture (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
setCalloutActive(true);
int PP_Order_ID = Env.getContextAsInt(ctx, WindowNo, "PP_Order_ID");
if (steps) log.warning("init - PP_Order_ID=" + PP_Order_ID + " - " );
BigDecimal QtyOrdered, QtyEntered, PriceActual, PriceEntered;
// // No Product
// if (PP_Order_ID == 0)
// {
// QtyEntered = (BigDecimal)mTab.getValue("QtyEntered");
// mTab.setValue("QtyOrdered", QtyEntered);
// }
// fjv e-evolution to bodevridio
if ((PP_Order_ID != 0))
{
String sql = new String("SELECT PP_Order_Workflow_ID FROM PP_Order_Workflow WHERE PP_Order_ID = ? ");
MPPOrder order = new MPPOrder(Env.getCtx(), PP_Order_ID, "PP_Order_ID");
//order.getS_Resource_ID();
mTab.setValue("S_Resource_ID", new Integer(order.getS_Resource_ID()));
mTab.setValue("M_Product_ID", new Integer(order.getM_Product_ID()));
mTab.setValue("M_AttributeSetInstance_ID", new Integer(order.getM_AttributeSetInstance_ID()));
mTab.setValue("M_Warehouse_ID", new Integer(order.getM_Warehouse_ID()));
mTab.setValue("MovementQty", order.getQtyEntered());
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement (sql,null);
pstmt.setInt(1, PP_Order_ID);
ResultSet rs = pstmt.executeQuery ();
while (rs.next())
{
//MPPMRP mrp = new MPPMRP(Env.getCtx(), rs.getInt(1),"PP_MRP");
MPPOrderWorkflow wflow = new MPPOrderWorkflow(Env.getCtx(),rs.getInt(1),"PP_Order_Workflow");
mTab.setValue("PP_Order_Workflow_ID", wflow.getPP_Order_Workflow_ID());
mTab.setValue("DurationUnit",wflow.getDurationUnit());
//mTab.setValue("C_UOM_ID",wflow.getDurationUnit());
}
rs.close();
pstmt.close();
}
catch (SQLException e)
{
//log.error ("doIt - " + sql, e);
System.out.println("doIt - " + sql + e);
}
// mTab.setValue("PP_Order_Workflow_ID", order.getAD_Workflow_ID());
}
// end fjv e-evolution bodevidrio
Integer PP_Order_ID = (Integer)value;
if (PP_Order_ID == null || PP_Order_ID <= 0)
return "";
//
MPPOrder order = new MPPOrder(ctx, PP_Order_ID, null);
mTab.setValue(MPPCostCollector.COLUMNNAME_S_Resource_ID, order.getS_Resource_ID());
mTab.setValue(MPPCostCollector.COLUMNNAME_M_Product_ID, order.getM_Product_ID());
mTab.setValue(MPPCostCollector.COLUMNNAME_M_AttributeSetInstance_ID, order.getM_AttributeSetInstance_ID());
mTab.setValue(MPPCostCollector.COLUMNNAME_M_Warehouse_ID, order.getM_Warehouse_ID());
mTab.setValue(MPPCostCollector.COLUMNNAME_MovementQty, order.getQtyEntered());
//
MPPOrderWorkflow owf = order.getMPPOrderWorkflow();
mTab.setValue(MPPCostCollector.COLUMNNAME_PP_Order_Workflow_ID, owf.getPP_Order_Workflow_ID());
// mTab.setValue(MPPCostCollector.COLUMNNAME_DurationUnit, owf.getDurationUnit());
//
return "";
} // qty
}
// fjv e-evolution bodevidrio
/**
* Order Line - metros 2 bodevidrio
* - multiplies the fields qty, horizontal and vertical
* - sets Description and QtyOrdered
* @param ctx Context
* @param WindowNo current Window No
* @param mTab Model Tab
* @param mField Model Field
* @param value The new value
*/
public String node (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
setCalloutActive(true);
Integer PP_Order_Node_ID = (Integer)mTab.getValue("PP_Order_Node_ID");
//
if (PP_Order_Node_ID == null || PP_Order_Node_ID.intValue() == 0)
/*
Integer PP_Order_Node_ID = (Integer)value;
//
if (PP_Order_Node_ID == null || PP_Order_Node_ID <= 0)
return "";
if(PP_Order_Node_ID.intValue()!=0)
{
//System.out.println("****** Node " +PP_Order_Node_ID.toString());
MPPOrderNode ordernode = new MPPOrderNode(Env.getCtx(), PP_Order_Node_ID.intValue(), "PP_Order_Node_ID");
//System.out.println("****** Node 2" +ordernode.isSubcontracting());
if (ordernode.isSubcontracting())
mTab.setValue("IsSubcontracting", "Y");
else
mTab.setValue("IsSubcontracting", "N");
//crp temp
// if (ordernode.isBatchTime())
// mTab.setValue("IsBatchTime", "Y");
// else
// mTab.setValue("IsBatchTime", "N");
}
// mTab.setValue("IsBatchTime",ordernode.get.getIsSubcontracting());
//
MPPOrderNode ordernode = new MPPOrderNode(ctx, PP_Order_Node_ID, null);
mTab.setValue(MPPCostCollector.COLUMNNAME_IsSubcontracting, ordernode.isSubcontracting() ? "Y" : "N");
*/
return "";
} // node
public String MovementType (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
}
public String MovementType (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
setCalloutActive(true);
Integer C_DocType_ID = (Integer)mTab.getValue("C_DocType_ID");
//
if (C_DocType_ID == null || C_DocType_ID.intValue() == 0)
return "";
if(C_DocType_ID.intValue()!=0)
{
String sql = new String("SELECT DocBaseType FROM C_DocType WHERE C_DocType_ID = ? ");
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement (sql,null);
pstmt.setInt(1, C_DocType_ID.intValue());
ResultSet rs = pstmt.executeQuery ();
while (rs.next())
{
//MPPMRP mrp = new MPPMRP(Env.getCtx(), rs.getInt(1),"PP_MRP");
if (rs.getString(1).equals("MOA"))
{
mTab.setValue("MovementType", "P+");
}
}
rs.close();
pstmt.close();
}
catch (SQLException e)
{
//log.error ("doIt - " + sql, e);
System.out.println("doIt - " + sql + e);
}
}
// mTab.setValue("IsBatchTime",ordernode.get.getIsSubcontracting());
//
return "";
} // node
// end e-evolution
} // CalloutCostCollector
}
}

View File

@ -0,0 +1,46 @@
-- 09.12.2008 19:27:42 EET
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET AD_Val_Rule_ID=189,Updated=TO_DATE('2008-12-09 19:27:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53824
;
-- 09.12.2008 19:27:47 EET
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
ALTER TABLE PP_Cost_Collector MODIFY M_Warehouse_ID NUMBER(10) DEFAULT NULL
;
-- 09.12.2008 19:54:39 EET
-- [ 2412212 ] Fix Activity Control Report Window
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52035,'PP_Order_Node.PP_Order_Workflow_ID=@PP_Order_Workflow_ID@',TO_DATE('2008-12-09 19:54:37','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','PP_Order_Node of PP_Order_Workflow','S',TO_DATE('2008-12-09 19:54:37','YYYY-MM-DD HH24:MI:SS'),0)
;
-- 09.12.2008 19:54:39 EET
-- [ 2412212 ] Fix Activity Control Report Window
INSERT INTO AD_Val_Rule_Trl (AD_Language,AD_Val_Rule_ID, Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Val_Rule_ID, t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Val_Rule t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Val_Rule_ID=52035 AND EXISTS (SELECT * FROM AD_Val_Rule_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Val_Rule_ID!=t.AD_Val_Rule_ID)
;
-- 09.12.2008 19:55:25 EET
-- [ 2412212 ] Fix Activity Control Report Window
UPDATE AD_Column SET AD_Val_Rule_ID=52035,Updated=TO_DATE('2008-12-09 19:55:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53831
;
-- 09.12.2008 19:55:29 EET
-- [ 2412212 ] Fix Activity Control Report Window
ALTER TABLE PP_Cost_Collector MODIFY PP_Order_Node_ID NUMBER(10) DEFAULT NULL
;
-- 09.12.2008 20:11:54 EET
-- [ 2412212 ] Fix Activity Control Report Window
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52036,'PP_Order_Workflow.PP_Order_ID=@PP_Order_ID@',TO_DATE('2008-12-09 20:11:53','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','PP_Order_Workflow_ID of PP_Order_ID','S',TO_DATE('2008-12-09 20:11:53','YYYY-MM-DD HH24:MI:SS'),0)
;
-- 09.12.2008 20:11:54 EET
-- [ 2412212 ] Fix Activity Control Report Window
INSERT INTO AD_Val_Rule_Trl (AD_Language,AD_Val_Rule_ID, Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Val_Rule_ID, t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Val_Rule t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Val_Rule_ID=52036 AND EXISTS (SELECT * FROM AD_Val_Rule_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Val_Rule_ID!=t.AD_Val_Rule_ID)
;
-- 09.12.2008 20:14:34 EET
-- [ 2412212 ] Fix Activity Control Report Window
UPDATE AD_Column SET AD_Val_Rule_ID=52036,Updated=TO_DATE('2008-12-09 20:14:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53832
;
update AD_Val_Rule set entitytype='EE01' where AD_Val_Rule_ID in (52035, 52036);

View File

@ -0,0 +1,47 @@
-- 09.12.2008 19:27:42 EET
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET AD_Val_Rule_ID=189,Updated=TO_TIMESTAMP('2008-12-09 19:27:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53824
;
-- 09.12.2008 19:27:47 EET
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
insert into t_alter_column values('pp_cost_collector','M_Warehouse_ID','NUMERIC(10)',null,'NULL')
;
-- 09.12.2008 19:54:39 EET
-- [ 2412212 ] Fix Activity Control Report Window
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52035,'PP_Order_Node.PP_Order_Workflow_ID=@PP_Order_Workflow_ID@',TO_TIMESTAMP('2008-12-09 19:54:37','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','PP_Order_Node of PP_Order_Workflow','S',TO_TIMESTAMP('2008-12-09 19:54:37','YYYY-MM-DD HH24:MI:SS'),0)
;
-- 09.12.2008 19:54:39 EET
-- [ 2412212 ] Fix Activity Control Report Window
INSERT INTO AD_Val_Rule_Trl (AD_Language,AD_Val_Rule_ID, Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Val_Rule_ID, t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Val_Rule t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Val_Rule_ID=52035 AND EXISTS (SELECT * FROM AD_Val_Rule_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Val_Rule_ID!=t.AD_Val_Rule_ID)
;
-- 09.12.2008 19:55:25 EET
-- [ 2412212 ] Fix Activity Control Report Window
UPDATE AD_Column SET AD_Val_Rule_ID=52035,Updated=TO_TIMESTAMP('2008-12-09 19:55:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53831
;
-- 09.12.2008 19:55:29 EET
-- [ 2412212 ] Fix Activity Control Report Window
insert into t_alter_column values('pp_cost_collector','PP_Order_Node_ID','NUMERIC(10)',null,'NULL')
;
-- 09.12.2008 20:11:54 EET
-- [ 2412212 ] Fix Activity Control Report Window
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52036,'PP_Order_Workflow.PP_Order_ID=@PP_Order_ID@',TO_TIMESTAMP('2008-12-09 20:11:53','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','PP_Order_Workflow_ID of PP_Order_ID','S',TO_TIMESTAMP('2008-12-09 20:11:53','YYYY-MM-DD HH24:MI:SS'),0)
;
-- 09.12.2008 20:11:54 EET
-- [ 2412212 ] Fix Activity Control Report Window
INSERT INTO AD_Val_Rule_Trl (AD_Language,AD_Val_Rule_ID, Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Val_Rule_ID, t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Val_Rule t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Val_Rule_ID=52036 AND EXISTS (SELECT * FROM AD_Val_Rule_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Val_Rule_ID!=t.AD_Val_Rule_ID)
;
-- 09.12.2008 20:14:34 EET
-- [ 2412212 ] Fix Activity Control Report Window
UPDATE AD_Column SET AD_Val_Rule_ID=52036,Updated=TO_TIMESTAMP('2008-12-09 20:14:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53832
;
update AD_Val_Rule set entitytype='EE01' where AD_Val_Rule_ID in (52035, 52036);