📄 docline_invoice.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.sql.*;
import java.math.*;
import org.compiere.util.Env;
import org.compiere.model.*;
/**
* Invoice Document Line
*
* @author Jorg Janke
* @version $Id: DocLine_Invoice.java,v 1.7 2002/11/18 06:11:57 jjanke Exp $
*/
public class DocLine_Invoice extends DocLine
{
/**
* Constructor
* @param DocumentType document type
* @param TrxHeader_ID trx header
* @param TrxLine_ID trx line
*/
public DocLine_Invoice (String DocumentType, int TrxHeader_ID, int TrxLine_ID)
{
super(DocumentType, TrxHeader_ID, TrxLine_ID);
} // DocLine_Invoice
/** Net Line Amt */
private BigDecimal m_LineNetAmt = null;
/** List Amount */
private BigDecimal m_ListAmt = Env.ZERO;
/** Discount Amount */
private BigDecimal m_DiscountAmt = Env.ZERO;
/**
* Set Product Amounts
* @param LineNetAmt Line Net Amt
* @param PriceList Price List
* @param Qty Qty
*/
public void setAmount (BigDecimal LineNetAmt, BigDecimal PriceList, BigDecimal Qty)
{
m_LineNetAmt = LineNetAmt == null ? Env.ZERO : LineNetAmt;
if (PriceList != null && Qty != null)
m_ListAmt = PriceList.multiply(Qty);
if (m_ListAmt.equals(Env.ZERO))
m_ListAmt = m_LineNetAmt;
m_DiscountAmt = m_ListAmt.subtract(LineNetAmt);
//
setAmount (m_ListAmt, m_DiscountAmt);
// Log.trace(this,Log.l6_Database, "DocLine_Invoice.setAmount",
// "LineNet=" + m_LineNetAmt + ", List=" + m_ListAmt + ", Discount=" + m_DiscountAmt
// + " => Amount=" + getAmount());
} // setAmounts
/**
* Line Discount
* @return discount amount
*/
public BigDecimal getDiscount()
{
return m_DiscountAmt;
} // getDiscount
/**
* Line List Amount
* @return list amount
*/
public BigDecimal getListAmount()
{
return m_ListAmt;
} // getListAmount
/*************************************************************************/
/**
* Line Account from Product (or Charge).
*
* @param AcctType see ProoductInfo.ACCTTYPE_* (0..3)
* @param as Accounting schema
* @return Requested Product Account
*/
public Account getAccount (int AcctType, AcctSchema as)
{
if (getM_Product_ID() == 0 && getC_Charge_ID() != 0)
{
BigDecimal amt = new BigDecimal (-1); // Revenue (-)
if (p_DocumentType.indexOf("AP") != -1)
amt = new BigDecimal (+1); // Expense (+)
Account acct = getChargeAccount(as, amt);
if (acct != null)
return acct;
}
return p_productInfo.getAccount (AcctType, as);
} // getAccount
} // DocLine_Invoice
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -