1 14 package org.compiere.acct; 15 16 import java.math.*; 17 import java.util.*; 18 import java.sql.*; 19 20 import org.compiere.util.*; 21 import org.compiere.model.*; 22 23 32 public class Doc_Payment extends Doc 33 { 34 38 protected Doc_Payment(int AD_Client_ID) 39 { 40 super(AD_Client_ID); 41 } 42 43 47 public String getTableName() 48 { 49 return "C_Payment"; 50 } 52 56 public int getAD_Table_ID() 57 { 58 return 335; 59 } 61 66 protected boolean loadDocumentDetails (ResultSet rs) 67 { 68 try 69 { 70 p_vo.DateDoc = rs.getTimestamp("DateTrx"); 71 72 p_vo.Amounts[Doc.AMTTYPE_Gross] = rs.getBigDecimal("PayAmt"); 74 if (p_vo.Amounts[Doc.AMTTYPE_Gross] == null) 75 p_vo.Amounts[Doc.AMTTYPE_Gross] = Env.ZERO; 76 } 77 catch (SQLException e) 78 { 79 log.error("loadDocumentDetails", e); 80 } 81 return false; 82 } 84 85 86 90 public BigDecimal getBalance() 91 { 92 BigDecimal retValue = Env.ZERO; 93 return retValue; 95 } 97 113 public Fact createFact (AcctSchema as) 114 { 115 Fact fact = new Fact(this, as, Fact.POST_Actual); 117 118 if (p_vo.DocumentType.equals(DocVO.DOCTYPE_ARReceipt)) 119 { 120 fact.createLine(null, getAccount(Doc.ACCTTYPE_BankInTransit, as), 121 p_vo.C_Currency_ID, getAmount(), null); 122 fact.createLine(null, getAccount(Doc.ACCTTYPE_UnallocatedCash, as), 123 p_vo.C_Currency_ID, null, getAmount()); 124 } 125 else if (p_vo.DocumentType.equals(DocVO.DOCTYPE_APPayment)) 127 { 128 fact.createLine(null, getAccount(Doc.ACCTTYPE_PaymentSelect, as), 129 p_vo.C_Currency_ID, getAmount(), null); 130 fact.createLine(null, getAccount(Doc.ACCTTYPE_BankInTransit, as), 131 p_vo.C_Currency_ID, null, getAmount()); 132 } 133 else 134 { 135 p_vo.Error = "DocumentType unknown: " + p_vo.DocumentType; 136 log.error("createFact - " + p_vo.Error); 137 fact = null; 138 } 139 return fact; 140 } 142 } | Popular Tags |