"; var oldstr = document.body.innerHTML; $("#AppReportList1").find(".table").each(function () { $(this).addClass("temp-table").removeClass("table"); }); //var newstr = document.all.item("AppReportList").innerHTML.replace(/table-bordered/g, "temp_table-bordered"); var newstr = document.all.item("AppReportList1").innerHTML; console.log(newstr); document.body.innerHTML = headstr + '' + newstr + footstr; window.print(); window.close(RedirectAppRpt()); document.body.innerHTML = oldstr; return false; }); });//Document ready ending function RedirectAppRpt() { var url = "/Reports/AppointmentReport"; } function GetAppReportDetails() { var frmdat = $("[id*=txtfromdate]").val(); var txtValidfrm = ""; var txtValidto = ""; if (frmdat != "") { var frmdate = frmdat.split("/"); var fromday = frmdate[0]; var frommonth = frmdate[1]; var fromyear = frmdate[2]; var fromdate = frommonth + '/' + fromday + '/' + fromyear; txtValidfrm = new Date(fromdate.replace(/(\d{2})-(\d{2})-(\d{4})/, "$2/$1/$3")); } else { fromdate = null; } var todat = $("[id*=txttodate]").val(); if (todat != "") { var tdate = todat.split("/"); var today = tdate[0]; var tomonth = tdate[1]; var toyear = tdate[2]; var todate = tomonth + '/' + today + '/' + toyear; txtValidto = new Date(todate.replace(/(\d{2})-(\d{2})-(\d{4})/, "$2/$1/$3")); } else { todate = null; } var dateerrorflag = 0; if (txtValidfrm != "" && txtValidto != "") { if (txtValidfrm > txtValidto) { $('#dvfromdate').show(); $('#dvfromdate').html("Please enter Date less than to date"); dateerrorflag = 1; } else { $('#dvfromdate').hide(); $('#dvfromdate').html(""); dateerrorflag = 0; } } var status = $("#ddlAppStatus").val(); var branchId = $("#ddlLocations").val(); var associateID = 0; if ($.cookie("Userid") != null) { associateID = $.cookie("Userid"); } if ($.cookie("BusinessCategoryId") == 8) { var AccountActivationId = $.cookie("AccountActivationId"); associateID = 0; } if (localStorage.getItem("ddlAppStatuschange") == 1) { status = localStorage.getItem("ddlaptstatusid"); localStorage.removeItem("ddlAppStatuschange"); } if (localStorage.getItem("ddlLocationchange") == 1) { branchId = localStorage.getItem("ddlLocationid"); localStorage.removeItem("ddlLocationchange"); } var appReportDetails = { intUserId: associateID, intBranchId: branchId, intStatusId:status, strFromDate: fromdate, strToDate: todate, intorgid: AccountActivationId }; if (dateerrorflag == 0) { $.ajax({ url: apiPath + '/Report/GetAppointmentReportList', type: 'Post', data: JSON.stringify(appReportDetails), contentType: "application/json;charset=utf-8", success: function (objInvcReport) { $("#tblAppReport tbody").html(""); $("#tblAppReport tbody").hide(); $("#tblAppReport1 tbody").html(""); $("#tblAppReport1 tbody").hide(); $("#pager").html(""); if (objInvcReport.length != "0") { var myJsonObject = objInvcReport; contentType: "text/javascript"; WriteResponses(objInvcReport); $("#tblAppReport tbody").show(); } else { //alert("No Data Found"); $('#lblErrormsg').text("No Data Found"); Errorpopupcode(); $("#tblAppReport tbody").html(''); $("#tblAppReport1 tbody").html(''); $("#pager").html(""); } }, error: function (x, y, z) { //alert("No Data"); $('#lblErrormsg').text("No Data"); Errorpopupcode(); } }); } //Displays in a Table function WriteResponses(objAppDetails) { $("#tblAppReport tbody").hide(); $("#tblAppReport1 tbody").hide(); $("#pager").hide(); var strResult = ''; $.each(objAppDetails, function (index, item) { strResult += "" + item.strAppointmentDate + "" + item.strUHID + "" + item.strPatientName + "" + item.strAge + "" + item.strGender + "" + item.strLocation + "" + item.strStatus + "" }); strResult += ""; $("#tblAppReport").append(strResult); $("#tblAppReport1").append(strResult); //$('#tblAppReport').paging({ limit: 10 }); $('#tblAppReport').each(function () { $("#pager").html(""); var currentPage = 0; var numPerPage = 5; var $table = $(this); $table.bind('repaginate', function () { //$table.find('tbody tr').hide().slice(currentPage * (numPerPage * 2), (currentPage + 1) * (numPerPage * 2)).show(); $table.find('tbody tr').hide().slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).show(); }); $table.trigger('repaginate'); var numRows = $table.find('tbody tr').length; var numPages = (Math.ceil(numRows / numPerPage)); if (numPages > 1) { var $pager = $('
'); $pager.insertAfter($table).find('span.page-number:first').addClass('active'); } //var $pager = $('#btnpager'); var $previous = $('<<'); var $next = $('>>'); for (var page = 0; page < numPages; page++) { if (numPages > 1) { $('').text(page + 1).bind('click', { newPage: page }, function (event) { currentPage = event.data['newPage']; $table.trigger('repaginate'); $(this).addClass('active').siblings().removeClass('active'); }).appendTo($pager).addClass('clickable'); } } //$pager.insertBefore($table).find('span.page-number:first').addClass('active'); $pager.insertAfter($table).find('span.page-number:first').addClass('active'); var higlitednum = $('.page-number.clickable.active').text(); if (higlitednum >= numPerPage) $previous.insertBefore('span.page-number:first'); if (numPerPage < numPages) { $next.insertAfter('span.page-number:last'); $next.show(); } else $next.hide(); var activenum = ''; for (var a = 1; a <= numPages; a++) { if (a > numPerPage) { $('#spn' + a).hide(); } else { $('#spn' + a).show(); } } var k = 1; $next.click(function (e) { $previous.addClass('clickable'); $pager.find('.active').next('.page-number.clickable').click(); activenum = $('.page-number.clickable.active').text() - 1; if (activenum >= numPerPage) { $previous.insertBefore('span.page-number:first'); $previous.show(); } if (numPages != (activenum + 1)) { var pcount = ""; pcount = numPages - (activenum + 1); if (pcount > 5) { $next.insertAfter('span.page-number:last'); $next.show(); } else $next.hide(); } else $next.hide(); if (activenum == (k * numPerPage)) { k++; $('.page-number').hide(); for (var b = (activenum + 1) ; b <= numPages; b++) { if (b > (k * numPerPage)) { $('#spn' + b).hide(); } else { $('#spn' + b).show(); } } } }); $previous.click(function (e) { $next.addClass('clickable'); $pager.find('.active').prev('.page-number.clickable').click(); $next.show(); activenum = $('.page-number.clickable.active').text(); if (activenum > numPerPage) { $previous.insertBefore('span.page-number:first'); $previous.show(); } else $previous.hide(); var firstnum = activenum - (numPerPage - 1); if ((activenum % numPerPage) == 0) { k--; $('.page-number').hide(); for (var c = firstnum; c <= activenum; c++) { $('#spn' + c).show(); } } }); $table.on('repaginate', function () { $next.addClass('clickable'); $previous.addClass('clickable'); setTimeout(function () { var $active = $pager.find('.page-number.active'); if ($active.next('.page-number.clickable').length === 0) { $next.removeClass('clickable'); } else if ($active.prev('.page-number.clickable').length === 0) { $previous.removeClass('clickable'); } }); }); $table.trigger('repaginate'); }); }; } $(function () { $("#ddlAppStatus").change(function () { var ddlaptstatusid = $('#ddlAppStatus option:selected').val(); localStorage.setItem("ddlAppStatuschange", 1); localStorage.setItem("ddlaptstatusid", ddlaptstatusid); GetAppReportDetails(); }); }); $(function () { $("#ddlLocations").change(function () { var ddlLocationid = $('#ddlLocations option:selected').val(); localStorage.setItem("ddlLocationchange", 1); localStorage.setItem("ddlLocationid", ddlLocationid); GetAppReportDetails(); }); }); function OrgBranchAddressDetails() { $('#lblBranchAddress').show(); var BranchId = $('#ddlOrgdashbranchnames').val(); $.ajax({ type: "Get", url: apiPath + "/AccountServices/GetBranchAddress/" + BranchId, dataType: "json", success: function (data) { contentType: "text/javascript"; $('#lblBranchAddress').text(data); }, error: function (msg) { $('#lblErrormsg').text("Please try again, server not connected."); Errorpopupcode(); } }); }
Appointment Report
Date UHID Patient Name Age Gender Location Status