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.module.purap.document;
017    
018    import java.math.BigDecimal;
019    import java.sql.Date;
020    import java.util.List;
021    
022    import org.kuali.kfs.module.purap.PurapWorkflowConstants.NodeDetails;
023    import org.kuali.kfs.module.purap.businessobject.ItemType;
024    import org.kuali.kfs.module.purap.businessobject.PurApItem;
025    import org.kuali.kfs.module.purap.businessobject.Status;
026    import org.kuali.kfs.module.purap.util.PurApItemUtils;
027    import org.kuali.rice.kns.bo.Country;
028    import org.kuali.kfs.sys.document.AccountingDocument;
029    import org.kuali.kfs.vnd.businessobject.VendorAddress;
030    import org.kuali.kfs.vnd.businessobject.VendorDetail;
031    import org.kuali.rice.kns.util.KualiDecimal;
032    
033    
034    /**
035     * Interface for Purchasing-Accounts Payable Documents.
036     */
037    public interface PurchasingAccountsPayableDocument extends AccountingDocument, PurapItemOperations {
038    
039        /**
040         * Returns true if posting year on document is set to use NEXT fiscal year. If set to anything besides NEXT, then return false.
041         * 
042         * @return boolean
043         */
044        public boolean isPostingYearNext();
045    
046        /**
047         * Returns true if posting year on document is set to use PRIOR fiscal year. If set to anything besides PRIOR, then return false.
048         * 
049         * @return boolean
050         */
051        public boolean isPostingYearPrior();
052        
053        /**
054         * If posting year on document is set to use NEXT fiscal year, then return NEXT. If set to anything besides NEXT, then return
055         * CURRENT fiscal year.  This is assuming that the system does not allow the user to set a posting year beyond NEXT. 
056         * 
057         * @return Integer
058         */
059        public Integer getPostingYearNextOrCurrent();
060    
061        /**
062         * Returns the Item Class.
063         * 
064         * @return the Item Class.
065         */
066        public Class getItemClass();
067    
068        /**
069         * Returns the source of this Purchasing Accounts Payable Document if exists.
070         * 
071         * @return the source of this document if exists, else null.
072         */
073        public PurchasingAccountsPayableDocument getPurApSourceDocumentIfPossible();
074    
075        /**
076         * Returns the label of the source of this Purchasing Accounts Payable Document if exists.
077         * 
078         * @return the label of the document source if exists, else null.
079         */
080        public String getPurApSourceDocumentLabelIfPossible();
081    
082        /**
083         * Returns true if this document is stopped in the specified route node.
084         * 
085         * @param nodeDetails the node details of the specified node.
086         * @return true if this document is stopped in the specified route node.
087         */
088        public boolean isDocumentStoppedInRouteNode(NodeDetails nodeDetails);
089    
090        /**
091         * Adds the specified item to this document.
092         * 
093         * @param item the specified item to add.
094         */
095        public void addItem(PurApItem item);
096    
097        /**
098         * Deletes the specified item from this document.
099         * 
100         * @param item the specified item to delete.
101         */
102        public void deleteItem(int lineNum);
103    
104        /**
105         * Renumbers the item starting from the specified index.
106         * 
107         * @param start the index of the starting item to be renumbered.
108         */
109        public void renumberItems(int start);
110    
111        /**
112         * Swaps the specified two items based on their item line numbers (which are one higher than the item positions in the list).
113         * 
114         * @param position1 the position of the first item
115         * @param position2 the position of the second item
116         */
117        public void itemSwap(int position1, int position2);
118    
119        /**
120         * Determines the item line position if the user did not specify the line number on an above the line items before clicking on
121         * the add button. It subtracts the number of the below the line items on the list with the total item list size.
122         * 
123         * @return the item line position of the last (highest) line number of above the line items.
124         */
125        public int getItemLinePosition();
126    
127        /**
128         * Gets the item at the specified index.
129         * 
130         * @param pos the specified index.
131         * @return the item at the specified index.
132         */
133        public PurApItem getItem(int pos);
134    
135        /**
136         * Gets all below the line item types.
137         * 
138         * @return Returns a list of below the line item types.
139         */
140        public String[] getBelowTheLineTypes();
141    
142        /**
143         * Computes the total dollar amount of all items.
144         * 
145         * @return the total dollar amount of all items.
146         */
147        public KualiDecimal getTotalDollarAmount();
148    
149        /**
150         * Sets the total dollar amount to the specified amount.
151         * 
152         * @param the specified total amount.
153         */
154        public void setTotalDollarAmount(KualiDecimal totalDollarAmount);
155    
156        /**
157         * Computes the total dollar amount with the specified item types excluded.
158         * 
159         * @param excludedTypes the types of items to be excluded.
160         * @return the total dollar amount with the specified item types excluded.
161         */
162        public KualiDecimal getTotalDollarAmountAllItems(String[] excludedTypes);
163    
164        public KualiDecimal getTotalDollarAmountAboveLineItems();
165        /**
166         * Computes the pre tax total dollar amount of all items.
167         * 
168         * @return the pre tax total dollar amount of all items.
169         */
170        public KualiDecimal getTotalPreTaxDollarAmount();
171    
172        /**
173         * Sets the pre tax total dollar amount to the specified amount.
174         * 
175         * @param the specified total amount.
176         */
177        public void setTotalPreTaxDollarAmount(KualiDecimal totalDollarAmount);
178    
179        /**
180         * Computes the pre tax total dollar amount with the specified item types excluded.
181         * 
182         * @param excludedTypes the types of items to be excluded.
183         * @return the pre tax total dollar amount with the specified item types excluded.
184         */
185        public KualiDecimal getTotalPreTaxDollarAmountAllItems(String[] excludedTypes);
186    
187        public KualiDecimal getTotalTaxAmount();
188    
189        public void setTotalTaxAmount(KualiDecimal amount);
190    
191        public KualiDecimal getTotalTaxAmountAllItems(String[] excludedTypes);
192    
193        public KualiDecimal getTotalTaxAmountAboveLineItems();
194    
195        public KualiDecimal getTotalTaxAmountAboveLineItems(String[] excludedTypes);
196    
197        public KualiDecimal getTotalTaxAmountWithExclusions(String[] excludedTypes, boolean includeBelowTheLine);
198    
199        /**
200         * Sets vendor address fields based on a given VendorAddress.
201         * 
202         * @param vendorAddress
203         */
204        public void templateVendorAddress(VendorAddress vendorAddress);
205    
206        public Country getVendorCountry();
207    
208        public Status getStatus();
209    
210        public VendorDetail getVendorDetail();
211    
212        public List<PurApItem> getItems();
213    
214        public void setItems(List items);
215    
216        public String getVendorNumber();
217    
218        public void setVendorNumber(String vendorNumber);
219    
220        public Integer getVendorHeaderGeneratedIdentifier();
221    
222        public void setVendorHeaderGeneratedIdentifier(Integer vendorHeaderGeneratedIdentifier);
223    
224        public Integer getVendorDetailAssignedIdentifier();
225    
226        public void setVendorDetailAssignedIdentifier(Integer vendorDetailAssignedIdentifier);
227    
228        public String getVendorCustomerNumber();
229    
230        public void setVendorCustomerNumber(String vendorCustomerNumber);
231    
232        public Integer getPurapDocumentIdentifier();
233    
234        public void setPurapDocumentIdentifier(Integer identifier);
235    
236        public String getStatusCode();
237    
238        public void setStatusCode(String statusCode);
239    
240        public String getVendorCityName();
241    
242        public void setVendorCityName(String vendorCityName);
243    
244        public String getVendorCountryCode();
245    
246        public void setVendorCountryCode(String vendorCountryCode);
247    
248        public String getVendorLine1Address();
249    
250        public void setVendorLine1Address(String vendorLine1Address);
251    
252        public String getVendorLine2Address();
253    
254        public void setVendorLine2Address(String vendorLine2Address);
255    
256        public String getVendorName();
257    
258        public void setVendorName(String vendorName);
259    
260        public String getVendorPostalCode();
261    
262        public void setVendorPostalCode(String vendorPostalCode);
263    
264        public String getVendorStateCode();
265    
266        public void setVendorStateCode(String vendorStateCode);
267        
268        public String getVendorAddressInternationalProvinceName();
269        
270        public void setVendorAddressInternationalProvinceName(String vendorAddressInternationalProvinceName);
271    
272        public Integer getAccountsPayablePurchasingDocumentLinkIdentifier();
273    
274        public void setAccountsPayablePurchasingDocumentLinkIdentifier(Integer accountsPayablePurchasingDocumentLinkIdentifier);
275    
276        public Integer getVendorAddressGeneratedIdentifier();
277    
278        public void setVendorAddressGeneratedIdentifier(Integer vendorAddressGeneratedIdentifier);
279        
280        public boolean isUseTaxIndicator();
281        
282        public void setUseTaxIndicator(boolean useTaxIndicator);
283    
284        public void fixItemReferences();
285        
286        public Date getTransactionTaxDate();
287        
288        public PurApItem getTradeInItem();
289        
290        public KualiDecimal getTotalDollarAmountForTradeIn();
291        
292        public List<PurApItem> getTradeInItems();
293        
294        /**
295         * Always returns true. 
296         * This method is needed here because it's called by some tag files shared with PurAp documents.
297         * @return true.
298         */
299        public boolean getIsATypeOfPurAPRecDoc();
300    
301        /**
302         * Determines whether the document is a type of PurchasingDocument.
303         * @return true if the document is a type of PurchasingDocument.
304         */
305        public boolean getIsATypeOfPurDoc();
306    
307        /**
308         * Determines whether the document is a type of PurchseOrderDocument (including its subclass documents).
309         * @return true if the document is a type of PurchseOrderDocument.
310         */
311        public boolean getIsATypeOfPODoc();
312            
313        /**
314         * Determines whether the document is a PurchaseOrderDocument (excluding its subclass documents).
315         * @return true if the document is a PurchaseOrderDocument.
316         */
317        public boolean getIsPODoc();
318    
319        /**
320         * Determines whether the document is a RequisitionDocument.
321         * @return true if the document is a RequisitionDocument.
322         */
323        public boolean getIsReqsDoc(); 
324    
325        /**
326         * Determines whether the inquiry links should be rendered
327         * for Object Code and Sub Object Code.
328         * 
329         * @return
330         */
331        public boolean isInquiryRendered();
332        
333        public boolean shouldGiveErrorForEmptyAccountsProration();
334    }