function JobProposalListDisplayResult(next, isSearch)
{
var CAMLQuery_String = "";
try{
next = next.replace(/&/g,'&').replace(/"/g,'"').replace(/</g,'<').replace(/>/g,'>');
}
catch(e){
}
if(isSearch)
{
var searchJPNumber = document.getElementById("TextBoxFilterJPNumber").value.trim();
var searchHPLPM = document.getElementById("TextBoxFilterHPLPM").value.trim();
var searchProductDropDownList = document.getElementById("DropDownListFilterProduct");
var searchVersionDropDownList = document.getElementById("DropDownListFilterVersion");
var searchLanguageDropDownList = document.getElementById("DropDownListFilterLanguage");
var searchComponentDropDownList = document.getElementById("DropDownListFilterComponent");
var searchStatusDropDownList = document.getElementById("DropDownListFilterStatus");
var searchProduct = searchProductDropDownList.options[searchProductDropDownList.selectedIndex].text;
var searchVersion = searchVersionDropDownList.options[searchVersionDropDownList.selectedIndex].text;
var searchLanguage = searchLanguageDropDownList.options[searchLanguageDropDownList.selectedIndex].text;
var searchComponent = searchComponentDropDownList.options[searchComponentDropDownList.selectedIndex].text;
var searchStatus = searchStatusDropDownList.options[searchStatusDropDownList.selectedIndex].text;
var _searchArray = new Array();
CAMLQuery_String += "<Query><Where>#######";
_searchArray.push("<Eq><FieldRef Name='VENDER_LPM'/><Value Type='string'>"+ JobProposalListCurrentUserName +"</Value></Eq>");
if(searchJPNumber!= "")
{
_searchArray.push("<Contains><FieldRef Name='LinkTitle'/><Value Type='string'>"+ searchJPNumber+"</Value></Contains>");
}
if(searchHPLPM != "")
{
_searchArray.push("<Contains><FieldRef Name='HP_LPM'/><Value Type='string'>"+ searchHPLPM +"</Value></Contains>");
}
if(searchProduct != "ALL")
{
_searchArray.push("<Eq><FieldRef Name='PRODUCT'/><Value Type='string'>"+ searchProduct +"</Value></Eq>");
}
if(searchVersion !="ALL")
{
_searchArray.push("<Eq><FieldRef Name='PRODUCT_VERSION'/><Value Type='string'>"+ searchVersion +"</Value></Eq>");
}
if(searchLanguage != "ALL")
{
_searchArray.push("<Eq><FieldRef Name='LANGUAGE'/><Value Type='string'>"+ searchLanguage +"</Value></Eq>");
}
if(searchStatus != "ALL")
{
_searchArray.push("<Eq><FieldRef Name='JP_STATUS'/><Value Type='string'>"+ searchStatus +"</Value></Eq>");
}
for(var i =0;i<_searchArray.length;i++)
{
if(i==_searchArray.length-1)
{
CAMLQuery_String = CAMLQuery_String.replace("#######",_searchArray[i]);
}
else
{
CAMLQuery_String= CAMLQuery_String.replace("#######","<And>#######"+_searchArray[i]+"</And>");
}
}
CAMLQuery_String += "</Where><OrderBy><FieldRef Name='LinkTitle' Ascending='False' /></OrderBy></Query>";
}
else
{
CAMLQuery_String += "<Query><Where><Eq><FieldRef Name='VENDER_LPM'/><Value Type='string'>"+ JobProposalListCurrentUserName +"</Value></Eq></Where><OrderBy><FieldRef Name='LinkTitle' Ascending='False' /></OrderBy></Query>";
}
/*
$().SPServices({
operation: "GetListItems",
listName: listName,
webURL: siteURL,
CAMLQueryOptions: '<QueryOptions><Paging ListItemCollectionPositionNext="'+next+'" /></QueryOptions>',
CAMLRowLimit: "10",
completefunc: function (xData, Status) {
//YourOutputCodeHere
var next=$(xData.responseXML).find("rs\\:data").attr("ListItemCollectionPositionNext");
$("#WSOutput").html("").append('<a href="javascript:displayResult(\''+listName+'\', \''+next+'\')">Next</a>');
}
});
*/
$().SPServices({
operation: "GetListItems",
async: false,
listName: "m_job_proposal",
CAMLRowLimit: "10",
CAMLQueryOptions: '<QueryOptions><Paging ListItemCollectionPositionNext="'+next+'" /></QueryOptions>',
CAMLQuery: CAMLQuery_String,
CAMLViewFields: "<ViewFields><FieldRef Name='LinkTitle'/><FieldRef Name='ID'/></ViewFields>",
completefunc: function (xData, Status) {
var tableResult = ""
tableResult += "<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\" id=\"GridViewJPlist\" style=\"color:#333333;width:100%;border-collapse:collapse; text-align:center;\">";
tableResult += "<tr style=\"color:White;background-color:#003399;font-weight:bold; font-family:Arial, Tahoma, Helvetica, sans-serif; font-size:12px;\">";
tableResult += "<th scope=\"col\">JP Number</th>";
tableResult += "<th scope=\"col\">Product</th>";
tableResult += "<th scope=\"col\">Version</th>";
tableResult += "<th scope=\"col\">Language</th>";
tableResult += "<th scope=\"col\">Component</th>";
tableResult += "<th scope=\"col\">Status</th>";
tableResult += "<th scope=\"col\">History</th>";
tableResult += "<th scope=\"col\" colspan=\"2\">JP</th>";
tableResult += "<th scope=\"col\" colspan=\"2\">JR</th>";
tableResult += "<th scope=\"col\"> </th>";
tableResult += "<th scope=\"col\"> </th>";
tableResult += "<th scope=\"col\"> </th>";
tableResult += "</tr>";
var rowCount = 0;
$(xData.responseXML).find("[nodeName='z:row']").each(function() {
var _JPNumber= $(this).attr("ows_LinkTitle");
var _Product= $(this).attr("ows_PRODUCT");
var _Version= $(this).attr("ows_PRODUCT_VERSION");
var _Language= $(this).attr("ows_LANGUAGE");
var _Component= $(this).attr("ows_JOB_COMPONENT");
var _Status= $(this).attr("ows_JP_STATUS");
var _JPID = $(this).attr("ows_ID");
_Product= _Product.substring(_Product.indexOf("#")+1);
_Version= _Version.substring(_Version.indexOf("#")+1);
_Language= _Language.substring(_Language.indexOf("#")+1);
_Component= _Component.substring(_Component.indexOf("#")+1);
_Status= _Status.substring(_Status.indexOf("#")+1);
if(rowCount % 2 == 0)
{
tableResult += "<tr style=\"background-color:#EFF3FB;\">";
}
else
{
tableResult += "<tr style=\"background-color:White;\">";
}
tableResult += " <td style=\"width:120px;\"><span style=\"font-weight:bold;\">"+_JPNumber+"</span></td>";
tableResult += " <td>"+_Product+"</td>";
tableResult += " <td>"+_Version+"</td>";
tableResult += " <td>"+_Language+"</td>";
tableResult += " <td>"+_Component+"</td>";
tableResult += " <td>"+_Status+"</td>";
tableResult += " <td><img alt=\"View JP History\" src=\"images/iconInformation.gif\" style=\"cursor:hand\" onclick=\"JobProposalListViewJPHistory('"+_JPNumber+"')\"/></td>";
tableResult += " <td><img alt=\"View JP\" src=\"images/View_enable.JPG\" style=\"cursor:hand\" onclick=\"JobProposalListViewJP('"+_JPNumber+"')\"/></td>";
//tableResult += " <td><img alt=\"Download JP\" src=\"images/download_enable.JPG\" style=\"cursor:hand\" onclick=\"JobProposalListDownloadJP('"+_JPNumber+"')\"/></td>";
tableResult += " <td><img alt=\"Download JP\" src=\"images/download_disable.JPG\"/></td>";
switch(_Status)
{
case "New":
tableResult += " <td><img alt=\"View JR\" src=\"images/View_disable.JPG\"/></td>";
tableResult += " <td><img alt=\"Download JR\" src=\"images/download_disable.JPG\"/></td>";
tableResult += " <td><input type=\"button\" name=\"ButtonEditJP\" value=\"Edit\" id=\"ButtonEditJP\" style=\"cursor:hand\" onclick=\"JobProposalListEditJP('"+_JPNumber+"')\"/></td>";
tableResult += " <td><input type=\"button\" name=\"ButtonCopyJP\" value=\"Copy\" id=\"ButtonCopyJP\" style=\"cursor:hand\" onclick=\"JobProposalListCopyJP('"+_JPNumber+"')\"/></td>";
tableResult += " <td><input type=\"button\" name=\"ButtonDeleteJP\" value=\"Delete\" id=\"ButtonDeleteJP\" style=\"cursor:hand\" onclick=\"JobProposalListDeleteJP('"+_JPNumber+"')\"/></td>";
break;
case "Pending":
tableResult += " <td><img alt=\"View JR\" src=\"images/View_disable.JPG\"/></td>";
tableResult += " <td><img alt=\"Download JR\" src=\"images/download_disable.JPG\"/></td>";
tableResult += " <td><input type=\"button\" name=\"ButtonEditJP\" value=\"Edit\" id=\"ButtonEditJP\" disabled=\"disabled\"/></td>";
tableResult += " <td><input type=\"button\" name=\"ButtonCopyJP\" value=\"Copy\" id=\"ButtonCopyJP\" style=\"cursor:hand\" onclick=\"JobProposalListCopyJP('"+_JPNumber+"')\"/></td>";
tableResult += " <td><input type=\"button\" name=\"ButtonDeleteJP\" value=\"Delete\" id=\"ButtonDeleteJP\" disabled=\"disabled\"/></td>";
break;
case "Need Updated":
tableResult += " <td><img alt=\"View JR\" src=\"images/View_disable.JPG\"/></td>";
tableResult += " <td><img alt=\"Download JR\" src=\"images/download_disable.JPG\"/></td>";
tableResult += " <td><input type=\"button\" name=\"ButtonEditJP\" value=\"Edit\" id=\"ButtonEditJP\" style=\"cursor:hand\" onclick=\"JobProposalListEditJP('"+_JPNumber+"')\"/></td>";
tableResult += " <td><input type=\"button\" name=\"ButtonCopyJP\" value=\"Copy\" id=\"ButtonCopyJP\" style=\"cursor:hand\" onclick=\"JobProposalListCopyJP('"+_JPNumber+"')\"/></td>";
tableResult += " <td><input type=\"button\" name=\"ButtonDeleteJP\" value=\"Delete\" id=\"ButtonDeleteJP\" disabled=\"disabled\" /></td>";
break;
case "Approved":
tableResult += " <td><img alt=\"View JR\" src=\"images/View_enable.JPG\" style=\"cursor:hand\" onclick=\"JobProposalListViewJR('"+_JPNumber+"')\"/></td>";
//tableResult += " <td><img alt=\"Download JR\" src=\"images/download_enable.JPG\" style=\"cursor:hand\" onclick=\"JobProposalListDownloadJR('"+_JPNumber+"')\"/></td>";
tableResult += " <td><img alt=\"Download JR\" src=\"images/download_disable.JPG\"/></td>";
tableResult += " <td><input type=\"button\" name=\"ButtonEditJP\" value=\"Edit\" id=\"ButtonEditJP\" disabled=\"disabled\"/></td>";
tableResult += " <td><input type=\"button\" name=\"ButtonCopyJP\" value=\"Copy\" id=\"ButtonCopyJP\" style=\"cursor:hand\" onclick=\"JobProposalListCopyJP('"+_JPNumber+"')\"/></td>";
tableResult += " <td><input type=\"button\" name=\"ButtonDeleteJP\" value=\"Delete\" id=\"ButtonDeleteJP\" disabled=\"disabled\" /></td>";
break;
default:
tableResult += " <td><img alt=\"View JR\" src=\"images/View_disable.JPG\"/></td>";
tableResult += " <td><img alt=\"Download JR\" src=\"images/download_disable.JPG\"/></td>";
tableResult += " <td><input type=\"button\" name=\"ButtonEditJP\" value=\"Edit\" id=\"ButtonEditJP\" disabled=\"disabled\"/></td>";
tableResult += " <td><input type=\"button\" name=\"ButtonCopyJP\" value=\"Copy\" id=\"ButtonCopyJP\" disabled=\"disabled\"/></td>";
tableResult += " <td><input type=\"button\" name=\"ButtonDeleteJP\" value=\"Delete\" id=\"ButtonDeleteJP\" disabled=\"disabled\"/></td>";
}
tableResult += "</tr>";
rowCount ++;
});//$(xData.responseXML).find("[nodeName='z:row']").each(function() {
if(rowCount ==0)
{
//none data
tableResult += "<tr><td colspan=\"14\" style=\"color:red;text-align:center;\">No Record! </td></tr>"
}
tableResult += "<tr style=\"text-align:center; background-color: #003399; color: white;\"><td colSpan=\"14\">";
JobProposalListCurrentPage = next;
if(JobProposalListArrayPages.length != 0)
{
tableResult += "<a style=\"color: white;\" href=\"#\" onclick=\"JobProposalListArrayPages.pop(JobProposalListArrayPages.length-1); JobProposalListDisplayResult('"+JobProposalListArrayPages[JobProposalListArrayPages.length -1]+"',"+isSearch+")\"/>Last Page</a> ";
}
$(xData.responseXML).find("[nodeName='rs:data']").each(function() {
var nextpage = $(this).attr("ListItemCollectionPositionNext");
if(nextpage != undefined)
{
tableResult += "<a style=\"color: white;\" href=\"#\" onclick=\"JobProposalListArrayPages.push(JobProposalListCurrentPage); JobProposalListDisplayResult('"+nextpage+"',"+isSearch+")\"/>Next Page</a>";
}
});
tableResult += "</td></tr></table>";
if(document.getElementById("JobProposalListJPTable") != null)
{
document.getElementById("JobProposalListJPTable").innerHTML = tableResult;
}
}
});
}