IDEMPIERE-207 GL Journal Generator

This commit is contained in:
Carlos Ruiz 2012-09-24 15:44:28 -05:00
parent a9ba8f51ec
commit 1ab3ea6f00
12 changed files with 5516 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,255 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* 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 *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for GL_JournalGenerator
* @author Adempiere (generated)
* @version Release 3.6.0LTS
*/
public interface I_GL_JournalGenerator
{
/** TableName=GL_JournalGenerator */
public static final String Table_Name = "GL_JournalGenerator";
/** AD_Table_ID=200021 */
public static final int Table_ID = 200021;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = - Client - Org
*/
BigDecimal accessLevel = BigDecimal.valueOf(3);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name C_AcctSchema_ID */
public static final String COLUMNNAME_C_AcctSchema_ID = "C_AcctSchema_ID";
/** Set Accounting Schema.
* Rules for accounting
*/
public void setC_AcctSchema_ID (int C_AcctSchema_ID);
/** Get Accounting Schema.
* Rules for accounting
*/
public int getC_AcctSchema_ID();
public org.compiere.model.I_C_AcctSchema getC_AcctSchema() throws RuntimeException;
/** Column name C_DocType_ID */
public static final String COLUMNNAME_C_DocType_ID = "C_DocType_ID";
/** Set Document Type.
* Document type or rules
*/
public void setC_DocType_ID (int C_DocType_ID);
/** Get Document Type.
* Document type or rules
*/
public int getC_DocType_ID();
public org.compiere.model.I_C_DocType getC_DocType() throws RuntimeException;
/** Column name C_ElementValueAdjustCR_ID */
public static final String COLUMNNAME_C_ElementValueAdjustCR_ID = "C_ElementValueAdjustCR_ID";
/** Set Account Adjust CR */
public void setC_ElementValueAdjustCR_ID (int C_ElementValueAdjustCR_ID);
/** Get Account Adjust CR */
public int getC_ElementValueAdjustCR_ID();
public org.compiere.model.I_C_ElementValue getC_ElementValueAdjustCR() throws RuntimeException;
/** Column name C_ElementValueAdjustDR_ID */
public static final String COLUMNNAME_C_ElementValueAdjustDR_ID = "C_ElementValueAdjustDR_ID";
/** Set Account Adjust DR */
public void setC_ElementValueAdjustDR_ID (int C_ElementValueAdjustDR_ID);
/** Get Account Adjust DR */
public int getC_ElementValueAdjustDR_ID();
public org.compiere.model.I_C_ElementValue getC_ElementValueAdjustDR() throws RuntimeException;
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name Description */
public static final String COLUMNNAME_Description = "Description";
/** Set Description.
* Optional short description of the record
*/
public void setDescription (String Description);
/** Get Description.
* Optional short description of the record
*/
public String getDescription();
/** Column name GenerateGLJournal */
public static final String COLUMNNAME_GenerateGLJournal = "GenerateGLJournal";
/** Set Generate GL Journal */
public void setGenerateGLJournal (String GenerateGLJournal);
/** Get Generate GL Journal */
public String getGenerateGLJournal();
/** Column name GL_Category_ID */
public static final String COLUMNNAME_GL_Category_ID = "GL_Category_ID";
/** Set GL Category.
* General Ledger Category
*/
public void setGL_Category_ID (int GL_Category_ID);
/** Get GL Category.
* General Ledger Category
*/
public int getGL_Category_ID();
public org.compiere.model.I_GL_Category getGL_Category() throws RuntimeException;
/** Column name GL_JournalGenerator_ID */
public static final String COLUMNNAME_GL_JournalGenerator_ID = "GL_JournalGenerator_ID";
/** Set GL Journal Generator */
public void setGL_JournalGenerator_ID (int GL_JournalGenerator_ID);
/** Get GL Journal Generator */
public int getGL_JournalGenerator_ID();
/** Column name GL_JournalGenerator_UU */
public static final String COLUMNNAME_GL_JournalGenerator_UU = "GL_JournalGenerator_UU";
/** Set GL_JournalGenerator_UU */
public void setGL_JournalGenerator_UU (String GL_JournalGenerator_UU);
/** Get GL_JournalGenerator_UU */
public String getGL_JournalGenerator_UU();
/** Column name Help */
public static final String COLUMNNAME_Help = "Help";
/** Set Comment/Help.
* Comment or Hint
*/
public void setHelp (String Help);
/** Get Comment/Help.
* Comment or Hint
*/
public String getHelp();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name Name */
public static final String COLUMNNAME_Name = "Name";
/** Set Name.
* Alphanumeric identifier of the entity
*/
public void setName (String Name);
/** Get Name.
* Alphanumeric identifier of the entity
*/
public String getName();
/** Column name PostingType */
public static final String COLUMNNAME_PostingType = "PostingType";
/** Set PostingType.
* The type of posted amount for the transaction
*/
public void setPostingType (String PostingType);
/** Get PostingType.
* The type of posted amount for the transaction
*/
public String getPostingType();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}

View File

@ -0,0 +1,274 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* 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 *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for GL_JournalGeneratorLine
* @author Adempiere (generated)
* @version Release 3.6.0LTS
*/
public interface I_GL_JournalGeneratorLine
{
/** TableName=GL_JournalGeneratorLine */
public static final String Table_Name = "GL_JournalGeneratorLine";
/** AD_Table_ID=200022 */
public static final int Table_ID = 200022;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = - Client - Org
*/
BigDecimal accessLevel = BigDecimal.valueOf(3);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name AmtMultiplier */
public static final String COLUMNNAME_AmtMultiplier = "AmtMultiplier";
/** Set Multiplier Amount.
* Multiplier Amount for generating commissions
*/
public void setAmtMultiplier (BigDecimal AmtMultiplier);
/** Get Multiplier Amount.
* Multiplier Amount for generating commissions
*/
public BigDecimal getAmtMultiplier();
/** Column name BPColumn */
public static final String COLUMNNAME_BPColumn = "BPColumn";
/** Set BP Column */
public void setBPColumn (String BPColumn);
/** Get BP Column */
public String getBPColumn();
/** Column name BPDimensionType */
public static final String COLUMNNAME_BPDimensionType = "BPDimensionType";
/** Set Type of BP Dimension */
public void setBPDimensionType (String BPDimensionType);
/** Get Type of BP Dimension */
public String getBPDimensionType();
/** Column name C_BPartner_ID */
public static final String COLUMNNAME_C_BPartner_ID = "C_BPartner_ID";
/** Set Business Partner .
* Identifies a Business Partner
*/
public void setC_BPartner_ID (int C_BPartner_ID);
/** Get Business Partner .
* Identifies a Business Partner
*/
public int getC_BPartner_ID();
public org.compiere.model.I_C_BPartner getC_BPartner() throws RuntimeException;
/** Column name C_ElementValueCR_ID */
public static final String COLUMNNAME_C_ElementValueCR_ID = "C_ElementValueCR_ID";
/** Set Account CR */
public void setC_ElementValueCR_ID (int C_ElementValueCR_ID);
/** Get Account CR */
public int getC_ElementValueCR_ID();
public org.compiere.model.I_C_ElementValue getC_ElementValueCR() throws RuntimeException;
/** Column name C_ElementValueDR_ID */
public static final String COLUMNNAME_C_ElementValueDR_ID = "C_ElementValueDR_ID";
/** Set Account DR */
public void setC_ElementValueDR_ID (int C_ElementValueDR_ID);
/** Get Account DR */
public int getC_ElementValueDR_ID();
public org.compiere.model.I_C_ElementValue getC_ElementValueDR() throws RuntimeException;
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name Description */
public static final String COLUMNNAME_Description = "Description";
/** Set Description.
* Optional short description of the record
*/
public void setDescription (String Description);
/** Get Description.
* Optional short description of the record
*/
public String getDescription();
/** Column name GL_JournalGenerator_ID */
public static final String COLUMNNAME_GL_JournalGenerator_ID = "GL_JournalGenerator_ID";
/** Set GL Journal Generator */
public void setGL_JournalGenerator_ID (int GL_JournalGenerator_ID);
/** Get GL Journal Generator */
public int getGL_JournalGenerator_ID();
public org.compiere.model.I_GL_JournalGenerator getGL_JournalGenerator() throws RuntimeException;
/** Column name GL_JournalGeneratorLine_ID */
public static final String COLUMNNAME_GL_JournalGeneratorLine_ID = "GL_JournalGeneratorLine_ID";
/** Set Generator Line */
public void setGL_JournalGeneratorLine_ID (int GL_JournalGeneratorLine_ID);
/** Get Generator Line */
public int getGL_JournalGeneratorLine_ID();
/** Column name GL_JournalGeneratorLine_UU */
public static final String COLUMNNAME_GL_JournalGeneratorLine_UU = "GL_JournalGeneratorLine_UU";
/** Set GL_JournalGeneratorLine_UU */
public void setGL_JournalGeneratorLine_UU (String GL_JournalGeneratorLine_UU);
/** Get GL_JournalGeneratorLine_UU */
public String getGL_JournalGeneratorLine_UU();
/** Column name Help */
public static final String COLUMNNAME_Help = "Help";
/** Set Comment/Help.
* Comment or Hint
*/
public void setHelp (String Help);
/** Get Comment/Help.
* Comment or Hint
*/
public String getHelp();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name IsCopyAllDimensions */
public static final String COLUMNNAME_IsCopyAllDimensions = "IsCopyAllDimensions";
/** Set Copy All Dimensions */
public void setIsCopyAllDimensions (boolean IsCopyAllDimensions);
/** Get Copy All Dimensions */
public boolean isCopyAllDimensions();
/** Column name IsSameProduct */
public static final String COLUMNNAME_IsSameProduct = "IsSameProduct";
/** Set Same Product */
public void setIsSameProduct (boolean IsSameProduct);
/** Get Same Product */
public boolean isSameProduct();
/** Column name RoundFactor */
public static final String COLUMNNAME_RoundFactor = "RoundFactor";
/** Set Round Factor */
public void setRoundFactor (int RoundFactor);
/** Get Round Factor */
public int getRoundFactor();
/** Column name SeqNo */
public static final String COLUMNNAME_SeqNo = "SeqNo";
/** Set Sequence.
* Method of ordering records;
lowest number comes first
*/
public void setSeqNo (int SeqNo);
/** Get Sequence.
* Method of ordering records;
lowest number comes first
*/
public int getSeqNo();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}

View File

@ -0,0 +1,203 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* 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 *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for GL_JournalGeneratorSource
* @author Adempiere (generated)
* @version Release 3.6.0LTS
*/
public interface I_GL_JournalGeneratorSource
{
/** TableName=GL_JournalGeneratorSource */
public static final String Table_Name = "GL_JournalGeneratorSource";
/** AD_Table_ID=200023 */
public static final int Table_ID = 200023;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = - Client - Org
*/
BigDecimal accessLevel = BigDecimal.valueOf(3);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name AmtMultiplier */
public static final String COLUMNNAME_AmtMultiplier = "AmtMultiplier";
/** Set Multiplier Amount.
* Multiplier Amount for generating commissions
*/
public void setAmtMultiplier (BigDecimal AmtMultiplier);
/** Get Multiplier Amount.
* Multiplier Amount for generating commissions
*/
public BigDecimal getAmtMultiplier();
/** Column name C_ElementValue_ID */
public static final String COLUMNNAME_C_ElementValue_ID = "C_ElementValue_ID";
/** Set Account Element.
* Account Element
*/
public void setC_ElementValue_ID (int C_ElementValue_ID);
/** Get Account Element.
* Account Element
*/
public int getC_ElementValue_ID();
public org.compiere.model.I_C_ElementValue getC_ElementValue() throws RuntimeException;
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name GL_Category_ID */
public static final String COLUMNNAME_GL_Category_ID = "GL_Category_ID";
/** Set GL Category.
* General Ledger Category
*/
public void setGL_Category_ID (int GL_Category_ID);
/** Get GL Category.
* General Ledger Category
*/
public int getGL_Category_ID();
public org.compiere.model.I_GL_Category getGL_Category() throws RuntimeException;
/** Column name GL_JournalGeneratorLine_ID */
public static final String COLUMNNAME_GL_JournalGeneratorLine_ID = "GL_JournalGeneratorLine_ID";
/** Set Generator Line */
public void setGL_JournalGeneratorLine_ID (int GL_JournalGeneratorLine_ID);
/** Get Generator Line */
public int getGL_JournalGeneratorLine_ID();
public org.compiere.model.I_GL_JournalGeneratorLine getGL_JournalGeneratorLine() throws RuntimeException;
/** Column name GL_JournalGeneratorSource_ID */
public static final String COLUMNNAME_GL_JournalGeneratorSource_ID = "GL_JournalGeneratorSource_ID";
/** Set Generator Source */
public void setGL_JournalGeneratorSource_ID (int GL_JournalGeneratorSource_ID);
/** Get Generator Source */
public int getGL_JournalGeneratorSource_ID();
/** Column name GL_JournalGeneratorSource_UU */
public static final String COLUMNNAME_GL_JournalGeneratorSource_UU = "GL_JournalGeneratorSource_UU";
/** Set GL_JournalGeneratorSource_UU */
public void setGL_JournalGeneratorSource_UU (String GL_JournalGeneratorSource_UU);
/** Get GL_JournalGeneratorSource_UU */
public String getGL_JournalGeneratorSource_UU();
/** Column name Help */
public static final String COLUMNNAME_Help = "Help";
/** Set Comment/Help.
* Comment or Hint
*/
public void setHelp (String Help);
/** Get Comment/Help.
* Comment or Hint
*/
public String getHelp();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name RoundFactor */
public static final String COLUMNNAME_RoundFactor = "RoundFactor";
/** Set Round Factor */
public void setRoundFactor (int RoundFactor);
/** Get Round Factor */
public int getRoundFactor();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}

View File

@ -0,0 +1,87 @@
/**********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz - globalqss *
**********************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import java.util.List;
import java.util.Properties;
import org.compiere.util.CLogger;
/**
* GL Journal Generator Model
*
* @author Carlos Ruiz - GlobalQSS
*/
public class MJournalGenerator extends X_GL_JournalGenerator
{
/**
*
*/
private static final long serialVersionUID = -8044550395699815424L;
/** Logger */
private static CLogger s_log = CLogger.getCLogger(MJournalGenerator.class);
/**************************************************************************
* Standard Constructor
* @param ctx context
* @param GL_JournalGenerator_ID id
* @param trxName transaction
*/
public MJournalGenerator (Properties ctx, int GL_JournalGenerator_ID, String trxName)
{
super (ctx, GL_JournalGenerator_ID, trxName);
} // MJournalGenerator
/**
* Load Constructor
* @param ctx ctx
* @param rs result set
* @param trxName transaction
*/
public MJournalGenerator (Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
} // MJournalGenerator
/**
* Get Journal Generator Lines of Journal Generator
* @return lines
*/
public MJournalGeneratorLine[] getLines ()
{
List<MJournalGeneratorLine> list = new Query(getCtx(), MJournalGeneratorLine.Table_Name, "GL_JournalGenerator_ID=?", get_TrxName())
.setOnlyActiveRecords(true)
.setParameters(getGL_JournalGenerator_ID())
.setOrderBy(MJournalGeneratorLine.COLUMNNAME_SeqNo)
.list();
//
MJournalGeneratorLine[] lines = new MJournalGeneratorLine[list.size()];
list.toArray(lines);
return lines;
} // getLines
} // MJournalGenerator

