001: /*
002: * Copyright 2006-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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.module.purap;
017:
018: import java.util.Arrays;
019: import java.util.Collections;
020: import java.util.HashMap;
021: import java.util.HashSet;
022: import java.util.Map;
023: import java.util.Set;
024:
025: import org.apache.commons.lang.StringUtils;
026: import org.kuali.RicePropertyConstants;
027: import org.kuali.core.JstlConstants;
028: import org.kuali.core.util.KualiDecimal;
029: import org.kuali.kfs.KFSConstants;
030: import org.kuali.kfs.KFSPropertyConstants;
031: import org.kuali.module.purap.bo.PurchaseOrderAccount;
032: import org.kuali.module.purap.bo.PurchaseOrderItem;
033: import org.kuali.module.purap.bo.PurchaseOrderVendorQuote;
034: import org.kuali.module.purap.document.CreditMemoDocument;
035: import org.kuali.module.purap.document.PaymentRequestDocument;
036: import org.kuali.module.purap.document.PurchaseOrderDocument;
037: import org.kuali.module.purap.document.PurchasingAccountsPayableDocumentBase;
038: import org.kuali.module.purap.document.RequisitionDocument;
039:
040: /**
041: * Holds constants for PURAP.
042: */
043: public class PurapConstants extends JstlConstants {
044:
045: // special user used in the special ap cancel action
046: public static final String SYSTEM_AP_USER = KFSConstants.SYSTEM_USER;
047:
048: public static final KualiDecimal HUNDRED = new KualiDecimal(100);
049:
050: public static final String B2_B_ALLOW_COPY_DAYS = "B2_B_ALLOW_COPY_DAYS";
051:
052: public static final String DEFAULT_FUNDING_SOURCE = "DEFAULT_FUNDING_SOURCE";
053:
054: /*
055: * THIS CODE IS NOT USED IN RELEASE 2 BUT THE CODE WAS LEFT IN TO
056: * FACILITATE TURNING IT BACK ON EARLY IN THE DEVELOPMENT CYCLE OF RELEASE 3.
057: */
058: // STANDARD PARAMETER PREFIXES
059: public static class QuoteTypes {
060: public static final String COMPETITIVE = "COMP";
061: public static final String PRICE_CONFIRMATION = "CONF";
062: }
063:
064: /*
065: * THIS CODE IS NOT USED IN RELEASE 2 BUT THE CODE WAS LEFT IN TO
066: * FACILITATE TURNING IT BACK ON EARLY IN THE DEVELOPMENT CYCLE OF RELEASE 3.
067: */
068: public static class QuoteTransmitTypes {
069: public static final String PRINT = "PRINT";
070: }
071:
072: /*
073: * THIS CODE IS NOT USED IN RELEASE 2 BUT THE CODE WAS LEFT IN TO
074: * FACILITATE TURNING IT BACK ON EARLY IN THE DEVELOPMENT CYCLE OF RELEASE 3.
075: */
076: public static class QuoteStatusCode {
077: public static final String DELV = "DELV";
078: public static final String FUIP = "FUIP";
079: public static final String IIQ = "IIQ";
080: public static final String LEXP = "LEXP";
081: public static final String MULT = "MULT";
082: public static final String NORS = "NORS";
083: public static final String PTFE = "PTFE";
084: public static final String RECV = "RECV";
085: public static final String RIR = "RIR";
086: public static final String RECL = "RECL";
087: public static final String RNLB = "RNLB";
088: public static final String RNLN = "RNLN";
089: public static final String NOBD = "NOBD";
090: public static final String SQNA = "SQNA";
091: public static final String TINC = "TINC";
092: }
093:
094: public static final String NOTE_TAB_WARNING = "noteWarning";
095:
096: public static final String QUESTION_INDEX = "questionIndex";
097: public static final String REMOVE_ACCOUNTS_QUESTION = "RemoveAccounts";
098: public static final String QUESTION_ROUTE_DOCUMENT_TO_COMPLETE = "Completing this document will remove it from your Action List.<br/><br/> Are you sure you want to continue?";
099: public static final String QUESTION_REMOVE_ACCOUNTS = "question.document.purap.removeAccounts";
100:
101: public static final String REQ_REASON_NOT_APO = "Requisition did not become an APO because: ";
102: public static final String REQ_UNABLE_TO_CREATE_NOTE = "Unable to create a note on this document.";
103:
104: // Delivery Tag
105: public static final String DELIVERY_BUILDING_OTHER = "Other";
106: public static final String DELIVERY_BUILDING_OTHER_CODE = "OTH";
107:
108: // PDF KFSConstants
109: public static final String IMAGE_TEMP_PATH = "PDF_IMAGE_TEMP_PATH";
110: public static final String PDF_DIRECTORY = "PDF_DIRECTORY";
111: public static final String STATUS_INQUIRY_URL = "PDF_STATUS_INQUIRY_URL";
112: public static final String PURCHASING_DIRECTOR_IMAGE_PREFIX = "PDF_DIRECTOR_IMAGE_PREFIX";
113: public static final String PURCHASING_DIRECTOR_IMAGE_EXTENSION = "PDF_DIRECTOR_IMAGE_EXTENSION";
114: public static final String CONTRACT_MANAGER_IMAGE_PREFIX = "PDF_IMAGE_PREFIX";
115: public static final String CONTRACT_MANAGER_IMAGE_EXTENSION = "PDF_IMAGE_EXTENSION";
116: public static final String LOGO_IMAGE_PREFIX = "PDF_LOGO_IMAGE_PREFIX";
117: public static final String LOGO_IMAGE_EXTENSION = "PDF_LOGO_IMAGE_EXTENSION";
118: public static final String PDF_IMAGES_AVAILABLE_INDICATOR = "PDF_IMAGES_AVAILABLE_IND";
119:
120: public static class RequisitionStatuses {
121: public static final String IN_PROCESS = "INPR";
122: public static final String CANCELLED = "CANC";
123: public static final String CLOSED = "CLOS";
124: public static final String AWAIT_CONTENT_REVIEW = "ACNT";
125: public static final String AWAIT_SUB_ACCT_REVIEW = "ASUB";
126: public static final String AWAIT_FISCAL_REVIEW = "AFIS";
127: public static final String AWAIT_CHART_REVIEW = "ACHA";
128: public static final String AWAIT_SEP_OF_DUTY_REVIEW = "ASOD";
129: public static final String DAPRVD_CONTENT = "DCNT";
130: public static final String DAPRVD_SUB_ACCT = "DSUB";
131: public static final String DAPRVD_FISCAL = "DFIS";
132: public static final String DAPRVD_CHART = "DCHA";
133: public static final String DAPRVD_SEP_OF_DUTY = "DSOD";
134: public static final String AWAIT_CONTRACT_MANAGER_ASSGN = "ACMR";
135:
136: }
137:
138: public static class POCostSources {
139: public static final String ESTIMATE = "EST";
140: }
141:
142: public static final class POTransmissionMethods {
143: public static final String FAX = "FAX";
144: public static final String PRINT = "PRIN";
145: public static final String NOPRINT = "NOPR";
146: public static final String ELECTRONIC = "ELEC";
147: }
148:
149: public static final String REQ_B2B_ALLOW_COPY_DAYS = "5";
150:
151: public static class RequisitionSources {
152: public static final String STANDARD_ORDER = "STAN";
153: public static final String B2B = "B2B";
154: }
155:
156: // PURCHASE ORDER VENDOR CHOICE CODES
157: public static class VendorChoice {
158: public static final String CONTRACTED_PRICE = "CONT";
159: public static final String SMALL_ORDER = "SMAL";
160: public static final String PROFESSIONAL_SERVICE = "PROF";
161: public static final String SUBCONTRACT = "SUBC";
162: }
163:
164: public static Integer APO_CONTRACT_MANAGER = new Integer(99);
165:
166: // Requisition/Purchase Order Tab Errors
167: public static final String DELIVERY_TAB_ERRORS = "document.delivery*";
168: public static final String VENDOR_ERRORS = "document.vendor*,document.purchaseOrderVendorChoiceCode";
169: public static final String ADDITIONAL_TAB_ERRORS = "document.requestor*,document.purchaseOrderTransmissionMethodCode,document.chartOfAccountsCode,document.organizationCode,document.purchaseOrderCostSourceCode,document.purchaseOrderTotalLimit";
170: public static final String ITEM_TAB_ERRORS = "document.item*,accountDistribution*,newPurchasingItemLine*,itemQuantity";
171: public static final String ITEM_TAB_ERROR_PROPERTY = ITEM_TAB_ERRORS; // used to be "newPurchasingItemLine"
172: public static final String ACCOUNT_SUMMARY_TAB_ERRORS = "document.accountSummary*";
173: public static final String ACCOUNT_DISTRIBUTION_ERROR_KEY = "accountDistribution";
174: public static final String RELATED_DOCS_TAB_ERRORS = "";
175: public static final String PAYMENT_HISTORY_TAB_ERRORS = "";
176: public static final String PAYMENT_INFO_ERRORS = "document.paymentInfo";
177: public static final String PAYMENT_INFO_TAB_ERRORS = "document.paymentInfo*,document.purchaseOrderBeginDate,document.purchaseOrderEndDate";
178:
179: // PO/Quotes Tab Constants
180: public static final String QUOTE_TAB_ERRORS = "document.quote*,quote*,purchaseOrderVendorQuotes*";
181:
182: // Assign Contract Manager
183: public static final String ASSIGN_CONTRACT_MANAGER_DEFAULT_DESC = "Contract Manager Assigned";
184: public static final String ASSIGN_CONTRACT_MANAGER_TAB_ERRORS = "document.unassignedRequisition*";
185:
186: public static class PurchaseOrderStatuses {
187: public static final String IN_PROCESS = "INPR";
188: public static final String WAITING_FOR_VENDOR = "WVEN";
189: public static final String WAITING_FOR_DEPARTMENT = "WDPT";
190: public static final String OPEN = "OPEN";
191: public static final String CLOSED = "CLOS";
192: public static final String CANCELLED = "CANC";
193: public static final String PAYMENT_HOLD = "PHOL";
194: public static final String AWAIT_TAX_REVIEW = "WTAX";
195: public static final String AWAIT_BUDGET_REVIEW = "WBUD";
196: public static final String AWAIT_CONTRACTS_GRANTS_REVIEW = "WCG";
197: public static final String AWAIT_PURCHASING_REVIEW = "WPUR";
198: public static final String DAPRVD_TAX = "DTAX";
199: public static final String DAPRVD_BUDGET = "DBUD";
200: public static final String DAPRVD_CONTRACTS_GRANTS = "DCG";
201: public static final String DAPRVD_PURCHASING = "DPUR";
202: public static final String CXML_ERROR = "CXER";
203: public static final String PENDING_CXML = "CXPE";
204: public static final String PENDING_FAX = "FXPE";
205: public static final String PENDING_PRINT = "PRPE";
206: public static final String QUOTE = "QUOT";
207: public static final String VOID = "VOID";
208: public static final String AMENDMENT = "AMND";
209:
210: public static final String RETIRED_VERSION = "RTVN";
211: public static final String CHANGE_IN_PROCESS = "CGIN";
212: public static final String CANCELLED_CHANGE = "CNCG";
213: public static final String DISAPPROVED_CHANGE = "DACG";
214: public static final String PENDING_VOID = "VOPE";
215: public static final String PENDING_PAYMENT_HOLD = "PHPE";
216: public static final String PENDING_RETRANSMIT = "RTPE";
217: public static final String PENDING_CLOSE = "CLPE";
218: public static final String PENDING_REOPEN = "ROPE";
219: public static final String PENDING_REMOVE_HOLD = "RHPE";
220:
221: public static final Set<String> INCOMPLETE_STATUSES = new HashSet<String>();
222: static {
223: INCOMPLETE_STATUSES.add(AWAIT_TAX_REVIEW);
224: INCOMPLETE_STATUSES.add(AWAIT_BUDGET_REVIEW);
225: INCOMPLETE_STATUSES.add(AWAIT_CONTRACTS_GRANTS_REVIEW);
226: INCOMPLETE_STATUSES.add(AWAIT_PURCHASING_REVIEW);
227: INCOMPLETE_STATUSES.add(QUOTE);
228: INCOMPLETE_STATUSES.add(CXML_ERROR);
229: INCOMPLETE_STATUSES.add(PENDING_CXML);
230: INCOMPLETE_STATUSES.add(IN_PROCESS);
231: INCOMPLETE_STATUSES.add(PAYMENT_HOLD);
232: INCOMPLETE_STATUSES.add(PENDING_FAX);
233: INCOMPLETE_STATUSES.add(PENDING_PRINT);
234: INCOMPLETE_STATUSES.add(WAITING_FOR_VENDOR);
235: INCOMPLETE_STATUSES.add(WAITING_FOR_DEPARTMENT);
236: }
237:
238: /**
239: * Do not include 'OPEN' status in this map. The 'OPEN' status is the default status that is set when no status exists for a
240: * particular pending transmission type code.
241: *
242: * @see {@link org.kuali.module.purap.service.PurchaseOrderService#completePurchaseOrder(org.kuali.module.purap.document.PurchaseOrderDocument)}
243: */
244: private static final Map<String, String> getStatusesByTransmissionType() {
245: Map<String, String> statusByTrans = new HashMap<String, String>();
246: statusByTrans.put(
247: PurapConstants.POTransmissionMethods.PRINT,
248: PENDING_PRINT);
249: statusByTrans.put(
250: PurapConstants.POTransmissionMethods.ELECTRONIC,
251: PENDING_CXML);
252: statusByTrans.put(PurapConstants.POTransmissionMethods.FAX,
253: PENDING_FAX);
254: return Collections.unmodifiableMap(statusByTrans);
255: }
256:
257: public static final Map<String, String> STATUSES_BY_TRANSMISSION_TYPE = getStatusesByTransmissionType();
258:
259: }
260:
261: public static final class ItemTypeCodes {
262: // ITEM TYPES
263: public static final String ITEM_TYPE_ITEM_CODE = "ITEM";
264: public static final String ITEM_TYPE_SERVICE_CODE = "SRVC";
265: public static final String ITEM_TYPE_FREIGHT_CODE = "FRHT";
266: public static final String ITEM_TYPE_SHIP_AND_HAND_CODE = "SPHD";
267: public static final String ITEM_TYPE_TRADE_IN_CODE = "TRDI";
268: public static final String ITEM_TYPE_ORDER_DISCOUNT_CODE = "ORDS";
269: public static final String ITEM_TYPE_MIN_ORDER_CODE = "MNOR";
270: public static final String ITEM_TYPE_MISC_CODE = "MISC";
271: public static final String ITEM_TYPE_PMT_TERMS_DISCOUNT_CODE = "DISC";
272: public static final String ITEM_TYPE_FEDERAL_TAX_CODE = "FDTX";
273: public static final String ITEM_TYPE_STATE_TAX_CODE = "STTX";
274: public static final String ITEM_TYPE_FEDERAL_GROSS_CODE = "FDGR";
275: public static final String ITEM_TYPE_STATE_GROSS_CODE = "STGR";
276: public static final String ITEM_TYPE_RESTCK_FEE_CODE = "RSTO";
277: public static final String ITEM_TYPE_MISC_CRDT_CODE = "MSCR";
278:
279: }
280:
281: // Item constants
282: public static final int DOLLAR_AMOUNT_MIN_SCALE = 2;
283: public static final int UNIT_PRICE_MAX_SCALE = 4;
284: public static final int PREQ_DESC_LENGTH = 500;
285: public static final String PREQ_DISCOUNT_MULT = "-0.01";
286:
287: public static class PurchaseOrderDocTypes {
288: public static final String PURCHASE_ORDER_REOPEN_DOCUMENT = "PurchaseOrderReopenDocument";
289: public static final String PURCHASE_ORDER_CLOSE_DOCUMENT = "PurchaseOrderCloseDocument";
290: public static final String PURCHASE_ORDER_DOCUMENT = "PurchaseOrderDocument";
291: public static final String PURCHASE_ORDER_RETRANSMIT_DOCUMENT = "PurchaseOrderRetransmitDocument";
292: public static final String PURCHASE_ORDER_PRINT_DOCUMENT = "PurchaseOrderPrintDocument";
293: public static final String PURCHASE_ORDER_VOID_DOCUMENT = "PurchaseOrderVoidDocument";
294: public static final String PURCHASE_ORDER_PAYMENT_HOLD_DOCUMENT = "PurchaseOrderPaymentHoldDocument";
295: public static final String PURCHASE_ORDER_REMOVE_HOLD_DOCUMENT = "PurchaseOrderRemoveHoldDocument";
296: public static final String PURCHASE_ORDER_AMENDMENT_DOCUMENT = "PurchaseOrderAmendmentDocument";
297: }
298:
299: public static class PODocumentsStrings {
300: public static final String CLOSE_QUESTION = "POClose";
301: public static final String CLOSE_CONFIRM = "POCloseConfirm";
302: public static final String CLOSE_NOTE_PREFIX = "Note entered while closing a Purchase Order :";
303:
304: public static final String REOPEN_PO_QUESTION = "ReopenPO";
305: public static final String CONFIRM_REOPEN_QUESTION = "ConfirmReopen";
306: public static final String REOPEN_NOTE_PREFIX = "Note entered while reopening a Purchase Order : ";
307:
308: public static final String VOID_QUESTION = "POVoid";
309: public static final String VOID_CONFIRM = "POVoidConfirm";
310: public static final String VOID_NOTE_PREFIX = "Note entered while voiding a Purchase Order :";
311:
312: public static final String PAYMENT_HOLD_QUESTION = "POPaymentHold";
313: public static final String PAYMENT_HOLD_CONFIRM = "POPaymentHoldConfirm";
314: public static final String PAYMENT_HOLD_NOTE_PREFIX = "Note entered while putting a Purchase Order on payment hold :";
315:
316: public static final String REMOVE_HOLD_QUESTION = "PORemoveHold";
317: public static final String REMOVE_HOLD_CONFIRM = "PORemoveHoldConfirm";
318: public static final String REMOVE_HOLD_NOTE_PREFIX = "Note entered while removing a Purchase Order from payment hold :";
319: public static final String REMOVE_HOLD_FYI = "This document was taken off Payment Hold status.";
320:
321: public static final String AMENDMENT_PO_QUESTION = "AmendmentPO";
322: public static final String CONFIRM_AMENDMENT_QUESTION = "ConfirmAmendment";
323: public static final String AMENDMENT_NOTE_PREFIX = "Note entered while amending a Purchase Order : ";
324:
325: public static final String CONFIRM_AWARD_QUESTION = "POConfirmAward";
326: public static final String CONFIRM_AWARD_RETURN = "completeQuote";
327:
328: public static final String CONFIRM_CANCEL_QUESTION = "POCancelQuote";
329: public static final String CONFIRM_CANCEL_RETURN = "cancelQuote";
330:
331: public static final String SINGLE_CONFIRMATION_QUESTION = "singleConfirmationQuestion";
332:
333: public static final String MANUAL_STATUS_CHANGE_QUESTION = "manualStatusChangeQuestion";
334: public static final String OPEN_STATUS = "Open";
335: }
336:
337: public static final String PO_OVERRIDE_NOT_TO_EXCEED_QUESTION = "OverrideNotToExceed";
338:
339: // ACCOUNTS PAYABLE
340: public static final String AP_OVERRIDE_INVOICE_NOMATCH_QUESTION = "OverrideInvoiceNoMatch";
341:
342: public static class AccountsPayableDocumentStrings {
343: public static final String CANCEL_NOTE_PREFIX = "Note entered while canceling document: ";
344: }
345:
346: // PAYMENT REQUEST
347: public static final String PAYMENT_REQUEST_ACTION_NAME = "PaymentRequest";
348: public static final int PREQ_PAY_DATE_DEFAULT_NUMBER_OF_DAYS = 10;
349: public static final String PREQ_PAY_DATE_DAYS = "days";
350: public static final String PREQ_PAY_DATE_DATE = "date";
351: public static final int PREQ_PAY_DATE_EMPTY_TERMS_DEFAULT_DAYS = 28;
352: public static final int PREQ_PAY_DATE_DAYS_BEFORE_WARNING = 60;
353:
354: // Weird PaymentTermsType is due on either the 10th or 25th with no discount
355: public static final String PMT_TERMS_TYP_NO_DISCOUNT_CD = "00N2T";
356:
357: public static final String PURAP_AP_SHOW_CONTINUATION_ACCOUNT_WARNING_FISCAL_OFFICERS = "SHOW_CONTINUATION_ACCOUNT_WARNING_FISCAL_OFFICERS_IND";
358: public static final String PURAP_AP_SHOW_CONTINUATION_ACCOUNT_WARNING_AP_USERS = "SHOW_CONTINUATION_ACCOUNT_WARNING_AP_USERS_IND";
359:
360: public static final class PaymentRequestIndicatorText {
361: public static final String HOLD = "HOLD";
362: public static final String REQUEST_CANCEL = "REQUEST CANCEL";
363: }
364:
365: public static final class PaymentRequestStatuses {
366: public static final String INITIATE = "INIT";
367: public static final String IN_PROCESS = "INPR";
368: public static final String CANCELLED_IN_PROCESS = "CIPR";
369: public static final String CANCELLED_PRIOR_TO_AP_APPROVAL = "VOID";
370: public static final String CANCELLED_POST_AP_APPROVE = "CANC";
371: public static final String DEPARTMENT_APPROVED = "DPTA";
372: public static final String AUTO_APPROVED = "AUTO";
373: public static final String AWAITING_ACCOUNTS_PAYABLE_REVIEW = "APAD"; // Waiting for Accounts Payable approval
374: public static final String AWAITING_SUB_ACCT_MGR_REVIEW = "ASAA"; // Waiting for Sub Acct Manager approval
375: public static final String AWAITING_FISCAL_REVIEW = "AFOA"; // Waiting for Fiscal Officer approval
376: public static final String AWAITING_ORG_REVIEW = "ACHA"; // Waiting for Chart/Org approval
377: public static final String AWAITING_TAX_REVIEW = "ATAX"; // Waiting for Vendor Tax approval
378:
379: // keep these in the order of potential routing
380: // Note it doesn't make much sense to compare auto_approved and dept_approved but this is
381: // easier than two enums plus this should primarily be used for user enterred areas
382: public enum STATUS_ORDER {
383: CANCELLED_IN_PROCESS(
384: PurapConstants.PaymentRequestStatuses.CANCELLED_IN_PROCESS,
385: false), CANCELLED_PRIOR_TO_AP_APPROVAL(
386: PurapConstants.PaymentRequestStatuses.CANCELLED_PRIOR_TO_AP_APPROVAL,
387: false), CANCELLED_POST_AP_APPROVE(
388: PurapConstants.PaymentRequestStatuses.CANCELLED_POST_AP_APPROVE,
389: false), INITIATE(
390: PurapConstants.PaymentRequestStatuses.INITIATE,
391: true), IN_PROCESS(
392: PurapConstants.PaymentRequestStatuses.IN_PROCESS,
393: true), AWAITING_ACCOUNTS_PAYABLE_REVIEW(
394: PurapConstants.PaymentRequestStatuses.AWAITING_ACCOUNTS_PAYABLE_REVIEW,
395: false), AWAITING_SUB_ACCT_MGR_REVIEW(
396: PurapConstants.PaymentRequestStatuses.AWAITING_SUB_ACCT_MGR_REVIEW,
397: false), AWAITING_FISCAL_REVIEW(
398: PurapConstants.PaymentRequestStatuses.AWAITING_FISCAL_REVIEW,
399: false), AWAITING_ORG_REVIEW(
400: PurapConstants.PaymentRequestStatuses.AWAITING_ORG_REVIEW,
401: false), AWAITING_TAX_REVIEW(
402: PurapConstants.PaymentRequestStatuses.AWAITING_TAX_REVIEW,
403: false), DEPARTMENT_APPROVED(
404: PurapConstants.PaymentRequestStatuses.DEPARTMENT_APPROVED,
405: false), AUTO_APPROVED(
406: PurapConstants.PaymentRequestStatuses.AUTO_APPROVED,
407: false), ;
408:
409: private String statusCode = new String();
410: private boolean fullEntryAllowed = false;
411:
412: STATUS_ORDER(String statusCode, boolean fullEntry) {
413: this .statusCode = statusCode;
414: this .fullEntryAllowed = fullEntry;
415: }
416:
417: public static STATUS_ORDER getByStatusCode(String statusCode) {
418: for (STATUS_ORDER status : STATUS_ORDER.values()) {
419: if (StringUtils.equals(status.statusCode,
420: statusCode)) {
421: return status;
422: }
423: }
424: return null;
425: }
426:
427: public static boolean isFullDocumentEntryCompleted(
428: String status) {
429: return !getByStatusCode(status).fullEntryAllowed;
430: }
431:
432: public static STATUS_ORDER getPreviousStatus(
433: String statusCode) {
434: STATUS_ORDER statusOrder = STATUS_ORDER
435: .getByStatusCode(statusCode);
436: if (statusOrder.ordinal() > 0) {
437: return STATUS_ORDER.values()[statusOrder.ordinal() - 1];
438: }
439: return null;
440: }
441:
442: public static boolean isFirstFullEntryStatus(
443: String statusCode) {
444: // NOTE this won't work if there endsup being two ways to get to the first full entry status (i.e. like AUTO/DEPT
445: // for final)
446: return getByStatusCode(statusCode).fullEntryAllowed
447: && !getPreviousStatus(statusCode).fullEntryAllowed;
448: }
449: }
450:
451: public static final String[] PREQ_STATUSES_FOR_AUTO_APPROVE = {
452: AWAITING_SUB_ACCT_MGR_REVIEW, AWAITING_FISCAL_REVIEW,
453: AWAITING_ORG_REVIEW };
454:
455: public static final String[] STATUSES_ALLOWED_FOR_EXTRACTION = {
456: AUTO_APPROVED, DEPARTMENT_APPROVED };
457:
458: public static final Set CANCELLED_STATUSES = new HashSet();
459: public static final Set STATUSES_DISALLOWING_HOLD = new HashSet();
460: public static final Set STATUSES_DISALLOWING_REMOVE_HOLD = new HashSet();
461: public static final Set STATUSES_DISALLOWING_REQUEST_CANCEL = new HashSet();
462: public static final Set STATUSES_DISALLOWING_REMOVE_REQUEST_CANCEL = new HashSet();
463: static {
464: CANCELLED_STATUSES.add(CANCELLED_IN_PROCESS);
465: CANCELLED_STATUSES.add(CANCELLED_PRIOR_TO_AP_APPROVAL);
466: CANCELLED_STATUSES.add(CANCELLED_POST_AP_APPROVE);
467:
468: STATUSES_DISALLOWING_HOLD.add(INITIATE);
469: STATUSES_DISALLOWING_HOLD.add(IN_PROCESS);
470: STATUSES_DISALLOWING_HOLD.addAll(Arrays
471: .asList(CANCELLED_STATUSES
472: .toArray(new String[CANCELLED_STATUSES
473: .size()])));
474:
475: STATUSES_DISALLOWING_REMOVE_HOLD.addAll(Arrays
476: .asList(CANCELLED_STATUSES
477: .toArray(new String[CANCELLED_STATUSES
478: .size()])));
479:
480: STATUSES_DISALLOWING_REQUEST_CANCEL.add(INITIATE);
481: STATUSES_DISALLOWING_REQUEST_CANCEL.add(IN_PROCESS);
482: STATUSES_DISALLOWING_REQUEST_CANCEL
483: .add(DEPARTMENT_APPROVED);
484: STATUSES_DISALLOWING_REQUEST_CANCEL.add(AUTO_APPROVED);
485: STATUSES_DISALLOWING_REQUEST_CANCEL.addAll(Arrays
486: .asList(CANCELLED_STATUSES
487: .toArray(new String[CANCELLED_STATUSES
488: .size()])));
489:
490: STATUSES_DISALLOWING_REMOVE_REQUEST_CANCEL.addAll(Arrays
491: .asList(CANCELLED_STATUSES
492: .toArray(new String[CANCELLED_STATUSES
493: .size()])));
494: }
495: }
496:
497: public static class PREQDocumentsStrings {
498: public static final String DUPLICATE_INVOICE_QUESTION = "PREQDuplicateInvoice";
499: public static final String HOLD_PREQ_QUESTION = "HoldPREQ";
500: public static final String CONFIRM_HOLD_QUESTION = "ConfirmHold";
501: public static final String HOLD_NOTE_PREFIX = "Note entered while placing Payment Request on hold : ";
502: public static final String REMOVE_HOLD_PREQ_QUESTION = "RemoveHoldPREQ";
503: public static final String CONFIRM_REMOVE_HOLD_QUESTION = "ConfirmRemoveHold";
504: public static final String REMOVE_HOLD_NOTE_PREFIX = "Note entered while removing a hold on Payment Request : ";
505: public static final String CANCEL_PREQ_QUESTION = "CancelPREQ";
506: public static final String CONFIRM_CANCEL_QUESTION = "ConfirmCancel";
507: public static final String CANCEL_NOTE_PREFIX = "Note entered while requesting cancel on Payment Request : ";
508: public static final String REMOVE_CANCEL_PREQ_QUESTION = "RemoveCancelPREQ";
509: public static final String CONFIRM_REMOVE_CANCEL_QUESTION = "ConfirmRemoveCancel";
510: public static final String REMOVE_CANCEL_NOTE_PREFIX = "Note entered while removing a request cancel on Payment Request : ";
511: public static final String PURCHASE_ORDER_ID = "Purchase Order Identifier";
512: public static final String INVOICE_DATE = "Invoice Date";
513: public static final String INVOICE_NUMBER = "Invoice Number";
514: public static final String IN_PROCESS = "In Process";
515: public static final String THRESHOLD_DAYS_OVERRIDE_QUESTION = "Threshold Days Override Question";
516: public static final String VENDOR_INVOICE_AMOUNT = "Vendor Invoice Amount";
517: public static final String VENDOR_STATE = "State";
518: public static final String VENDOR_POSTAL_CODE = "Postal Code";
519: }
520:
521: public static final String BELOW_THE_LINES_PARAMETER = "BELOW_THE_LINE_ITEM_TYPES";
522: public static final String ITEM_ALLOWS_ZERO = "ITEM_TYPES_ALLOWING_ZERO";
523: public static final String ITEM_ALLOWS_POSITIVE = "ITEM_TYPES_ALLOWING_POSITIVE";
524: public static final String ITEM_ALLOWS_NEGATIVE = "ITEM_TYPES_ALLOWING_NEGATIVE";
525: public static final String ITEM_REQUIRES_USER_ENTERED_DESCRIPTION = "ITEM_TYPES_REQUIRING_USER_ENTERED_DESCRIPTION";
526:
527: public static class ItemFields {
528: public static final String QUANTITY = "Quantity";
529: public static final String UNIT_OF_MEASURE = "Unit of Measure";
530: public static final String DESCRIPTION = "Description";
531: public static final String UNIT_COST = "Unit Cost";
532: public static final String INVOICE_QUANTITY = "Qty Invoiced";
533: public static final String OPEN_QUANTITY = "Open Qty";
534: public static final String INVOICE_EXTENDED_PRICE = "Total Inv Cost";
535: }
536:
537: // CREDIT MEMO DOCUMENT
538: public static final String CREDIT_MEMO_ACTION_NAME = "CreditMemo";
539:
540: public static class CreditMemoStatuses {
541: public static final String INITIATE = "INIT";
542: public static final String IN_PROCESS = "INPR";
543: public static final String CANCELLED_IN_PROCESS = "CIPR";
544: public static final String CANCELLED_PRIOR_TO_AP_APPROVAL = "VOID";
545: public static final String CANCELLED_POST_AP_APPROVE = "CANC";
546: public static final String COMPLETE = "CMPT";
547: public static final String AWAITING_ACCOUNTS_PAYABLE_REVIEW = "APAD"; // Waiting for Accounts Payable approval
548: public static final String AWAITING_FISCAL_REVIEW = "AFOA"; // Waiting for Fiscal Officer approval
549:
550: public enum STATUS_ORDER {
551: CANCELLED_IN_PROCESS(
552: PurapConstants.CreditMemoStatuses.CANCELLED_IN_PROCESS,
553: false), CANCELLED_PRIOR_TO_AP_APPROVAL(
554: PurapConstants.CreditMemoStatuses.CANCELLED_PRIOR_TO_AP_APPROVAL,
555: false), CANCELLED_POST_AP_APPROVE(
556: PurapConstants.CreditMemoStatuses.CANCELLED_POST_AP_APPROVE,
557: false), INITIATE(
558: PurapConstants.CreditMemoStatuses.INITIATE, true), IN_PROCESS(
559: PurapConstants.CreditMemoStatuses.IN_PROCESS, true), AWAITING_ACCOUNTS_PAYABLE_REVIEW(
560: PurapConstants.CreditMemoStatuses.AWAITING_ACCOUNTS_PAYABLE_REVIEW,
561: false), AWAITING_FISCAL_REVIEW(
562: PurapConstants.CreditMemoStatuses.AWAITING_FISCAL_REVIEW,
563: false), COMPLETE(
564: PurapConstants.CreditMemoStatuses.COMPLETE, false), ;
565:
566: private String statusCode = new String();
567: private boolean fullEntryAllowed = false;
568:
569: STATUS_ORDER(String statusCode, boolean fullEntry) {
570: this .statusCode = statusCode;
571: this .fullEntryAllowed = fullEntry;
572: }
573:
574: public static STATUS_ORDER getByStatusCode(String statusCode) {
575: for (STATUS_ORDER status : STATUS_ORDER.values()) {
576: if (StringUtils.equals(status.statusCode,
577: statusCode)) {
578: return status;
579: }
580: }
581: return null;
582: }
583:
584: public static boolean isFullDocumentEntryCompleted(
585: String status) {
586: return !getByStatusCode(status).fullEntryAllowed;
587: }
588:
589: public static STATUS_ORDER getPreviousStatus(
590: String statusCode) {
591: STATUS_ORDER statusOrder = STATUS_ORDER
592: .getByStatusCode(statusCode);
593: if (statusOrder.ordinal() > 0) {
594: return STATUS_ORDER.values()[statusOrder.ordinal() - 1];
595: }
596: return null;
597: }
598:
599: public static boolean isFirstFullEntryStatus(
600: String statusCode) {
601: // NOTE this won't work if there endsup being two ways to get to the first full entry status (i.e. like AUTO/DEPT
602: // for final)
603: return getByStatusCode(statusCode).fullEntryAllowed
604: && !getPreviousStatus(statusCode).fullEntryAllowed;
605: }
606: }
607:
608: public static final String[] STATUSES_ALLOWED_FOR_EXTRACTION = { COMPLETE };
609:
610: public static final Set CANCELLED_STATUSES = new HashSet();
611: public static final Set STATUSES_DISALLOWING_HOLD = new HashSet();
612: public static final Set STATUSES_NOT_REQUIRING_ENTRY_REVERSAL = new HashSet();
613: static {
614: CANCELLED_STATUSES.add(CANCELLED_IN_PROCESS);
615: CANCELLED_STATUSES.add(CANCELLED_PRIOR_TO_AP_APPROVAL);
616: CANCELLED_STATUSES.add(CANCELLED_POST_AP_APPROVE);
617:
618: STATUSES_DISALLOWING_HOLD.add(INITIATE);
619: STATUSES_DISALLOWING_HOLD.add(IN_PROCESS);
620: STATUSES_DISALLOWING_HOLD.addAll(Arrays
621: .asList(CANCELLED_STATUSES
622: .toArray(new String[CANCELLED_STATUSES
623: .size()])));
624:
625: STATUSES_NOT_REQUIRING_ENTRY_REVERSAL.add(INITIATE);
626: STATUSES_NOT_REQUIRING_ENTRY_REVERSAL.add(IN_PROCESS);
627: STATUSES_NOT_REQUIRING_ENTRY_REVERSAL.addAll(Arrays
628: .asList(CANCELLED_STATUSES
629: .toArray(new String[CANCELLED_STATUSES
630: .size()])));
631: }
632: }
633:
634: public static class CMDocumentsStrings {
635: public static final String DUPLICATE_CREDIT_MEMO_QUESTION = "CMDuplicateInvoice";
636: public static final String HOLD_CM_QUESTION = "HoldCM";
637: public static final String HOLD_NOTE_PREFIX = "Note entered while placing Credit Memo on hold: ";
638: public static final String CANCEL_CM_QUESTION = "CancelCM";
639: public static final String REMOVE_HOLD_CM_QUESTION = "RemoveCM";
640: public static final String REMOVE_HOLD_NOTE_PREFIX = "Note entered while removing hold on Credit Memo: ";
641: }
642:
643: public static final class CREDIT_MEMO_TYPE_LABELS {
644: public static final String TYPE_PO = "PO";
645: public static final String TYPE_PREQ = "PREQ";
646: public static final String TYPE_VENDOR = "Vendor";
647:
648: }
649:
650: private static final HashMap<String, Class> uncopyableFields() {
651: HashMap<String, Class> fields = new HashMap<String, Class>();
652: fields.put(KFSConstants.VERSION_NUMBER, null);
653: fields.put("LOG", null);
654: fields.put(KFSPropertyConstants.GENERAL_LEDGER_PENDING_ENTRIES,
655: null);
656: return fields;
657: }
658:
659: /*
660: * Fields that shouldn't be copied by our reflective copy method. This should only contain fields that are known throughout
661: * objects not item/doc specific ones
662: */
663: public static final HashMap<String, Class> KNOWN_UNCOPYABLE_FIELDS = uncopyableFields();
664:
665: private static final HashMap<String, Class> uncopyableItemFields() {
666: HashMap<String, Class> fields = new HashMap<String, Class>();
667: fields.put(PurapPropertyConstants.ITEM_IDENTIFIER, null);
668: fields.put(PurapPropertyConstants.ACCOUNTS, null);
669: return fields;
670: }
671:
672: /*
673: * Fields that shouldn't be copied by our reflective copy method. This should only contain fields that are known throughout
674: * objects not item/doc specific ones
675: */
676: public static final HashMap<String, Class> ITEM_UNCOPYABLE_FIELDS = uncopyableItemFields();
677:
678: private static final HashMap<String, Class> uncopyablePREQItemFields() {
679: HashMap<String, Class> fields = new HashMap<String, Class>(
680: ITEM_UNCOPYABLE_FIELDS);
681: fields.put(PurapPropertyConstants.QUANTITY, null);
682: fields.put(PurapPropertyConstants.EXTENDED_PRICE, null);
683: return fields;
684: }
685:
686: /*
687: * fields that shouldn't be copied on PREQ item
688: */
689: public static final HashMap<String, Class> PREQ_ITEM_UNCOPYABLE_FIELDS = uncopyablePREQItemFields();
690:
691: private static final Map<String, Class> uncopyableFieldsForPurchaseOrder() {
692: Map<String, Class> returnMap = new HashMap<String, Class>();
693: returnMap.put(RicePropertyConstants.DOCUMENT_NUMBER, null);
694: returnMap.put(PurapPropertyConstants.ITEM_IDENTIFIER,
695: PurchaseOrderItem.class);
696: returnMap.put(PurapPropertyConstants.ACCOUNT_IDENTIFIER,
697: PurchaseOrderAccount.class);
698: returnMap
699: .put(
700: PurapPropertyConstants.PURCHASE_ORDER_VENDOR_QUOTE_IDENTIFIER,
701: PurchaseOrderVendorQuote.class);
702: returnMap.put("relatedRequisitionViews",
703: PurchasingAccountsPayableDocumentBase.class);
704: returnMap.put("relatedPurchaseOrderViews",
705: PurchasingAccountsPayableDocumentBase.class);
706: returnMap.put("relatedPaymentRequestViews",
707: PurchasingAccountsPayableDocumentBase.class);
708: returnMap.put("relatedCreditMemoViews",
709: PurchasingAccountsPayableDocumentBase.class);
710: returnMap.put("paymentHistoryPaymentRequestViews",
711: PurchasingAccountsPayableDocumentBase.class);
712: returnMap.put("paymentHistoryCreditMemoViews",
713: PurchasingAccountsPayableDocumentBase.class);
714: return returnMap;
715: }
716:
717: public static final Map<String, Class> UNCOPYABLE_FIELDS_FOR_PO = uncopyableFieldsForPurchaseOrder();
718:
719: public static final String PURAP_ORIGIN_CODE = "EP";
720:
721: public static final class PurapDocTypeCodes {
722: public static final String PAYMENT_REQUEST_DOCUMENT = "PREQ";
723: public static final String CREDIT_MEMO_DOCUMENT = "CM";
724: public static final String PO_DOCUMENT = "PO";
725: public static final String PO_AMENDMENT_DOCUMENT = "POA";
726: public static final String PO_CLOSE_DOCUMENT = "POC";
727: public static final String PO_REOPEN_DOCUMENT = "POR";
728: public static final String PO_VOID_DOCUMENT = "POV";
729: }
730:
731: public static final Integer PRORATION_SCALE = new Integer(6);
732:
733: private static HashMap<String, String> getPurapParameterDetailTypeCodes() {
734: HashMap<String, String> map;
735: map = new HashMap<String, String>();
736: map.put("RequisitionDocument", RequisitionDocument.class
737: .getName());
738: map.put("PurchaseOrderDocument", PurchaseOrderDocument.class
739: .getName());
740: map.put("PurchaseOrderCloseDocument",
741: PurchaseOrderDocument.class.getName());
742: map.put("PurchaseOrderReopenDocument",
743: PurchaseOrderDocument.class.getName());
744: map.put("PurchaseOrderAmendmentDocument",
745: PurchaseOrderDocument.class.getName());
746: map.put("PurchaseOrderPaymentHoldDocument",
747: PurchaseOrderDocument.class.getName());
748: map.put("PurchaseOrderRemoveHoldDocument",
749: PurchaseOrderDocument.class.getName());
750: map.put("PurchaseOrderRetransmitDocument",
751: PurchaseOrderDocument.class.getName());
752: map.put("PurchaseOrderVoidDocument",
753: PurchaseOrderDocument.class.getName());
754: map.put("PaymentRequestDocument", PaymentRequestDocument.class
755: .getName());
756: map.put("CreditMemoDocument", CreditMemoDocument.class
757: .getName());
758: return map;
759: }
760:
761: public static final HashMap<String, String> PURAP_DETAIL_TYPE_CODE_MAP = getPurapParameterDetailTypeCodes();
762:
763: }
|