1 17 package org.openbravo.erpCommon.ad_forms; 18 19 import java.math.*; 20 import org.apache.log4j.Logger ; 21 import org.openbravo.database.ConnectionProvider; 23 24 25 26 public class DocLine_Invoice extends DocLine { 27 static Logger log4jDocLine_Invoice = Logger.getLogger(DocLine_Invoice.class); 28 29 public DocLine_Invoice (String DocumentType, String TrxHeader_ID, String TrxLine_ID){ 30 super(DocumentType, TrxHeader_ID, TrxLine_ID); 31 } 32 33 34 35 private String m_LineNetAmt = "0"; 36 37 private String m_ListAmt = "0"; 38 39 private String m_DiscountAmt = "0"; 40 41 42 43 public void setAmount (String LineNetAmt, String PriceList, String Qty){ 44 BigDecimal ZERO = new BigDecimal("0"); 45 m_LineNetAmt = (LineNetAmt == "0")? ZERO.toString() : LineNetAmt; 46 BigDecimal b_Qty = new BigDecimal(Qty); 47 BigDecimal b_PriceList = new BigDecimal(PriceList); 48 if (PriceList != "" && Qty != "") 49 m_ListAmt = b_PriceList.multiply(b_Qty).toString(); 50 if (m_ListAmt.equals(ZERO.toString())) 51 m_ListAmt = m_LineNetAmt; 52 BigDecimal b_LineNetAmt = new BigDecimal(LineNetAmt); 53 BigDecimal b_ListAmt = new BigDecimal(m_ListAmt); 54 m_DiscountAmt = b_ListAmt.subtract(b_LineNetAmt).toString(); 55 setAmount (m_ListAmt, m_DiscountAmt); 57 } 59 66 public Account getAccount (String AcctType, AcctSchema as,ConnectionProvider conn){ 67 if (m_M_Product_ID.equals("") && !m_C_Charge_ID.equals("")){ 69 BigDecimal amt = new BigDecimal (-1); if (p_DocumentType.indexOf("AP") != -1) 71 amt = new BigDecimal (+1); Account acct = getChargeAccount(as, amt,conn); 73 if (acct != null) 74 return acct; 75 } 76 return p_productInfo.getAccount (AcctType, as,conn); 78 } 80 public String getServletInfo() { 81 return "Servlet for the accounting"; 82 } } 84 | Popular Tags |