Ticket #1001569: Move receipts into batch from QS to Idempiere
This commit is contained in:
parent
7f3e9c8c92
commit
d50e43d850
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,91 @@
|
|||
/**********************************************************************
|
||||
* This file is part of Adempiere ERP Bazaar *
|
||||
* http://www.adempiere.org *
|
||||
* *
|
||||
* Copyright (C) Alejandro Falcone *
|
||||
* 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: *
|
||||
* - Alejandro Falcone (afalcone@users.sourceforge.net) *
|
||||
* http://www.openbiz.com.ar *
|
||||
* *
|
||||
* Sponsors: *
|
||||
* - Idalica Inc. (http://www.idalica.com) *
|
||||
***********************************************************************/
|
||||
package org.adempiere.process;
|
||||
|
||||
|
||||
import java.util.logging.*;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.process.ProcessInfoParameter;
|
||||
import org.compiere.process.SvrProcess;
|
||||
|
||||
/**
|
||||
* Close Deposit Batch.
|
||||
*
|
||||
* @author Alejandro Falcone
|
||||
* @version $Id: DepositBatchClose.java,v 1.2 2007/07/03 00:51:01 afalcone Exp $
|
||||
*/
|
||||
public class DepositBatchClose extends SvrProcess
|
||||
{
|
||||
/** Deposit Batch from Record */
|
||||
private int m_X_DepositBatch_ID = 0;
|
||||
|
||||
/**
|
||||
* 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 (para[i].getParameter() == null)
|
||||
;
|
||||
else
|
||||
log.log(Level.SEVERE, "prepare - Unknown Parameter: " + name);
|
||||
}
|
||||
m_X_DepositBatch_ID = getRecord_ID();
|
||||
} // prepare
|
||||
|
||||
/**
|
||||
* Perform process.
|
||||
* @return Message (translated text)
|
||||
* @throws Exception if not successful
|
||||
*/
|
||||
protected String doIt() throws Exception
|
||||
{
|
||||
MDepositBatch depositbatch = new MDepositBatch (getCtx(), m_X_DepositBatch_ID, get_TrxName());
|
||||
log.info("doIt - " + depositbatch);
|
||||
|
||||
MDepositBatchLine[] depositbatchLines = depositbatch.getLines();
|
||||
|
||||
// Close lines
|
||||
for (int line = 0; line < depositbatchLines.length; line++)
|
||||
{
|
||||
depositbatchLines[line].setProcessed(true);
|
||||
depositbatchLines[line].save();
|
||||
}
|
||||
|
||||
depositbatch.setProcessed(true);
|
||||
depositbatch.save();
|
||||
|
||||
return "";
|
||||
} // doIt
|
||||
|
||||
} // DepositBatchClose
|
|
@ -395,4 +395,13 @@ public interface I_C_BankStatement
|
|||
* User who updated this records
|
||||
*/
|
||||
public int getUpdatedBy();
|
||||
|
||||
/** Column name X_CreateFromBatch */
|
||||
public static final String COLUMNNAME_X_CreateFromBatch = "X_CreateFromBatch";
|
||||
|
||||
/** Set Create From Batch */
|
||||
public void setX_CreateFromBatch (String X_CreateFromBatch);
|
||||
|
||||
/** Get Create From Batch */
|
||||
public String getX_CreateFromBatch();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,262 @@
|
|||
/******************************************************************************
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2012 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 X_DepositBatch
|
||||
* @author iDempiere (generated)
|
||||
* @version Release 1.0a
|
||||
*/
|
||||
public interface I_X_DepositBatch
|
||||
{
|
||||
|
||||
/** TableName=X_DepositBatch */
|
||||
public static final String Table_Name = "X_DepositBatch";
|
||||
|
||||
/** AD_Table_ID=200056 */
|
||||
public static final int Table_ID = 200056;
|
||||
|
||||
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
/** AccessLevel = 3 - 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_BankAccount_ID */
|
||||
public static final String COLUMNNAME_C_BankAccount_ID = "C_BankAccount_ID";
|
||||
|
||||
/** Set Bank Account.
|
||||
* Account at the Bank
|
||||
*/
|
||||
public void setC_BankAccount_ID (int C_BankAccount_ID);
|
||||
|
||||
/** Get Bank Account.
|
||||
* Account at the Bank
|
||||
*/
|
||||
public int getC_BankAccount_ID();
|
||||
|
||||
public org.compiere.model.I_C_BankAccount getC_BankAccount() 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 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 CreateFrom */
|
||||
public static final String COLUMNNAME_CreateFrom = "CreateFrom";
|
||||
|
||||
/** Set Create lines from.
|
||||
* Process which will generate a new document lines based on an existing document
|
||||
*/
|
||||
public void setCreateFrom (String CreateFrom);
|
||||
|
||||
/** Get Create lines from.
|
||||
* Process which will generate a new document lines based on an existing document
|
||||
*/
|
||||
public String getCreateFrom();
|
||||
|
||||
/** Column name DateDeposit */
|
||||
public static final String COLUMNNAME_DateDeposit = "DateDeposit";
|
||||
|
||||
/** Set Deposit Date */
|
||||
public void setDateDeposit (Timestamp DateDeposit);
|
||||
|
||||
/** Get Deposit Date */
|
||||
public Timestamp getDateDeposit();
|
||||
|
||||
/** Column name DateDoc */
|
||||
public static final String COLUMNNAME_DateDoc = "DateDoc";
|
||||
|
||||
/** Set Document Date.
|
||||
* Date of the Document
|
||||
*/
|
||||
public void setDateDoc (Timestamp DateDoc);
|
||||
|
||||
/** Get Document Date.
|
||||
* Date of the Document
|
||||
*/
|
||||
public Timestamp getDateDoc();
|
||||
|
||||
/** Column name DepositAmt */
|
||||
public static final String COLUMNNAME_DepositAmt = "DepositAmt";
|
||||
|
||||
/** Set Deposit Amount */
|
||||
public void setDepositAmt (BigDecimal DepositAmt);
|
||||
|
||||
/** Get Deposit Amount */
|
||||
public BigDecimal getDepositAmt();
|
||||
|
||||
/** 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 DocStatus */
|
||||
public static final String COLUMNNAME_DocStatus = "DocStatus";
|
||||
|
||||
/** Set Document Status.
|
||||
* The current status of the document
|
||||
*/
|
||||
public void setDocStatus (String DocStatus);
|
||||
|
||||
/** Get Document Status.
|
||||
* The current status of the document
|
||||
*/
|
||||
public String getDocStatus();
|
||||
|
||||
/** Column name DocumentNo */
|
||||
public static final String COLUMNNAME_DocumentNo = "DocumentNo";
|
||||
|
||||
/** Set Document No.
|
||||
* Document sequence number of the document
|
||||
*/
|
||||
public void setDocumentNo (String DocumentNo);
|
||||
|
||||
/** Get Document No.
|
||||
* Document sequence number of the document
|
||||
*/
|
||||
public String getDocumentNo();
|
||||
|
||||
/** 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 Processed */
|
||||
public static final String COLUMNNAME_Processed = "Processed";
|
||||
|
||||
/** Set Processed.
|
||||
* The document has been processed
|
||||
*/
|
||||
public void setProcessed (boolean Processed);
|
||||
|
||||
/** Get Processed.
|
||||
* The document has been processed
|
||||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
/** Set Process Now */
|
||||
public void setProcessing (boolean Processing);
|
||||
|
||||
/** Get Process Now */
|
||||
public boolean isProcessing();
|
||||
|
||||
/** 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();
|
||||
|
||||
/** Column name X_DepositBatch_ID */
|
||||
public static final String COLUMNNAME_X_DepositBatch_ID = "X_DepositBatch_ID";
|
||||
|
||||
/** Set Deposit Batch */
|
||||
public void setX_DepositBatch_ID (int X_DepositBatch_ID);
|
||||
|
||||
/** Get Deposit Batch */
|
||||
public int getX_DepositBatch_ID();
|
||||
|
||||
/** Column name X_DepositBatch_UU */
|
||||
public static final String COLUMNNAME_X_DepositBatch_UU = "X_DepositBatch_UU";
|
||||
|
||||
/** Set X_DepositBatch_UU */
|
||||
public void setX_DepositBatch_UU (String X_DepositBatch_UU);
|
||||
|
||||
/** Get X_DepositBatch_UU */
|
||||
public String getX_DepositBatch_UU();
|
||||
}
|
|
@ -0,0 +1,201 @@
|
|||
/******************************************************************************
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2012 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 X_DepositBatchLine
|
||||
* @author iDempiere (generated)
|
||||
* @version Release 1.0a
|
||||
*/
|
||||
public interface I_X_DepositBatchLine
|
||||
{
|
||||
|
||||
/** TableName=X_DepositBatchLine */
|
||||
public static final String Table_Name = "X_DepositBatchLine";
|
||||
|
||||
/** AD_Table_ID=200057 */
|
||||
public static final int Table_ID = 200057;
|
||||
|
||||
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
/** AccessLevel = 3 - 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_Payment_ID */
|
||||
public static final String COLUMNNAME_C_Payment_ID = "C_Payment_ID";
|
||||
|
||||
/** Set Payment.
|
||||
* Payment identifier
|
||||
*/
|
||||
public void setC_Payment_ID (int C_Payment_ID);
|
||||
|
||||
/** Get Payment.
|
||||
* Payment identifier
|
||||
*/
|
||||
public int getC_Payment_ID();
|
||||
|
||||
public org.compiere.model.I_C_Payment getC_Payment() 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 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 Line */
|
||||
public static final String COLUMNNAME_Line = "Line";
|
||||
|
||||
/** Set Line No.
|
||||
* Unique line for this document
|
||||
*/
|
||||
public void setLine (int Line);
|
||||
|
||||
/** Get Line No.
|
||||
* Unique line for this document
|
||||
*/
|
||||
public int getLine();
|
||||
|
||||
/** Column name PayAmt */
|
||||
public static final String COLUMNNAME_PayAmt = "PayAmt";
|
||||
|
||||
/** Set Payment amount.
|
||||
* Amount being paid
|
||||
*/
|
||||
public void setPayAmt (BigDecimal PayAmt);
|
||||
|
||||
/** Get Payment amount.
|
||||
* Amount being paid
|
||||
*/
|
||||
public BigDecimal getPayAmt();
|
||||
|
||||
/** Column name Processed */
|
||||
public static final String COLUMNNAME_Processed = "Processed";
|
||||
|
||||
/** Set Processed.
|
||||
* The document has been processed
|
||||
*/
|
||||
public void setProcessed (boolean Processed);
|
||||
|
||||
/** Get Processed.
|
||||
* The document has been processed
|
||||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
/** Set Process Now */
|
||||
public void setProcessing (boolean Processing);
|
||||
|
||||
/** Get Process Now */
|
||||
public boolean isProcessing();
|
||||
|
||||
/** 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();
|
||||
|
||||
/** Column name X_DepositBatch_ID */
|
||||
public static final String COLUMNNAME_X_DepositBatch_ID = "X_DepositBatch_ID";
|
||||
|
||||
/** Set Deposit Batch */
|
||||
public void setX_DepositBatch_ID (int X_DepositBatch_ID);
|
||||
|
||||
/** Get Deposit Batch */
|
||||
public int getX_DepositBatch_ID();
|
||||
|
||||
public org.compiere.model.I_X_DepositBatch getX_DepositBatch() throws RuntimeException;
|
||||
|
||||
/** Column name X_DepositBatchLine_ID */
|
||||
public static final String COLUMNNAME_X_DepositBatchLine_ID = "X_DepositBatchLine_ID";
|
||||
|
||||
/** Set Deposit Batch Line */
|
||||
public void setX_DepositBatchLine_ID (int X_DepositBatchLine_ID);
|
||||
|
||||
/** Get Deposit Batch Line */
|
||||
public int getX_DepositBatchLine_ID();
|
||||
|
||||
/** Column name X_DepositBatchLine_UU */
|
||||
public static final String COLUMNNAME_X_DepositBatchLine_UU = "X_DepositBatchLine_UU";
|
||||
|
||||
/** Set X_DepositBatchLine_UU */
|
||||
public void setX_DepositBatchLine_UU (String X_DepositBatchLine_UU);
|
||||
|
||||
/** Get X_DepositBatchLine_UU */
|
||||
public String getX_DepositBatchLine_UU();
|
||||
}
|
|
@ -0,0 +1,325 @@
|
|||
/**********************************************************************
|
||||
* This file is part of Adempiere ERP Bazaar *
|
||||
* http://www.adempiere.org *
|
||||
* *
|
||||
* Copyright (C) Alejandro Falcone *
|
||||
* 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: *
|
||||
* - Alejandro Falcone (afalcone@users.sourceforge.net) *
|
||||
* http://www.openbiz.com.ar *
|
||||
* *
|
||||
* Sponsors: *
|
||||
* - Idalica Inc. (http://www.idalica.com) *
|
||||
***********************************************************************/
|
||||
|
||||
package org.compiere.model;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.DB;
|
||||
|
||||
/**
|
||||
* Deposit Batch Model
|
||||
*
|
||||
* @author Alejandro Falcone
|
||||
* @version $Id: MDepositBatch.java,v 1.3 2007/06/28 00:51:03 afalcone Exp $
|
||||
*/
|
||||
public class MDepositBatch extends X_X_DepositBatch
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -977397802747749777L;
|
||||
|
||||
/**
|
||||
* Create & Load existing Persistent Object
|
||||
* @param ctx context
|
||||
* @param X_DepositBatch_ID The unique ID of the object
|
||||
* @param trxName transaction name
|
||||
*/
|
||||
public MDepositBatch (Properties ctx, int X_DepositBatch_ID, String trxName)
|
||||
{
|
||||
super (ctx, X_DepositBatch_ID, trxName);
|
||||
if (X_DepositBatch_ID == 0)
|
||||
{
|
||||
setDocStatus (DOCSTATUS_Drafted);
|
||||
setProcessed (false);
|
||||
setProcessing (false);
|
||||
setDepositAmt(new BigDecimal(0));
|
||||
}
|
||||
} // MDepositBatch
|
||||
|
||||
|
||||
/**
|
||||
* Load Constructor
|
||||
* @param ctx context
|
||||
* @param rs result set
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MDepositBatch (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super(ctx, rs, trxName);
|
||||
} // MDepositBatch
|
||||
|
||||
/**
|
||||
* Copy Constructor.
|
||||
* Dos not copy: Dates/Period
|
||||
* @param original original
|
||||
*/
|
||||
public MDepositBatch (MDepositBatch original)
|
||||
{
|
||||
this (original.getCtx(), 0, original.get_TrxName());
|
||||
setClientOrg(original);
|
||||
setX_DepositBatch_ID(original.getX_DepositBatch_ID());
|
||||
|
||||
setDescription(original.getDescription());
|
||||
setC_DocType_ID(original.getC_DocType_ID());
|
||||
|
||||
setDateDoc(original.getDateDoc());
|
||||
setDateDeposit(original.getDateDeposit());
|
||||
setDepositAmt(original.getDepositAmt());
|
||||
} // MDepositBatch
|
||||
|
||||
public int getX_DepositBatch_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("X_DepositBatch_ID");
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
public void setX_DepositBatch_ID(int X_DepositBatch_ID)
|
||||
{
|
||||
set_Value("X_DepositBatch_ID", Integer.valueOf(X_DepositBatch_ID));
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrite Client/Org if required
|
||||
* @param AD_Client_ID client
|
||||
* @param AD_Org_ID org
|
||||
*/
|
||||
public void setClientOrg (int AD_Client_ID, int AD_Org_ID)
|
||||
{
|
||||
super.setClientOrg(AD_Client_ID, AD_Org_ID);
|
||||
} // setClientOrg
|
||||
|
||||
/**
|
||||
* Set Accounting Date.
|
||||
* Set also Period if not set earlier
|
||||
* @param DateAcct date
|
||||
*/
|
||||
public void setDateAcct (Timestamp DateAcct)
|
||||
{
|
||||
super.setDateDeposit(DateAcct);
|
||||
if (DateAcct == null)
|
||||
return;
|
||||
} // setDateAcct
|
||||
|
||||
|
||||
/** Process Message */
|
||||
private String m_processMsg = null;
|
||||
/** Just Prepared Flag */
|
||||
// private boolean m_justPrepared = false;
|
||||
|
||||
/**
|
||||
* Unlock Document.
|
||||
* @return true if success
|
||||
*/
|
||||
public boolean unlockIt()
|
||||
{
|
||||
log.info("unlockIt - " + toString());
|
||||
setProcessing(false);
|
||||
return true;
|
||||
} // unlockIt
|
||||
|
||||
/**
|
||||
* Invalidate Document
|
||||
* @return true if success
|
||||
*/
|
||||
public boolean invalidateIt()
|
||||
{
|
||||
log.info("invalidateIt - " + toString());
|
||||
return true;
|
||||
} // invalidateIt
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Void Document.
|
||||
* @return false
|
||||
*/
|
||||
public boolean voidIt()
|
||||
{
|
||||
log.info("voidIt - " + toString());
|
||||
// Before Void
|
||||
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
|
||||
if (m_processMsg != null)
|
||||
return false;
|
||||
// After Void
|
||||
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
|
||||
if (m_processMsg != null)
|
||||
return false;
|
||||
|
||||
return false;
|
||||
} // voidIt
|
||||
|
||||
|
||||
/**
|
||||
* String Representation
|
||||
* @return info
|
||||
*/
|
||||
public String toString ()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer ("MDepositBatch[");
|
||||
sb.append(get_ID()).append(",").append(getDescription())
|
||||
.append(",Amount=").append(getDepositAmt())
|
||||
.append ("]");
|
||||
return sb.toString ();
|
||||
} // toString
|
||||
|
||||
/**
|
||||
* Get Document Info
|
||||
* @return document info (untranslated)
|
||||
*/
|
||||
public String getDocumentInfo()
|
||||
{
|
||||
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
|
||||
return dt.getName() + " " + getDocumentNo();
|
||||
} // getDocumentInfo
|
||||
|
||||
/**
|
||||
* Create PDF
|
||||
* @return File or null
|
||||
*/
|
||||
public File createPDF ()
|
||||
{
|
||||
try
|
||||
{
|
||||
File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
|
||||
return createPDF (temp);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.severe("Could not create PDF - " + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
} // getPDF
|
||||
|
||||
/**
|
||||
* Create PDF file
|
||||
* @param file output file
|
||||
* @return file if success
|
||||
*/
|
||||
public File createPDF (File file)
|
||||
{
|
||||
// ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.INVOICE, getC_Invoice_ID());
|
||||
// if (re == null)
|
||||
return null;
|
||||
// return re.getPDF(file);
|
||||
} // createPDF
|
||||
|
||||
|
||||
/**
|
||||
* Get Process Message
|
||||
* @return clear text error message
|
||||
*/
|
||||
public String getProcessMsg()
|
||||
{
|
||||
return m_processMsg;
|
||||
} // getProcessMsg
|
||||
|
||||
/**
|
||||
* Get Document Owner (Responsible)
|
||||
* @return AD_User_ID (Created By)
|
||||
*/
|
||||
public int getDoc_User_ID()
|
||||
{
|
||||
return getCreatedBy();
|
||||
} // getDoc_User_ID
|
||||
|
||||
/**
|
||||
* Get Document Approval Amount
|
||||
* @return DR amount
|
||||
*/
|
||||
public BigDecimal getApprovalAmt()
|
||||
{
|
||||
return getDepositAmt();
|
||||
} // getApprovalAmt
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* After Delete
|
||||
* @param success success
|
||||
* @return success
|
||||
*/
|
||||
protected boolean afterDelete (boolean success)
|
||||
{
|
||||
if (getX_DepositBatch_ID() != 0 )
|
||||
{
|
||||
String sql = "UPDATE C_Payment p SET X_DepositBatch_ID= 0 WHERE p.X_DepositBatch_ID=?";
|
||||
DB.executeUpdate(sql, getX_DepositBatch_ID(), get_TrxName());
|
||||
}
|
||||
|
||||
return success;
|
||||
} // afterDelete
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Get Deposit Batch Lines
|
||||
* @return Array of lines
|
||||
*/
|
||||
public MDepositBatchLine[] getLines()
|
||||
{
|
||||
ArrayList<MDepositBatchLine> list = new ArrayList<MDepositBatchLine>();
|
||||
String sql = "SELECT * FROM X_DepositBatchLine WHERE X_DepositBatch_ID=? ORDER BY Line";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, getX_DepositBatch_ID());
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add(new MDepositBatchLine (getCtx(), rs, get_TrxName()));
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
}
|
||||
|
||||
//
|
||||
MDepositBatchLine[] retValue = new MDepositBatchLine[list.size()];
|
||||
list.toArray(retValue);
|
||||
return retValue;
|
||||
} // getLines
|
||||
|
||||
} // MDepositBatch
|
|
@ -0,0 +1,189 @@
|
|||
/**********************************************************************
|
||||
* This file is part of Adempiere ERP Bazaar *
|
||||
* http://www.adempiere.org *
|
||||
* *
|
||||
* Copyright (C) Alejandro Falcone *
|
||||
* 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: *
|
||||
* - Alejandro Falcone (afalcone@users.sourceforge.net) *
|
||||
* http://www.openbiz.com.ar *
|
||||
* *
|
||||
* Sponsors: *
|
||||
* - Idalica Inc. (http://www.idalica.com) *
|
||||
***********************************************************************/
|
||||
|
||||
package org.compiere.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
* Bank Statement Line Model
|
||||
*
|
||||
* @author Alejandro Falcone
|
||||
* @version $Id: MDepositBatchLine.java,v 1.3 2007/07/02 00:51:02 afalcone Exp $
|
||||
*
|
||||
*/
|
||||
public class MDepositBatchLine extends X_X_DepositBatchLine
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -4461960512392850996L;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
* @param ctx context
|
||||
* @param C_BankStatementLine_ID id
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MDepositBatchLine (Properties ctx, int X_DepositBatchLine_ID, String trxName)
|
||||
{
|
||||
super (ctx, X_DepositBatchLine_ID, trxName);
|
||||
if (X_DepositBatchLine_ID == 0)
|
||||
{
|
||||
setPayAmt(Env.ZERO);
|
||||
}
|
||||
} // MDepositBatchLine
|
||||
|
||||
/**
|
||||
* Load Constructor
|
||||
* @param ctx context
|
||||
* @param rs result set
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MDepositBatchLine (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super(ctx, rs, trxName);
|
||||
} // MDepositBatchLine
|
||||
|
||||
/**
|
||||
* Parent Constructor
|
||||
* @param statement Bank Statement that the line is part of
|
||||
*/
|
||||
public MDepositBatchLine(MDepositBatch statement)
|
||||
{
|
||||
this (statement.getCtx(), 0, statement.get_TrxName());
|
||||
setClientOrg(statement);
|
||||
setX_DepositBatch_ID(statement.getX_DepositBatch_ID());
|
||||
} // MDepositBatchLine
|
||||
|
||||
/**
|
||||
* Parent Constructor
|
||||
* @param statement Deposit Batch that the line is part of
|
||||
* @param lineNo position of the line within the statement
|
||||
*/
|
||||
public MDepositBatchLine(MDepositBatch statement, int lineNo)
|
||||
{
|
||||
this (statement);
|
||||
setLine(lineNo);
|
||||
} // MDepositBatchLine
|
||||
|
||||
|
||||
/**
|
||||
* Set Payment
|
||||
* @param payment payment
|
||||
*/
|
||||
public void setPayment (MPayment payment)
|
||||
{
|
||||
setC_Payment_ID (payment.getC_Payment_ID());
|
||||
//
|
||||
BigDecimal amt = payment.getPayAmt(true);
|
||||
setPayAmt(amt);
|
||||
//
|
||||
} // setPayment
|
||||
|
||||
/**
|
||||
* Before Save
|
||||
* @param newRecord new
|
||||
* @return true
|
||||
*/
|
||||
protected boolean beforeSave (boolean newRecord)
|
||||
{
|
||||
// Set Line No
|
||||
if (getLine() == 0)
|
||||
{
|
||||
String sql = "SELECT COALESCE(MAX(Line),0)+10 AS DefaultValue FROM X_DepositBatchLine WHERE X_DepositBatch_ID=?";
|
||||
int ii = DB.getSQLValue (get_TrxName(), sql, getX_DepositBatch_ID());
|
||||
setLine (ii);
|
||||
}
|
||||
|
||||
// Set DepositBatch_ID into C_Payment table
|
||||
if (getC_Payment_ID() != 0 )
|
||||
{
|
||||
String sql = "UPDATE C_Payment p SET X_DepositBatch_ID=? WHERE p.C_Payment_ID=?";
|
||||
DB.executeUpdate(sql, new Object[] {getX_DepositBatch_ID(), getC_Payment_ID()}, false, get_TrxName());
|
||||
}
|
||||
//
|
||||
|
||||
return true;
|
||||
} // beforeSave
|
||||
|
||||
|
||||
/**
|
||||
* After Save
|
||||
* @param newRecord new
|
||||
* @param success success
|
||||
* @return success
|
||||
*/
|
||||
protected boolean afterSave (boolean newRecord, boolean success)
|
||||
{
|
||||
updateHeader();
|
||||
return success;
|
||||
} // afterSave
|
||||
|
||||
/**
|
||||
* After Delete
|
||||
* @param success success
|
||||
* @return success
|
||||
*/
|
||||
protected boolean afterDelete (boolean success)
|
||||
{
|
||||
updateHeader();
|
||||
if (getC_Payment_ID() != 0 )
|
||||
{
|
||||
String sql = "UPDATE C_Payment p SET X_DepositBatch_ID= 0 WHERE p.C_Payment_ID=?";
|
||||
DB.executeUpdate(sql, getC_Payment_ID(), get_TrxName());
|
||||
}
|
||||
|
||||
return success;
|
||||
} // afterDelete
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Update Header
|
||||
*/
|
||||
private void updateHeader()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("UPDATE X_DepositBatch dp");
|
||||
sql.append(" SET DepositAmt=(SELECT COALESCE(SUM(PayAmt),0) FROM X_DepositBatchLine dpl ");
|
||||
sql.append("WHERE dpl.X_DepositBatch_ID=dp.X_DepositBatch_ID AND dpl.IsActive='Y') ");
|
||||
sql.append("WHERE X_DepositBatch_ID=?");
|
||||
DB.executeUpdate(sql.toString(), getX_DepositBatch_ID(), get_TrxName());
|
||||
} // updateHeader
|
||||
|
||||
} // MDepositBatchLine
|
|
@ -33,7 +33,7 @@ public class X_C_BankStatement extends PO implements I_C_BankStatement, I_Persis
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20121212L;
|
||||
private static final long serialVersionUID = 20130123L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_C_BankStatement (Properties ctx, int C_BankStatement_ID, String trxName)
|
||||
|
@ -602,4 +602,18 @@ public class X_C_BankStatement extends PO implements I_C_BankStatement, I_Persis
|
|||
return Env.ZERO;
|
||||
return bd;
|
||||
}
|
||||
|
||||
/** Set Create From Batch.
|
||||
@param X_CreateFromBatch Create From Batch */
|
||||
public void setX_CreateFromBatch (String X_CreateFromBatch)
|
||||
{
|
||||
set_Value (COLUMNNAME_X_CreateFromBatch, X_CreateFromBatch);
|
||||
}
|
||||
|
||||
/** Get Create From Batch.
|
||||
@return Create From Batch */
|
||||
public String getX_CreateFromBatch ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_X_CreateFromBatch);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,372 @@
|
|||
/******************************************************************************
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2012 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.sql.Timestamp;
|
||||
import java.util.Properties;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
|
||||
/** Generated Model for X_DepositBatch
|
||||
* @author iDempiere (generated)
|
||||
* @version Release 1.0a - $Id$ */
|
||||
public class X_X_DepositBatch extends PO implements I_X_DepositBatch, I_Persistent
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20130123L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_X_DepositBatch (Properties ctx, int X_DepositBatch_ID, String trxName)
|
||||
{
|
||||
super (ctx, X_DepositBatch_ID, trxName);
|
||||
/** if (X_DepositBatch_ID == 0)
|
||||
{
|
||||
setC_BankAccount_ID (0);
|
||||
setC_DocType_ID (0);
|
||||
setDateDeposit (new Timestamp( System.currentTimeMillis() ));
|
||||
// @#Date@
|
||||
setDateDoc (new Timestamp( System.currentTimeMillis() ));
|
||||
// @#Date@
|
||||
setDepositAmt (Env.ZERO);
|
||||
setDocStatus (null);
|
||||
// DR
|
||||
setDocumentNo (null);
|
||||
setProcessed (false);
|
||||
setX_DepositBatch_ID (0);
|
||||
} */
|
||||
}
|
||||
|
||||
/** Load Constructor */
|
||||
public X_X_DepositBatch (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_X_DepositBatch[")
|
||||
.append(get_ID()).append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public org.compiere.model.I_C_BankAccount getC_BankAccount() throws RuntimeException
|
||||
{
|
||||
return (org.compiere.model.I_C_BankAccount)MTable.get(getCtx(), org.compiere.model.I_C_BankAccount.Table_Name)
|
||||
.getPO(getC_BankAccount_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Bank Account.
|
||||
@param C_BankAccount_ID
|
||||
Account at the Bank
|
||||
*/
|
||||
public void setC_BankAccount_ID (int C_BankAccount_ID)
|
||||
{
|
||||
if (C_BankAccount_ID < 1)
|
||||
set_Value (COLUMNNAME_C_BankAccount_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_C_BankAccount_ID, Integer.valueOf(C_BankAccount_ID));
|
||||
}
|
||||
|
||||
/** Get Bank Account.
|
||||
@return Account at the Bank
|
||||
*/
|
||||
public int getC_BankAccount_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_C_BankAccount_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();
|
||||
}
|
||||
|
||||
/** Set Create lines from.
|
||||
@param CreateFrom
|
||||
Process which will generate a new document lines based on an existing document
|
||||
*/
|
||||
public void setCreateFrom (String CreateFrom)
|
||||
{
|
||||
set_Value (COLUMNNAME_CreateFrom, CreateFrom);
|
||||
}
|
||||
|
||||
/** Get Create lines from.
|
||||
@return Process which will generate a new document lines based on an existing document
|
||||
*/
|
||||
public String getCreateFrom ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_CreateFrom);
|
||||
}
|
||||
|
||||
/** Set Deposit Date.
|
||||
@param DateDeposit Deposit Date */
|
||||
public void setDateDeposit (Timestamp DateDeposit)
|
||||
{
|
||||
set_Value (COLUMNNAME_DateDeposit, DateDeposit);
|
||||
}
|
||||
|
||||
/** Get Deposit Date.
|
||||
@return Deposit Date */
|
||||
public Timestamp getDateDeposit ()
|
||||
{
|
||||
return (Timestamp)get_Value(COLUMNNAME_DateDeposit);
|
||||
}
|
||||
|
||||
/** Set Document Date.
|
||||
@param DateDoc
|
||||
Date of the Document
|
||||
*/
|
||||
public void setDateDoc (Timestamp DateDoc)
|
||||
{
|
||||
set_Value (COLUMNNAME_DateDoc, DateDoc);
|
||||
}
|
||||
|
||||
/** Get Document Date.
|
||||
@return Date of the Document
|
||||
*/
|
||||
public Timestamp getDateDoc ()
|
||||
{
|
||||
return (Timestamp)get_Value(COLUMNNAME_DateDoc);
|
||||
}
|
||||
|
||||
/** Set Deposit Amount.
|
||||
@param DepositAmt Deposit Amount */
|
||||
public void setDepositAmt (BigDecimal DepositAmt)
|
||||
{
|
||||
set_Value (COLUMNNAME_DepositAmt, DepositAmt);
|
||||
}
|
||||
|
||||
/** Get Deposit Amount.
|
||||
@return Deposit Amount */
|
||||
public BigDecimal getDepositAmt ()
|
||||
{
|
||||
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_DepositAmt);
|
||||
if (bd == null)
|
||||
return Env.ZERO;
|
||||
return bd;
|
||||
}
|
||||
|
||||
/** 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);
|
||||
}
|
||||
|
||||
/** DocStatus AD_Reference_ID=131 */
|
||||
public static final int DOCSTATUS_AD_Reference_ID=131;
|
||||
/** Drafted = DR */
|
||||
public static final String DOCSTATUS_Drafted = "DR";
|
||||
/** Completed = CO */
|
||||
public static final String DOCSTATUS_Completed = "CO";
|
||||
/** Approved = AP */
|
||||
public static final String DOCSTATUS_Approved = "AP";
|
||||
/** Not Approved = NA */
|
||||
public static final String DOCSTATUS_NotApproved = "NA";
|
||||
/** Voided = VO */
|
||||
public static final String DOCSTATUS_Voided = "VO";
|
||||
/** Invalid = IN */
|
||||
public static final String DOCSTATUS_Invalid = "IN";
|
||||
/** Reversed = RE */
|
||||
public static final String DOCSTATUS_Reversed = "RE";
|
||||
/** Closed = CL */
|
||||
public static final String DOCSTATUS_Closed = "CL";
|
||||
/** Unknown = ?? */
|
||||
public static final String DOCSTATUS_Unknown = "??";
|
||||
/** In Progress = IP */
|
||||
public static final String DOCSTATUS_InProgress = "IP";
|
||||
/** Waiting Payment = WP */
|
||||
public static final String DOCSTATUS_WaitingPayment = "WP";
|
||||
/** Waiting Confirmation = WC */
|
||||
public static final String DOCSTATUS_WaitingConfirmation = "WC";
|
||||
/** Set Document Status.
|
||||
@param DocStatus
|
||||
The current status of the document
|
||||
*/
|
||||
public void setDocStatus (String DocStatus)
|
||||
{
|
||||
|
||||
set_Value (COLUMNNAME_DocStatus, DocStatus);
|
||||
}
|
||||
|
||||
/** Get Document Status.
|
||||
@return The current status of the document
|
||||
*/
|
||||
public String getDocStatus ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_DocStatus);
|
||||
}
|
||||
|
||||
/** Set Document No.
|
||||
@param DocumentNo
|
||||
Document sequence number of the document
|
||||
*/
|
||||
public void setDocumentNo (String DocumentNo)
|
||||
{
|
||||
set_Value (COLUMNNAME_DocumentNo, DocumentNo);
|
||||
}
|
||||
|
||||
/** Get Document No.
|
||||
@return Document sequence number of the document
|
||||
*/
|
||||
public String getDocumentNo ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_DocumentNo);
|
||||
}
|
||||
|
||||
/** Get Record ID/ColumnName
|
||||
@return ID/ColumnName pair
|
||||
*/
|
||||
public KeyNamePair getKeyNamePair()
|
||||
{
|
||||
return new KeyNamePair(get_ID(), getDocumentNo());
|
||||
}
|
||||
|
||||
/** Set Processed.
|
||||
@param Processed
|
||||
The document has been processed
|
||||
*/
|
||||
public void setProcessed (boolean Processed)
|
||||
{
|
||||
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
|
||||
}
|
||||
|
||||
/** Get Processed.
|
||||
@return The document has been processed
|
||||
*/
|
||||
public boolean isProcessed ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_Processed);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Process Now.
|
||||
@param Processing Process Now */
|
||||
public void setProcessing (boolean Processing)
|
||||
{
|
||||
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
|
||||
}
|
||||
|
||||
/** Get Process Now.
|
||||
@return Process Now */
|
||||
public boolean isProcessing ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_Processing);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Deposit Batch.
|
||||
@param X_DepositBatch_ID Deposit Batch */
|
||||
public void setX_DepositBatch_ID (int X_DepositBatch_ID)
|
||||
{
|
||||
if (X_DepositBatch_ID < 1)
|
||||
set_ValueNoCheck (COLUMNNAME_X_DepositBatch_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_X_DepositBatch_ID, Integer.valueOf(X_DepositBatch_ID));
|
||||
}
|
||||
|
||||
/** Get Deposit Batch.
|
||||
@return Deposit Batch */
|
||||
public int getX_DepositBatch_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_X_DepositBatch_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set X_DepositBatch_UU.
|
||||
@param X_DepositBatch_UU X_DepositBatch_UU */
|
||||
public void setX_DepositBatch_UU (String X_DepositBatch_UU)
|
||||
{
|
||||
set_Value (COLUMNNAME_X_DepositBatch_UU, X_DepositBatch_UU);
|
||||
}
|
||||
|
||||
/** Get X_DepositBatch_UU.
|
||||
@return X_DepositBatch_UU */
|
||||
public String getX_DepositBatch_UU ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_X_DepositBatch_UU);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,261 @@
|
|||
/******************************************************************************
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2012 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 X_DepositBatchLine
|
||||
* @author iDempiere (generated)
|
||||
* @version Release 1.0a - $Id$ */
|
||||
public class X_X_DepositBatchLine extends PO implements I_X_DepositBatchLine, I_Persistent
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20130123L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_X_DepositBatchLine (Properties ctx, int X_DepositBatchLine_ID, String trxName)
|
||||
{
|
||||
super (ctx, X_DepositBatchLine_ID, trxName);
|
||||
/** if (X_DepositBatchLine_ID == 0)
|
||||
{
|
||||
setC_Payment_ID (0);
|
||||
setLine (0);
|
||||
// @SQL=SELECT NVL(MAX(Line),0)+10 AS DefaultValue FROM X_DepositBatchLine WHERE X_DepositBatch_ID=@X_DepositBatch_ID@
|
||||
setPayAmt (Env.ZERO);
|
||||
setProcessed (false);
|
||||
setProcessing (false);
|
||||
setX_DepositBatch_ID (0);
|
||||
setX_DepositBatchLine_ID (0);
|
||||
} */
|
||||
}
|
||||
|
||||
/** Load Constructor */
|
||||
public X_X_DepositBatchLine (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_X_DepositBatchLine[")
|
||||
.append(get_ID()).append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public org.compiere.model.I_C_Payment getC_Payment() throws RuntimeException
|
||||
{
|
||||
return (org.compiere.model.I_C_Payment)MTable.get(getCtx(), org.compiere.model.I_C_Payment.Table_Name)
|
||||
.getPO(getC_Payment_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Payment.
|
||||
@param C_Payment_ID
|
||||
Payment identifier
|
||||
*/
|
||||
public void setC_Payment_ID (int C_Payment_ID)
|
||||
{
|
||||
if (C_Payment_ID < 1)
|
||||
set_Value (COLUMNNAME_C_Payment_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_C_Payment_ID, Integer.valueOf(C_Payment_ID));
|
||||
}
|
||||
|
||||
/** Get Payment.
|
||||
@return Payment identifier
|
||||
*/
|
||||
public int getC_Payment_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_C_Payment_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Line No.
|
||||
@param Line
|
||||
Unique line for this document
|
||||
*/
|
||||
public void setLine (int Line)
|
||||
{
|
||||
set_Value (COLUMNNAME_Line, Integer.valueOf(Line));
|
||||
}
|
||||
|
||||
/** Get Line No.
|
||||
@return Unique line for this document
|
||||
*/
|
||||
public int getLine ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_Line);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Payment amount.
|
||||
@param PayAmt
|
||||
Amount being paid
|
||||
*/
|
||||
public void setPayAmt (BigDecimal PayAmt)
|
||||
{
|
||||
set_Value (COLUMNNAME_PayAmt, PayAmt);
|
||||
}
|
||||
|
||||
/** Get Payment amount.
|
||||
@return Amount being paid
|
||||
*/
|
||||
public BigDecimal getPayAmt ()
|
||||
{
|
||||
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PayAmt);
|
||||
if (bd == null)
|
||||
return Env.ZERO;
|
||||
return bd;
|
||||
}
|
||||
|
||||
/** Set Processed.
|
||||
@param Processed
|
||||
The document has been processed
|
||||
*/
|
||||
public void setProcessed (boolean Processed)
|
||||
{
|
||||
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
|
||||
}
|
||||
|
||||
/** Get Processed.
|
||||
@return The document has been processed
|
||||
*/
|
||||
public boolean isProcessed ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_Processed);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Process Now.
|
||||
@param Processing Process Now */
|
||||
public void setProcessing (boolean Processing)
|
||||
{
|
||||
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
|
||||
}
|
||||
|
||||
/** Get Process Now.
|
||||
@return Process Now */
|
||||
public boolean isProcessing ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_Processing);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public org.compiere.model.I_X_DepositBatch getX_DepositBatch() throws RuntimeException
|
||||
{
|
||||
return (org.compiere.model.I_X_DepositBatch)MTable.get(getCtx(), org.compiere.model.I_X_DepositBatch.Table_Name)
|
||||
.getPO(getX_DepositBatch_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Deposit Batch.
|
||||
@param X_DepositBatch_ID Deposit Batch */
|
||||
public void setX_DepositBatch_ID (int X_DepositBatch_ID)
|
||||
{
|
||||
if (X_DepositBatch_ID < 1)
|
||||
set_ValueNoCheck (COLUMNNAME_X_DepositBatch_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_X_DepositBatch_ID, Integer.valueOf(X_DepositBatch_ID));
|
||||
}
|
||||
|
||||
/** Get Deposit Batch.
|
||||
@return Deposit Batch */
|
||||
public int getX_DepositBatch_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_X_DepositBatch_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(getX_DepositBatch_ID()));
|
||||
}
|
||||
|
||||
/** Set Deposit Batch Line.
|
||||
@param X_DepositBatchLine_ID Deposit Batch Line */
|
||||
public void setX_DepositBatchLine_ID (int X_DepositBatchLine_ID)
|
||||
{
|
||||
if (X_DepositBatchLine_ID < 1)
|
||||
set_ValueNoCheck (COLUMNNAME_X_DepositBatchLine_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_X_DepositBatchLine_ID, Integer.valueOf(X_DepositBatchLine_ID));
|
||||
}
|
||||
|
||||
/** Get Deposit Batch Line.
|
||||
@return Deposit Batch Line */
|
||||
public int getX_DepositBatchLine_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_X_DepositBatchLine_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set X_DepositBatchLine_UU.
|
||||
@param X_DepositBatchLine_UU X_DepositBatchLine_UU */
|
||||
public void setX_DepositBatchLine_UU (String X_DepositBatchLine_UU)
|
||||
{
|
||||
set_Value (COLUMNNAME_X_DepositBatchLine_UU, X_DepositBatchLine_UU);
|
||||
}
|
||||
|
||||
/** Get X_DepositBatchLine_UU.
|
||||
@return X_DepositBatchLine_UU */
|
||||
public String getX_DepositBatchLine_UU ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_X_DepositBatchLine_UU);
|
||||
}
|
||||
}
|
|
@ -2549,12 +2549,12 @@ public final class APanel extends CPanel
|
|||
} // DocAction
|
||||
|
||||
// Pop up Create From
|
||||
else if (col.equals("CreateFrom"))
|
||||
else if (col.equals("CreateFrom") || col.equals("X_CreateFromBatch"))
|
||||
{
|
||||
// Run form only if the button has no process defined - teo_sarca [ 1974354 ]
|
||||
if (vButton.getProcess_ID() <= 0)
|
||||
{
|
||||
ICreateFrom cf = VCreateFromFactory.create(m_curTab);
|
||||
ICreateFrom cf = VCreateFromFactory.create(m_curTab, col);
|
||||
if(cf != null)
|
||||
{
|
||||
if(cf.isInitOK())
|
||||
|
|
|
@ -19,27 +19,41 @@ import org.compiere.model.I_C_Invoice;
|
|||
import org.compiere.model.I_M_InOut;
|
||||
import org.compiere.model.I_M_PackageMPS;
|
||||
import org.compiere.model.I_M_RMA;
|
||||
import org.compiere.model.I_X_DepositBatch;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Elaine
|
||||
*
|
||||
*/
|
||||
public class DefaultCreateFromFactory implements ICreateFromFactory {
|
||||
public class DefaultCreateFromFactory implements ICreateFromFactory
|
||||
{
|
||||
|
||||
@Override
|
||||
public ICreateFrom create(GridTab mTab) {
|
||||
public ICreateFrom create(GridTab mTab, String columnName)
|
||||
{
|
||||
String tableName = mTab.getTableName();
|
||||
if (columnName.equals("CreateFrom"))
|
||||
{
|
||||
if (tableName.equals(I_C_Invoice.Table_Name))
|
||||
return new VCreateFromInvoiceUI(mTab);
|
||||
else if (tableName.equals(I_C_BankStatement.Table_Name))
|
||||
return new VCreateFromStatementUI(mTab);
|
||||
// return new VCreateFromStatementUI(mTab);
|
||||
return new VCreateFromStatementBatchUI(mTab);
|
||||
else if (tableName.equals(I_M_InOut.Table_Name))
|
||||
return new VCreateFromShipmentUI(mTab);
|
||||
else if (tableName.equals(I_M_RMA.Table_Name))
|
||||
return new VCreateFromRMAUI(mTab);
|
||||
else if (tableName.equals(I_M_PackageMPS.Table_Name))
|
||||
return new VCreateFromPackageShipmentUI(mTab);
|
||||
else if (tableName.equals(I_X_DepositBatch.Table_Name))
|
||||
return new VCreateFromDepositBatchUI(mTab);
|
||||
}
|
||||
else if (columnName.equalsIgnoreCase("X_CreateFromBatch"))
|
||||
{
|
||||
if (tableName.equals(I_C_BankStatement.Table_Name))
|
||||
return new VCreateFromBatchStatementUI(mTab);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,335 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2013 Elaine Tan *
|
||||
* Copyright (C) 2013 Trek Global
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.compiere.grid;
|
||||
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import org.compiere.apps.ADialog;
|
||||
import org.compiere.apps.AEnv;
|
||||
import org.compiere.apps.ConfirmPanel;
|
||||
import org.compiere.grid.ed.VDate;
|
||||
import org.compiere.grid.ed.VLookup;
|
||||
import org.compiere.grid.ed.VNumber;
|
||||
import org.compiere.grid.ed.VString;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MBankStatement;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MPayment;
|
||||
import org.compiere.swing.CButton;
|
||||
import org.compiere.swing.CLabel;
|
||||
import org.compiere.swing.CPanel;
|
||||
import org.compiere.swing.CTextField;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Elaine
|
||||
*
|
||||
*/
|
||||
public class VCreateFromBatchStatementUI extends CreateFromBatchStatement implements ActionListener
|
||||
{
|
||||
private VCreateFromDialog dialog;
|
||||
|
||||
public VCreateFromBatchStatementUI(GridTab mTab)
|
||||
{
|
||||
super(mTab);
|
||||
log.info(getGridTab().toString());
|
||||
|
||||
dialog = new VCreateFromDialog(this, getGridTab().getWindowNo(), true);
|
||||
|
||||
p_WindowNo = getGridTab().getWindowNo();
|
||||
|
||||
try
|
||||
{
|
||||
if (!dynInit())
|
||||
return;
|
||||
jbInit();
|
||||
|
||||
setInitOK(true);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "", e);
|
||||
setInitOK(false);
|
||||
}
|
||||
AEnv.positionCenterWindow(AEnv.getWindow(p_WindowNo), dialog);
|
||||
} // VCreateFrom
|
||||
|
||||
/** Window No */
|
||||
private int p_WindowNo;
|
||||
|
||||
/** Logger */
|
||||
private CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
private JLabel bankAccountLabel = new JLabel();
|
||||
protected VLookup bankAccountField;
|
||||
|
||||
private CLabel documentNoLabel = new CLabel(Msg.translate(Env.getCtx(), "DocumentNo"));
|
||||
protected CTextField documentNoField = new CTextField(10);
|
||||
|
||||
private JLabel documentTypeLabel = new JLabel();
|
||||
protected VLookup documentTypeField;
|
||||
|
||||
private JLabel authorizationLabel = new JLabel();
|
||||
protected VString authorizationField = new VString();
|
||||
|
||||
private JLabel tenderTypeLabel = new JLabel();
|
||||
protected VLookup tenderTypeField;
|
||||
|
||||
private CLabel amtFromLabel = new CLabel(Msg.translate(Env.getCtx(), "PayAmt"));
|
||||
protected VNumber amtFromField = new VNumber("AmtFrom", false, false, true, DisplayType.Amount, Msg.translate(Env.getCtx(), "AmtFrom"));
|
||||
private CLabel amtToLabel = new CLabel("-");
|
||||
protected VNumber amtToField = new VNumber("AmtTo", false, false, true, DisplayType.Amount, Msg.translate(Env.getCtx(), "AmtTo"));
|
||||
|
||||
protected CLabel BPartner_idLabel = new CLabel(Msg.translate(Env.getCtx(), "BPartner"));
|
||||
protected VLookup bPartnerLookup;
|
||||
|
||||
private CLabel dateFromLabel = new CLabel(Msg.translate(Env.getCtx(), "DateTrx"));
|
||||
protected VDate dateFromField = new VDate("DateFrom", false, false, true, DisplayType.Date, Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
private CLabel dateToLabel = new CLabel("-");
|
||||
protected VDate dateToField = new VDate("DateTo", false, false, true, DisplayType.Date, Msg.translate(Env.getCtx(), "DateTo"));
|
||||
|
||||
|
||||
/**
|
||||
* Dynamic Init
|
||||
* @throws Exception if Lookups cannot be initialized
|
||||
* @return true if initialized
|
||||
*/
|
||||
public boolean dynInit() throws Exception
|
||||
{
|
||||
log.config("");
|
||||
|
||||
super.dynInit();
|
||||
|
||||
//Refresh button
|
||||
CButton refreshButton = ConfirmPanel.createRefreshButton(false);
|
||||
refreshButton.setMargin(new Insets (1, 10, 0, 10));
|
||||
refreshButton.setDefaultCapable(true);
|
||||
refreshButton.addActionListener(this);
|
||||
dialog.getConfirmPanel().addButton(refreshButton);
|
||||
dialog.getRootPane().setDefaultButton(refreshButton);
|
||||
|
||||
if (getGridTab().getValue("C_BankStatement_ID") == null)
|
||||
{
|
||||
ADialog.error(0, dialog, "SaveErrorRowNotFound");
|
||||
return false;
|
||||
}
|
||||
|
||||
dialog.setTitle(getTitle());
|
||||
|
||||
int AD_Column_ID = COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID; // C_BankStatement.C_BankAccount_ID
|
||||
MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir);
|
||||
bankAccountField = new VLookup ("C_BankAccount_ID", true, true, true, lookup);
|
||||
// Set Default
|
||||
int C_BankAccount_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "C_BankAccount_ID");
|
||||
bankAccountField.setValue(new Integer(C_BankAccount_ID));
|
||||
bankAccountField.addActionListener(this);
|
||||
// initial Loading
|
||||
authorizationField = new VString ("authorization", false, false, true, 10, 30, null, null);
|
||||
authorizationField.addActionListener(this);
|
||||
|
||||
MLookup lookupDocument = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_C_DocType_ID), DisplayType.TableDir);
|
||||
documentTypeField = new VLookup (MPayment.COLUMNNAME_C_DocType_ID,false,false,true,lookupDocument);
|
||||
documentTypeField.addActionListener(this);
|
||||
|
||||
MLookup lookupTender = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_TenderType), DisplayType.List);
|
||||
tenderTypeField = new VLookup (MPayment.COLUMNNAME_TenderType,false,false,true,lookupTender);
|
||||
tenderTypeField.addActionListener(this);
|
||||
|
||||
bPartnerLookup = new VLookup("C_BPartner_ID", false, false, true,
|
||||
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search));
|
||||
BPartner_idLabel.setLabelFor(bPartnerLookup);
|
||||
bPartnerLookup.addActionListener(this);
|
||||
|
||||
Timestamp date = Env.getContextAsDate(Env.getCtx(), p_WindowNo, MBankStatement.COLUMNNAME_StatementDate);
|
||||
dateToField.setValue(date);
|
||||
|
||||
documentNoField.addActionListener(this);
|
||||
dateFromField.addActionListener(this);
|
||||
dateToField.addActionListener(this);
|
||||
amtFromField.addActionListener(this);
|
||||
amtToField.addActionListener(this);
|
||||
|
||||
loadBankAccount();
|
||||
|
||||
return true;
|
||||
} // dynInit
|
||||
|
||||
/**
|
||||
* Static Init.
|
||||
* <pre>
|
||||
* parameterPanel
|
||||
* parameterBankPanel
|
||||
* parameterStdPanel
|
||||
* bPartner/order/invoice/shopment/licator Label/Field
|
||||
* dataPane
|
||||
* southPanel
|
||||
* confirmPanel
|
||||
* statusBar
|
||||
* </pre>
|
||||
* @throws Exception
|
||||
*/
|
||||
private void jbInit() throws Exception
|
||||
{
|
||||
bankAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID"));
|
||||
authorizationLabel.setText(Msg.translate(Env.getCtx(), "R_AuthCode"));
|
||||
|
||||
documentTypeLabel.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
|
||||
tenderTypeLabel.setText(Msg.translate(Env.getCtx(), "TenderType"));
|
||||
|
||||
documentNoLabel.setLabelFor(documentNoField);
|
||||
dateFromLabel.setLabelFor(dateFromField);
|
||||
dateFromField.setToolTipText(Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
dateToLabel.setLabelFor(dateToField);
|
||||
dateToField.setToolTipText(Msg.translate(Env.getCtx(), "DateTo"));
|
||||
amtFromLabel.setLabelFor(amtFromField);
|
||||
amtFromField.setToolTipText(Msg.translate(Env.getCtx(), "AmtFrom"));
|
||||
amtToLabel.setLabelFor(amtToField);
|
||||
amtToField.setToolTipText(Msg.translate(Env.getCtx(), "AmtTo"));
|
||||
|
||||
CPanel parameterPanel = dialog.getParameterPanel();
|
||||
parameterPanel.setLayout(new BorderLayout());
|
||||
|
||||
CPanel parameterBankPanel = new CPanel();
|
||||
parameterBankPanel.setLayout(new GridBagLayout());
|
||||
parameterPanel.add(parameterBankPanel, BorderLayout.CENTER);
|
||||
|
||||
parameterBankPanel.add(bankAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
if (bankAccountField != null)
|
||||
parameterBankPanel.add(bankAccountField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(documentTypeLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
if(documentTypeField!= null)
|
||||
parameterBankPanel.add(documentTypeField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(tenderTypeLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
if(tenderTypeField!=null)
|
||||
parameterBankPanel.add(tenderTypeField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(BPartner_idLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(bPartnerLookup, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(documentNoLabel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(documentNoField, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(authorizationLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(authorizationField, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(amtFromLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(amtFromField, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(amtToLabel, new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(amtToField, new GridBagConstraints(5, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(dateFromLabel, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(dateFromField, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(dateToLabel, new GridBagConstraints(4, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(dateToField, new GridBagConstraints(5, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
} // jbInit
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Action Listener
|
||||
* @param e event
|
||||
*/
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
log.config("Action=" + e.getActionCommand());
|
||||
// Object source = e.getSource();
|
||||
if(e.getActionCommand().equals(ConfirmPanel.A_REFRESH))
|
||||
{
|
||||
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
|
||||
loadBankAccount();
|
||||
dialog.tableChanged(null);
|
||||
Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
|
||||
}
|
||||
} // actionPerformed
|
||||
|
||||
protected void loadBankAccount()
|
||||
{
|
||||
loadTableOIS(getBankAccountData(bankAccountField.getValue(), bPartnerLookup.getValue(),
|
||||
documentNoField.getText(), dateFromField.getValue(), dateToField.getValue(),
|
||||
amtFromField.getValue(), amtToField.getValue(),
|
||||
documentTypeField.getValue(), tenderTypeField.getValue(), authorizationField.getText()));
|
||||
}
|
||||
|
||||
protected void loadTableOIS (Vector<?> data)
|
||||
{
|
||||
// Remove previous listeners
|
||||
dialog.getMiniTable().getModel().removeTableModelListener(dialog);
|
||||
// Set Model
|
||||
DefaultTableModel model = new DefaultTableModel(data, getOISColumnNames());
|
||||
model.addTableModelListener(dialog);
|
||||
dialog.getMiniTable().setModel(model);
|
||||
//
|
||||
|
||||
configureMiniTable(dialog.getMiniTable());
|
||||
}
|
||||
|
||||
public void showWindow()
|
||||
{
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
|
||||
public void closeWindow()
|
||||
{
|
||||
dialog.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getWindow()
|
||||
{
|
||||
return dialog;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,337 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2013 Elaine Tan *
|
||||
* Copyright (C) 2013 Trek Global
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.compiere.grid;
|
||||
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import org.compiere.apps.ADialog;
|
||||
import org.compiere.apps.AEnv;
|
||||
import org.compiere.apps.ConfirmPanel;
|
||||
import org.compiere.grid.ed.VDate;
|
||||
import org.compiere.grid.ed.VLookup;
|
||||
import org.compiere.grid.ed.VNumber;
|
||||
import org.compiere.grid.ed.VString;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MBankStatement;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MPayment;
|
||||
import org.compiere.swing.CButton;
|
||||
import org.compiere.swing.CLabel;
|
||||
import org.compiere.swing.CPanel;
|
||||
import org.compiere.swing.CTextField;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Elaine
|
||||
*
|
||||
*/
|
||||
public class VCreateFromDepositBatchUI extends CreateFromDepositBatch implements ActionListener
|
||||
{
|
||||
private VCreateFromDialog dialog;
|
||||
|
||||
public VCreateFromDepositBatchUI(GridTab mTab)
|
||||
{
|
||||
super(mTab);
|
||||
log.info(getGridTab().toString());
|
||||
|
||||
dialog = new VCreateFromDialog(this, getGridTab().getWindowNo(), true);
|
||||
|
||||
p_WindowNo = getGridTab().getWindowNo();
|
||||
|
||||
try
|
||||
{
|
||||
if (!dynInit())
|
||||
return;
|
||||
jbInit();
|
||||
|
||||
setInitOK(true);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "", e);
|
||||
setInitOK(false);
|
||||
}
|
||||
AEnv.positionCenterWindow(AEnv.getWindow(p_WindowNo), dialog);
|
||||
} // VCreateFrom
|
||||
|
||||
/** Window No */
|
||||
private int p_WindowNo;
|
||||
|
||||
/** Logger */
|
||||
private CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
private JLabel bankAccountLabel = new JLabel();
|
||||
protected VLookup bankAccountField;
|
||||
|
||||
private CLabel documentNoLabel = new CLabel(Msg.translate(Env.getCtx(), "DocumentNo"));
|
||||
protected CTextField documentNoField = new CTextField(10);
|
||||
|
||||
private JLabel documentTypeLabel = new JLabel();
|
||||
protected VLookup documentTypeField;
|
||||
|
||||
private JLabel authorizationLabel = new JLabel();
|
||||
protected VString authorizationField = new VString();
|
||||
|
||||
private JLabel tenderTypeLabel = new JLabel();
|
||||
protected VLookup tenderTypeField;
|
||||
|
||||
private CLabel amtFromLabel = new CLabel(Msg.translate(Env.getCtx(), "PayAmt"));
|
||||
protected VNumber amtFromField = new VNumber("AmtFrom", false, false, true, DisplayType.Amount, Msg.translate(Env.getCtx(), "AmtFrom"));
|
||||
private CLabel amtToLabel = new CLabel("-");
|
||||
protected VNumber amtToField = new VNumber("AmtTo", false, false, true, DisplayType.Amount, Msg.translate(Env.getCtx(), "AmtTo"));
|
||||
|
||||
protected CLabel BPartner_idLabel = new CLabel(Msg.translate(Env.getCtx(), "BPartner"));
|
||||
protected VLookup bPartnerLookup;
|
||||
|
||||
private CLabel dateFromLabel = new CLabel(Msg.translate(Env.getCtx(), "DateTrx"));
|
||||
protected VDate dateFromField = new VDate("DateFrom", false, false, true, DisplayType.Date, Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
private CLabel dateToLabel = new CLabel("-");
|
||||
protected VDate dateToField = new VDate("DateTo", false, false, true, DisplayType.Date, Msg.translate(Env.getCtx(), "DateTo"));
|
||||
|
||||
|
||||
/**
|
||||
* Dynamic Init
|
||||
* @throws Exception if Lookups cannot be initialized
|
||||
* @return true if initialized
|
||||
*/
|
||||
public boolean dynInit() throws Exception
|
||||
{
|
||||
log.config("");
|
||||
|
||||
super.dynInit();
|
||||
|
||||
//Refresh button
|
||||
CButton refreshButton = ConfirmPanel.createRefreshButton(false);
|
||||
refreshButton.setMargin(new Insets (1, 10, 0, 10));
|
||||
refreshButton.setDefaultCapable(true);
|
||||
refreshButton.addActionListener(this);
|
||||
dialog.getConfirmPanel().addButton(refreshButton);
|
||||
dialog.getRootPane().setDefaultButton(refreshButton);
|
||||
|
||||
if (getGridTab().getValue("X_DepositBatch_ID") == null)
|
||||
{
|
||||
ADialog.error(0, dialog, "SaveErrorRowNotFound");
|
||||
return false;
|
||||
}
|
||||
|
||||
dialog.setTitle(getTitle());
|
||||
|
||||
int AD_Column_ID = COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID; // C_BankStatement.C_BankAccount_ID
|
||||
MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir);
|
||||
bankAccountField = new VLookup ("C_BankAccount_ID", true, true, true, lookup);
|
||||
// Set Default
|
||||
int C_BankAccount_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "C_BankAccount_ID");
|
||||
bankAccountField.setValue(new Integer(C_BankAccount_ID));
|
||||
bankAccountField.addActionListener(this);
|
||||
// initial Loading
|
||||
authorizationField = new VString ("authorization", false, false, true, 10, 30, null, null);
|
||||
authorizationField.addActionListener(this);
|
||||
|
||||
MLookup lookupDocument = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_C_DocType_ID), DisplayType.TableDir);
|
||||
documentTypeField = new VLookup (MPayment.COLUMNNAME_C_DocType_ID,false,false,true,lookupDocument);
|
||||
int C_DocType_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "C_DocType_ID");
|
||||
documentTypeField.setValue(new Integer(C_DocType_ID));
|
||||
documentTypeField.addActionListener(this);
|
||||
|
||||
MLookup lookupTender = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_TenderType), DisplayType.List);
|
||||
tenderTypeField = new VLookup (MPayment.COLUMNNAME_TenderType,false,false,true,lookupTender);
|
||||
tenderTypeField.addActionListener(this);
|
||||
|
||||
bPartnerLookup = new VLookup("C_BPartner_ID", false, false, true,
|
||||
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search));
|
||||
BPartner_idLabel.setLabelFor(bPartnerLookup);
|
||||
bPartnerLookup.addActionListener(this);
|
||||
|
||||
Timestamp date = Env.getContextAsDate(Env.getCtx(), p_WindowNo, MBankStatement.COLUMNNAME_StatementDate);
|
||||
dateToField.setValue(date);
|
||||
|
||||
documentNoField.addActionListener(this);
|
||||
dateFromField.addActionListener(this);
|
||||
dateToField.addActionListener(this);
|
||||
amtFromField.addActionListener(this);
|
||||
amtToField.addActionListener(this);
|
||||
|
||||
loadBankAccount();
|
||||
|
||||
return true;
|
||||
} // dynInit
|
||||
|
||||
/**
|
||||
* Static Init.
|
||||
* <pre>
|
||||
* parameterPanel
|
||||
* parameterBankPanel
|
||||
* parameterStdPanel
|
||||
* bPartner/order/invoice/shopment/licator Label/Field
|
||||
* dataPane
|
||||
* southPanel
|
||||
* confirmPanel
|
||||
* statusBar
|
||||
* </pre>
|
||||
* @throws Exception
|
||||
*/
|
||||
private void jbInit() throws Exception
|
||||
{
|
||||
bankAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID"));
|
||||
authorizationLabel.setText(Msg.translate(Env.getCtx(), "R_AuthCode"));
|
||||
|
||||
documentTypeLabel.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
|
||||
tenderTypeLabel.setText(Msg.translate(Env.getCtx(), "TenderType"));
|
||||
|
||||
documentNoLabel.setLabelFor(documentNoField);
|
||||
dateFromLabel.setLabelFor(dateFromField);
|
||||
dateFromField.setToolTipText(Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
dateToLabel.setLabelFor(dateToField);
|
||||
dateToField.setToolTipText(Msg.translate(Env.getCtx(), "DateTo"));
|
||||
amtFromLabel.setLabelFor(amtFromField);
|
||||
amtFromField.setToolTipText(Msg.translate(Env.getCtx(), "AmtFrom"));
|
||||
amtToLabel.setLabelFor(amtToField);
|
||||
amtToField.setToolTipText(Msg.translate(Env.getCtx(), "AmtTo"));
|
||||
|
||||
CPanel parameterPanel = dialog.getParameterPanel();
|
||||
parameterPanel.setLayout(new BorderLayout());
|
||||
|
||||
CPanel parameterBankPanel = new CPanel();
|
||||
parameterBankPanel.setLayout(new GridBagLayout());
|
||||
parameterPanel.add(parameterBankPanel, BorderLayout.CENTER);
|
||||
|
||||
parameterBankPanel.add(bankAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
if (bankAccountField != null)
|
||||
parameterBankPanel.add(bankAccountField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(documentTypeLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
if(documentTypeField!= null)
|
||||
parameterBankPanel.add(documentTypeField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(tenderTypeLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
if(tenderTypeField!=null)
|
||||
parameterBankPanel.add(tenderTypeField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(BPartner_idLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(bPartnerLookup, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(documentNoLabel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(documentNoField, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(authorizationLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(authorizationField, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(amtFromLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(amtFromField, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(amtToLabel, new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(amtToField, new GridBagConstraints(5, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(dateFromLabel, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(dateFromField, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(dateToLabel, new GridBagConstraints(4, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(dateToField, new GridBagConstraints(5, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
} // jbInit
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Action Listener
|
||||
* @param e event
|
||||
*/
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
log.config("Action=" + e.getActionCommand());
|
||||
// Object source = e.getSource();
|
||||
if(e.getActionCommand().equals(ConfirmPanel.A_REFRESH))
|
||||
{
|
||||
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
|
||||
loadBankAccount();
|
||||
dialog.tableChanged(null);
|
||||
Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
|
||||
}
|
||||
} // actionPerformed
|
||||
|
||||
protected void loadBankAccount()
|
||||
{
|
||||
loadTableOIS(getBankAccountData(bankAccountField.getValue(), bPartnerLookup.getValue(),
|
||||
documentNoField.getText(), dateFromField.getValue(), dateToField.getValue(),
|
||||
amtFromField.getValue(), amtToField.getValue(),
|
||||
documentTypeField.getValue(), tenderTypeField.getValue(), authorizationField.getText()));
|
||||
}
|
||||
|
||||
protected void loadTableOIS (Vector<?> data)
|
||||
{
|
||||
// Remove previous listeners
|
||||
dialog.getMiniTable().getModel().removeTableModelListener(dialog);
|
||||
// Set Model
|
||||
DefaultTableModel model = new DefaultTableModel(data, getOISColumnNames());
|
||||
model.addTableModelListener(dialog);
|
||||
dialog.getMiniTable().setModel(model);
|
||||
//
|
||||
|
||||
configureMiniTable(dialog.getMiniTable());
|
||||
}
|
||||
|
||||
public void showWindow()
|
||||
{
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
|
||||
public void closeWindow()
|
||||
{
|
||||
dialog.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getWindow()
|
||||
{
|
||||
return dialog;
|
||||
}
|
||||
}
|
|
@ -196,7 +196,7 @@ public class VCreateFromDialog extends CDialog implements ActionListener, TableM
|
|||
}
|
||||
setStatusLine(count, null);
|
||||
|
||||
createFrom.info();
|
||||
createFrom.info(dataTable, statusBar);
|
||||
}
|
||||
|
||||
public void setStatusLine(int selectedRowCount, String text)
|
||||
|
|
|
@ -20,13 +20,13 @@ import org.compiere.model.GridTab;
|
|||
|
||||
public class VCreateFromFactory
|
||||
{
|
||||
public static ICreateFrom create (GridTab mTab)
|
||||
public static ICreateFrom create (GridTab mTab, String columnName)
|
||||
{
|
||||
ICreateFrom createFrom = null;
|
||||
List<ICreateFromFactory> factories = Service.locator().list(ICreateFromFactory.class).getServices();
|
||||
for (ICreateFromFactory factory : factories)
|
||||
{
|
||||
createFrom = factory.create(mTab);
|
||||
createFrom = factory.create(mTab, columnName);
|
||||
if (createFrom != null)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,335 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2013 Elaine Tan *
|
||||
* Copyright (C) 2013 Trek Global
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.compiere.grid;
|
||||
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import org.compiere.apps.ADialog;
|
||||
import org.compiere.apps.AEnv;
|
||||
import org.compiere.apps.ConfirmPanel;
|
||||
import org.compiere.grid.ed.VDate;
|
||||
import org.compiere.grid.ed.VLookup;
|
||||
import org.compiere.grid.ed.VNumber;
|
||||
import org.compiere.grid.ed.VString;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MBankStatement;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MPayment;
|
||||
import org.compiere.swing.CButton;
|
||||
import org.compiere.swing.CLabel;
|
||||
import org.compiere.swing.CPanel;
|
||||
import org.compiere.swing.CTextField;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Elaine
|
||||
*
|
||||
*/
|
||||
public class VCreateFromStatementBatchUI extends CreateFromStatementBatch implements ActionListener
|
||||
{
|
||||
private VCreateFromDialog dialog;
|
||||
|
||||
public VCreateFromStatementBatchUI(GridTab mTab)
|
||||
{
|
||||
super(mTab);
|
||||
log.info(getGridTab().toString());
|
||||
|
||||
dialog = new VCreateFromDialog(this, getGridTab().getWindowNo(), true);
|
||||
|
||||
p_WindowNo = getGridTab().getWindowNo();
|
||||
|
||||
try
|
||||
{
|
||||
if (!dynInit())
|
||||
return;
|
||||
jbInit();
|
||||
|
||||
setInitOK(true);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "", e);
|
||||
setInitOK(false);
|
||||
}
|
||||
AEnv.positionCenterWindow(AEnv.getWindow(p_WindowNo), dialog);
|
||||
} // VCreateFrom
|
||||
|
||||
/** Window No */
|
||||
private int p_WindowNo;
|
||||
|
||||
/** Logger */
|
||||
private CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
private JLabel bankAccountLabel = new JLabel();
|
||||
protected VLookup bankAccountField;
|
||||
|
||||
private CLabel documentNoLabel = new CLabel(Msg.translate(Env.getCtx(), "DocumentNo"));
|
||||
protected CTextField documentNoField = new CTextField(10);
|
||||
|
||||
private JLabel documentTypeLabel = new JLabel();
|
||||
protected VLookup documentTypeField;
|
||||
|
||||
private JLabel authorizationLabel = new JLabel();
|
||||
protected VString authorizationField = new VString();
|
||||
|
||||
private JLabel tenderTypeLabel = new JLabel();
|
||||
protected VLookup tenderTypeField;
|
||||
|
||||
private CLabel amtFromLabel = new CLabel(Msg.translate(Env.getCtx(), "PayAmt"));
|
||||
protected VNumber amtFromField = new VNumber("AmtFrom", false, false, true, DisplayType.Amount, Msg.translate(Env.getCtx(), "AmtFrom"));
|
||||
private CLabel amtToLabel = new CLabel("-");
|
||||
protected VNumber amtToField = new VNumber("AmtTo", false, false, true, DisplayType.Amount, Msg.translate(Env.getCtx(), "AmtTo"));
|
||||
|
||||
protected CLabel BPartner_idLabel = new CLabel(Msg.translate(Env.getCtx(), "BPartner"));
|
||||
protected VLookup bPartnerLookup;
|
||||
|
||||
private CLabel dateFromLabel = new CLabel(Msg.translate(Env.getCtx(), "DateTrx"));
|
||||
protected VDate dateFromField = new VDate("DateFrom", false, false, true, DisplayType.Date, Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
private CLabel dateToLabel = new CLabel("-");
|
||||
protected VDate dateToField = new VDate("DateTo", false, false, true, DisplayType.Date, Msg.translate(Env.getCtx(), "DateTo"));
|
||||
|
||||
|
||||
/**
|
||||
* Dynamic Init
|
||||
* @throws Exception if Lookups cannot be initialized
|
||||
* @return true if initialized
|
||||
*/
|
||||
public boolean dynInit() throws Exception
|
||||
{
|
||||
log.config("");
|
||||
|
||||
super.dynInit();
|
||||
|
||||
//Refresh button
|
||||
CButton refreshButton = ConfirmPanel.createRefreshButton(false);
|
||||
refreshButton.setMargin(new Insets (1, 10, 0, 10));
|
||||
refreshButton.setDefaultCapable(true);
|
||||
refreshButton.addActionListener(this);
|
||||
dialog.getConfirmPanel().addButton(refreshButton);
|
||||
dialog.getRootPane().setDefaultButton(refreshButton);
|
||||
|
||||
if (getGridTab().getValue("C_BankStatement_ID") == null)
|
||||
{
|
||||
ADialog.error(0, dialog, "SaveErrorRowNotFound");
|
||||
return false;
|
||||
}
|
||||
|
||||
dialog.setTitle(getTitle());
|
||||
|
||||
int AD_Column_ID = COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID; // C_BankStatement.C_BankAccount_ID
|
||||
MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir);
|
||||
bankAccountField = new VLookup ("C_BankAccount_ID", true, true, true, lookup);
|
||||
// Set Default
|
||||
int C_BankAccount_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "C_BankAccount_ID");
|
||||
bankAccountField.setValue(new Integer(C_BankAccount_ID));
|
||||
bankAccountField.addActionListener(this);
|
||||
// initial Loading
|
||||
authorizationField = new VString ("authorization", false, false, true, 10, 30, null, null);
|
||||
authorizationField.addActionListener(this);
|
||||
|
||||
MLookup lookupDocument = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_C_DocType_ID), DisplayType.TableDir);
|
||||
documentTypeField = new VLookup (MPayment.COLUMNNAME_C_DocType_ID,false,false,true,lookupDocument);
|
||||
documentTypeField.addActionListener(this);
|
||||
|
||||
MLookup lookupTender = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_TenderType), DisplayType.List);
|
||||
tenderTypeField = new VLookup (MPayment.COLUMNNAME_TenderType,false,false,true,lookupTender);
|
||||
tenderTypeField.addActionListener(this);
|
||||
|
||||
bPartnerLookup = new VLookup("C_BPartner_ID", false, false, true,
|
||||
MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search));
|
||||
BPartner_idLabel.setLabelFor(bPartnerLookup);
|
||||
bPartnerLookup.addActionListener(this);
|
||||
|
||||
Timestamp date = Env.getContextAsDate(Env.getCtx(), p_WindowNo, MBankStatement.COLUMNNAME_StatementDate);
|
||||
dateToField.setValue(date);
|
||||
|
||||
documentNoField.addActionListener(this);
|
||||
dateFromField.addActionListener(this);
|
||||
dateToField.addActionListener(this);
|
||||
amtFromField.addActionListener(this);
|
||||
amtToField.addActionListener(this);
|
||||
|
||||
loadBankAccount();
|
||||
|
||||
return true;
|
||||
} // dynInit
|
||||
|
||||
/**
|
||||
* Static Init.
|
||||
* <pre>
|
||||
* parameterPanel
|
||||
* parameterBankPanel
|
||||
* parameterStdPanel
|
||||
* bPartner/order/invoice/shopment/licator Label/Field
|
||||
* dataPane
|
||||
* southPanel
|
||||
* confirmPanel
|
||||
* statusBar
|
||||
* </pre>
|
||||
* @throws Exception
|
||||
*/
|
||||
private void jbInit() throws Exception
|
||||
{
|
||||
bankAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID"));
|
||||
authorizationLabel.setText(Msg.translate(Env.getCtx(), "R_AuthCode"));
|
||||
|
||||
documentTypeLabel.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
|
||||
tenderTypeLabel.setText(Msg.translate(Env.getCtx(), "TenderType"));
|
||||
|
||||
documentNoLabel.setLabelFor(documentNoField);
|
||||
dateFromLabel.setLabelFor(dateFromField);
|
||||
dateFromField.setToolTipText(Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
dateToLabel.setLabelFor(dateToField);
|
||||
dateToField.setToolTipText(Msg.translate(Env.getCtx(), "DateTo"));
|
||||
amtFromLabel.setLabelFor(amtFromField);
|
||||
amtFromField.setToolTipText(Msg.translate(Env.getCtx(), "AmtFrom"));
|
||||
amtToLabel.setLabelFor(amtToField);
|
||||
amtToField.setToolTipText(Msg.translate(Env.getCtx(), "AmtTo"));
|
||||
|
||||
CPanel parameterPanel = dialog.getParameterPanel();
|
||||
parameterPanel.setLayout(new BorderLayout());
|
||||
|
||||
CPanel parameterBankPanel = new CPanel();
|
||||
parameterBankPanel.setLayout(new GridBagLayout());
|
||||
parameterPanel.add(parameterBankPanel, BorderLayout.CENTER);
|
||||
|
||||
parameterBankPanel.add(bankAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
if (bankAccountField != null)
|
||||
parameterBankPanel.add(bankAccountField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(documentTypeLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
if(documentTypeField!= null)
|
||||
parameterBankPanel.add(documentTypeField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(tenderTypeLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
if(tenderTypeField!=null)
|
||||
parameterBankPanel.add(tenderTypeField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(BPartner_idLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(bPartnerLookup, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(documentNoLabel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(documentNoField, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(authorizationLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(authorizationField, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(amtFromLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(amtFromField, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(amtToLabel, new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(amtToField, new GridBagConstraints(5, 2, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
parameterBankPanel.add(dateFromLabel, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(dateFromField, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(dateToLabel, new GridBagConstraints(4, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterBankPanel.add(dateToField, new GridBagConstraints(5, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
} // jbInit
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Action Listener
|
||||
* @param e event
|
||||
*/
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
log.config("Action=" + e.getActionCommand());
|
||||
// Object source = e.getSource();
|
||||
if(e.getActionCommand().equals(ConfirmPanel.A_REFRESH))
|
||||
{
|
||||
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
|
||||
loadBankAccount();
|
||||
dialog.tableChanged(null);
|
||||
Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
|
||||
}
|
||||
} // actionPerformed
|
||||
|
||||
protected void loadBankAccount()
|
||||
{
|
||||
loadTableOIS(getBankAccountData(bankAccountField.getValue(), bPartnerLookup.getValue(),
|
||||
documentNoField.getText(), dateFromField.getValue(), dateToField.getValue(),
|
||||
amtFromField.getValue(), amtToField.getValue(),
|
||||
documentTypeField.getValue(), tenderTypeField.getValue(), authorizationField.getText()));
|
||||
}
|
||||
|
||||
protected void loadTableOIS (Vector<?> data)
|
||||
{
|
||||
// Remove previous listeners
|
||||
dialog.getMiniTable().getModel().removeTableModelListener(dialog);
|
||||
// Set Model
|
||||
DefaultTableModel model = new DefaultTableModel(data, getOISColumnNames());
|
||||
model.addTableModelListener(dialog);
|
||||
dialog.getMiniTable().setModel(model);
|
||||
//
|
||||
|
||||
configureMiniTable(dialog.getMiniTable());
|
||||
}
|
||||
|
||||
public void showWindow()
|
||||
{
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
|
||||
public void closeWindow()
|
||||
{
|
||||
dialog.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getWindow()
|
||||
{
|
||||
return dialog;
|
||||
}
|
||||
}
|
|
@ -13,6 +13,8 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.grid;
|
||||
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.GridBagConstraints;
|
||||
|
@ -20,9 +22,7 @@ import java.awt.GridBagLayout;
|
|||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -43,7 +43,6 @@ import org.compiere.model.MColumn;
|
|||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MPayment;
|
||||
import static org.compiere.model.SystemIDs.*;
|
||||
import org.compiere.swing.CButton;
|
||||
import org.compiere.swing.CLabel;
|
||||
import org.compiere.swing.CPanel;
|
||||
|
@ -55,7 +54,6 @@ import org.compiere.util.Msg;
|
|||
|
||||
public class VCreateFromStatementUI extends CreateFromStatement implements ActionListener
|
||||
{
|
||||
|
||||
private VCreateFromDialog dialog;
|
||||
|
||||
public VCreateFromStatementUI(GridTab mTab)
|
||||
|
@ -308,27 +306,6 @@ public class VCreateFromStatementUI extends CreateFromStatement implements Actio
|
|||
configureMiniTable(dialog.getMiniTable());
|
||||
}
|
||||
|
||||
/**
|
||||
* List total amount
|
||||
*/
|
||||
public void info()
|
||||
{
|
||||
DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
|
||||
|
||||
BigDecimal total = new BigDecimal(0.0);
|
||||
int rows = dialog.getMiniTable().getRowCount();
|
||||
int count = 0;
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
if (((Boolean)dialog.getMiniTable().getValueAt(i, 0)).booleanValue())
|
||||
{
|
||||
total = total.add((BigDecimal)dialog.getMiniTable().getValueAt(i, 4));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
dialog.setStatusLine(count, Msg.getMsg(Env.getCtx(), "Sum") + " " + format.format(total));
|
||||
} // infoStatement
|
||||
|
||||
public void showWindow()
|
||||
{
|
||||
dialog.setVisible(true);
|
||||
|
|
|
@ -2386,10 +2386,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
} // DocAction
|
||||
|
||||
// Pop up Create From
|
||||
|
||||
else if (col.equals("CreateFrom"))
|
||||
else if (col.equals("CreateFrom") || col.equals("X_CreateFromBatch"))
|
||||
{
|
||||
ICreateFrom cf = WCreateFromFactory.create(adtabPanel.getGridTab());
|
||||
ICreateFrom cf = WCreateFromFactory.create(adtabPanel.getGridTab(), col);
|
||||
|
||||
if(cf != null)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,27 +21,41 @@ import org.compiere.model.I_C_Invoice;
|
|||
import org.compiere.model.I_M_InOut;
|
||||
import org.compiere.model.I_M_PackageMPS;
|
||||
import org.compiere.model.I_M_RMA;
|
||||
import org.compiere.model.I_X_DepositBatch;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Elaine
|
||||
*
|
||||
*/
|
||||
public class DefaultCreateFromFactory implements ICreateFromFactory {
|
||||
public class DefaultCreateFromFactory implements ICreateFromFactory
|
||||
{
|
||||
|
||||
@Override
|
||||
public ICreateFrom create(GridTab mTab) {
|
||||
public ICreateFrom create(GridTab mTab, String columnName)
|
||||
{
|
||||
String tableName = mTab.getTableName();
|
||||
if (columnName.equals("CreateFrom"))
|
||||
{
|
||||
if (tableName.equals(I_C_Invoice.Table_Name))
|
||||
return new WCreateFromInvoiceUI(mTab);
|
||||
else if (tableName.equals(I_C_BankStatement.Table_Name))
|
||||
return new WCreateFromStatementUI(mTab);
|
||||
// return new WCreateFromStatementUI(mTab);
|
||||
return new WCreateFromStatementBatchUI(mTab);
|
||||
else if (tableName.equals(I_M_InOut.Table_Name))
|
||||
return new WCreateFromShipmentUI(mTab);
|
||||
else if (tableName.equals(I_M_RMA.Table_Name))
|
||||
return new WCreateFromRMAUI(mTab);
|
||||
else if (tableName.equals(I_M_PackageMPS.Table_Name))
|
||||
return new WCreateFromPackageShipmentUI(mTab);
|
||||
else if (tableName.equals(I_X_DepositBatch.Table_Name))
|
||||
return new WCreateFromDepositBatchUI(mTab);
|
||||
}
|
||||
else if (columnName.equalsIgnoreCase("X_CreateFromBatch"))
|
||||
{
|
||||
if (tableName.equals(I_C_BankStatement.Table_Name))
|
||||
return new WCreateFromBatchStatementUI(mTab);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,310 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2013 Elaine Tan *
|
||||
* Copyright (C) 2013 Trek Global
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.webui.apps.form;
|
||||
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.Column;
|
||||
import org.adempiere.webui.component.Columns;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.Grid;
|
||||
import org.adempiere.webui.component.GridFactory;
|
||||
import org.adempiere.webui.component.Label;
|
||||
import org.adempiere.webui.component.ListModelTable;
|
||||
import org.adempiere.webui.component.Panel;
|
||||
import org.adempiere.webui.component.Row;
|
||||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.editor.WDateEditor;
|
||||
import org.adempiere.webui.editor.WEditor;
|
||||
import org.adempiere.webui.editor.WNumberEditor;
|
||||
import org.adempiere.webui.editor.WSearchEditor;
|
||||
import org.adempiere.webui.editor.WStringEditor;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.compiere.grid.CreateFromBatchStatement;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MBankStatement;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MPayment;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Borderlayout;
|
||||
import org.zkoss.zul.Center;
|
||||
import org.zkoss.zul.Hbox;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Elaine
|
||||
*
|
||||
*/
|
||||
public class WCreateFromBatchStatementUI extends CreateFromBatchStatement implements EventListener<Event>
|
||||
{
|
||||
private WCreateFromWindow window;
|
||||
|
||||
public WCreateFromBatchStatementUI(GridTab tab)
|
||||
{
|
||||
super(tab);
|
||||
log.info(getGridTab().toString());
|
||||
|
||||
window = new WCreateFromWindow(this, getGridTab().getWindowNo());
|
||||
|
||||
p_WindowNo = getGridTab().getWindowNo();
|
||||
|
||||
try
|
||||
{
|
||||
if (!dynInit())
|
||||
return;
|
||||
zkInit();
|
||||
setInitOK(true);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "", e);
|
||||
setInitOK(false);
|
||||
}
|
||||
AEnv.showWindow(window);
|
||||
}
|
||||
|
||||
/** Window No */
|
||||
private int p_WindowNo;
|
||||
|
||||
/** Logger */
|
||||
private CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
protected Label bankAccountLabel = new Label();
|
||||
protected WTableDirEditor bankAccountField;
|
||||
|
||||
protected Label documentNoLabel = new Label(Msg.translate(Env.getCtx(), "DocumentNo"));
|
||||
protected WStringEditor documentNoField = new WStringEditor();
|
||||
|
||||
protected Label documentTypeLabel = new Label();
|
||||
protected WTableDirEditor documentTypeField;
|
||||
|
||||
protected Label authorizationLabel = new Label();
|
||||
protected WStringEditor authorizationField = new WStringEditor();
|
||||
|
||||
protected Label tenderTypeLabel = new Label();
|
||||
protected WTableDirEditor tenderTypeField;
|
||||
|
||||
protected Label amtFromLabel = new Label(Msg.translate(Env.getCtx(), "PayAmt"));
|
||||
protected WNumberEditor amtFromField = new WNumberEditor("AmtFrom", false, false, true, DisplayType.Amount, Msg.translate(Env.getCtx(), "AmtFrom"));
|
||||
protected Label amtToLabel = new Label("-");
|
||||
protected WNumberEditor amtToField = new WNumberEditor("AmtTo", false, false, true, DisplayType.Amount, Msg.translate(Env.getCtx(), "AmtTo"));
|
||||
|
||||
protected Label BPartner_idLabel = new Label(Msg.translate(Env.getCtx(), "BPartner"));
|
||||
protected WEditor bPartnerLookup;
|
||||
|
||||
protected Label dateFromLabel = new Label(Msg.translate(Env.getCtx(), "DateTrx"));
|
||||
protected WDateEditor dateFromField = new WDateEditor("DateFrom", false, false, true, Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
protected Label dateToLabel = new Label("-");
|
||||
protected WDateEditor dateToField = new WDateEditor("DateTo", false, false, true, Msg.translate(Env.getCtx(), "DateTo"));
|
||||
|
||||
/**
|
||||
* Dynamic Init
|
||||
* @throws Exception if Lookups cannot be initialized
|
||||
* @return true if initialized
|
||||
*/
|
||||
public boolean dynInit() throws Exception
|
||||
{
|
||||
log.config("");
|
||||
|
||||
super.dynInit();
|
||||
|
||||
//Refresh button
|
||||
Button refreshButton = window.getConfirmPanel().createButton(ConfirmPanel.A_REFRESH);
|
||||
refreshButton.addEventListener(Events.ON_CLICK, this);
|
||||
window.getConfirmPanel().addButton(refreshButton);
|
||||
|
||||
if (getGridTab().getValue("C_BankStatement_ID") == null)
|
||||
{
|
||||
FDialog.error(0, window, "SaveErrorRowNotFound");
|
||||
return false;
|
||||
}
|
||||
|
||||
window.setTitle(getTitle());
|
||||
|
||||
int AD_Column_ID = COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID; // C_BankStatement.C_BankAccount_ID
|
||||
MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir);
|
||||
bankAccountField = new WTableDirEditor ("C_BankAccount_ID", true, false, true, lookup);
|
||||
// Set Default
|
||||
int C_BankAccount_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "C_BankAccount_ID");
|
||||
bankAccountField.setValue(new Integer(C_BankAccount_ID));
|
||||
// initial Loading
|
||||
authorizationField = new WStringEditor ("authorization", false, false, true, 10, 30, null, null);
|
||||
authorizationField.getComponent().addEventListener(Events.ON_CHANGE, this);
|
||||
|
||||
lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_C_DocType_ID), DisplayType.TableDir);
|
||||
documentTypeField = new WTableDirEditor (MPayment.COLUMNNAME_C_DocType_ID,false,false,true,lookup);
|
||||
documentTypeField.getComponent().addEventListener(Events.ON_CHANGE, this);
|
||||
|
||||
lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_TenderType), DisplayType.List);
|
||||
tenderTypeField = new WTableDirEditor (MPayment.COLUMNNAME_TenderType,false,false,true,lookup);
|
||||
tenderTypeField.getComponent().addEventListener(Events.ON_CHANGE, this);
|
||||
|
||||
lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search);
|
||||
bPartnerLookup = new WSearchEditor ("C_BPartner_ID", false, false, true, lookup);
|
||||
|
||||
Timestamp date = Env.getContextAsDate(Env.getCtx(), p_WindowNo, MBankStatement.COLUMNNAME_StatementDate);
|
||||
dateToField.setValue(date);
|
||||
|
||||
loadBankAccount();
|
||||
|
||||
return true;
|
||||
} // dynInit
|
||||
|
||||
protected void zkInit() throws Exception
|
||||
{
|
||||
bankAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID"));
|
||||
authorizationLabel.setText(Msg.translate(Env.getCtx(), "R_AuthCode"));
|
||||
|
||||
documentTypeLabel.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
|
||||
tenderTypeLabel.setText(Msg.translate(Env.getCtx(), "TenderType"));
|
||||
|
||||
dateFromField.getComponent().setTooltiptext(Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
dateToField.getComponent().setTooltiptext(Msg.translate(Env.getCtx(), "DateTo"));
|
||||
|
||||
amtFromField.getComponent().setTooltiptext(Msg.translate(Env.getCtx(), "AmtFrom"));
|
||||
amtToField.getComponent().setTooltiptext(Msg.translate(Env.getCtx(), "AmtTo"));
|
||||
|
||||
Borderlayout parameterLayout = new Borderlayout();
|
||||
parameterLayout.setHeight("130px");
|
||||
parameterLayout.setWidth("100%");
|
||||
Panel parameterPanel = window.getParameterPanel();
|
||||
parameterPanel.appendChild(parameterLayout);
|
||||
|
||||
Grid parameterBankLayout = GridFactory.newGridLayout();
|
||||
Panel parameterBankPanel = new Panel();
|
||||
parameterBankPanel.appendChild(parameterBankLayout);
|
||||
|
||||
Center center = new Center();
|
||||
parameterLayout.appendChild(center);
|
||||
center.appendChild(parameterBankPanel);
|
||||
|
||||
Columns columns = new Columns();
|
||||
parameterBankLayout.appendChild(columns);
|
||||
Column column = new Column();
|
||||
columns.appendChild(column);
|
||||
column = new Column();
|
||||
column.setWidth("15%");
|
||||
columns.appendChild(column);
|
||||
column.setWidth("35%");
|
||||
column = new Column();
|
||||
column.setWidth("15%");
|
||||
columns.appendChild(column);
|
||||
column = new Column();
|
||||
column.setWidth("35%");
|
||||
columns.appendChild(column);
|
||||
|
||||
Rows rows = (Rows) parameterBankLayout.newRows();
|
||||
Row row = rows.newRow();
|
||||
row.appendChild(bankAccountLabel.rightAlign());
|
||||
row.appendChild(bankAccountField.getComponent());
|
||||
row.appendChild(documentNoLabel.rightAlign());
|
||||
row.appendChild(documentNoField.getComponent());
|
||||
|
||||
row = rows.newRow();
|
||||
row.appendChild(documentTypeLabel.rightAlign());
|
||||
row.appendChild(documentTypeField.getComponent());
|
||||
row.appendChild(authorizationLabel.rightAlign());
|
||||
row.appendChild(authorizationField.getComponent());
|
||||
|
||||
row = rows.newRow();
|
||||
row.appendChild(tenderTypeLabel.rightAlign());
|
||||
row.appendChild(tenderTypeField.getComponent());
|
||||
|
||||
row.appendChild(amtFromLabel.rightAlign());
|
||||
Hbox hbox = new Hbox();
|
||||
hbox.appendChild(amtFromField.getComponent());
|
||||
hbox.appendChild(amtToLabel.rightAlign());
|
||||
hbox.appendChild(amtToField.getComponent());
|
||||
row.appendChild(hbox);
|
||||
|
||||
row = rows.newRow();
|
||||
row.appendChild(BPartner_idLabel.rightAlign());
|
||||
row.appendChild(bPartnerLookup.getComponent());
|
||||
row.appendChild(dateFromLabel.rightAlign());
|
||||
|
||||
hbox = new Hbox();
|
||||
hbox.appendChild(dateFromField.getComponent());
|
||||
hbox.appendChild(dateToLabel.rightAlign());
|
||||
hbox.appendChild(dateToField.getComponent());
|
||||
row.appendChild(hbox);
|
||||
}
|
||||
|
||||
/**
|
||||
* Action Listener
|
||||
* @param e event
|
||||
* @throws Exception
|
||||
*/
|
||||
public void onEvent(Event e) throws Exception
|
||||
{
|
||||
log.config("Action=" + e.getTarget().getId());
|
||||
if(e.getTarget().equals(window.getConfirmPanel().getButton(ConfirmPanel.A_REFRESH)))
|
||||
{
|
||||
loadBankAccount();
|
||||
window.tableChanged(null);
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadBankAccount()
|
||||
{
|
||||
loadTableOIS(getBankAccountData(bankAccountField.getValue(), bPartnerLookup.getValue(),
|
||||
documentNoField.getValue().toString(), dateFromField.getValue(), dateToField.getValue(),
|
||||
amtFromField.getValue(), amtToField.getValue(),
|
||||
documentTypeField.getValue(), tenderTypeField.getValue(), authorizationField.getValue().toString()));
|
||||
}
|
||||
|
||||
protected void loadTableOIS (Vector<?> data)
|
||||
{
|
||||
window.getWListbox().clear();
|
||||
|
||||
// Remove previous listeners
|
||||
window.getWListbox().getModel().removeTableModelListener(window);
|
||||
// Set Model
|
||||
ListModelTable model = new ListModelTable(data);
|
||||
model.addTableModelListener(window);
|
||||
window.getWListbox().setData(model, getOISColumnNames());
|
||||
//
|
||||
|
||||
configureMiniTable(window.getWListbox());
|
||||
}
|
||||
|
||||
public void showWindow()
|
||||
{
|
||||
window.setVisible(true);
|
||||
}
|
||||
|
||||
public void closeWindow()
|
||||
{
|
||||
window.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getWindow() {
|
||||
return window;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,312 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2013 Elaine Tan *
|
||||
* Copyright (C) 2013 Trek Global
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.webui.apps.form;
|
||||
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.Column;
|
||||
import org.adempiere.webui.component.Columns;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.Grid;
|
||||
import org.adempiere.webui.component.GridFactory;
|
||||
import org.adempiere.webui.component.Label;
|
||||
import org.adempiere.webui.component.ListModelTable;
|
||||
import org.adempiere.webui.component.Panel;
|
||||
import org.adempiere.webui.component.Row;
|
||||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.editor.WDateEditor;
|
||||
import org.adempiere.webui.editor.WEditor;
|
||||
import org.adempiere.webui.editor.WNumberEditor;
|
||||
import org.adempiere.webui.editor.WSearchEditor;
|
||||
import org.adempiere.webui.editor.WStringEditor;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.compiere.grid.CreateFromDepositBatch;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MBankStatement;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MPayment;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Borderlayout;
|
||||
import org.zkoss.zul.Center;
|
||||
import org.zkoss.zul.Hbox;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Elaine
|
||||
*
|
||||
*/
|
||||
public class WCreateFromDepositBatchUI extends CreateFromDepositBatch implements EventListener<Event>
|
||||
{
|
||||
private WCreateFromWindow window;
|
||||
|
||||
public WCreateFromDepositBatchUI(GridTab tab)
|
||||
{
|
||||
super(tab);
|
||||
log.info(getGridTab().toString());
|
||||
|
||||
window = new WCreateFromWindow(this, getGridTab().getWindowNo());
|
||||
|
||||
p_WindowNo = getGridTab().getWindowNo();
|
||||
|
||||
try
|
||||
{
|
||||
if (!dynInit())
|
||||
return;
|
||||
zkInit();
|
||||
setInitOK(true);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "", e);
|
||||
setInitOK(false);
|
||||
}
|
||||
AEnv.showWindow(window);
|
||||
}
|
||||
|
||||
/** Window No */
|
||||
private int p_WindowNo;
|
||||
|
||||
/** Logger */
|
||||
private CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
protected Label bankAccountLabel = new Label();
|
||||
protected WTableDirEditor bankAccountField;
|
||||
|
||||
protected Label documentNoLabel = new Label(Msg.translate(Env.getCtx(), "DocumentNo"));
|
||||
protected WStringEditor documentNoField = new WStringEditor();
|
||||
|
||||
protected Label documentTypeLabel = new Label();
|
||||
protected WTableDirEditor documentTypeField;
|
||||
|
||||
protected Label authorizationLabel = new Label();
|
||||
protected WStringEditor authorizationField = new WStringEditor();
|
||||
|
||||
protected Label tenderTypeLabel = new Label();
|
||||
protected WTableDirEditor tenderTypeField;
|
||||
|
||||
protected Label amtFromLabel = new Label(Msg.translate(Env.getCtx(), "PayAmt"));
|
||||
protected WNumberEditor amtFromField = new WNumberEditor("AmtFrom", false, false, true, DisplayType.Amount, Msg.translate(Env.getCtx(), "AmtFrom"));
|
||||
protected Label amtToLabel = new Label("-");
|
||||
protected WNumberEditor amtToField = new WNumberEditor("AmtTo", false, false, true, DisplayType.Amount, Msg.translate(Env.getCtx(), "AmtTo"));
|
||||
|
||||
protected Label BPartner_idLabel = new Label(Msg.translate(Env.getCtx(), "BPartner"));
|
||||
protected WEditor bPartnerLookup;
|
||||
|
||||
protected Label dateFromLabel = new Label(Msg.translate(Env.getCtx(), "DateTrx"));
|
||||
protected WDateEditor dateFromField = new WDateEditor("DateFrom", false, false, true, Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
protected Label dateToLabel = new Label("-");
|
||||
protected WDateEditor dateToField = new WDateEditor("DateTo", false, false, true, Msg.translate(Env.getCtx(), "DateTo"));
|
||||
|
||||
/**
|
||||
* Dynamic Init
|
||||
* @throws Exception if Lookups cannot be initialized
|
||||
* @return true if initialized
|
||||
*/
|
||||
public boolean dynInit() throws Exception
|
||||
{
|
||||
log.config("");
|
||||
|
||||
super.dynInit();
|
||||
|
||||
//Refresh button
|
||||
Button refreshButton = window.getConfirmPanel().createButton(ConfirmPanel.A_REFRESH);
|
||||
refreshButton.addEventListener(Events.ON_CLICK, this);
|
||||
window.getConfirmPanel().addButton(refreshButton);
|
||||
|
||||
if (getGridTab().getValue("X_DepositBatch_ID") == null)
|
||||
{
|
||||
FDialog.error(0, window, "SaveErrorRowNotFound");
|
||||
return false;
|
||||
}
|
||||
|
||||
window.setTitle(getTitle());
|
||||
|
||||
int AD_Column_ID = COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID; // C_BankStatement.C_BankAccount_ID
|
||||
MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir);
|
||||
bankAccountField = new WTableDirEditor ("C_BankAccount_ID", true, false, true, lookup);
|
||||
// Set Default
|
||||
int C_BankAccount_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "C_BankAccount_ID");
|
||||
bankAccountField.setValue(new Integer(C_BankAccount_ID));
|
||||
// initial Loading
|
||||
authorizationField = new WStringEditor ("authorization", false, false, true, 10, 30, null, null);
|
||||
// authorizationField.getComponent().addEventListener(Events.ON_CHANGE, this);
|
||||
|
||||
lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_C_DocType_ID), DisplayType.TableDir);
|
||||
documentTypeField = new WTableDirEditor (MPayment.COLUMNNAME_C_DocType_ID,false,false,true,lookup);
|
||||
int C_DocType_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "C_DocType_ID");
|
||||
documentTypeField.setValue(new Integer(C_DocType_ID));
|
||||
// documentTypeField.getComponent().addEventListener(Events.ON_CHANGE, this);
|
||||
|
||||
lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_TenderType), DisplayType.List);
|
||||
tenderTypeField = new WTableDirEditor (MPayment.COLUMNNAME_TenderType,false,false,true,lookup);
|
||||
// tenderTypeField.getComponent().addEventListener(Events.ON_CHANGE, this);
|
||||
|
||||
lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search);
|
||||
bPartnerLookup = new WSearchEditor ("C_BPartner_ID", false, false, true, lookup);
|
||||
|
||||
Timestamp date = Env.getContextAsDate(Env.getCtx(), p_WindowNo, MBankStatement.COLUMNNAME_StatementDate);
|
||||
dateToField.setValue(date);
|
||||
|
||||
loadBankAccount();
|
||||
|
||||
return true;
|
||||
} // dynInit
|
||||
|
||||
protected void zkInit() throws Exception
|
||||
{
|
||||
bankAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID"));
|
||||
authorizationLabel.setText(Msg.translate(Env.getCtx(), "R_AuthCode"));
|
||||
|
||||
documentTypeLabel.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
|
||||
tenderTypeLabel.setText(Msg.translate(Env.getCtx(), "TenderType"));
|
||||
|
||||
dateFromField.getComponent().setTooltiptext(Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
dateToField.getComponent().setTooltiptext(Msg.translate(Env.getCtx(), "DateTo"));
|
||||
|
||||
amtFromField.getComponent().setTooltiptext(Msg.translate(Env.getCtx(), "AmtFrom"));
|
||||
amtToField.getComponent().setTooltiptext(Msg.translate(Env.getCtx(), "AmtTo"));
|
||||
|
||||
Borderlayout parameterLayout = new Borderlayout();
|
||||
parameterLayout.setHeight("130px");
|
||||
parameterLayout.setWidth("100%");
|
||||
Panel parameterPanel = window.getParameterPanel();
|
||||
parameterPanel.appendChild(parameterLayout);
|
||||
|
||||
Grid parameterBankLayout = GridFactory.newGridLayout();
|
||||
Panel parameterBankPanel = new Panel();
|
||||
parameterBankPanel.appendChild(parameterBankLayout);
|
||||
|
||||
Center center = new Center();
|
||||
parameterLayout.appendChild(center);
|
||||
center.appendChild(parameterBankPanel);
|
||||
|
||||
Columns columns = new Columns();
|
||||
parameterBankLayout.appendChild(columns);
|
||||
Column column = new Column();
|
||||
columns.appendChild(column);
|
||||
column = new Column();
|
||||
column.setWidth("15%");
|
||||
columns.appendChild(column);
|
||||
column.setWidth("35%");
|
||||
column = new Column();
|
||||
column.setWidth("15%");
|
||||
columns.appendChild(column);
|
||||
column = new Column();
|
||||
column.setWidth("35%");
|
||||
columns.appendChild(column);
|
||||
|
||||
Rows rows = (Rows) parameterBankLayout.newRows();
|
||||
Row row = rows.newRow();
|
||||
row.appendChild(bankAccountLabel.rightAlign());
|
||||
row.appendChild(bankAccountField.getComponent());
|
||||
row.appendChild(documentNoLabel.rightAlign());
|
||||
row.appendChild(documentNoField.getComponent());
|
||||
|
||||
row = rows.newRow();
|
||||
row.appendChild(documentTypeLabel.rightAlign());
|
||||
row.appendChild(documentTypeField.getComponent());
|
||||
row.appendChild(authorizationLabel.rightAlign());
|
||||
row.appendChild(authorizationField.getComponent());
|
||||
|
||||
row = rows.newRow();
|
||||
row.appendChild(tenderTypeLabel.rightAlign());
|
||||
row.appendChild(tenderTypeField.getComponent());
|
||||
|
||||
row.appendChild(amtFromLabel.rightAlign());
|
||||
Hbox hbox = new Hbox();
|
||||
hbox.appendChild(amtFromField.getComponent());
|
||||
hbox.appendChild(amtToLabel.rightAlign());
|
||||
hbox.appendChild(amtToField.getComponent());
|
||||
row.appendChild(hbox);
|
||||
|
||||
row = rows.newRow();
|
||||
row.appendChild(BPartner_idLabel.rightAlign());
|
||||
row.appendChild(bPartnerLookup.getComponent());
|
||||
row.appendChild(dateFromLabel.rightAlign());
|
||||
|
||||
hbox = new Hbox();
|
||||
hbox.appendChild(dateFromField.getComponent());
|
||||
hbox.appendChild(dateToLabel.rightAlign());
|
||||
hbox.appendChild(dateToField.getComponent());
|
||||
row.appendChild(hbox);
|
||||
}
|
||||
|
||||
/**
|
||||
* Action Listener
|
||||
* @param e event
|
||||
* @throws Exception
|
||||
*/
|
||||
public void onEvent(Event e) throws Exception
|
||||
{
|
||||
log.config("Action=" + e.getTarget().getId());
|
||||
if(e.getTarget().equals(window.getConfirmPanel().getButton(ConfirmPanel.A_REFRESH)))
|
||||
{
|
||||
loadBankAccount();
|
||||
window.tableChanged(null);
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadBankAccount()
|
||||
{
|
||||
loadTableOIS(getBankAccountData(bankAccountField.getValue(), bPartnerLookup.getValue(),
|
||||
documentNoField.getValue().toString(), dateFromField.getValue(), dateToField.getValue(),
|
||||
amtFromField.getValue(), amtToField.getValue(),
|
||||
documentTypeField.getValue(), tenderTypeField.getValue(), authorizationField.getValue().toString()));
|
||||
}
|
||||
|
||||
protected void loadTableOIS (Vector<?> data)
|
||||
{
|
||||
window.getWListbox().clear();
|
||||
|
||||
// Remove previous listeners
|
||||
window.getWListbox().getModel().removeTableModelListener(window);
|
||||
// Set Model
|
||||
ListModelTable model = new ListModelTable(data);
|
||||
model.addTableModelListener(window);
|
||||
window.getWListbox().setData(model, getOISColumnNames());
|
||||
//
|
||||
|
||||
configureMiniTable(window.getWListbox());
|
||||
}
|
||||
|
||||
public void showWindow()
|
||||
{
|
||||
window.setVisible(true);
|
||||
}
|
||||
|
||||
public void closeWindow()
|
||||
{
|
||||
window.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getWindow() {
|
||||
return window;
|
||||
}
|
||||
}
|
|
@ -22,13 +22,13 @@ import org.compiere.model.GridTab;
|
|||
|
||||
public class WCreateFromFactory
|
||||
{
|
||||
public static ICreateFrom create (GridTab mTab)
|
||||
public static ICreateFrom create (GridTab mTab, String columnName)
|
||||
{
|
||||
ICreateFrom createFrom = null;
|
||||
List<ICreateFromFactory> factories = Service.locator().list(ICreateFromFactory.class).getServices();
|
||||
for (ICreateFromFactory factory : factories)
|
||||
{
|
||||
createFrom = factory.create(mTab);
|
||||
createFrom = factory.create(mTab, columnName);
|
||||
if (createFrom != null)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,311 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2013 Elaine Tan *
|
||||
* Copyright (C) 2013 Trek Global
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.webui.apps.form;
|
||||
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.Column;
|
||||
import org.adempiere.webui.component.Columns;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.Grid;
|
||||
import org.adempiere.webui.component.GridFactory;
|
||||
import org.adempiere.webui.component.Label;
|
||||
import org.adempiere.webui.component.ListModelTable;
|
||||
import org.adempiere.webui.component.Panel;
|
||||
import org.adempiere.webui.component.Row;
|
||||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.editor.WDateEditor;
|
||||
import org.adempiere.webui.editor.WEditor;
|
||||
import org.adempiere.webui.editor.WNumberEditor;
|
||||
import org.adempiere.webui.editor.WSearchEditor;
|
||||
import org.adempiere.webui.editor.WStringEditor;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.compiere.grid.CreateFromStatementBatch;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MBankStatement;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MPayment;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Borderlayout;
|
||||
import org.zkoss.zul.Center;
|
||||
import org.zkoss.zul.Hbox;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Elaine
|
||||
*
|
||||
*/
|
||||
public class WCreateFromStatementBatchUI extends CreateFromStatementBatch implements EventListener<Event>
|
||||
{
|
||||
private WCreateFromWindow window;
|
||||
|
||||
public WCreateFromStatementBatchUI(GridTab tab)
|
||||
{
|
||||
super(tab);
|
||||
log.info(getGridTab().toString());
|
||||
|
||||
window = new WCreateFromWindow(this, getGridTab().getWindowNo());
|
||||
|
||||
p_WindowNo = getGridTab().getWindowNo();
|
||||
|
||||
try
|
||||
{
|
||||
if (!dynInit())
|
||||
return;
|
||||
zkInit();
|
||||
setInitOK(true);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "", e);
|
||||
setInitOK(false);
|
||||
}
|
||||
AEnv.showWindow(window);
|
||||
}
|
||||
|
||||
/** Window No */
|
||||
private int p_WindowNo;
|
||||
|
||||
/** Logger */
|
||||
private CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
protected Label bankAccountLabel = new Label();
|
||||
protected WTableDirEditor bankAccountField;
|
||||
|
||||
protected Label documentNoLabel = new Label(Msg.translate(Env.getCtx(), "DocumentNo"));
|
||||
protected WStringEditor documentNoField = new WStringEditor();
|
||||
|
||||
protected Label documentTypeLabel = new Label();
|
||||
protected WTableDirEditor documentTypeField;
|
||||
|
||||
protected Label authorizationLabel = new Label();
|
||||
protected WStringEditor authorizationField = new WStringEditor();
|
||||
|
||||
protected Label tenderTypeLabel = new Label();
|
||||
protected WTableDirEditor tenderTypeField;
|
||||
|
||||
protected Label amtFromLabel = new Label(Msg.translate(Env.getCtx(), "PayAmt"));
|
||||
protected WNumberEditor amtFromField = new WNumberEditor("AmtFrom", false, false, true, DisplayType.Amount, Msg.translate(Env.getCtx(), "AmtFrom"));
|
||||
protected Label amtToLabel = new Label("-");
|
||||
protected WNumberEditor amtToField = new WNumberEditor("AmtTo", false, false, true, DisplayType.Amount, Msg.translate(Env.getCtx(), "AmtTo"));
|
||||
|
||||
protected Label BPartner_idLabel = new Label(Msg.translate(Env.getCtx(), "BPartner"));
|
||||
protected WEditor bPartnerLookup;
|
||||
|
||||
protected Label dateFromLabel = new Label(Msg.translate(Env.getCtx(), "DateTrx"));
|
||||
protected WDateEditor dateFromField = new WDateEditor("DateFrom", false, false, true, Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
protected Label dateToLabel = new Label("-");
|
||||
protected WDateEditor dateToField = new WDateEditor("DateTo", false, false, true, Msg.translate(Env.getCtx(), "DateTo"));
|
||||
|
||||
/**
|
||||
* Dynamic Init
|
||||
* @throws Exception if Lookups cannot be initialized
|
||||
* @return true if initialized
|
||||
*/
|
||||
public boolean dynInit() throws Exception
|
||||
{
|
||||
log.config("");
|
||||
|
||||
super.dynInit();
|
||||
|
||||
//Refresh button
|
||||
Button refreshButton = window.getConfirmPanel().createButton(ConfirmPanel.A_REFRESH);
|
||||
refreshButton.addEventListener(Events.ON_CLICK, this);
|
||||
window.getConfirmPanel().addButton(refreshButton);
|
||||
|
||||
if (getGridTab().getValue("C_BankStatement_ID") == null)
|
||||
{
|
||||
FDialog.error(0, window, "SaveErrorRowNotFound");
|
||||
return false;
|
||||
}
|
||||
|
||||
window.setTitle(getTitle());
|
||||
|
||||
int AD_Column_ID = COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID; // C_BankStatement.C_BankAccount_ID
|
||||
MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir);
|
||||
bankAccountField = new WTableDirEditor ("C_BankAccount_ID", true, false, true, lookup);
|
||||
// Set Default
|
||||
int C_BankAccount_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "C_BankAccount_ID");
|
||||
bankAccountField.setValue(new Integer(C_BankAccount_ID));
|
||||
// initial Loading
|
||||
authorizationField = new WStringEditor ("authorization", false, false, true, 10, 30, null, null);
|
||||
authorizationField.getComponent().addEventListener(Events.ON_CHANGE, this);
|
||||
|
||||
lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_C_DocType_ID), DisplayType.TableDir);
|
||||
documentTypeField = new WTableDirEditor (MPayment.COLUMNNAME_C_DocType_ID,false,false,true,lookup);
|
||||
documentTypeField.getComponent().addEventListener(Events.ON_CHANGE, this);
|
||||
|
||||
lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_TenderType), DisplayType.List);
|
||||
tenderTypeField = new WTableDirEditor (MPayment.COLUMNNAME_TenderType,false,false,true,lookup);
|
||||
tenderTypeField.getComponent().addEventListener(Events.ON_CHANGE, this);
|
||||
|
||||
lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search);
|
||||
bPartnerLookup = new WSearchEditor ("C_BPartner_ID", false, false, true, lookup);
|
||||
|
||||
Timestamp date = Env.getContextAsDate(Env.getCtx(), p_WindowNo, MBankStatement.COLUMNNAME_StatementDate);
|
||||
dateToField.setValue(date);
|
||||
|
||||
loadBankAccount();
|
||||
|
||||
return true;
|
||||
} // dynInit
|
||||
|
||||
protected void zkInit() throws Exception
|
||||
{
|
||||
bankAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID"));
|
||||
authorizationLabel.setText(Msg.translate(Env.getCtx(), "R_AuthCode"));
|
||||
|
||||
documentTypeLabel.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
|
||||
tenderTypeLabel.setText(Msg.translate(Env.getCtx(), "TenderType"));
|
||||
|
||||
dateFromField.getComponent().setTooltiptext(Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
dateToField.getComponent().setTooltiptext(Msg.translate(Env.getCtx(), "DateTo"));
|
||||
|
||||
amtFromField.getComponent().setTooltiptext(Msg.translate(Env.getCtx(), "AmtFrom"));
|
||||
amtToField.getComponent().setTooltiptext(Msg.translate(Env.getCtx(), "AmtTo"));
|
||||
|
||||
Borderlayout parameterLayout = new Borderlayout();
|
||||
parameterLayout.setHeight("130px");
|
||||
parameterLayout.setWidth("100%");
|
||||
Panel parameterPanel = window.getParameterPanel();
|
||||
parameterPanel.appendChild(parameterLayout);
|
||||
|
||||
Grid parameterBankLayout = GridFactory.newGridLayout();
|
||||
Panel parameterBankPanel = new Panel();
|
||||
parameterBankPanel.appendChild(parameterBankLayout);
|
||||
|
||||
Center center = new Center();
|
||||
parameterLayout.appendChild(center);
|
||||
center.appendChild(parameterBankPanel);
|
||||
|
||||
Columns columns = new Columns();
|
||||
parameterBankLayout.appendChild(columns);
|
||||
Column column = new Column();
|
||||
columns.appendChild(column);
|
||||
column = new Column();
|
||||
column.setWidth("15%");
|
||||
columns.appendChild(column);
|
||||
column.setWidth("35%");
|
||||
column = new Column();
|
||||
column.setWidth("15%");
|
||||
columns.appendChild(column);
|
||||
column = new Column();
|
||||
column.setWidth("35%");
|
||||
columns.appendChild(column);
|
||||
|
||||
Rows rows = (Rows) parameterBankLayout.newRows();
|
||||
Row row = rows.newRow();
|
||||
row.appendChild(bankAccountLabel.rightAlign());
|
||||
row.appendChild(bankAccountField.getComponent());
|
||||
row.appendChild(documentNoLabel.rightAlign());
|
||||
row.appendChild(documentNoField.getComponent());
|
||||
|
||||
row = rows.newRow();
|
||||
row.appendChild(documentTypeLabel.rightAlign());
|
||||
row.appendChild(documentTypeField.getComponent());
|
||||
row.appendChild(authorizationLabel.rightAlign());
|
||||
row.appendChild(authorizationField.getComponent());
|
||||
|
||||
row = rows.newRow();
|
||||
row.appendChild(tenderTypeLabel.rightAlign());
|
||||
row.appendChild(tenderTypeField.getComponent());
|
||||
|
||||
row.appendChild(amtFromLabel.rightAlign());
|
||||
Hbox hbox = new Hbox();
|
||||
hbox.appendChild(amtFromField.getComponent());
|
||||
hbox.appendChild(amtToLabel.rightAlign());
|
||||
hbox.appendChild(amtToField.getComponent());
|
||||
row.appendChild(hbox);
|
||||
|
||||
row = rows.newRow();
|
||||
row.appendChild(BPartner_idLabel.rightAlign());
|
||||
row.appendChild(bPartnerLookup.getComponent());
|
||||
row.appendChild(dateFromLabel.rightAlign());
|
||||
|
||||
hbox = new Hbox();
|
||||
hbox.appendChild(dateFromField.getComponent());
|
||||
hbox.appendChild(dateToLabel.rightAlign());
|
||||
hbox.appendChild(dateToField.getComponent());
|
||||
row.appendChild(hbox);
|
||||
}
|
||||
|
||||
/**
|
||||
* Action Listener
|
||||
* @param e event
|
||||
* @throws Exception
|
||||
*/
|
||||
public void onEvent(Event e) throws Exception
|
||||
{
|
||||
log.config("Action=" + e.getTarget().getId());
|
||||
if(e.getTarget().equals(window.getConfirmPanel().getButton(ConfirmPanel.A_REFRESH)))
|
||||
{
|
||||
loadBankAccount();
|
||||
window.tableChanged(null);
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadBankAccount()
|
||||
{
|
||||
loadTableOIS(getBankAccountData(bankAccountField.getValue(), bPartnerLookup.getValue(),
|
||||
documentNoField.getValue().toString(), dateFromField.getValue(), dateToField.getValue(),
|
||||
amtFromField.getValue(), amtToField.getValue(),
|
||||
documentTypeField.getValue(), tenderTypeField.getValue(), authorizationField.getValue().toString()));
|
||||
}
|
||||
|
||||
protected void loadTableOIS (Vector<?> data)
|
||||
{
|
||||
window.getWListbox().clear();
|
||||
|
||||
// Remove previous listeners
|
||||
window.getWListbox().getModel().removeTableModelListener(window);
|
||||
// Set Model
|
||||
ListModelTable model = new ListModelTable(data);
|
||||
model.addTableModelListener(window);
|
||||
window.getWListbox().setData(model, getOISColumnNames());
|
||||
//
|
||||
|
||||
configureMiniTable(window.getWListbox());
|
||||
}
|
||||
|
||||
public void showWindow()
|
||||
{
|
||||
window.setVisible(true);
|
||||
}
|
||||
|
||||
public void closeWindow()
|
||||
{
|
||||
window.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getWindow()
|
||||
{
|
||||
return window;
|
||||
}
|
||||
}
|
|
@ -13,9 +13,9 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.webui.apps.form;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -44,7 +44,6 @@ import org.compiere.model.MColumn;
|
|||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MPayment;
|
||||
import static org.compiere.model.SystemIDs.*;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -274,27 +273,6 @@ public class WCreateFromStatementUI extends CreateFromStatement implements Event
|
|||
configureMiniTable(window.getWListbox());
|
||||
}
|
||||
|
||||
/**
|
||||
* List total amount
|
||||
*/
|
||||
public void info()
|
||||
{
|
||||
DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
|
||||
|
||||
BigDecimal total = new BigDecimal(0.0);
|
||||
int rows = window.getWListbox().getRowCount();
|
||||
int count = 0;
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
if (((Boolean)window.getWListbox().getValueAt(i, 0)).booleanValue())
|
||||
{
|
||||
total = total.add((BigDecimal)window.getWListbox().getValueAt(i, 4));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
window.setStatusLine(count, Msg.getMsg(Env.getCtx(), "Sum") + " " + format.format(total));
|
||||
} // infoStatement
|
||||
|
||||
public void showWindow()
|
||||
{
|
||||
window.setVisible(true);
|
||||
|
|
|
@ -192,7 +192,7 @@ public class WCreateFromWindow extends Window implements EventListener<Event>, W
|
|||
}
|
||||
setStatusLine(count, null);
|
||||
|
||||
createFrom.info();
|
||||
createFrom.info(dataTable, statusBar);
|
||||
}
|
||||
|
||||
public void setStatusLine(int selectedRowCount, String text)
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.ArrayList;
|
|||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.apps.IStatusBar;
|
||||
import org.compiere.minigrid.IMiniTable;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MOrder;
|
||||
|
@ -54,7 +55,7 @@ public abstract class CreateFrom implements ICreateFrom
|
|||
|
||||
public abstract boolean dynInit() throws Exception;
|
||||
|
||||
public abstract void info();
|
||||
public abstract void info(IMiniTable miniTable, IStatusBar statusBar);
|
||||
|
||||
public abstract boolean save(IMiniTable miniTable, String trxName);
|
||||
|
||||
|
|
|
@ -0,0 +1,181 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2013 Elaine Tan *
|
||||
* Copyright (C) 2013 Trek Global
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.compiere.grid;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.compiere.apps.IStatusBar;
|
||||
import org.compiere.minigrid.IMiniTable;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Elaine
|
||||
*
|
||||
*/
|
||||
public abstract class CreateFromBatch extends CreateFrom
|
||||
{
|
||||
public CreateFromBatch(GridTab gridTab)
|
||||
{
|
||||
super(gridTab);
|
||||
}
|
||||
|
||||
public String getSQLWhere(Object BPartner, String DocumentNo, Object DateFrom, Object DateTo,
|
||||
Object AmtFrom, Object AmtTo, Object DocType, Object TenderType, String AuthCode)
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("WHERE p.Processed='Y' AND p.IsReconciled='N'");
|
||||
sql.append(" AND p.DocStatus IN ('CO','CL','RE','VO') AND p.PayAmt<>0");
|
||||
sql.append(" AND p.C_BankAccount_ID = ?");
|
||||
sql.append(" AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_Payment_ID=l.C_Payment_ID AND l.StmtAmt <> 0)");
|
||||
|
||||
if(DocType != null)
|
||||
sql.append(" AND p.C_DocType_ID=?");
|
||||
if(TenderType != null && TenderType.toString().length() > 0)
|
||||
sql.append(" AND p.TenderType=?");
|
||||
if(BPartner != null)
|
||||
sql.append(" AND p.C_BPartner_ID=?");
|
||||
|
||||
if(DocumentNo.length() > 0)
|
||||
sql.append(" AND UPPER(p.DocumentNo) LIKE ?");
|
||||
if(AuthCode.length() > 0)
|
||||
sql.append(" AND p.R_AuthCode LIKE ?");
|
||||
|
||||
if(AmtFrom != null || AmtTo != null)
|
||||
{
|
||||
BigDecimal from = (BigDecimal) AmtFrom;
|
||||
BigDecimal to = (BigDecimal) AmtTo;
|
||||
if(from == null && to != null)
|
||||
sql.append(" AND p.PayAmt <= ?");
|
||||
else if(from != null && to == null)
|
||||
sql.append(" AND p.PayAmt >= ?");
|
||||
else if(from != null && to != null)
|
||||
sql.append(" AND p.PayAmt BETWEEN ? AND ?");
|
||||
}
|
||||
|
||||
if(DateFrom != null || DateTo != null)
|
||||
{
|
||||
Timestamp from = (Timestamp) DateFrom;
|
||||
Timestamp to = (Timestamp) DateTo;
|
||||
if(from == null && to != null)
|
||||
sql.append(" AND TRUNC(p.DateTrx) <= ?");
|
||||
else if(from != null && to == null)
|
||||
sql.append(" AND TRUNC(p.DateTrx) >= ?");
|
||||
else if(from != null && to != null)
|
||||
sql.append(" AND TRUNC(p.DateTrx) BETWEEN ? AND ?");
|
||||
}
|
||||
|
||||
log.fine(sql.toString());
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
void setParameters(PreparedStatement pstmt, Object BankAccount, Object BPartner, String DocumentNo, Object DateFrom, Object DateTo,
|
||||
Object AmtFrom, Object AmtTo, Object DocType, Object TenderType, String AuthCode)
|
||||
throws SQLException
|
||||
{
|
||||
// Get StatementDate
|
||||
Timestamp ts = (Timestamp) getGridTab().getValue("StatementDate");
|
||||
if (ts == null)
|
||||
ts = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
int index = 1;
|
||||
|
||||
pstmt.setTimestamp(index++, ts);
|
||||
pstmt.setInt(index++, BankAccount != null ? (Integer) BankAccount : (Integer) getGridTab().getValue("C_BankAccount_ID"));
|
||||
|
||||
if(DocType != null)
|
||||
pstmt.setInt(index++, (Integer) DocType);
|
||||
|
||||
if(TenderType != null && TenderType.toString().length() > 0)
|
||||
pstmt.setString(index++, (String) TenderType);
|
||||
|
||||
if(BPartner != null)
|
||||
pstmt.setInt(index++, (Integer) BPartner);
|
||||
|
||||
if(DocumentNo.length() > 0)
|
||||
pstmt.setString(index++, getSQLText(DocumentNo));
|
||||
|
||||
if(AuthCode.length() > 0)
|
||||
pstmt.setString(index++, getSQLText(AuthCode));
|
||||
|
||||
if(AmtFrom != null || AmtTo != null)
|
||||
{
|
||||
BigDecimal from = (BigDecimal) AmtFrom;
|
||||
BigDecimal to = (BigDecimal) AmtTo;
|
||||
log.fine("Amt From=" + from + ", To=" + to);
|
||||
if(from == null && to != null)
|
||||
pstmt.setBigDecimal(index++, to);
|
||||
else if(from != null && to == null)
|
||||
pstmt.setBigDecimal(index++, from);
|
||||
else if(from != null && to != null)
|
||||
{
|
||||
pstmt.setBigDecimal(index++, from);
|
||||
pstmt.setBigDecimal(index++, to);
|
||||
}
|
||||
}
|
||||
|
||||
if(DateFrom != null || DateTo != null)
|
||||
{
|
||||
Timestamp from = (Timestamp) DateFrom;
|
||||
Timestamp to = (Timestamp) DateTo;
|
||||
log.fine("Date From=" + from + ", To=" + to);
|
||||
if(from == null && to != null)
|
||||
pstmt.setTimestamp(index++, to);
|
||||
else if(from != null && to == null)
|
||||
pstmt.setTimestamp(index++, from);
|
||||
else if(from != null && to != null)
|
||||
{
|
||||
pstmt.setTimestamp(index++, from);
|
||||
pstmt.setTimestamp(index++, to);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getSQLText(String text)
|
||||
{
|
||||
String s = text.toUpperCase();
|
||||
if(!s.endsWith("%"))
|
||||
s += "%";
|
||||
log.fine( "String=" + s);
|
||||
return s;
|
||||
}
|
||||
|
||||
protected abstract Vector<Vector<Object>> getBankAccountData(Object BankAccount, Object BPartner, String DocumentNo,
|
||||
Object DateFrom, Object DateTo, Object AmtFrom, Object AmtTo, Object DocType, Object TenderType, String AuthCode);
|
||||
|
||||
public void info(IMiniTable miniTable, IStatusBar statusBar)
|
||||
{
|
||||
DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
|
||||
BigDecimal total = new BigDecimal(0);
|
||||
int rows = miniTable.getRowCount();
|
||||
int count = 0;
|
||||
for(int i = 0; i < rows; i++)
|
||||
{
|
||||
if(((Boolean) miniTable.getValueAt(i, 0)).booleanValue())
|
||||
{
|
||||
total = total.add((BigDecimal) miniTable.getValueAt(i, 4));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
statusBar.setStatusLine(String.valueOf(count) + " - " + Msg.getMsg(Env.getCtx(), "Sum") + " " + format.format(total));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,218 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2013 Elaine Tan *
|
||||
* Copyright (C) 2013 Trek Global
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.compiere.grid;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.minigrid.IMiniTable;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MBankStatement;
|
||||
import org.compiere.model.MBankStatementLine;
|
||||
import org.compiere.model.MPayment;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Msg;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Elaine
|
||||
*
|
||||
*/
|
||||
public abstract class CreateFromBatchStatement extends CreateFromBatch
|
||||
{
|
||||
public CreateFromBatchStatement(GridTab mTab)
|
||||
{
|
||||
super(mTab);
|
||||
log.info(mTab.toString());
|
||||
}
|
||||
|
||||
public boolean dynInit() throws Exception
|
||||
{
|
||||
log.config("");
|
||||
setTitle(Msg.getElement(Env.getCtx(), "C_BankStatement_ID") + " .. " + Msg.translate(Env.getCtx(), "X_CreateFromBatch"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Vector<Vector<Object>> getBankAccountData(Object BankAccount, Object BPartner, String DocumentNo,
|
||||
Object DateFrom, Object DateTo, Object AmtFrom, Object AmtTo, Object DocType, Object TenderType, String AuthCode)
|
||||
{
|
||||
log.config ("C_BankAccount_ID=" + BankAccount);
|
||||
|
||||
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT py.X_DepositBatch_ID, db.DocumentNo, db.DateDeposit, db.C_BankAccount_ID, ba.AccountNo,");
|
||||
sql.append("SUM(currencyConvert(p.PayAmt,p.C_Currency_ID,ba.C_Currency_ID,?,null,p.AD_Client_ID,p.AD_Org_ID)) AS amount,");
|
||||
sql.append("SUM(p.PayAmt) AS amountoriginal");
|
||||
sql.append(" FROM C_BankAccount ba");
|
||||
sql.append(" INNER JOIN C_Payment_v p ON (p.C_BankAccount_ID=ba.C_BankAccount_ID)");
|
||||
sql.append(" INNER JOIN C_Currency c ON (p.C_Currency_ID=c.C_Currency_ID)");
|
||||
sql.append(" INNER JOIN C_Payment py ON (py.C_Payment_ID=p.C_Payment_ID)");
|
||||
sql.append(" INNER JOIN X_DepositBatch db ON (py.X_DepositBatch_ID = db.X_DepositBatch_ID) ");
|
||||
sql.append(getSQLWhere(BPartner, DocumentNo, DateFrom, DateTo, AmtFrom, AmtTo, DocType, TenderType, AuthCode));
|
||||
|
||||
sql.append(" AND p.IsReceipt = 'Y'");
|
||||
sql.append(" AND py.X_DepositBatch_ID <> 0");
|
||||
sql.append(" AND db.Processed = 'Y'");
|
||||
|
||||
sql.append(" GROUP BY py.X_DepositBatch_ID,db.DocumentNo,db.DateDeposit, db.C_BankAccount_ID,ba.AccountNo");
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
setParameters(pstmt, BankAccount, BPartner, DocumentNo, DateFrom, DateTo, AmtFrom, AmtTo, DocType, TenderType, AuthCode);
|
||||
rs = pstmt.executeQuery();
|
||||
while(rs.next())
|
||||
{
|
||||
Vector<Object> line = new Vector<Object>(5);
|
||||
line.add(new Boolean(false)); // 0-Selection
|
||||
line.add(rs.getTimestamp(3)); // 1-DateDeposit
|
||||
KeyNamePair pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
|
||||
line.add(pp); // 2-X_DepositBatch
|
||||
line.add(rs.getBigDecimal(7)); // 3-PayAmt
|
||||
line.add(rs.getBigDecimal(6)); // 4-Conv Amt
|
||||
pp = new KeyNamePair(rs.getInt(4), rs.getString(5));
|
||||
line.add(pp); // 5-Bank Account
|
||||
data.add(line);
|
||||
}
|
||||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
protected void configureMiniTable (IMiniTable miniTable)
|
||||
{
|
||||
miniTable.setColumnClass(0, Boolean.class, false); // 0-Selection
|
||||
miniTable.setColumnClass(1, Timestamp.class, true); // 1-TrxDate
|
||||
miniTable.setColumnClass(2, String.class, true); // 2-DepositBatch
|
||||
miniTable.setColumnClass(3, BigDecimal.class, true); // 3-Amount
|
||||
miniTable.setColumnClass(4, BigDecimal.class, true); // 4-ConvAmount
|
||||
miniTable.setColumnClass(5, String.class, true); // 5-BankAccount
|
||||
// Table UI
|
||||
miniTable.autoSize();
|
||||
}
|
||||
|
||||
public boolean save(IMiniTable miniTable, String trxName)
|
||||
{
|
||||
// fixed values
|
||||
int C_BankStatement_ID = ((Integer)getGridTab().getValue("C_BankStatement_ID")).intValue();
|
||||
MBankStatement bs = new MBankStatement (Env.getCtx(), C_BankStatement_ID, null);
|
||||
log.config(bs.toString());
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT p.DateTrx,p.C_Payment_ID,p.DocumentNo, p.C_Currency_ID,c.ISO_Code, p.PayAmt,");
|
||||
sql.append("currencyConvert(p.PayAmt,p.C_Currency_ID,ba.C_Currency_ID,?,null,p.AD_Client_ID,p.AD_Org_ID), bp.Name ");
|
||||
sql.append(" FROM C_BankAccount ba");
|
||||
sql.append(" INNER JOIN C_Payment_v p ON (p.C_BankAccount_ID=ba.C_BankAccount_ID)");
|
||||
sql.append(" INNER JOIN C_Currency c ON (p.C_Currency_ID=c.C_Currency_ID)");
|
||||
sql.append(" INNER JOIN C_Payment py ON (py.C_Payment_ID=p.C_Payment_ID)");
|
||||
sql.append(" INNER JOIN X_DepositBatch db ON (py.X_DepositBatch_ID = db.X_DepositBatch_ID)");
|
||||
sql.append(" LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID)");
|
||||
sql.append(" WHERE p.Processed='Y' AND p.IsReconciled='N'");
|
||||
sql.append(" AND p.IsReceipt = 'Y'");
|
||||
sql.append(" AND py.X_DepositBatch_ID = ?");
|
||||
sql.append(" AND p.DocStatus IN ('CO','CL','RE','VO') AND p.PayAmt<>0");
|
||||
sql.append(" AND p.C_BankAccount_ID=?");
|
||||
sql.append(" AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_Payment_ID=l.C_Payment_ID AND l.StmtAmt <> 0)");
|
||||
|
||||
Timestamp ts = (Timestamp) getGridTab().getValue("StatementDate");
|
||||
if(ts == null)
|
||||
ts = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
// Lines
|
||||
for(int i = 0; i < miniTable.getRowCount(); i++)
|
||||
{
|
||||
if(((Boolean) miniTable.getValueAt(i, 0)).booleanValue())
|
||||
{
|
||||
Timestamp trxDate = (Timestamp) miniTable.getValueAt(i, 1); // 1-DateTrx
|
||||
KeyNamePair pp = (KeyNamePair) miniTable.getValueAt(i, 2); // 2-X_DepositBatch_ID
|
||||
int X_DepositBatch_ID = pp.getKey();
|
||||
|
||||
pp = (KeyNamePair) miniTable.getValueAt(i, 5); // 5- C_BankAccount_ID
|
||||
int C_BankAccount_ID = pp.getKey();
|
||||
|
||||
log.fine("Deposit Batch Date=" + trxDate + ", Batch=" + X_DepositBatch_ID
|
||||
+" , Bank Account" + C_BankAccount_ID);
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
pstmt.setTimestamp(1, ts);
|
||||
pstmt.setInt(2, X_DepositBatch_ID);
|
||||
pstmt.setInt(3, C_BankAccount_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
while(rs.next())
|
||||
{
|
||||
int C_Payment_ID = rs.getInt(2);
|
||||
int C_Currency_ID = rs.getInt(4);
|
||||
BigDecimal TrxAmt = rs.getBigDecimal(6); // PayAmt
|
||||
|
||||
log.fine("Line Date=" + trxDate + ", Payment=" + C_Payment_ID + ", Currency=" + C_Currency_ID + ", Amt=" + TrxAmt);
|
||||
//
|
||||
MBankStatementLine bsl = new MBankStatementLine (bs);
|
||||
bsl.setStatementLineDate(trxDate);
|
||||
bsl.setPayment(new MPayment(Env.getCtx(), C_Payment_ID, null));
|
||||
if (!bsl.save())
|
||||
log.log(Level.SEVERE, "Line not created #" + i);
|
||||
|
||||
}
|
||||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
} // if selected
|
||||
} // for all rows
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Vector<String> getOISColumnNames()
|
||||
{
|
||||
// Header Info
|
||||
Vector<String> columnNames = new Vector<String>(6);
|
||||
columnNames.add(Msg.getMsg(Env.getCtx(), "Select"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Date"));
|
||||
columnNames.add(Msg.getElement(Env.getCtx(), "X_DepositBatch_ID"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Amount"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "ConvertedAmount"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "C_BankAccount_ID"));
|
||||
|
||||
return columnNames;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2013 Elaine Tan *
|
||||
* Copyright (C) 2013 Trek Global
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.compiere.grid;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.minigrid.IMiniTable;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MDepositBatch;
|
||||
import org.compiere.model.MDepositBatchLine;
|
||||
import org.compiere.model.MPayment;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Msg;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Elaine
|
||||
*
|
||||
*/
|
||||
public abstract class CreateFromDepositBatch extends CreateFromBatch
|
||||
{
|
||||
public CreateFromDepositBatch(GridTab mTab)
|
||||
{
|
||||
super(mTab);
|
||||
log.info(mTab.toString());
|
||||
}
|
||||
|
||||
public boolean dynInit() throws Exception
|
||||
{
|
||||
log.config("");
|
||||
setTitle(Msg.getElement(Env.getCtx(), "X_DepositBatch_ID") + " .. " + Msg.translate(Env.getCtx(), "CreateFrom"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Vector<Vector<Object>> getBankAccountData(Object BankAccount, Object BPartner, String DocumentNo,
|
||||
Object DateFrom, Object DateTo, Object AmtFrom, Object AmtTo, Object DocType, Object TenderType, String AuthCode)
|
||||
{
|
||||
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT p.DateTrx,p.C_Payment_ID,p.DocumentNo, p.C_Currency_ID,c.ISO_Code, p.PayAmt,");
|
||||
sql.append("currencyConvert(p.PayAmt,p.C_Currency_ID,ba.C_Currency_ID,?,null,p.AD_Client_ID,p.AD_Org_ID), bp.Name ");
|
||||
sql.append("FROM C_BankAccount ba");
|
||||
sql.append(" INNER JOIN C_Payment_v p ON (p.C_BankAccount_ID=ba.C_BankAccount_ID)");
|
||||
sql.append(" INNER JOIN C_Currency c ON (p.C_Currency_ID=c.C_Currency_ID)");
|
||||
sql.append(" INNER JOIN C_Payment py ON (py.C_Payment_ID=p.C_Payment_ID)");
|
||||
sql.append(" LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) ");
|
||||
sql.append(getSQLWhere(BPartner, DocumentNo, DateFrom, DateTo, AmtFrom, AmtTo, DocType, TenderType, AuthCode));
|
||||
|
||||
sql.append(" AND p.IsReceipt = 'Y'");
|
||||
sql.append(" AND (py.X_DepositBatch_ID = 0 OR py.X_DepositBatch_ID IS NULL)");
|
||||
|
||||
sql.append(" ORDER BY p.DateTrx");
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
setParameters(pstmt, BankAccount, BPartner, DocumentNo, DateFrom, DateTo, AmtFrom, AmtTo, DocType, TenderType, AuthCode);
|
||||
rs = pstmt.executeQuery();
|
||||
while(rs.next())
|
||||
{
|
||||
Vector<Object> line = new Vector<Object>(6);
|
||||
line.add(new Boolean(false)); // 0-Selection
|
||||
line.add(rs.getTimestamp(1)); // 1-DateTrx
|
||||
KeyNamePair pp = new KeyNamePair(rs.getInt(2), rs.getString(3));
|
||||
line.add(pp); // 2-C_Payment_ID
|
||||
pp = new KeyNamePair(rs.getInt(4), rs.getString(5));
|
||||
line.add(pp); // 3-Currency
|
||||
line.add(rs.getBigDecimal(6)); // 4-PayAmt
|
||||
line.add(rs.getBigDecimal(7)); // 5-Conv Amt
|
||||
line.add(rs.getString(8)); // 6-BParner
|
||||
data.add(line);
|
||||
}
|
||||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
protected void configureMiniTable(IMiniTable miniTable)
|
||||
{
|
||||
miniTable.setColumnClass(0, Boolean.class, false); // 0-Selection
|
||||
miniTable.setColumnClass(1, Timestamp.class, true); // 1-TrxDate
|
||||
miniTable.setColumnClass(2, String.class, true); // 2-Payment
|
||||
miniTable.setColumnClass(3, String.class, true); // 3-Currency
|
||||
miniTable.setColumnClass(4, BigDecimal.class, true); // 4-Amount
|
||||
miniTable.setColumnClass(5, BigDecimal.class, true); // 5-ConvAmount
|
||||
miniTable.setColumnClass(6, String.class, true); // 6-BPartner
|
||||
// Table UI
|
||||
miniTable.autoSize();
|
||||
}
|
||||
|
||||
public boolean save(IMiniTable miniTable, String trxName)
|
||||
{
|
||||
// fixed values
|
||||
int X_DepositBatch_ID = ((Integer) getGridTab().getValue("X_DepositBatch_ID")).intValue();
|
||||
MDepositBatch db = new MDepositBatch(Env.getCtx(), X_DepositBatch_ID, null);
|
||||
log.config(db.toString());
|
||||
|
||||
// Lines
|
||||
for(int i = 0; i < miniTable.getRowCount(); i++)
|
||||
{
|
||||
if(((Boolean) miniTable.getValueAt(i, 0)).booleanValue())
|
||||
{
|
||||
Timestamp trxDate = (Timestamp) miniTable.getValueAt(i, 1); // 1-DateTrx
|
||||
KeyNamePair pp = (KeyNamePair) miniTable.getValueAt(i, 2); // 2-C_Payment_ID
|
||||
int C_Payment_ID = pp.getKey();
|
||||
pp = (KeyNamePair) miniTable.getValueAt(i, 3); // 3-Currency
|
||||
int C_Currency_ID = pp.getKey();
|
||||
BigDecimal TrxAmt = (BigDecimal) miniTable.getValueAt(i, 4); // 4-PayAmt
|
||||
// BigDecimal StmtAmt = (BigDecimal) miniTable.getValueAt(i, 5);// 5-Conv Amt
|
||||
//
|
||||
log.fine("Line Date=" + trxDate + ", Payment=" + C_Payment_ID + ", Currency=" + C_Currency_ID + ", Amt=" + TrxAmt);
|
||||
//
|
||||
MDepositBatchLine dbl = new MDepositBatchLine(db);
|
||||
// dbl.setStatementLineDate(trxDate);
|
||||
dbl.setPayment(new MPayment(Env.getCtx(), C_Payment_ID, null));
|
||||
if(!dbl.save())
|
||||
log.log(Level.SEVERE, "Line not created #" + i);
|
||||
} // if selected
|
||||
} // for all rows
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Vector<String> getOISColumnNames()
|
||||
{
|
||||
// Header Info
|
||||
Vector<String> columnNames = new Vector<String>(7);
|
||||
columnNames.add(Msg.getMsg(Env.getCtx(), "Select"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Date"));
|
||||
columnNames.add(Msg.getElement(Env.getCtx(), "C_Payment_ID"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "C_Currency_ID"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Amount"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "ConvertedAmount"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
|
||||
|
||||
return columnNames;
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ import java.util.ArrayList;
|
|||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.apps.IStatusBar;
|
||||
import org.compiere.minigrid.IMiniTable;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MCurrency;
|
||||
|
@ -327,7 +328,7 @@ public abstract class CreateFromInvoice extends CreateFrom
|
|||
/**
|
||||
* List number of rows selected
|
||||
*/
|
||||
public void info()
|
||||
public void info(IMiniTable miniTable, IStatusBar statusBar)
|
||||
{
|
||||
|
||||
} // infoInvoice
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.HashMap;
|
|||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.apps.IStatusBar;
|
||||
import org.compiere.minigrid.IMiniTable;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MInOut;
|
||||
|
@ -94,7 +95,7 @@ public abstract class CreateFromPackageShipment extends CreateFrom
|
|||
return data;
|
||||
}
|
||||
|
||||
public void info()
|
||||
public void info(IMiniTable miniTable, IStatusBar statusBar)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.sql.SQLException;
|
|||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.apps.IStatusBar;
|
||||
import org.compiere.minigrid.IMiniTable;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MRMA;
|
||||
|
@ -122,7 +123,7 @@ public abstract class CreateFromRMA extends CreateFrom {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void info()
|
||||
public void info(IMiniTable miniTable, IStatusBar statusBar)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ import java.sql.SQLException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.apps.IStatusBar;
|
||||
import org.compiere.minigrid.IMiniTable;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MInOut;
|
||||
|
@ -501,7 +503,7 @@ public abstract class CreateFromShipment extends CreateFrom
|
|||
/**
|
||||
* List number of rows selected
|
||||
*/
|
||||
public void info()
|
||||
public void info(IMiniTable miniTable, IStatusBar statusBar)
|
||||
{
|
||||
|
||||
} // infoInvoice
|
||||
|
|
|
@ -18,9 +18,11 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.apps.IStatusBar;
|
||||
import org.compiere.minigrid.IMiniTable;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MBankAccount;
|
||||
|
@ -28,6 +30,7 @@ import org.compiere.model.MBankStatement;
|
|||
import org.compiere.model.MBankStatementLine;
|
||||
import org.compiere.model.MPayment;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Msg;
|
||||
|
@ -257,9 +260,22 @@ public abstract class CreateFromStatement extends CreateFrom
|
|||
return data;
|
||||
}
|
||||
|
||||
public void info()
|
||||
public void info(IMiniTable miniTable, IStatusBar statusBar)
|
||||
{
|
||||
DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
|
||||
|
||||
BigDecimal total = new BigDecimal(0.0);
|
||||
int rows = miniTable.getRowCount();
|
||||
int count = 0;
|
||||
for(int i = 0; i < rows; i++)
|
||||
{
|
||||
if(((Boolean) miniTable.getValueAt(i, 0)).booleanValue())
|
||||
{
|
||||
total = total.add((BigDecimal) miniTable.getValueAt(i, 4));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
statusBar.setStatusLine(String.valueOf(count) + " - " + Msg.getMsg(Env.getCtx(), "Sum") + " " + format.format(total));
|
||||
}
|
||||
|
||||
protected void configureMiniTable (IMiniTable miniTable)
|
||||
|
|
|
@ -0,0 +1,169 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2013 Elaine Tan *
|
||||
* Copyright (C) 2013 Trek Global
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.compiere.grid;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.minigrid.IMiniTable;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MBankStatement;
|
||||
import org.compiere.model.MBankStatementLine;
|
||||
import org.compiere.model.MPayment;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Msg;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Elaine
|
||||
*
|
||||
*/
|
||||
public abstract class CreateFromStatementBatch extends CreateFromBatch
|
||||
{
|
||||
public CreateFromStatementBatch(GridTab mTab)
|
||||
{
|
||||
super(mTab);
|
||||
log.info(mTab.toString());
|
||||
}
|
||||
|
||||
public boolean dynInit() throws Exception
|
||||
{
|
||||
log.config("");
|
||||
setTitle(Msg.getElement(Env.getCtx(), "C_BankStatement_ID") + " .. " + Msg.translate(Env.getCtx(), "CreateFrom"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Vector<Vector<Object>> getBankAccountData(Object BankAccount, Object BPartner, String DocumentNo,
|
||||
Object DateFrom, Object DateTo, Object AmtFrom, Object AmtTo, Object DocType, Object TenderType, String AuthCode)
|
||||
{
|
||||
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT p.DateTrx,p.C_Payment_ID,p.DocumentNo, p.C_Currency_ID,c.ISO_Code, p.PayAmt,");
|
||||
sql.append("currencyConvert(p.PayAmt,p.C_Currency_ID,ba.C_Currency_ID,?,null,p.AD_Client_ID,p.AD_Org_ID), bp.Name ");
|
||||
sql.append("FROM C_BankAccount ba");
|
||||
sql.append(" INNER JOIN C_Payment_v p ON (p.C_BankAccount_ID=ba.C_BankAccount_ID)");
|
||||
sql.append(" INNER JOIN C_Currency c ON (p.C_Currency_ID=c.C_Currency_ID)");
|
||||
sql.append(" LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) ");
|
||||
sql.append(getSQLWhere(BPartner, DocumentNo, DateFrom, DateTo, AmtFrom, AmtTo, DocType, TenderType, AuthCode));
|
||||
sql.append(" ORDER BY p.DateTrx");
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
setParameters(pstmt, BankAccount, BPartner, DocumentNo, DateFrom, DateTo, AmtFrom, AmtTo, DocType, TenderType, AuthCode);
|
||||
rs = pstmt.executeQuery();
|
||||
while(rs.next())
|
||||
{
|
||||
Vector<Object> line = new Vector<Object>(6);
|
||||
line.add(new Boolean(false)); // 0-Selection
|
||||
line.add(rs.getTimestamp(1)); // 1-DateTrx
|
||||
KeyNamePair pp = new KeyNamePair(rs.getInt(2), rs.getString(3));
|
||||
line.add(pp); // 2-C_Payment_ID
|
||||
pp = new KeyNamePair(rs.getInt(4), rs.getString(5));
|
||||
line.add(pp); // 3-Currency
|
||||
line.add(rs.getBigDecimal(6)); // 4-PayAmt
|
||||
line.add(rs.getBigDecimal(7)); // 5-Conv Amt
|
||||
line.add(rs.getString(8)); // 6-BParner
|
||||
data.add(line);
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
protected void configureMiniTable(IMiniTable miniTable)
|
||||
{
|
||||
miniTable.setColumnClass(0, Boolean.class, false); // 0-Selection
|
||||
miniTable.setColumnClass(1, Timestamp.class, false); // 1-TrxDate / nmicoud - idempiere 240 Let user choose the 'Statement Line Date'
|
||||
miniTable.setColumnClass(2, String.class, true); // 2-Payment
|
||||
miniTable.setColumnClass(3, String.class, true); // 3-Currency
|
||||
miniTable.setColumnClass(4, BigDecimal.class, true); // 4-Amount
|
||||
miniTable.setColumnClass(5, BigDecimal.class, true); // 5-ConvAmount
|
||||
miniTable.setColumnClass(6, String.class, true); // 6-BPartner
|
||||
// Table UI
|
||||
miniTable.autoSize();
|
||||
}
|
||||
|
||||
public boolean save(IMiniTable miniTable, String trxName)
|
||||
{
|
||||
// fixed values
|
||||
int C_BankStatement_ID = ((Integer) getGridTab().getValue("C_BankStatement_ID")).intValue();
|
||||
MBankStatement bs = new MBankStatement (Env.getCtx(), C_BankStatement_ID, trxName);
|
||||
log.config(bs.toString());
|
||||
|
||||
// Lines
|
||||
for(int i = 0; i < miniTable.getRowCount(); i++)
|
||||
{
|
||||
if(((Boolean) miniTable.getValueAt(i, 0)).booleanValue())
|
||||
{
|
||||
Timestamp trxDate = (Timestamp) miniTable.getValueAt(i, 1); // 1-DateTrx
|
||||
KeyNamePair pp = (KeyNamePair) miniTable.getValueAt(i, 2); // 2-C_Payment_ID
|
||||
int C_Payment_ID = pp.getKey();
|
||||
pp = (KeyNamePair) miniTable.getValueAt(i, 3); // 3-Currency
|
||||
int C_Currency_ID = pp.getKey();
|
||||
BigDecimal TrxAmt = (BigDecimal) miniTable.getValueAt(i, 5); // 5- Conv Amt
|
||||
|
||||
log.fine("Line Date=" + trxDate
|
||||
+ ", Payment=" + C_Payment_ID + ", Currency=" + C_Currency_ID + ", Amt=" + TrxAmt);
|
||||
//
|
||||
MBankStatementLine bsl = new MBankStatementLine (bs);
|
||||
bsl.setStatementLineDate(trxDate);
|
||||
bsl.setPayment(new MPayment(Env.getCtx(), C_Payment_ID, trxName));
|
||||
|
||||
bsl.setTrxAmt(TrxAmt);
|
||||
bsl.setStmtAmt(TrxAmt);
|
||||
bsl.setC_Currency_ID(C_Currency_ID);
|
||||
|
||||
if (!bsl.save())
|
||||
log.log(Level.SEVERE, "Line not created #" + i);
|
||||
} // if selected
|
||||
} // for all rows
|
||||
return true;
|
||||
} // save
|
||||
|
||||
protected Vector<String> getOISColumnNames()
|
||||
{
|
||||
// Header Info
|
||||
Vector<String> columnNames = new Vector<String>(7);
|
||||
columnNames.add(Msg.getMsg(Env.getCtx(), "Select"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Date"));
|
||||
columnNames.add(Msg.getElement(Env.getCtx(), "C_Payment_ID"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "C_Currency_ID"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Amount"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "ConvertedAmount"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
|
||||
|
||||
return columnNames;
|
||||
}
|
||||
}
|
|
@ -22,6 +22,6 @@ import org.compiere.model.GridTab;
|
|||
*/
|
||||
public interface ICreateFromFactory {
|
||||
|
||||
public ICreateFrom create(GridTab mTab);
|
||||
public ICreateFrom create(GridTab mTab, String columnName);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue