KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > compiere > model > MJournalLine


1 /******************************************************************************
2  * The contents of this file are subject to the Compiere License Version 1.1
3  * ("License"); You may not use this file except in compliance with the License
4  * You may obtain a copy of the License at http://www.compiere.org/license.html
5  * Software distributed under the License is distributed on an "AS IS" basis,
6  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
7  * the specific language governing rights and limitations under the License.
8  * The Original Code is Compiere ERP & CRM Smart Business Solution
9  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
10  * Portions created by Jorg Janke are Copyright (C) 1999-2003 Jorg Janke, parts
11  * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
12  * Contributor(s): ______________________________________.
13  *****************************************************************************/

14 package org.compiere.model;
15
16 import java.util.*;
17 import java.sql.*;
18 import java.math.*;
19
20 import org.compiere.util.*;
21
22 /**
23  * Journal Line Model
24  *
25  * @author Jorg Janke
26  * @version $Id: MJournalLine.java,v 1.2 2003/08/25 02:31:57 jjanke Exp $
27  */

28 public class MJournalLine extends X_GL_JournalLine
29 {
30     public MJournalLine (Properties ctx, int GL_JournalLine_ID)
31     {
32         super (ctx, GL_JournalLine_ID);
33         if (GL_JournalLine_ID == 0)
34         {
35         // setGL_JournalLine_ID (0); // PK
36
// setGL_Journal_ID (0); // Parent
37
// setC_Currency_ID (0);
38
// setC_ValidCombination_ID (0);
39
setLine (0);
40             setAmtAcctCr (Env.ZERO);
41             setAmtAcctDr (Env.ZERO);
42             setAmtSourceCr (Env.ZERO);
43             setAmtSourceDr (Env.ZERO);
44             setCurrencyRate (Env.ONE);
45             setCurrencyRateType (CURRENCYRATETYPE_Spot);
46             setDateAcct (new Timestamp(System.currentTimeMillis()));
47             setIsGenerated (true);
48         }
49     } // MJournalLine
50

51     public MJournalLine (Properties ctx, ResultSet rs)
52     {
53         super (ctx, rs);
54     } // MJournalLine
55

56     public void setGL_Journal_ID (int GL_Journal_ID)
57     {
58         super.setGL_Journal_ID (GL_Journal_ID);
59     }
60
61     /**
62      * Overwrite Client/Org if required
63      * @param AD_Client_ID client
64      * @param AD_Org_ID org
65      */

66     public void setClientOrg (int AD_Client_ID, int AD_Org_ID)
67     {
68         super.setClientOrg(AD_Client_ID, AD_Org_ID);
69     } // setClientOrg
70

71
72     /**
73      * Set Currency Info
74      * @param C_Currency_ID currenct
75      * @param CurrencyRateType type
76      * @param CurrencyRate rate
77      */

78     public void setCurrency (int C_Currency_ID, String JavaDoc CurrencyRateType, BigDecimal CurrencyRate)
79     {
80         if (C_Currency_ID != 0)
81             setC_Currency_ID(C_Currency_ID);
82         if (CurrencyRateType != null && CurrencyRateType.length() != 0)
83             setCurrencyRateType(CurrencyRateType);
84         if (CurrencyRate != null && CurrencyRate.compareTo(Env.ZERO) == 0)
85             setCurrencyRate(CurrencyRate);
86     } // setCurrency
87

88     /**
89      * Set Accounted Amounts
90      * @param AmtAcctDr Dr
91      * @param AmtAcctCr Cr
92      */

93     public void setAmtAcct (BigDecimal AmtAcctDr, BigDecimal AmtAcctCr)
94     {
95         if (AmtAcctDr != null && AmtAcctDr.compareTo(Env.ZERO) != 0)
96             super.setAmtAcctDr(AmtAcctDr);
97         if (AmtAcctCr != null && AmtAcctCr.compareTo(Env.ZERO) != 0)
98             super.setAmtAcctCr(AmtAcctCr);
99     } // setAmtAcct
100

101
102
103 } // MJournalLine
104
Popular Tags