| Copyright (c) 2001, 2003 Oracle Corporation, Redwood Shores, CA, USA |
| All rights reserved. |
+===========================================================================+
| HISTORY |
+===========================================================================*/
package oracle.apps.cfi.ipr.server.webui;
import com.sun.java.util.collections.HashMap;
import java.sql.Connection;
import java.util.Hashtable;
import java.util.Vector;
import oracle.apps.fnd.common.MessageToken;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.cp.request.ConcurrentRequest;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.server.OADBTransaction;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OADialogPage;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageChoiceBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageLovInputBean;
import java.util.Date;
import java.text.SimpleDateFormat;
/**
* Controller for ...
*/
public class orderDetailCO extends OAControllerImpl
{
public static final String RCS_ID =
"$Header: /apps/pvcs/archive/sj/xxcfi/11.5.0/java/mds/oracle/apps/cfi/ipr/server/webui/orderDetailCO.java_v 1.2 11 Nov 2004 12:31:16 tvatsa $";
public static final boolean RCS_ID_RECORDED =
VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
/**
* Layout and page setup logic for a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
*/
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
// Profile
boolean isGlobal = false;
String operatingProfile = pageContext.getProfile("ORG_ID");
String queryAllProfile =
pageContext.getProfile("XXCFI_IPROC_REPORT_QRY_ALL");
if (queryAllProfile == null)
{
queryAllProfile = new String("N");
}
if (queryAllProfile.equalsIgnoreCase("Y"))
{
isGlobal = true;
}
// Responsibility
int respId = pageContext.getResponsibilityId();
String respName = pageContext.getResponsibilityName();
// User
int userId = pageContext.getUserId();
String userName = pageContext.getUserName();
// Org Id
int orgId = pageContext.getOrgId(); //165;
String srtOrgId = new String().valueOf(orgId);
// Get a Handle to the OU PopList
OAMessageChoiceBean operUnitPopList =
(OAMessageChoiceBean)webBean.findIndexedChildRecursive("operatingUnit");
if (!isGlobal)
{
operUnitPopList.setDefaultValue(srtOrgId);
operUnitPopList.setDisabled(true);
} else
{
operUnitPopList.setDefaultValue(null);
operUnitPopList.setDisabled(false);
}
// Get a Handle to the Preparer
OAMessageLovInputBean preparerLOV =
(OAMessageLovInputBean)webBean.findIndexedChildRecursive("preparerEmail");
if (!isGlobal)
{
//int i = 9;
//preparerLOV.setDefaultValue("bmcmanus");
preparerLOV.setRendered(false);
//preparerLOV.setDisabled(true);
} else
{
preparerLOV.setRendered(true);
}
if(pageContext.getParameter("apPoSplitConfirmOk")!=null)
{
HashMap hm = new HashMap();
String url = "OA.jsp?akRegionCode=FNDCPREQUESTVIEWPAGE&akRegionApplicationId=0";
// Show breadcrumbs
pageContext.setForwardURL(url, null,
OAWebBeanConstants.KEEP_MENU_CONTEXT, null,
hm, true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}
}
/**
* Procedure to handle form submissions for form elements in
* a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
*/
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
// Profile
boolean isGlobal = false;
String queryAllProfile =
pageContext.getProfile("XXCFI_IPROC_REPORT_QRY_ALL");
if (queryAllProfile == null)
{
queryAllProfile = new String("N");
}
if (queryAllProfile.equalsIgnoreCase("Y"))
{
isGlobal = true;
}
if (pageContext.getParameter("webButton") != null)
{
String operatingUnit = new String();
if (isGlobal)
{
operatingUnit = pageContext.getParameter("operatingUnit");
} else if (!isGlobal)
{
int orgId = pageContext.getOrgId();
String srtOrgId = new String().valueOf(orgId);
operatingUnit = srtOrgId;
}
//String operatingUnit = pageContext.getParameter("operatingUnit");
String preparerEmail = new String();
if (isGlobal)
{
preparerEmail = pageContext.getParameter("preparerEmail");
} else if (!isGlobal)
{
int userId = pageContext.getUserId();
String userName = pageContext.getUserName();
preparerEmail = userName; //"bmcmanus";
}
//String operatingUnit = pageContext.getParameter("operatingUnit");
String reqStatus = pageContext.getParameter("orderStatus");
String currency = pageContext.getParameter("currency");
String department = pageContext.getParameter("department");
String account = pageContext.getParameter("account");
String supplier = pageContext.getParameter("supplier");
//String preparerEmail = pageContext.getParameter("preparerEmail");
String requesterEmail = pageContext.getParameter("requesterEmail");
//String deliverEmail = pageContext.getParameter("deliverEmail");
String dateTo = pageContext.getParameter("dateTo");
String dateFrom = pageContext.getParameter("dateFrom");
String supplierSite = pageContext.getParameter("location");
//String preparerId = pageContext.getParameter("PreparerId");
SimpleDateFormat dateFormat1;
Date d1;
Date d2;
String dfrom=null;
String dto=null;
try
{
dateFormat1 = new SimpleDateFormat("YYYY/MM/DD");
d1 = dateFormat1.parse(dateFrom);
d2 = dateFormat1.parse(dateTo);
dfrom = dateFormat1.format(d1);
dto = dateFormat1.format(d2);
}
catch(Exception e)
{
//System.out.println(e);
;
}
Vector concParams = new Vector();
concParams.add(operatingUnit);
concParams.add(requesterEmail);
concParams.add(reqStatus);
concParams.add(currency);
concParams.add(supplier);
concParams.add(supplierSite);
concParams.add(department);
concParams.add(account);
// concParams.add(dateFrom);
// concParams.add(dateTo);
concParams.add(dfrom);
concParams.add(dto);
submitConcProgram(pageContext, concParams);
}
}
private void submitConcProgram(OAPageContext pageContext, Vector concParams)
{
OADBTransaction txn = pageContext.getRootApplicationModule().getOADBTransaction();
Connection conn = txn.getJdbcConnection();
try
{
String cpAppName = "XXCPO";
String cpName = "XXCFIORDDET";
String cpDesc = "";
ConcurrentRequest cr = new ConcurrentRequest(conn);
int requestId =
cr.submitRequest(cpAppName, cpName, cpDesc, null, false, concParams);
txn.commit();
if (requestId != 0)
{
pageContext.redirectToDialogPage(getWarningDialog(pageContext,requestId));
}
}
catch (Exception e)
{
;
}
}
public OADialogPage getWarningDialog(OAPageContext pageContext,int requestId)
{
String reportName = null;
OAHeaderBean hdrReportName = (OAHeaderBean)pageContext.getPageLayoutBean().findIndexedChildRecursive("headerRN");
if(hdrReportName != null)
reportName = hdrReportName.getText();
MessageToken[] tokens = { new MessageToken("REPORT_NAME", reportName),
new MessageToken("REQUEST_ID", String.valueOf(requestId))
};
OAException message = new OAException("ICX", "XXCFI_SHOW_REQUEST_ID", tokens, OAException.INFORMATION, null);
OADialogPage warningDialog = new OADialogPage(OAException.CONFIRMATION, message, null, "", "");
//String okButtonLabel = pageContext.getMessage("FND", "OK", null);
warningDialog.setRetainAMValue(true);
warningDialog.setOkButtonItemName("apPoSplitConfirmOk");
//warningDialog.setOkButtonLabel(okButtonLabel);
warningDialog.setOkButtonLabel("OK");
warningDialog.setNoButtonUrl(null);
warningDialog.setOkButtonToPost(true);
warningDialog.setPostToCallingPage(true);
Hashtable formParams = new Hashtable(1);
formParams.put("isFromWarningDialog", "Y");
warningDialog.setFormParameters(formParams);
return warningDialog;
}
}
thanks buddy
ReplyDeletehttp://www.oracleappstech-vinoth.blogspot.com
http://www.newtrendsinit.blogspot.com