/****************************************************************************** * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2006 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.acct; import java.math.BigDecimal; import java.sql.ResultSet; import java.util.ArrayList; import java.util.logging.Level; import org.compiere.model.MAccount; import org.compiere.model.MAcctSchema; import org.compiere.model.MBankAccount; import org.compiere.model.MCharge; import org.compiere.model.MClientInfo; import org.compiere.model.MPayment; import org.compiere.model.MSysConfig; import org.compiere.util.Env; /** * Post {@link MPayment} Documents. *
* Table: C_Payment (335) * Document Types ARP, APP ** @author Jorg Janke * @version $Id: Doc_Payment.java,v 1.3 2006/07/30 00:53:33 jjanke Exp $ */ public class Doc_Payment extends Doc { /** * Constructor * @param as accounting schema * @param rs record * @param trxName trx */ public Doc_Payment (MAcctSchema as, ResultSet rs, String trxName) { super (as, MPayment.class, rs, null, trxName); } // Doc_Payment /** Tender Type */ private String m_TenderType = null; /** Prepayment */ private boolean m_Prepayment = false; /** Bank Account */ private int m_C_BankAccount_ID = 0; /** * Load Specific Document Details * @return error message or null */ @Override protected String loadDocumentDetails () { MPayment pay = (MPayment)getPO(); setDateDoc(pay.getDateTrx()); m_TenderType = pay.getTenderType(); m_Prepayment = pay.isPrepayment(); m_C_BankAccount_ID = pay.getC_BankAccount_ID(); // Amount setAmount(Doc.AMTTYPE_Gross, pay.getPayAmt()); return null; } // loadDocumentDetails /** * Get Source Currency Balance - always zero * @return Zero (always balanced) */ @Override public BigDecimal getBalance() { BigDecimal retValue = Env.ZERO; return retValue; } // getBalance /** * Create Facts (the accounting logic) for * ARP, APP. *
* ARP * BankInTransit DR * UnallocatedCash CR * or Charge/C_Prepayment * APP * PaymentSelect DR * or Charge/V_Prepayment * BankInTransit CR * CashBankTransfer * - ** @param as accounting schema * @return Fact */ @Override public ArrayList