KickJava   Java API By Example, From Geeks To Geeks.

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


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.sql.*;
17 import java.util.*;
18
19 import org.compiere.util.*;
20
21 /**
22  * Project Line Model
23  *
24  * @author Jorg Janke
25  * @version $Id: MProjectLine.java,v 1.4 2003/09/07 04:47:40 jjanke Exp $
26  */

27 public class MProjectLine extends X_C_ProjectLine
28 {
29     /**
30      * Standard Constructor
31      * @param ctx context
32      * @param C_ProjectLine_ID id
33      */

34     public MProjectLine (Properties ctx, int C_ProjectLine_ID)
35     {
36         super (ctx, C_ProjectLine_ID);
37         if (C_ProjectLine_ID == 0)
38         {
39         // setC_Project_ID (0);
40
// setC_ProjectLine_ID (0);
41
setLine (0);
42             setIsPrinted(true);
43             setProcessed(false);
44             setInvoicedAmt (Env.ZERO);
45             setInvoicedQty (Env.ZERO);
46             setPlannedAmt (Env.ZERO);
47             setPlannedMarginAmt (Env.ZERO);
48             setPlannedPrice (Env.ZERO);
49             setPlannedQty (Env.ZERO);
50         }
51     } // MProjectLine
52

53     /**
54      * Load Constructor
55      * @param ctx context
56      * @param rs result set
57      */

58     public MProjectLine (Properties ctx, ResultSet rs)
59     {
60         super (ctx, rs);
61     } // MProjectLine
62

63     /**
64      * Parent Constructor
65      * @param project parent
66      */

67     public MProjectLine (MProject project)
68     {
69         this (project.getCtx(), 0);
70         setClientOrg(project.getAD_Client_ID(), project.getAD_Org_ID());
71     // setC_ProjectLine_ID (0); // PK
72
setC_Project_ID (project.getC_Project_ID()); // Parent
73
setLine (getNextLine());
74     } // MProjectLine
75

76     /**
77      * Get the next Line No
78      * @return next line no
79      */

80     private int getNextLine()
81     {
82         return DB.getSQLValue("SELECT COALESCE(MAX(Line),0)+10 FROM C_ProjectLine WHERE C_Project_ID=?", getC_Project_ID());
83     } // getLineFromProject
84

85     /**
86      * Set Product, committed qty, etc.
87      * @param pi project issue
88      */

89     public void setMProjectIssue (MProjectIssue pi)
90     {
91         setC_ProjectIssue_ID(pi.getC_ProjectIssue_ID());
92         setM_Product_ID(pi.getM_Product_ID());
93         setCommittedQty(pi.getMovementQty());
94         if (getDescription() != null)
95             setDescription(pi.getDescription());
96     } // setMProjectIssue
97

98     /**
99      * Set PO
100      * @param C_OrderPO_ID po id
101      */

102     public void setC_OrderPO_ID (int C_OrderPO_ID)
103     {
104         super.setC_OrderPO_ID(C_OrderPO_ID);
105     } // setC_OrderPO_ID
106

107 } // MProjectLine
108
Popular Tags