001    /*
002     * Copyright 2011 The Kuali Foundation.
003     * 
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     * http://www.opensource.org/licenses/ecl2.php
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.kfs.fp.businessobject;
017    
018    import java.sql.Timestamp;
019    import java.util.LinkedHashMap;
020    
021    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
022    import org.kuali.rice.kns.util.KualiDecimal;
023    
024    /**
025     * This class represents an Internal Billing Item business object.
026     */
027    public class InternalBillingItem extends PersistableBusinessObjectBase {
028    
029        private static final long serialVersionUID = -2830091652446423539L;
030        private String documentNumber;
031        private Integer itemSequenceId;
032        private String itemStockNumber;
033        private String itemStockDescription;
034        private Timestamp itemServiceDate;
035        private Integer itemQuantity;
036        private KualiDecimal itemUnitAmount;
037        private String unitOfMeasureCode;
038    
039        /**
040         * Constructs a InternalBillingItem.
041         */
042        public InternalBillingItem() {
043            setItemUnitAmount(KualiDecimal.ZERO);
044        }
045    
046    
047        /**
048         * Gets the documentNumber attribute.
049         * 
050         * @return Returns the documentNumber.
051         */
052        public String getDocumentNumber() {
053            return documentNumber;
054        }
055    
056    
057        /**
058         * Sets the documentNumber attribute value.
059         * 
060         * @param documentNumber The documentNumber to set.
061         */
062        public void setDocumentNumber(String documentNumber) {
063            this.documentNumber = documentNumber;
064        }
065    
066    
067        /**
068         * Gets the itemQuantity attribute.
069         * 
070         * @return Returns the itemQuantity.
071         */
072        public Integer getItemQuantity() {
073            return itemQuantity;
074        }
075    
076    
077        /**
078         * Sets the itemQuantity attribute value.
079         * 
080         * @param itemQuantity The itemQuantity to set.
081         */
082        public void setItemQuantity(Integer itemQuantity) {
083            this.itemQuantity = itemQuantity;
084        }
085    
086    
087        /**
088         * Gets the itemSequenceId attribute.
089         * 
090         * @return Returns the itemSequenceId.
091         */
092        public Integer getItemSequenceId() {
093            return itemSequenceId;
094        }
095    
096    
097        /**
098         * Sets the itemSequenceId attribute value.
099         * 
100         * @param itemSequenceId The itemSequenceId to set.
101         */
102        public void setItemSequenceId(Integer itemSequenceId) {
103            this.itemSequenceId = itemSequenceId;
104        }
105    
106    
107        /**
108         * Gets the itemServiceDate attribute.
109         * 
110         * @return Returns the itemServiceDate.
111         */
112        public Timestamp getItemServiceDate() {
113            return itemServiceDate;
114        }
115    
116    
117        /**
118         * Sets the itemServiceDate attribute value.
119         * 
120         * @param itemServiceDate The itemServiceDate to set.
121         */
122        public void setItemServiceDate(Timestamp itemServiceDate) {
123            this.itemServiceDate = itemServiceDate;
124        }
125    
126    
127        /**
128         * Gets the itemStockDescription attribute.
129         * 
130         * @return Returns the itemStockDescription.
131         */
132        public String getItemStockDescription() {
133            return itemStockDescription;
134        }
135    
136    
137        /**
138         * Sets the itemStockDescription attribute value.
139         * 
140         * @param itemStockDescription The itemStockDescription to set.
141         */
142        public void setItemStockDescription(String itemStockDescription) {
143            this.itemStockDescription = itemStockDescription;
144        }
145    
146    
147        /**
148         * Gets the itemStockNumber attribute.
149         * 
150         * @return Returns the itemStockNumber.
151         */
152        public String getItemStockNumber() {
153            return itemStockNumber;
154        }
155    
156    
157        /**
158         * Sets the itemStockNumber attribute value.
159         * 
160         * @param itemStockNumber The itemStockNumber to set.
161         */
162        public void setItemStockNumber(String itemStockNumber) {
163            this.itemStockNumber = itemStockNumber;
164        }
165    
166    
167        /**
168         * Gets the itemUnitAmount attribute.
169         * 
170         * @return Returns the itemUnitAmount.
171         */
172        public KualiDecimal getItemUnitAmount() {
173            return itemUnitAmount;
174        }
175    
176    
177        /**
178         * Sets the itemUnitAmount attribute value.
179         * 
180         * @param itemUnitAmount The itemUnitAmount to set.
181         */
182        public void setItemUnitAmount(KualiDecimal itemUnitAmount) {
183            this.itemUnitAmount = itemUnitAmount;
184        }
185    
186    
187        /**
188         * Gets the unitOfMeasureCode attribute.
189         * 
190         * @return Returns the unitOfMeasureCode.
191         */
192        public String getUnitOfMeasureCode() {
193            return unitOfMeasureCode;
194        }
195    
196    
197        /**
198         * Sets the unitOfMeasureCode attribute value.
199         * 
200         * @param unitOfMeasureCode The unitOfMeasureCode to set.
201         */
202        public void setUnitOfMeasureCode(String unitOfMeasureCode) {
203            this.unitOfMeasureCode = unitOfMeasureCode;
204        }
205    
206    
207        /**
208         * @return the total amount for this item
209         */
210        public KualiDecimal getTotal() {
211            KualiDecimal total = new KualiDecimal(itemQuantity.toString());
212            return total.multiply(itemUnitAmount);
213        }
214    
215    
216        /**
217         * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
218         */
219        protected LinkedHashMap toStringMapper() {
220            LinkedHashMap m = new LinkedHashMap();
221    
222            m.put("docHeaderId", getDocumentNumber());
223            m.put("itemSequenceId", getItemSequenceId());
224    
225            return m;
226        }
227    }