<% %> <% asp_include "classes/searchclause.asp",false add_nocache_headers asp_include "include/courses_variables.asp",false doAssignmentByRef all,postvalue("all") pageName = "print.asp" asp_include "include/xtempl.asp",false asp_include "classes/runnerpage.asp",false Set xt = (CreateClass("Xtempl",0,Empty,Empty,Empty,Empty,Empty,Empty,Empty)) doAssignment id,IIF(not IsEqual(postvalue("id"),""),postvalue("id"),1) Set params = (CreateDictionary3("pageType",PAGE_PRINT,"id",id,"tName",strTableName)) setArrElementByRef params,"xt",xt Set pageObject = (CreateClass("RunnerPage",1,params,Empty,Empty,Empty,Empty,Empty,Empty)) doAssignmentByRef onLoadJsCode,GetTableData(pageObject.tName,".jsOnloadPrint","") pageObject.addOnLoadJsEvent_p1 onLoadJsCode pageObject.addButtonHandlers if not bValue(postvalue("pdf")) then gQuery.ReplaceFieldsWithDummies_p1 GetBinaryFieldsIndices("") end if if bValue(eventObj.exists_p1("BeforeProcessPrint")) then eventObj.BeforeProcessPrint_p1 conn end if strWhereClause = "" strHavingClause = "" Set selected_recs = (CreateDictionary()) if not IsEqual(GetRequestValue(Request,"a"),"") then sWhere = "1=0" if bValue(GetRequestValue(Request,"mdelete")) then GetCollectionBounds GetRequestValue(Request,"mdelete"),print_loopIdx2,print_loopMax2 do while print_loopIdx2<=print_loopMax2 print_arrKey2 = GetCollectionKey(GetRequestValue(Request,"mdelete"),print_loopIdx2) doAssignment ind,GetRequestValue(GetRequestValue(Request,"mdelete"),print_arrKey2) Set keys = (CreateDictionary()) setArrElement keys,"CourseID",GetRequestValue(GetRequestValue(Request,"mdelete1"),mdeleteIndex(ind)) setArrElement selected_recs,asp_count(selected_recs),keys print_loopIdx2=print_loopIdx2+1 loop else if bValue(GetRequestValue(Request,"selection")) then GetCollectionBounds GetRequestValue(Request,"selection"),print_loopIdx3,print_loopMax3 print_exitLoop3=false do while print_loopIdx3<=print_loopMax3 print_exitLoop3=false do print_arrKey3 = GetCollectionKey(GetRequestValue(Request,"selection"),print_loopIdx3) doAssignment keyblock,GetRequestValue(GetRequestValue(Request,"selection"),print_arrKey3) doAssignmentByRef arr,explode("&",keyblock) if IsLess(asp_count(arr),1) then exit do end if Set keys = (CreateDictionary()) setArrElement keys,"CourseID",asp_urldecode(ArrayElement(arr,0)) setArrElement selected_recs,asp_count(selected_recs),keys loop while false if print_exitLoop3 then _ exit do print_loopIdx3=print_loopIdx3+1 loop end if end if GetCollectionBounds selected_recs,print_loopIdx4,print_loopMax4 do while print_loopIdx4<=print_loopMax4 print_arrKey4 = GetCollectionKey(selected_recs,print_loopIdx4) doAssignment keys,ArrayElement(selected_recs,print_arrKey4) sWhere = CSmartStr(sWhere) & " or " sWhere = CSmartStr(sWhere) & CSmartStr(KeyWhere(keys,"")) print_loopIdx4=print_loopIdx4+1 loop doAssignmentByRef strSQL,gSQLWhere(sWhere,"") doAssignment strWhereClause,sWhere else doAssignment strWhereClause,Session(CSmartStr(strTableName) & "_where") doAssignment strHavingClause,Session(CSmartStr(strTableName) & "_having") doAssignmentByRef strSQL,gSQLWhere(strWhereClause,strHavingClause) end if if bValue(postvalue("pdf")) then doAssignment strWhereClause,Session(CSmartStr(strTableName) & "_pdfwhere") end if setArrElement Session,CSmartStr(strTableName) & "_pdfwhere",strWhereClause doAssignment strOrderBy,Session(CSmartStr(strTableName) & "_order") if not bValue(strOrderBy) then doAssignment strOrderBy,gstrOrderBy end if strSQL = CSmartStr(strSQL) & (" " & CSmartStr(trim(strOrderBy))) doAssignment strSQLbak,strSQL if bValue(eventObj.exists_p1("BeforeQueryPrint")) then eventObj.BeforeQueryPrint_p3 strSQL,strWhereClause,strOrderBy end if if not IsEqual(strSQL,strSQLbak) then doAssignmentByRef numrows,GetRowCount(strSQL) else doAssignmentByRef strSQL,gSQLWhere(strWhereClause,strHavingClause) strSQL = CSmartStr(strSQL) & (" " & CSmartStr(trim(strOrderBy))) rowcount = false if bValue(eventObj.exists_p1("ListGetRowCount")) then Set masterKeysReq = (CreateDictionary()) i = 0 do while IsLess(i,asp_count(pageObject.detailKeysByM)) setArrElement masterKeysReq,asp_count(masterKeysReq),Session((CSmartStr(strTableName) & "_masterkey") & CSmartStr(CSmartDbl(i)+1)) i = CSmartDbl(i)+1 loop doAssignmentByRef rowcount,eventObj.ListGetRowCount_p4(pageObject.searchClauseObj,Session(CSmartStr(strTableName) & "_mastertable"),masterKeysReq,selected_recs) end if if not IsFalse(rowcount) then doAssignment numrows,rowcount else doAssignmentByRef numrows,gSQLRowCount(strWhereClause,strHavingClause) end if end if LogInfo strSQL mypage = CSmartLng(Session(CSmartStr(strTableName) & "_pagenumber")) if not bValue(mypage) then mypage = 1 end if PageSize = CSmartLng(Session(CSmartStr(strTableName) & "_pagesize")) if not bValue(PageSize) then doAssignmentByRef PageSize,GetTableData(strTableName,".pageSize",0) end if if IsLess(PageSize,0) then all = 1 end if recno = 1 records = 0 maxpages = 1 pageindex = 1 if not bValue(all) then if bValue(numrows) then doAssignment maxRecords,numrows doAssignmentByRef maxpages,asp_ceil(CSmartDbl(maxRecords)/CSmartDbl(PageSize)) if IsLess(maxpages,mypage) then doAssignment mypage,maxpages end if if IsLess(mypage,1) then mypage = 1 end if doAssignment maxrecs,PageSize end if listarray = false if bValue(eventObj.exists_p1("ListQuery")) then doAssignmentByRef listarray,eventObj.ListQuery_p8(pageObject.searchClauseObj,Session(CSmartStr(strTableName) & "_arrFieldForSort"),Session(CSmartStr(strTableName) & "_arrHowFieldSort"),Session(CSmartStr(strTableName) & "_mastertable"),masterKeysReq,selected_recs,PageSize,mypage) end if if not IsFalse(listarray) then doAssignment rs,listarray else if bValue(numrows) then strSQL = CSmartStr(strSQL) & (((" limit " & CSmartStr((CSmartDbl(mypage)-1)*CSmartDbl(PageSize))) & ",") & CSmartStr(PageSize)) end if doAssignmentByRef rs,db_query(strSQL,conn) end if recordsonpage = CSmartDbl(numrows)-(CSmartDbl(mypage)-1)*CSmartDbl(PageSize) if IsLess(PageSize,recordsonpage) then doAssignment recordsonpage,PageSize end if xt.assign_p2 "page_number",true xt.assign_p2 "maxpages",maxpages xt.assign_p2 "pageno",mypage else listarray = false if bValue(eventObj.exists_p1("ListQuery")) then doAssignmentByRef listarray,eventObj.ListQuery_p8(pageObject.searchClauseObj,Session(CSmartStr(strTableName) & "_arrFieldForSort"),Session(CSmartStr(strTableName) & "_arrHowFieldSort"),Session(CSmartStr(strTableName) & "_mastertable"),masterKeysReq,selected_recs,PageSize,mypage) end if if not IsFalse(listarray) then doAssignment rs,listarray else doAssignmentByRef rs,db_query(strSQL,conn) end if doAssignment recordsonpage,numrows doAssignmentByRef maxpages,asp_ceil(CSmartDbl(recordsonpage)/CSmartDbl(30)) xt.assign_p2 "page_number",true xt.assign_p2 "maxpages",maxpages end if Set fieldsArr = (CreateDictionary()) Set arr = (CreateDictionary()) setArrElement arr,"fName","CourseID" setArrElement arr,"viewFormat",ViewFormat("CourseID",strTableName) setArrElement fieldsArr,asp_count(fieldsArr),arr Set arr = (CreateDictionary()) setArrElement arr,"fName","CourseTitle" setArrElement arr,"viewFormat",ViewFormat("CourseTitle",strTableName) setArrElement fieldsArr,asp_count(fieldsArr),arr Set arr = (CreateDictionary()) setArrElement arr,"fName","CEUCredit" setArrElement arr,"viewFormat",ViewFormat("CEUCredit",strTableName) setArrElement fieldsArr,asp_count(fieldsArr),arr Set arr = (CreateDictionary()) setArrElement arr,"fName","Location" setArrElement arr,"viewFormat",ViewFormat("Location",strTableName) setArrElement fieldsArr,asp_count(fieldsArr),arr Set arr = (CreateDictionary()) setArrElement arr,"fName","CourseDates" setArrElement arr,"viewFormat",ViewFormat("CourseDates",strTableName) setArrElement fieldsArr,asp_count(fieldsArr),arr Set arr = (CreateDictionary()) setArrElement arr,"fName","DurationInDays" setArrElement arr,"viewFormat",ViewFormat("DurationInDays",strTableName) setArrElement fieldsArr,asp_count(fieldsArr),arr Set arr = (CreateDictionary()) setArrElement arr,"fName","Tuitionfees" setArrElement arr,"viewFormat",ViewFormat("Tuitionfees",strTableName) setArrElement fieldsArr,asp_count(fieldsArr),arr pageObject.setGoogleMapsParams_p1 fieldsArr colsonpage = 1 if IsLess(recordsonpage,colsonpage) then doAssignment colsonpage,recordsonpage end if if IsLess(colsonpage,1) then colsonpage = 1 end if Set pages = (CreateDictionary()) Set rowinfo = (CreateDictionary()) setArrElement rowinfo,"data",CreateDictionary() if bValue(eventObj.exists_p1("ListFetchArray")) then doAssignmentByRef data,eventObj.ListFetchArray_p1(rs) else doAssignmentByRef data,db_fetch_array(rs) end if print_exitLoop6=false do while bValue(data) print_exitLoop6=false do if bValue(eventObj.exists_p1("BeforeProcessRowPrint")) then if not bValue(eventObj.BeforeProcessRowPrint_p1(data)) then if bValue(eventObj.exists_p1("ListFetchArray")) then doAssignmentByRef data,eventObj.ListFetchArray_p1(rs) else doAssignmentByRef data,db_fetch_array(rs) end if exit do end if end if print_exitLoop6=true exit do loop while false if print_exitLoop6 then _ exit do loop do while bValue(data) and (bValue(all) or IsLessOrEqual(recno,PageSize)) Set row = (CreateDictionary()) setArrElement row,"grid_record",CreateDictionary() setArrElementN row,CreateArray2("grid_record","data"),CreateDictionary() col = 1 do while (bValue(data) and (bValue(all) or IsLessOrEqual(recno,PageSize))) and IsLessOrEqual(col,1) Set record = (CreateDictionary()) recno = CSmartDbl(recno)+1 records = CSmartDbl(records)+1 keylink = "" keylink = CSmartStr(keylink) & ("&key1=" & CSmartStr(htmlspecialchars(asp_rawurlencode(ArrayElement(data,"CourseID"))))) value = "" doAssignmentByRef value,ProcessLargeText(GetData(data,"CourseID",""),"field=CourseID" & CSmartStr(keylink),"",MODE_PRINT,"") setArrElement record,"CourseID_value",value value = "" doAssignmentByRef value,ProcessLargeText(GetData(data,"CourseTitle",""),"field=CourseTitle" & CSmartStr(keylink),"",MODE_PRINT,"") setArrElement record,"CourseTitle_value",value value = "" doAssignmentByRef value,ProcessLargeText(GetData(data,"CEUCredit","Number"),"field=CEUCredit" & CSmartStr(keylink),"",MODE_PRINT,"") setArrElement record,"CEUCredit_value",value value = "" doAssignmentByRef value,ProcessLargeText(GetData(data,"Location",""),"field=Location" & CSmartStr(keylink),"",MODE_PRINT,"") setArrElement record,"Location_value",value value = "" doAssignmentByRef value,ProcessLargeText(GetData(data,"CourseDates",""),"field=CourseDates" & CSmartStr(keylink),"",MODE_PRINT,"") setArrElement record,"CourseDates_value",value value = "" doAssignmentByRef value,ProcessLargeText(GetData(data,"DurationInDays",""),"field=DurationInDays" & CSmartStr(keylink),"",MODE_PRINT,"") setArrElement record,"DurationInDays_value",value value = "" doAssignmentByRef value,ProcessLargeText(GetData(data,"Tuitionfees","Number"),"field=Tuitionfees" & CSmartStr(keylink),"",MODE_PRINT,"") setArrElement record,"Tuitionfees_value",value if IsLess(col,colsonpage) then setArrElement record,"endrecord_block",true end if setArrElement record,"grid_recordheader",true setArrElement record,"grid_vrecord",true if bValue(eventObj.exists_p1("BeforeMoveNextPrint")) then eventObj.BeforeMoveNextPrint_p3 data,row,record end if setArrElementN row,CreateArray3("grid_record","data",empty),record if bValue(eventObj.exists_p1("ListFetchArray")) then doAssignmentByRef data,eventObj.ListFetchArray_p1(rs) else doAssignmentByRef data,db_fetch_array(rs) end if print_exitLoop9=false do while bValue(data) print_exitLoop9=false do if bValue(eventObj.exists_p1("BeforeProcessRowPrint")) then if not bValue(eventObj.BeforeProcessRowPrint_p1(data)) then if bValue(eventObj.exists_p1("ListFetchArray")) then doAssignmentByRef data,eventObj.ListFetchArray_p1(rs) else doAssignmentByRef data,db_fetch_array(rs) end if exit do end if end if print_exitLoop9=true exit do loop while false if print_exitLoop9 then _ exit do loop col = CSmartDbl(col)+1 loop if IsLessOrEqual(col,colsonpage) then setArrElementN row,CreateArray4("grid_record","data",CSmartDbl(asp_count(ArrayElement(ArrayElement(row,"grid_record"),"data")))-1,"endrecord_block"),false end if setArrElement row,"grid_rowspace",true setArrElement row,"grid_recordspace",CreateDictionary1("data",CreateDictionary()) i = 0 do while IsLess(i,CSmartDbl(colsonpage)*2-1) setArrElementN row,CreateArray3("grid_recordspace","data",empty),true i = CSmartDbl(i)+1 loop setArrElementN rowinfo,CreateArray2("data",empty),row if bValue(all) and IsLessOrEqual(30,records) then Set page = (CreateDictionary1("grid_row",rowinfo)) setArrElement page,"pageno",pageindex pageindex = CSmartDbl(pageindex)+1 setArrElement pages,asp_count(pages),page records = 0 Set rowinfo = (CreateDictionary()) end if loop if bValue(asp_count(rowinfo)) then Set page = (CreateDictionary1("grid_row",rowinfo)) if bValue(all) then setArrElement page,"pageno",pageindex end if setArrElement pages,asp_count(pages),page end if i = 0 do while IsLess(i,asp_count(pages)) if IsLess(i,CSmartDbl(asp_count(pages))-1) then setArrElementN pages,CreateArray2(i,"begin"),"
" else setArrElementN pages,CreateArray2(i,"begin"),"
" end if setArrElementN pages,CreateArray2(i,"end"),"
" i = CSmartDbl(i)+1 loop Set page = (CreateDictionary()) setArrElementByRef page,"data",pages xt.assignbyref_p2 "page",page doAssignment mastertable,Session(CSmartStr(strTableName) & "_mastertable") Set masterkeys = (CreateDictionary()) if IsEqual(mastertable,"customer") then asp_include "include/customer_masterprint.asp",false setArrElement masterkeys,asp_count(masterkeys),Session(CSmartStr(strTableName) & "_masterkey1") Set params = (CreateDictionary2("detailtable","courses","keys",masterkeys)) Set master = (CreateDictionary()) setArrElement master,"func","DisplayMasterTableInfo_customer" setArrElement master,"params",params xt.assignbyref_p2 "showmasterfile",master xt.assign_p2 "mastertable_block",true end if doAssignment strSQL,Session(CSmartStr(strTableName) & "_sql") isPdfView = false if (bValue(GetTableData(strTableName,".isUsebuttonHandlers",false)) or bValue(isPdfView)) or bValue(onLoadJsCode) then setArrElement pageObject.body,"begin",CSmartStr(ArrayElement(pageObject.body,"begin")) & "" & vbcrlf setArrElement pageObject.body,"begin",CSmartStr(ArrayElement(pageObject.body,"begin")) & "" & vbcrlf if IsIdentical(pageObject.debugJSMode,true) then setArrElement pageObject.body,"begin",CSmartStr(ArrayElement(pageObject.body,"begin")) & "" & vbcrlf else setArrElement pageObject.body,"begin",CSmartStr(ArrayElement(pageObject.body,"begin")) & "" & vbcrlf end if pageObject.fillSetCntrlMaps setArrElement pageObject.body,"end",CSmartStr(ArrayElement(pageObject.body,"end")) & "" pageObject.addCommonJs end if if (bValue(GetTableData(strTableName,".isUsebuttonHandlers",false)) or bValue(isPdfView)) or bValue(onLoadJsCode) then setArrElement pageObject.body,"end",CSmartStr(ArrayElement(pageObject.body,"end")) & (("") end if xt.assignbyref_p2 "body",pageObject.body xt.assign_p2 "grid_block",true xt.assign_p2 "CourseID_fieldheadercolumn",true xt.assign_p2 "CourseID_fieldheader",true xt.assign_p2 "CourseID_fieldcolumn",true xt.assign_p2 "CourseID_fieldfootercolumn",true xt.assign_p2 "CourseTitle_fieldheadercolumn",true xt.assign_p2 "CourseTitle_fieldheader",true xt.assign_p2 "CourseTitle_fieldcolumn",true xt.assign_p2 "CourseTitle_fieldfootercolumn",true xt.assign_p2 "CEUCredit_fieldheadercolumn",true xt.assign_p2 "CEUCredit_fieldheader",true xt.assign_p2 "CEUCredit_fieldcolumn",true xt.assign_p2 "CEUCredit_fieldfootercolumn",true xt.assign_p2 "Location_fieldheadercolumn",true xt.assign_p2 "Location_fieldheader",true xt.assign_p2 "Location_fieldcolumn",true xt.assign_p2 "Location_fieldfootercolumn",true xt.assign_p2 "CourseDates_fieldheadercolumn",true xt.assign_p2 "CourseDates_fieldheader",true xt.assign_p2 "CourseDates_fieldcolumn",true xt.assign_p2 "CourseDates_fieldfootercolumn",true xt.assign_p2 "DurationInDays_fieldheadercolumn",true xt.assign_p2 "DurationInDays_fieldheader",true xt.assign_p2 "DurationInDays_fieldcolumn",true xt.assign_p2 "DurationInDays_fieldfootercolumn",true xt.assign_p2 "Tuitionfees_fieldheadercolumn",true xt.assign_p2 "Tuitionfees_fieldheader",true xt.assign_p2 "Tuitionfees_fieldcolumn",true xt.assign_p2 "Tuitionfees_fieldfootercolumn",true Set record_header = (CreateDictionary1("data",CreateDictionary())) i = 0 do while IsLess(i,colsonpage) Set rheader = (CreateDictionary()) if IsLess(i,CSmartDbl(colsonpage)-1) then setArrElement rheader,"endrecordheader_block",true end if setArrElementN record_header,CreateArray2("data",empty),rheader i = CSmartDbl(i)+1 loop xt.assignbyref_p2 "record_header",record_header xt.assign_p2 "grid_header",true xt.assign_p2 "grid_footer",true templatefile = "courses_print.htm" if bValue(eventObj.exists_p1("BeforeShowPrint")) then eventObj.BeforeShowPrint_p2 xt,templatefile end if if not bValue(postvalue("pdf")) then xt.display_p1 templatefile else xt.load_template_p1 templatefile doAssignmentByRef page,xt.fetch_loaded() pagewidth = CSmartDbl(postvalue("width"))*1.050000 pageheight = CSmartDbl(postvalue("height"))*1.050000 landscape = false if bValue(postvalue("all")) then if IsLess(pageheight,pagewidth) then landscape = true if IsLess(CSmartDbl(pagewidth)/CSmartDbl(pageheight),297/210) then pagewidth = (297/210)*CSmartDbl(pageheight) end if else if IsLess(CSmartDbl(pagewidth)/CSmartDbl(pageheight),210/297) then pagewidth = (210/297)*CSmartDbl(pageheight) end if end if end if end if %>