/**
* Procedure for setting radio button selection values in the Detail reports Search section
* @param pageContext
* @param webBean
*/
protected void handleRadioButtonSelection(OAPageContext pageContext, OAWebBean webBean)
{
String action = pageContext.getParameter(EVENT_PARAM);
if("BuyerSelection".equals(action))
{
setRadioButtonValues(pageContext, webBean, "N", "Y", "N");
}else if("SupplierSelection".equals(action))
{
setRadioButtonValues(pageContext, webBean, "N", "N", "Y");
} else if("InvoiceSelection".equals(action))
{
setRadioButtonValues(pageContext, webBean, "Y", "N","N");
}
}
/**
* Procedure for capturing the event of selected radio button in the Detail reports Search section
* @param pageContext
* @param webBean
*/
protected void handleRadioButtonSelectionAction(OAPageContext pageContext, OAWebBean webBean)
{
String action = pageContext.getParameter(EVENT_PARAM);
if("BuyerSelection".equals(action) || "SupplierSelection".equals(action) || "InvoiceSelection".equals(action))
pageContext.forwardImmediatelyToCurrentPage(null, true, OAWebBeanConstants.ADD_BREAD_CRUMB_SAVE);
}
/**
* Procedure for handling radio button selection in Detail reports section
* @param pageContext
* @param webBean
* @param InvoiceNumValue
* @param BuyerIdValue
* @param SupplierIdValue
*/
protected void setRadioButtonValues(OAPageContext pageContext, OAWebBean webBean,
String InvoiceNumValue, String BuyerIdValue, String SupplierIdValue)
{
OAPageLayoutBean pageLayout = pageContext.getPageLayoutBean();
OAMessageRadioButtonBean InvoiceNumRadio = (OAMessageRadioButtonBean)pageLayout.findIndexedChildRecursive("invoiceNoRadioButton");
OAMessageRadioButtonBean BuyerIdRadio = (OAMessageRadioButtonBean)pageLayout.findIndexedChildRecursive("buyerRadioButton");
OAMessageRadioButtonBean SupplierIdRadio = (OAMessageRadioButtonBean)pageLayout.findIndexedChildRecursive("supplierRadioButton");
if(InvoiceNumRadio != null)
InvoiceNumRadio.setValue(pageContext, InvoiceNumValue);
InvoiceNumRadio.setSelected("Y".equals(InvoiceNumValue));
if(BuyerIdRadio != null)
BuyerIdRadio.setValue(pageContext, BuyerIdValue);
BuyerIdRadio.setSelected("Y".equals(BuyerIdValue));
if(SupplierIdRadio != null)
SupplierIdRadio.setValue(pageContext, SupplierIdValue);
SupplierIdRadio.setSelected("Y".equals(SupplierIdValue));
}
/**
* Procedure for capturing the selected search criteria and directing to the Detail report results page
* @param pageContext
* @param webBean
*/
protected void handleDetailReport(OAPageContext pageContext, OAWebBean webBean)
{
String getInvoices = pageContext.getParameter("getInvoicesButton");
if(getInvoices != null)
{
OAPageLayoutBean pageLayout = pageContext.getPageLayoutBean();
OAMessageRadioButtonBean invoiceNumRadio = (OAMessageRadioButtonBean)pageLayout.findIndexedChildRecursive("invoiceNoRadioButton");
OAMessageRadioButtonBean buyerIdRadio = (OAMessageRadioButtonBean)pageLayout.findIndexedChildRecursive("buyerRadioButton");
OAMessageRadioButtonBean supplierIdRadio = (OAMessageRadioButtonBean)pageLayout.findIndexedChildRecursive("supplierRadioButton");
String invRadioSelection = invoiceNumRadio.getSelectedValue();
String buyerRadioSelection = buyerIdRadio.getSelectedValue();
String supRadioSelection = supplierIdRadio.getSelectedValue();
String supplierId = pageContext.getParameter(HOLDTEL_DTL_SUPPLIER_ID);
String buyerId = pageContext.getParameter(HOLDTEL_DTL_BUYER_ID);
String invoiceNum = pageContext.getParameter(HOLDTEL_INVOICE_NUM);
if("Y".equals(invRadioSelection))
{
if(invoiceNum==null && "".equals(invoiceNum))
{
OAException message = new OAException("XXCAP","XXCFI_AP_HOLDTEL_DETAIL_MSG",null,OAException.ERROR,null);
pageContext.putDialogMessage(message);
}
}
else if("Y".equals(buyerRadioSelection))
{
if(buyerId==null && "".equals(buyerId))
{
OAException message = new OAException("XXCAP","XXCFI_AP_HOLDTEL_DETAIL_MSG",null,OAException.ERROR,null);
pageContext.putDialogMessage(message);
}
}
else if("Y".equals(supRadioSelection))
{
if(supplierId == null && "".equals(supplierId))
{
OAException message = new OAException("XXCAP","XXCFI_AP_HOLDTEL_DETAIL_MSG",null,OAException.ERROR,null);
pageContext.putDialogMessage(message);
}
}
else
{
if(isEmpty(supplierId) && isEmpty(buyerId) && isEmpty(invoiceNum))
{
OAException message = new OAException("XXCAP","XXCFI_AP_HOLDTEL_DETAIL_MSG",null,OAException.ERROR,null);
pageContext.putDialogMessage(message);
}
}
}
}
/**
* Procedure for resetting/clearing the entered values in the search page for Detail reports section
* @param pageContext
* @param webBean
*/
public void handleDetailResetButtonValues(OAPageContext pageContext, OAWebBean webBean)
{
String doReset = pageContext.getParameter("detailReportsResetButton");
if (doReset != null)
{
OAMessageLovInputBean clearSuppliers = (OAMessageLovInputBean)webBean.findIndexedChildRecursive("detailReportSuppliers");
OAMessageLovInputBean clearBuyers = (OAMessageLovInputBean)webBean.findIndexedChildRecursive("detailReportBuyers");
OAMessageTextInputBean clearInvoice = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("invoiceNum");
clearSuppliers.setValue(pageContext, null);
clearBuyers.setValue(pageContext, null);
clearInvoice.setValue(pageContext, null);
}
}
}