1 14 package org.compiere.acct; 15 16 import java.sql.*; 17 import java.math.*; 18 19 import org.compiere.util.Env; 20 import org.compiere.model.*; 21 22 28 public class DocLine_Invoice extends DocLine 29 { 30 36 public DocLine_Invoice (String DocumentType, int TrxHeader_ID, int TrxLine_ID) 37 { 38 super(DocumentType, TrxHeader_ID, TrxLine_ID); 39 } 41 42 private BigDecimal m_LineNetAmt = null; 43 44 private BigDecimal m_ListAmt = Env.ZERO; 45 46 private BigDecimal m_DiscountAmt = Env.ZERO; 47 48 54 public void setAmount (BigDecimal LineNetAmt, BigDecimal PriceList, BigDecimal Qty) 55 { 56 m_LineNetAmt = LineNetAmt == null ? Env.ZERO : LineNetAmt; 57 58 if (PriceList != null && Qty != null) 59 m_ListAmt = PriceList.multiply(Qty); 60 if (m_ListAmt.equals(Env.ZERO)) 61 m_ListAmt = m_LineNetAmt; 62 m_DiscountAmt = m_ListAmt.subtract(LineNetAmt); 63 setAmount (m_ListAmt, m_DiscountAmt); 65 } 70 74 public BigDecimal getDiscount() 75 { 76 return m_DiscountAmt; 77 } 79 83 public BigDecimal getListAmount() 84 { 85 return m_ListAmt; 86 } 88 89 90 97 public Account getAccount (int AcctType, AcctSchema as) 98 { 99 if (getM_Product_ID() == 0 && getC_Charge_ID() != 0) 101 { 102 BigDecimal amt = new BigDecimal (-1); if (p_DocumentType.indexOf("AP") != -1) 104 amt = new BigDecimal (+1); Account acct = getChargeAccount(as, amt); 106 if (acct != null) 107 return acct; 108 } 109 return p_productInfo.getAccount (AcctType, as); 111 } 113 114 124 } | Popular Tags |