View File

@ -0,0 +1,86 @@
/**********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz - globalqss *
**********************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import java.util.List;
import java.util.Properties;
import org.compiere.util.CLogger;
/**
* GL Journal Generator Model
*
* @author Carlos Ruiz - GlobalQSS
*/
public class MJournalGeneratorLine extends X_GL_JournalGeneratorLine
{
/**
*
*/
private static final long serialVersionUID = -8151648371117046820L;
/** Logger */
private static CLogger s_log = CLogger.getCLogger(MJournalGeneratorLine.class);
/**************************************************************************
* Standard Constructor
* @param ctx context
* @param GL_JournalGeneratorLine_ID id
* @param trxName transaction
*/
public MJournalGeneratorLine (Properties ctx, int GL_JournalGeneratorLine_ID, String trxName)
{
super (ctx, GL_JournalGeneratorLine_ID, trxName);
} // MJournalGeneratorLine
/**
* Load Constructor
* @param ctx ctx
* @param rs result set
* @param trxName transaction
*/
public MJournalGeneratorLine (Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
} // MJournalGeneratorLine
/**
* Get Journal Generator Sources of Journal Generator Line
* @return sources
*/
public MJournalGeneratorSource[] getSources ()
{
List<MJournalGeneratorSource> list = new Query(getCtx(), MJournalGeneratorSource.Table_Name, "GL_JournalGeneratorLine_ID=?", get_TrxName())
.setOnlyActiveRecords(true)
.setParameters(getGL_JournalGeneratorLine_ID())
.list();
//
MJournalGeneratorSource[] sources = new MJournalGeneratorSource[list.size()];
list.toArray(sources);
return sources;
} // getSources
} // MJournalGeneratorLine

View File

@ -0,0 +1,69 @@
/**********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz - globalqss *
**********************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.CLogger;
/**
* GL Journal Generator Model
*
* @author Carlos Ruiz - GlobalQSS
*/
public class MJournalGeneratorSource extends X_GL_JournalGeneratorSource
{
/**
*
*/
private static final long serialVersionUID = 7489445330989092988L;
/** Logger */
private static CLogger s_log = CLogger.getCLogger(MJournalGeneratorSource.class);
/**************************************************************************
* Standard Constructor
* @param ctx context
* @param GL_JournalGeneratorSource_ID id
* @param trxName transaction
*/
public MJournalGeneratorSource (Properties ctx, int GL_JournalGeneratorSource_ID, String trxName)
{
super (ctx, GL_JournalGeneratorSource_ID, trxName);
} // MJournalGeneratorSource
/**
* Load Constructor
* @param ctx ctx
* @param rs result set
* @param trxName transaction
*/
public MJournalGeneratorSource (Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
} // MJournalGeneratorSource
} // MJournalGeneratorSource

View File

@ -0,0 +1,344 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* 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 *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.KeyNamePair;
/** Generated Model for GL_JournalGenerator
* @author Adempiere (generated)
* @version Release 3.6.0LTS - $Id$ */
public class X_GL_JournalGenerator extends PO implements I_GL_JournalGenerator, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20120924L;
/** Standard Constructor */
public X_GL_JournalGenerator (Properties ctx, int GL_JournalGenerator_ID, String trxName)
{
super (ctx, GL_JournalGenerator_ID, trxName);
/** if (GL_JournalGenerator_ID == 0)
{
setGL_JournalGenerator_ID (0);
setName (null);
} */
}
/** Load Constructor */
public X_GL_JournalGenerator (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 3 - Client - Org
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_GL_JournalGenerator[")
.append(get_ID()).append("]");
return sb.toString();
}
public org.compiere.model.I_C_AcctSchema getC_AcctSchema() throws RuntimeException
{
return (org.compiere.model.I_C_AcctSchema)MTable.get(getCtx(), org.compiere.model.I_C_AcctSchema.Table_Name)
.getPO(getC_AcctSchema_ID(), get_TrxName()); }
/** Set Accounting Schema.
@param C_AcctSchema_ID
Rules for accounting
*/
public void setC_AcctSchema_ID (int C_AcctSchema_ID)
{
if (C_AcctSchema_ID < 1)
set_Value (COLUMNNAME_C_AcctSchema_ID, null);
else
set_Value (COLUMNNAME_C_AcctSchema_ID, Integer.valueOf(C_AcctSchema_ID));
}
/** Get Accounting Schema.
@return Rules for accounting
*/
public int getC_AcctSchema_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_AcctSchema_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_DocType getC_DocType() throws RuntimeException
{
return (org.compiere.model.I_C_DocType)MTable.get(getCtx(), org.compiere.model.I_C_DocType.Table_Name)
.getPO(getC_DocType_ID(), get_TrxName()); }
/** Set Document Type.
@param C_DocType_ID
Document type or rules
*/
public void setC_DocType_ID (int C_DocType_ID)
{
if (C_DocType_ID < 0)
set_Value (COLUMNNAME_C_DocType_ID, null);
else
set_Value (COLUMNNAME_C_DocType_ID, Integer.valueOf(C_DocType_ID));
}
/** Get Document Type.
@return Document type or rules
*/
public int getC_DocType_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_DocType_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_ElementValue getC_ElementValueAdjustCR() throws RuntimeException
{
return (org.compiere.model.I_C_ElementValue)MTable.get(getCtx(), org.compiere.model.I_C_ElementValue.Table_Name)
.getPO(getC_ElementValueAdjustCR_ID(), get_TrxName()); }
/** Set Account Adjust CR.
@param C_ElementValueAdjustCR_ID Account Adjust CR */
public void setC_ElementValueAdjustCR_ID (int C_ElementValueAdjustCR_ID)
{
if (C_ElementValueAdjustCR_ID < 1)
set_Value (COLUMNNAME_C_ElementValueAdjustCR_ID, null);
else
set_Value (COLUMNNAME_C_ElementValueAdjustCR_ID, Integer.valueOf(C_ElementValueAdjustCR_ID));
}
/** Get Account Adjust CR.
@return Account Adjust CR */
public int getC_ElementValueAdjustCR_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_ElementValueAdjustCR_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_ElementValue getC_ElementValueAdjustDR() throws RuntimeException
{
return (org.compiere.model.I_C_ElementValue)MTable.get(getCtx(), org.compiere.model.I_C_ElementValue.Table_Name)
.getPO(getC_ElementValueAdjustDR_ID(), get_TrxName()); }
/** Set Account Adjust DR.
@param C_ElementValueAdjustDR_ID Account Adjust DR */
public void setC_ElementValueAdjustDR_ID (int C_ElementValueAdjustDR_ID)
{
if (C_ElementValueAdjustDR_ID < 1)
set_Value (COLUMNNAME_C_ElementValueAdjustDR_ID, null);
else
set_Value (COLUMNNAME_C_ElementValueAdjustDR_ID, Integer.valueOf(C_ElementValueAdjustDR_ID));
}
/** Get Account Adjust DR.
@return Account Adjust DR */
public int getC_ElementValueAdjustDR_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_ElementValueAdjustDR_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Generate GL Journal.
@param GenerateGLJournal Generate GL Journal */
public void setGenerateGLJournal (String GenerateGLJournal)
{
set_Value (COLUMNNAME_GenerateGLJournal, GenerateGLJournal);
}
/** Get Generate GL Journal.
@return Generate GL Journal */
public String getGenerateGLJournal ()
{
return (String)get_Value(COLUMNNAME_GenerateGLJournal);
}
public org.compiere.model.I_GL_Category getGL_Category() throws RuntimeException
{
return (org.compiere.model.I_GL_Category)MTable.get(getCtx(), org.compiere.model.I_GL_Category.Table_Name)
.getPO(getGL_Category_ID(), get_TrxName()); }
/** Set GL Category.
@param GL_Category_ID
General Ledger Category
*/
public void setGL_Category_ID (int GL_Category_ID)
{
if (GL_Category_ID < 1)
set_Value (COLUMNNAME_GL_Category_ID, null);
else
set_Value (COLUMNNAME_GL_Category_ID, Integer.valueOf(GL_Category_ID));
}
/** Get GL Category.
@return General Ledger Category
*/
public int getGL_Category_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_GL_Category_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set GL Journal Generator.
@param GL_JournalGenerator_ID GL Journal Generator */
public void setGL_JournalGenerator_ID (int GL_JournalGenerator_ID)
{
if (GL_JournalGenerator_ID < 1)
set_ValueNoCheck (COLUMNNAME_GL_JournalGenerator_ID, null);
else
set_ValueNoCheck (COLUMNNAME_GL_JournalGenerator_ID, Integer.valueOf(GL_JournalGenerator_ID));
}
/** Get GL Journal Generator.
@return GL Journal Generator */
public int getGL_JournalGenerator_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_GL_JournalGenerator_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set GL_JournalGenerator_UU.
@param GL_JournalGenerator_UU GL_JournalGenerator_UU */
public void setGL_JournalGenerator_UU (String GL_JournalGenerator_UU)
{
set_Value (COLUMNNAME_GL_JournalGenerator_UU, GL_JournalGenerator_UU);
}
/** Get GL_JournalGenerator_UU.
@return GL_JournalGenerator_UU */
public String getGL_JournalGenerator_UU ()
{
return (String)get_Value(COLUMNNAME_GL_JournalGenerator_UU);
}
/** Set Comment/Help.
@param Help
Comment or Hint
*/
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** PostingType AD_Reference_ID=125 */
public static final int POSTINGTYPE_AD_Reference_ID=125;
/** Actual = A */
public static final String POSTINGTYPE_Actual = "A";
/** Budget = B */
public static final String POSTINGTYPE_Budget = "B";
/** Commitment = E */
public static final String POSTINGTYPE_Commitment = "E";
/** Statistical = S */
public static final String POSTINGTYPE_Statistical = "S";
/** Reservation = R */
public static final String POSTINGTYPE_Reservation = "R";
/** Set PostingType.
@param PostingType
The type of posted amount for the transaction
*/
public void setPostingType (String PostingType)
{
set_Value (COLUMNNAME_PostingType, PostingType);
}
/** Get PostingType.
@return The type of posted amount for the transaction
*/
public String getPostingType ()
{
return (String)get_Value(COLUMNNAME_PostingType);
}
}

View File

@ -0,0 +1,396 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* 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 *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
/** Generated Model for GL_JournalGeneratorLine
* @author Adempiere (generated)
* @version Release 3.6.0LTS - $Id$ */
public class X_GL_JournalGeneratorLine extends PO implements I_GL_JournalGeneratorLine, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20120924L;
/** Standard Constructor */
public X_GL_JournalGeneratorLine (Properties ctx, int GL_JournalGeneratorLine_ID, String trxName)
{
super (ctx, GL_JournalGeneratorLine_ID, trxName);
/** if (GL_JournalGeneratorLine_ID == 0)
{
setGL_JournalGenerator_ID (0);
setGL_JournalGeneratorLine_ID (0);
setIsCopyAllDimensions (false);
// N
setIsSameProduct (false);
// N
setSeqNo (0);
// @SQL=SELECT NVL(MAX(SeqNo),0)+10 AS DefaultValue FROM GL_JournalGeneratorLine WHERE GL_JournalGenerator_ID=@GL_JournalGenerator_ID@
} */
}
/** Load Constructor */
public X_GL_JournalGeneratorLine (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 3 - Client - Org
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_GL_JournalGeneratorLine[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Multiplier Amount.
@param AmtMultiplier
Multiplier Amount for generating commissions
*/
public void setAmtMultiplier (BigDecimal AmtMultiplier)
{
set_Value (COLUMNNAME_AmtMultiplier, AmtMultiplier);
}
/** Get Multiplier Amount.
@return Multiplier Amount for generating commissions
*/
public BigDecimal getAmtMultiplier ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_AmtMultiplier);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set BP Column.
@param BPColumn BP Column */
public void setBPColumn (String BPColumn)
{
set_Value (COLUMNNAME_BPColumn, BPColumn);
}
/** Get BP Column.
@return BP Column */
public String getBPColumn ()
{
return (String)get_Value(COLUMNNAME_BPColumn);
}
/** BPDimensionType AD_Reference_ID=200008 */
public static final int BPDIMENSIONTYPE_AD_Reference_ID=200008;
/** Column = C */
public static final String BPDIMENSIONTYPE_Column = "C";
/** Fixed = F */
public static final String BPDIMENSIONTYPE_Fixed = "F";
/** Same = S */
public static final String BPDIMENSIONTYPE_Same = "S";
/** Set Type of BP Dimension.
@param BPDimensionType Type of BP Dimension */
public void setBPDimensionType (String BPDimensionType)
{
set_Value (COLUMNNAME_BPDimensionType, BPDimensionType);
}
/** Get Type of BP Dimension.
@return Type of BP Dimension */
public String getBPDimensionType ()
{
return (String)get_Value(COLUMNNAME_BPDimensionType);
}
public org.compiere.model.I_C_BPartner getC_BPartner() throws RuntimeException
{
return (org.compiere.model.I_C_BPartner)MTable.get(getCtx(), org.compiere.model.I_C_BPartner.Table_Name)
.getPO(getC_BPartner_ID(), get_TrxName()); }
/** Set Business Partner .
@param C_BPartner_ID
Identifies a Business Partner
*/
public void setC_BPartner_ID (int C_BPartner_ID)
{
if (C_BPartner_ID < 1)
set_Value (COLUMNNAME_C_BPartner_ID, null);
else
set_Value (COLUMNNAME_C_BPartner_ID, Integer.valueOf(C_BPartner_ID));
}
/** Get Business Partner .
@return Identifies a Business Partner
*/
public int getC_BPartner_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_ElementValue getC_ElementValueCR() throws RuntimeException
{
return (org.compiere.model.I_C_ElementValue)MTable.get(getCtx(), org.compiere.model.I_C_ElementValue.Table_Name)
.getPO(getC_ElementValueCR_ID(), get_TrxName()); }
/** Set Account CR.
@param C_ElementValueCR_ID Account CR */
public void setC_ElementValueCR_ID (int C_ElementValueCR_ID)
{
if (C_ElementValueCR_ID < 1)
set_Value (COLUMNNAME_C_ElementValueCR_ID, null);
else
set_Value (COLUMNNAME_C_ElementValueCR_ID, Integer.valueOf(C_ElementValueCR_ID));
}
/** Get Account CR.
@return Account CR */
public int getC_ElementValueCR_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_ElementValueCR_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_ElementValue getC_ElementValueDR() throws RuntimeException
{
return (org.compiere.model.I_C_ElementValue)MTable.get(getCtx(), org.compiere.model.I_C_ElementValue.Table_Name)
.getPO(getC_ElementValueDR_ID(), get_TrxName()); }
/** Set Account DR.
@param C_ElementValueDR_ID Account DR */
public void setC_ElementValueDR_ID (int C_ElementValueDR_ID)
{
if (C_ElementValueDR_ID < 1)
set_Value (COLUMNNAME_C_ElementValueDR_ID, null);
else
set_Value (COLUMNNAME_C_ElementValueDR_ID, Integer.valueOf(C_ElementValueDR_ID));
}
/** Get Account DR.
@return Account DR */
public int getC_ElementValueDR_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_ElementValueDR_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
public org.compiere.model.I_GL_JournalGenerator getGL_JournalGenerator() throws RuntimeException
{
return (org.compiere.model.I_GL_JournalGenerator)MTable.get(getCtx(), org.compiere.model.I_GL_JournalGenerator.Table_Name)
.getPO(getGL_JournalGenerator_ID(), get_TrxName()); }
/** Set GL Journal Generator.
@param GL_JournalGenerator_ID GL Journal Generator */
public void setGL_JournalGenerator_ID (int GL_JournalGenerator_ID)
{
if (GL_JournalGenerator_ID < 1)
set_ValueNoCheck (COLUMNNAME_GL_JournalGenerator_ID, null);
else
set_ValueNoCheck (COLUMNNAME_GL_JournalGenerator_ID, Integer.valueOf(GL_JournalGenerator_ID));
}
/** Get GL Journal Generator.
@return GL Journal Generator */
public int getGL_JournalGenerator_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_GL_JournalGenerator_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getGL_JournalGenerator_ID()));
}
/** Set Generator Line.
@param GL_JournalGeneratorLine_ID Generator Line */
public void setGL_JournalGeneratorLine_ID (int GL_JournalGeneratorLine_ID)
{
if (GL_JournalGeneratorLine_ID < 1)
set_ValueNoCheck (COLUMNNAME_GL_JournalGeneratorLine_ID, null);
else
set_ValueNoCheck (COLUMNNAME_GL_JournalGeneratorLine_ID, Integer.valueOf(GL_JournalGeneratorLine_ID));
}
/** Get Generator Line.
@return Generator Line */
public int getGL_JournalGeneratorLine_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_GL_JournalGeneratorLine_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set GL_JournalGeneratorLine_UU.
@param GL_JournalGeneratorLine_UU GL_JournalGeneratorLine_UU */
public void setGL_JournalGeneratorLine_UU (String GL_JournalGeneratorLine_UU)
{
set_Value (COLUMNNAME_GL_JournalGeneratorLine_UU, GL_JournalGeneratorLine_UU);
}
/** Get GL_JournalGeneratorLine_UU.
@return GL_JournalGeneratorLine_UU */
public String getGL_JournalGeneratorLine_UU ()
{
return (String)get_Value(COLUMNNAME_GL_JournalGeneratorLine_UU);
}
/** Set Comment/Help.
@param Help
Comment or Hint
*/
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Copy All Dimensions.
@param IsCopyAllDimensions Copy All Dimensions */
public void setIsCopyAllDimensions (boolean IsCopyAllDimensions)
{
set_Value (COLUMNNAME_IsCopyAllDimensions, Boolean.valueOf(IsCopyAllDimensions));
}
/** Get Copy All Dimensions.
@return Copy All Dimensions */
public boolean isCopyAllDimensions ()
{
Object oo = get_Value(COLUMNNAME_IsCopyAllDimensions);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Same Product.
@param IsSameProduct Same Product */
public void setIsSameProduct (boolean IsSameProduct)
{
set_Value (COLUMNNAME_IsSameProduct, Boolean.valueOf(IsSameProduct));
}
/** Get Same Product.
@return Same Product */
public boolean isSameProduct ()
{
Object oo = get_Value(COLUMNNAME_IsSameProduct);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Round Factor.
@param RoundFactor Round Factor */
public void setRoundFactor (int RoundFactor)
{
set_Value (COLUMNNAME_RoundFactor, Integer.valueOf(RoundFactor));
}
/** Get Round Factor.
@return Round Factor */
public int getRoundFactor ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_RoundFactor);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Sequence.
@param SeqNo
Method of ordering records; lowest number comes first
*/
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Sequence.
@return Method of ordering records; lowest number comes first
*/
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
}

View File

@ -0,0 +1,246 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* 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 *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.Env;
/** Generated Model for GL_JournalGeneratorSource
* @author Adempiere (generated)
* @version Release 3.6.0LTS - $Id$ */
public class X_GL_JournalGeneratorSource extends PO implements I_GL_JournalGeneratorSource, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20120924L;
/** Standard Constructor */
public X_GL_JournalGeneratorSource (Properties ctx, int GL_JournalGeneratorSource_ID, String trxName)
{
super (ctx, GL_JournalGeneratorSource_ID, trxName);
/** if (GL_JournalGeneratorSource_ID == 0)
{
setAmtMultiplier (Env.ZERO);
// 1
setC_ElementValue_ID (0);
setGL_JournalGeneratorLine_ID (0);
setGL_JournalGeneratorSource_ID (0);
} */
}
/** Load Constructor */
public X_GL_JournalGeneratorSource (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 3 - Client - Org
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_GL_JournalGeneratorSource[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Multiplier Amount.
@param AmtMultiplier
Multiplier Amount for generating commissions
*/
public void setAmtMultiplier (BigDecimal AmtMultiplier)
{
set_Value (COLUMNNAME_AmtMultiplier, AmtMultiplier);
}
/** Get Multiplier Amount.
@return Multiplier Amount for generating commissions
*/
public BigDecimal getAmtMultiplier ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_AmtMultiplier);
if (bd == null)
return Env.ZERO;
return bd;
}
public org.compiere.model.I_C_ElementValue getC_ElementValue() throws RuntimeException
{
return (org.compiere.model.I_C_ElementValue)MTable.get(getCtx(), org.compiere.model.I_C_ElementValue.Table_Name)
.getPO(getC_ElementValue_ID(), get_TrxName()); }
/** Set Account Element.
@param C_ElementValue_ID
Account Element
*/
public void setC_ElementValue_ID (int C_ElementValue_ID)
{
if (C_ElementValue_ID < 1)
set_Value (COLUMNNAME_C_ElementValue_ID, null);
else
set_Value (COLUMNNAME_C_ElementValue_ID, Integer.valueOf(C_ElementValue_ID));
}
/** Get Account Element.
@return Account Element
*/
public int getC_ElementValue_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_ElementValue_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_GL_Category getGL_Category() throws RuntimeException
{
return (org.compiere.model.I_GL_Category)MTable.get(getCtx(), org.compiere.model.I_GL_Category.Table_Name)
.getPO(getGL_Category_ID(), get_TrxName()); }
/** Set GL Category.
@param GL_Category_ID
General Ledger Category
*/
public void setGL_Category_ID (int GL_Category_ID)
{
if (GL_Category_ID < 1)
set_Value (COLUMNNAME_GL_Category_ID, null);
else
set_Value (COLUMNNAME_GL_Category_ID, Integer.valueOf(GL_Category_ID));
}
/** Get GL Category.
@return General Ledger Category
*/
public int getGL_Category_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_GL_Category_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_GL_JournalGeneratorLine getGL_JournalGeneratorLine() throws RuntimeException
{
return (org.compiere.model.I_GL_JournalGeneratorLine)MTable.get(getCtx(), org.compiere.model.I_GL_JournalGeneratorLine.Table_Name)
.getPO(getGL_JournalGeneratorLine_ID(), get_TrxName()); }
/** Set Generator Line.
@param GL_JournalGeneratorLine_ID Generator Line */
public void setGL_JournalGeneratorLine_ID (int GL_JournalGeneratorLine_ID)
{
if (GL_JournalGeneratorLine_ID < 1)
set_ValueNoCheck (COLUMNNAME_GL_JournalGeneratorLine_ID, null);
else
set_ValueNoCheck (COLUMNNAME_GL_JournalGeneratorLine_ID, Integer.valueOf(GL_JournalGeneratorLine_ID));
}
/** Get Generator Line.
@return Generator Line */
public int getGL_JournalGeneratorLine_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_GL_JournalGeneratorLine_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Generator Source.
@param GL_JournalGeneratorSource_ID Generator Source */
public void setGL_JournalGeneratorSource_ID (int GL_JournalGeneratorSource_ID)
{
if (GL_JournalGeneratorSource_ID < 1)
set_ValueNoCheck (COLUMNNAME_GL_JournalGeneratorSource_ID, null);
else
set_ValueNoCheck (COLUMNNAME_GL_JournalGeneratorSource_ID, Integer.valueOf(GL_JournalGeneratorSource_ID));
}
/** Get Generator Source.
@return Generator Source */
public int getGL_JournalGeneratorSource_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_GL_JournalGeneratorSource_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set GL_JournalGeneratorSource_UU.
@param GL_JournalGeneratorSource_UU GL_JournalGeneratorSource_UU */
public void setGL_JournalGeneratorSource_UU (String GL_JournalGeneratorSource_UU)
{
set_Value (COLUMNNAME_GL_JournalGeneratorSource_UU, GL_JournalGeneratorSource_UU);
}
/** Get GL_JournalGeneratorSource_UU.
@return GL_JournalGeneratorSource_UU */
public String getGL_JournalGeneratorSource_UU ()
{
return (String)get_Value(COLUMNNAME_GL_JournalGeneratorSource_UU);
}
/** Set Comment/Help.
@param Help
Comment or Hint
*/
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Round Factor.
@param RoundFactor Round Factor */
public void setRoundFactor (int RoundFactor)
{
set_Value (COLUMNNAME_RoundFactor, Integer.valueOf(RoundFactor));
}
/** Get Round Factor.
@return Round Factor */
public int getRoundFactor ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_RoundFactor);
if (ii == null)
return 0;
return ii.intValue();
}
}

View File

@ -0,0 +1,538 @@
/**********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz - globalqss *
**********************************************************************/
package org.globalqss.process;
import java.math.BigDecimal;
import java.math.MathContext;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.DBException;
import org.compiere.model.MAccount;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MAcctSchemaElement;
import org.compiere.model.MBPartner;
import org.compiere.model.MConversionType;
import org.compiere.model.MElementValue;
import org.compiere.model.MJournal;
import org.compiere.model.MJournalGenerator;
import org.compiere.model.MJournalGeneratorLine;
import org.compiere.model.MJournalGeneratorSource;
import org.compiere.model.MJournalLine;
import org.compiere.model.MProduct;
import org.compiere.model.MTable;
import org.compiere.model.PO;
import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.SvrProcess;
import org.compiere.report.MReportTree;
import org.compiere.util.DB;
import org.compiere.util.Env;
/**
* GL Journal Generator
*
* @author Carlos Ruiz - Quality Systems & Solutions - globalqss
*/
public class GLJournalGenerate extends SvrProcess
{
/** Processing date from/to */
private Timestamp p_ProcessingDateFrom;
private Timestamp p_ProcessingDateTo;
/** Date of GL Journal */
private Timestamp p_DateAcct;
/** Flag is simulation */
private boolean p_IsSimulation = true;
/** Document Action */
private String p_DocAction = null;
/** Document No */
private String p_DocumentNo;
/** BPartner to filter */
private int p_C_BPartner_ID = 0;
/** Product to filter */
private int p_M_Product_ID = 0;
/* The Journal Generator */
private int p_QSS_JournalGenerator_ID;
/**
* Prepare - e.g., get Parameters.
*/
protected void prepare()
{
ProcessInfoParameter[] para = getParameter();
for (int i = 0; i < para.length; i++)
{
String name = para[i].getParameterName();
if (name.equals("ProcessingDate")) {
p_ProcessingDateFrom = (Timestamp)para[i].getParameter();
p_ProcessingDateTo = (Timestamp)para[i].getParameter_To();
}
else if (name.equals("DateAcct"))
p_DateAcct = (Timestamp)para[i].getParameter();
else if (name.equals("IsSimulation"))
p_IsSimulation = para[i].getParameterAsBoolean();
else if (name.equals("DocAction"))
p_DocAction = (String) para[i].getParameter();
else if (name.equals("DocumentNo"))
p_DocumentNo = (String) para[i].getParameter();
else if (name.equals("C_BPartner_ID"))
p_C_BPartner_ID = para[i].getParameterAsInt();
else if (name.equals("M_Product_ID"))
p_M_Product_ID = para[i].getParameterAsInt();
else
log.log(Level.SEVERE, "Unknown Parameter: " + name);
}
p_QSS_JournalGenerator_ID = getRecord_ID();
} // prepare
/**
* Perform process.
* @return Message
* @throws Exception
*/
protected String doIt() throws Exception
{
log.info("QSS_Journal_Generator_ID=" + p_QSS_JournalGenerator_ID
+ ", ProcessingDate=" + p_ProcessingDateFrom + "/" + p_ProcessingDateTo
+ ", DateAcct=" + p_DateAcct
+ ", IsSimulation=" + p_IsSimulation
+ ", DocAction=" + p_DocAction
+ ", DocumentNo=" + p_DocumentNo
+ ", C_BPartner_ID=" + p_C_BPartner_ID
+ ", M_Product_ID=" + p_M_Product_ID
);
MJournalGenerator journalGenerator = new MJournalGenerator(getCtx(), p_QSS_JournalGenerator_ID, get_TrxName());
MAcctSchema as = (MAcctSchema) journalGenerator.getC_AcctSchema();
BigDecimal totalAmount = Env.ZERO;
List<List<Integer>> listDimOut = new ArrayList<List<Integer>>();
List<List<String>> listColOut = new ArrayList<List<String>>();
List<BigDecimal> listDrAmtOut = new ArrayList<BigDecimal>();
List<BigDecimal> listCrAmtOut = new ArrayList<BigDecimal>();
List<Integer> listAccountOut = new ArrayList<Integer>();
List<MJournalGeneratorLine> listLinesOut = new ArrayList<MJournalGeneratorLine>();
for (MJournalGeneratorLine line : journalGenerator.getLines()) {
int idxBPColumn = -1;
List<String> groupColumns = new ArrayList<String>();
groupColumns.add("AD_Client_ID");
if (line.isCopyAllDimensions()) {
for (MAcctSchemaElement element : as.getAcctSchemaElements()) {
String columnName = MAcctSchemaElement.getColumnName(element.getElementType());
if (! groupColumns.contains(columnName))
groupColumns.add(columnName);
}
} else {
if (MJournalGeneratorLine.BPDIMENSIONTYPE_Same.equals(line.getBPDimensionType()))
groupColumns.add("C_BPartner_ID");
else if (MJournalGeneratorLine.BPDIMENSIONTYPE_Column.equals(line.getBPDimensionType())) {
String[] parts = line.getBPColumn().split("\\.");
String tablename = parts[0];
groupColumns.add(tablename + "_ID");
idxBPColumn = groupColumns.size()-1;
}
if (line.isSameProduct())
groupColumns.add("M_Product_ID");
}
String groupBy = "";
for (String column : groupColumns) {
if (groupBy.length() == 0)
groupBy += column;
else
groupBy += ","+column;
}
List<List<Integer>> listDim = new ArrayList<List<Integer>>();
List<BigDecimal> listAmt = new ArrayList<BigDecimal>();
int p_AD_Org_ID = line.getAD_Org_ID();
if (p_AD_Org_ID == 0)
p_AD_Org_ID = journalGenerator.getAD_Org_ID();
if (p_AD_Org_ID == 0)
p_AD_Org_ID = Env.getAD_Org_ID(getCtx());
for (MJournalGeneratorSource source : line.getSources()) {
String sql =
"SELECT SUM(AmtAcctDr-AmtAcctCr), "
+ groupBy
+ " FROM Fact_Acct "
+ " WHERE PostingType='A' "
+ " AND IsActive='Y' "
+ " AND DateAcct BETWEEN ? AND ? "
+ " AND C_AcctSchema_ID=? "
+ " AND AD_Client_ID=? ";
if (p_AD_Org_ID > 0)
sql += " AND AD_Org_ID=" + p_AD_Org_ID;
if (p_C_BPartner_ID > 0)
sql += " AND C_BPartner_ID=" + p_C_BPartner_ID;
if (p_M_Product_ID > 0)
sql += " AND M_Product_ID=" + p_M_Product_ID;
if (source.getGL_Category_ID() > 0)
sql += " AND GL_Category_ID=" + source.getGL_Category_ID();
sql += " AND (";
/* TODO: Get all accounts below tree of source */
sql += MReportTree.getWhereClause(getCtx(), 0, MAcctSchemaElement.ELEMENTTYPE_Account, source.getC_ElementValue_ID());
sql += ")";
sql += " GROUP BY " + groupBy;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, get_TrxName());
pstmt.setTimestamp(1, p_ProcessingDateFrom);
pstmt.setTimestamp(2, p_ProcessingDateTo);
pstmt.setInt(3, journalGenerator.getC_AcctSchema_ID());
pstmt.setInt(4, getAD_Client_ID());
rs = pstmt.executeQuery();
while (rs.next()) {
BigDecimal sourceAmt = rs.getBigDecimal(1);
if (sourceAmt != null && sourceAmt.signum() != 0) {
sourceAmt = applyMultiplierAndFactor(sourceAmt, source.getAmtMultiplier(), source.getRoundFactor());
List<Integer> dimensions = new ArrayList<Integer>();
int idxCol = 0;
for (String column : groupColumns) {
if (idxBPColumn == idxCol) {
// Assign the BPDIMENSIONTYPE_Column to the output BP
int bpIdOut = 0;
String[] parts = line.getBPColumn().split("\\.");
String tablename = parts[0];
String columnname = parts[1];
int id = rs.getInt(column);
if (id > 0) {
MTable table = MTable.get(getCtx(), tablename);
PO po = table.getPO(id, get_TrxName());
bpIdOut = po.get_ValueAsInt(columnname);
}
dimensions.add(bpIdOut);
} else {
dimensions.add(rs.getInt(column));
}
idxCol++;
}
if (listDim.contains(dimensions)) {
int idx = listDim.indexOf(dimensions);
BigDecimal dimAmt = listAmt.get(idx);
dimAmt = dimAmt.add(sourceAmt);
listAmt.set(idx, dimAmt);
} else {
listDim.add(dimensions);
listAmt.add(sourceAmt);
}
}
}
}
catch (SQLException e)
{
//log.log(Level.SEVERE, sql, getSQLException(e));
throw new DBException(e, sql);
}
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
}
/* Ready, here I have the input array with all sources to take into account, construct the output */
List<String> columnsOut = new ArrayList<String>();
if (line.isCopyAllDimensions()) {
columnsOut = groupColumns;
} else {
columnsOut.add("AD_Client_ID");
if ( MJournalGeneratorLine.BPDIMENSIONTYPE_Same.equals(line.getBPDimensionType())
|| MJournalGeneratorLine.BPDIMENSIONTYPE_Fixed.equals(line.getBPDimensionType())
|| MJournalGeneratorLine.BPDIMENSIONTYPE_Column.equals(line.getBPDimensionType()))
columnsOut.add("C_BPartner_ID");
if (line.isSameProduct())
columnsOut.add("M_Product_ID");
}
for (int i = 0; i < listDim.size(); i++) {
List<Integer> dimensions = listDim.get(i);
BigDecimal amount = listAmt.get(i);
List<Integer> dimensionsOut = new ArrayList<Integer>();
if (amount != null && amount.signum() != 0) {
amount = applyMultiplierAndFactor(amount, line.getAmtMultiplier(), line.getRoundFactor());
if (line.isCopyAllDimensions()) {
dimensionsOut = dimensions;
} else {
/* First dimension is always AD_Client_ID */
dimensionsOut.add(dimensions.get(0));
if (MJournalGeneratorLine.BPDIMENSIONTYPE_Same.equals(line.getBPDimensionType())) {
dimensionsOut.add(dimensions.get(groupColumns.indexOf("C_BPartner_ID")));
} else if (MJournalGeneratorLine.BPDIMENSIONTYPE_Fixed.equals(line.getBPDimensionType())) {
dimensionsOut.add(line.getC_BPartner_ID());
} else if (MJournalGeneratorLine.BPDIMENSIONTYPE_Column.equals(line.getBPDimensionType())) {
String[] parts = line.getBPColumn().split("\\.");
String tablename = parts[0];
dimensionsOut.add(dimensions.get(groupColumns.indexOf(tablename + "_ID")));
}
if (line.isSameProduct()) {
dimensionsOut.add(dimensions.get(groupColumns.indexOf("M_Product_ID")));
}
}
if (line.getC_ElementValueDR_ID() > 0) {
listAccountOut.add(line.getC_ElementValueDR_ID());
listDrAmtOut.add(amount);
listCrAmtOut.add(Env.ZERO);
listDimOut.add(dimensionsOut);
listColOut.add(columnsOut);
listLinesOut.add(line);
totalAmount = totalAmount.add(amount);
}
if (line.getC_ElementValueCR_ID() > 0) {
listAccountOut.add(line.getC_ElementValueCR_ID());
listDrAmtOut.add(Env.ZERO);
listCrAmtOut.add(amount);
listDimOut.add(dimensionsOut);
listColOut.add(columnsOut);
listLinesOut.add(line);
totalAmount = totalAmount.subtract(amount);
}
if (line.getC_ElementValueDR_ID() == 0 && line.getC_ElementValueCR_ID() == 0 && line.isCopyAllDimensions()) {
int accountId = dimensions.get(groupColumns.indexOf("Account_ID"));
listAccountOut.add(accountId);
if (amount.signum() > 0) {
listDrAmtOut.add(amount);
listCrAmtOut.add(Env.ZERO);
totalAmount = totalAmount.add(amount);
} else {
listDrAmtOut.add(Env.ZERO);
listCrAmtOut.add(amount.negate());
totalAmount = totalAmount.add(amount);
}
listDimOut.add(dimensionsOut);
listColOut.add(columnsOut);
listLinesOut.add(line);
}
}
}
} // generatorLines
// Add adjust line
if (totalAmount.signum() < 0 && journalGenerator.getC_ElementValueAdjustDR_ID() > 0) {
listAccountOut.add(journalGenerator.getC_ElementValueAdjustDR_ID());
listDrAmtOut.add(totalAmount.negate());
listCrAmtOut.add(Env.ZERO);
listDimOut.add(null);
listColOut.add(null);
listLinesOut.add(null);
} else if (totalAmount.signum() > 0 && journalGenerator.getC_ElementValueAdjustCR_ID() > 0) {
listAccountOut.add(journalGenerator.getC_ElementValueAdjustCR_ID());
listDrAmtOut.add(Env.ZERO);
listCrAmtOut.add(totalAmount);
listDimOut.add(null);
listColOut.add(null);
listLinesOut.add(null);
}
MJournal j = null;
int lineNo = 10;
/* Ready, here we have an array of output calculated journals, let's process them */
for (int i = 0; i < listDimOut.size(); i++) {
List<Integer> dimensions = listDimOut.get(i);
List<String> columnsOut = listColOut.get(i);
BigDecimal dr = listDrAmtOut.get(i);
BigDecimal cr = listCrAmtOut.get(i);
int accountId = listAccountOut.get(i);
MJournalGeneratorLine line = listLinesOut.get(i);
if (p_IsSimulation) {
MElementValue ev = new MElementValue(getCtx(), accountId, get_TrxName());
String msg = "Account=" + ev.getValue()
+ ", DR=" + dr
+ ", CR=" + cr;
int idxcol = 0;
if (columnsOut != null) {
for (String col : columnsOut) {
int id = dimensions.get(idxcol);
if (id == 0)
continue;
if ("C_BPartner_ID".equals(col)) {
MBPartner bp = MBPartner.get(getCtx(), id);
msg += ", C_BPartner=" + bp.getValue();
} else if ("M_Product_ID".equals(col)) {
MProduct pr = MProduct.get(getCtx(), id);
msg += ", M_Product=" + pr.getValue();
} else if ("AD_Client_ID".equals(col)) {
} else {
msg += ", " + col + "=" + id;
}
idxcol++;
}
}
addLog(msg);
} else {
/* Create journals */
if (j == null) {
// * Create a GL Journal
// conversion type = default
j = new MJournal(getCtx(), 0, get_TrxName());
if (journalGenerator.getAD_Org_ID() > 0)
j.setAD_Org_ID(journalGenerator.getAD_Org_ID());
else
j.setAD_Org_ID(Env.getAD_Org_ID(getCtx()));
j.setC_Currency_ID(as.getC_Currency_ID());
j.setC_DocType_ID(journalGenerator.getC_DocType_ID());
j.setControlAmt(Env.ZERO);
j.setDateAcct(p_DateAcct);
j.setDateDoc(p_DateAcct);
j.setDescription(journalGenerator.getDescription());
j.setDocumentNo(p_DocumentNo);
j.setGL_Category_ID(journalGenerator.getGL_Category_ID());
j.setPostingType(journalGenerator.getPostingType());
j.setC_AcctSchema_ID(as.getC_AcctSchema_ID());
j.setC_ConversionType_ID(MConversionType.getDefault(as.getAD_Client_ID()));
j.saveEx();
}
// Create the journal lines
MJournalLine jl = new MJournalLine(j);
jl.setLine(lineNo);
lineNo += 10;
MAccount combination;
{
int AD_Client_ID = getAD_Client_ID();
int AD_Org_ID = 0;
if (line != null)
AD_Org_ID = line.getAD_Org_ID();
if (AD_Org_ID == 0)
AD_Org_ID = journalGenerator.getAD_Org_ID();
if (AD_Org_ID == 0)
AD_Org_ID = Env.getAD_Org_ID(getCtx());
int C_AcctSchema_ID = journalGenerator.getC_AcctSchema_ID();
int Account_ID = accountId;
int C_SubAcct_ID = 0;
int M_Product_ID = 0;
int C_BPartner_ID = 0;
int AD_OrgTrx_ID = 0;
int C_LocFrom_ID = 0;
int C_LocTo_ID = 0;
int C_SalesRegion_ID = 0;
int C_Project_ID = 0;
int C_Campaign_ID = 0;
int C_Activity_ID = 0;
int User1_ID = 0;
int User2_ID = 0;
int UserElement1_ID = 0;
int UserElement2_ID = 0;
if (columnsOut != null) {
int idxcol = 0;
for (String col : columnsOut) {
int id = dimensions.get(idxcol);
if ("M_Product_ID".equals(col))
M_Product_ID = id;
else if ("C_BPartner_ID".equals(col))
C_BPartner_ID = id;
else if ("AD_OrgTrx_ID".equals(col))
AD_OrgTrx_ID = id;
else if ("C_LocFrom_ID".equals(col))
C_LocFrom_ID = id;
else if ("C_LocTo_ID".equals(col))
C_LocTo_ID = id;
else if ("C_SalesRegion_ID".equals(col))
C_SalesRegion_ID = id;
else if ("C_Project_ID".equals(col))
C_Project_ID = id;
else if ("C_Campaign_ID".equals(col))
C_Campaign_ID = id;
else if ("C_Activity_ID".equals(col))
C_Activity_ID = id;
else if ("User1_ID".equals(col))
User1_ID = id;
else if ("User2_ID".equals(col))
User2_ID = id;
else if ("UserElement1_ID".equals(col))
UserElement1_ID = id;
else if ("UserElement2_ID".equals(col))
UserElement2_ID = id;
idxcol++;
}
}
combination = MAccount.get(getCtx(), AD_Client_ID,
AD_Org_ID, C_AcctSchema_ID, Account_ID,
C_SubAcct_ID, M_Product_ID, C_BPartner_ID,
AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID,
C_SalesRegion_ID, C_Project_ID, C_Campaign_ID,
C_Activity_ID, User1_ID, User2_ID, UserElement1_ID,
UserElement2_ID);
if (combination == null)
throw new AdempiereException("Could not create combination");
}
jl.setC_ValidCombination_ID(combination);
if (line != null)
jl.setDescription(line.getDescription());
jl.setAmtSourceDr(dr);
jl.setAmtAcctDr(dr);
jl.setAmtSourceCr(cr);
jl.setAmtAcctCr(cr);
jl.saveEx();
}
}
if (j != null && p_DocAction != null) {
// DocAction
if (!j.processIt(p_DocAction))
throw new AdempiereException("Could not " + p_DocAction + " journal");
j.saveEx();
}
return "@OK@" + (j != null ? " @Created@ @GL_Journal_ID@=" + j.getDocumentNo() : "");
} // doIt
private BigDecimal applyMultiplierAndFactor(BigDecimal sourceAmt, BigDecimal amtMultiplier, int roundFactor) {
if (amtMultiplier.compareTo(Env.ONE) != 0)
sourceAmt = sourceAmt.multiply(amtMultiplier, MathContext.UNLIMITED);
if (roundFactor < 0) {
BigDecimal divisor = new BigDecimal(Math.pow(10, -roundFactor));
sourceAmt = sourceAmt.divide(divisor, MathContext.UNLIMITED);
sourceAmt = sourceAmt.setScale(0, BigDecimal.ROUND_HALF_UP);
sourceAmt = sourceAmt.multiply(divisor, MathContext.UNLIMITED);
sourceAmt = sourceAmt.setScale(0, BigDecimal.ROUND_HALF_UP);
} else {
sourceAmt = sourceAmt.setScale(roundFactor, BigDecimal.ROUND_HALF_UP);
}
return sourceAmt;
}
} // GLJournalGenerate