⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 doc_payment.java

📁 Java写的ERP系统
💻 JAVA
字号:
/******************************************************************************
 * The contents of this file are subject to the   Compiere License  Version 1.1
 * ("License"); You may not use this file except in compliance with the License
 * You may obtain a copy of the License at http://www.compiere.org/license.html
 * Software distributed under the License is distributed on an  "AS IS"  basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 * The Original Code is                  Compiere  ERP & CRM  Business Solution
 * The Initial Developer of the Original Code is Jorg Janke  and ComPiere, Inc.
 * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
 * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
 * Contributor(s): ______________________________________.
 *****************************************************************************/
package org.compiere.acct;

import java.math.*;
import java.util.*;
import java.sql.*;

import org.compiere.util.*;
import org.compiere.model.*;

/**
 *  Post Invoice Documents.
 *  <pre>
 *  Table:              C_Payment (335)
 *  Document Types      ARP, APP
 *  </pre>
 *  @author Jorg Janke
 *  @version  $Id: Doc_Payment.java,v 1.8 2003/03/19 06:47:32 jjanke Exp $
 */
public class Doc_Payment extends Doc
{
	/**
	 *  Constructor
	 *  @param AD_Client_ID clent
	 */
	protected Doc_Payment(int AD_Client_ID)
	{
		super(AD_Client_ID);
	}

	/**
	 *  Return TableName of Document
	 *  @return C_Payment
	 */
	public String getTableName()
	{
		return "C_Payment";
	}   //  getTableName

	/**
	 *  Get Table ID
	 *  @return 335
	 */
	public int getAD_Table_ID()
	{
		return 335;
	}   //  getAD_Table_ID

	/**
	 *  Load Specific Document Details
	 *  @param rs result set
	 *  @return true if loadDocumentType was set
	 */
	protected boolean loadDocumentDetails (ResultSet rs)
	{
		try
		{
			p_vo.DateDoc = rs.getTimestamp("DateTrx");

			//	Amount
			p_vo.Amounts[Doc.AMTTYPE_Gross] = rs.getBigDecimal("PayAmt");
			if (p_vo.Amounts[Doc.AMTTYPE_Gross] == null)
				p_vo.Amounts[Doc.AMTTYPE_Gross] = Env.ZERO;
		}
		catch (SQLException e)
		{
			log.error("loadDocumentDetails", e);
		}
		return false;
	}   //  loadDocumentDetails

	/*************************************************************************/

	/**
	 *  Get Source Currency Balance - always zero
	 *  @return Zero (always balanced)
	 */
	public BigDecimal getBalance()
	{
		BigDecimal retValue = Env.ZERO;
	//	Log.trace(Log.l4_Data, toString() + " Balance=" + retValue);
		return retValue;
	}   //  getBalance

	/**
	 *  Create Facts (the accounting logic) for
	 *  ARP, APP.
	 *  <pre>
	 *  ARP
	 *      BankInTransit   DR
	 *      UnallocatedCash         CR
	 *  APP
	 *      PaymentSelect   DR
	 *      BankInTransit           CR
	 *  CashBankTransfer
	 *      -
	 *  </pre>
	 *  @param as accounting schema
	 *  @return Fact
	 */
	public Fact createFact (AcctSchema as)
	{
		//  create Fact Header
		Fact fact = new Fact(this, as, Fact.POST_Actual);

		if (p_vo.DocumentType.equals(DocVO.DOCTYPE_ARReceipt))
		{
			fact.createLine(null, getAccount(Doc.ACCTTYPE_BankInTransit, as),
				p_vo.C_Currency_ID, getAmount(), null);
			fact.createLine(null, getAccount(Doc.ACCTTYPE_UnallocatedCash, as),
				p_vo.C_Currency_ID, null, getAmount());
		}
		//  APP
		else if (p_vo.DocumentType.equals(DocVO.DOCTYPE_APPayment))
		{
			fact.createLine(null, getAccount(Doc.ACCTTYPE_PaymentSelect, as),
				p_vo.C_Currency_ID, getAmount(), null);
			fact.createLine(null, getAccount(Doc.ACCTTYPE_BankInTransit, as),
				p_vo.C_Currency_ID, null, getAmount());
		}
		else
		{
			p_vo.Error = "DocumentType unknown: " + p_vo.DocumentType;
			log.error("createFact - " + p_vo.Error);
			fact = null;
		}
		return fact;
	}   //  createFact

}   //  Doc_Payment

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -