Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $strSort;
- $strSort = $sorting;
- //include the report generator class
- require_once("../common/nll_global_include_classes.php");
- require_once("engine/nll_classes_report_factory.php");
- $Redirect = "../menu_dynamic.php?menu_no=1600&menu_key=1l-30&menu_name={stxtMenuHotel}";
- if ($Cancel=="Cancel")
- {
- header("Location: " . $Redirect);
- die;
- }
- /* Report Types:
- * 1. detail
- * 2. label
- */
- // get the appropriate class from factory
- $rpt = nllReportFactory::getWrapperClass("detail");
- // load the template for this report
- $rpt->loadTemplate("templates/master_list_hotelmst_dt1.tpl");
- // assign the necessary values to template variables
- // 1. title
- //$list_by = $sorting == "code" ? " Code " : " Name ";
- //new try
- switch($sorting)
- {
- case "code":{ //$list_by="Code";
- if($hotel_code_get!=''){
- $hotel_code_get=str_ireplace(',',"','",$hotel_code_get);
- $between = " (hotel_code BETWEEN '$hotel_code_from' AND '$hotel_code_to' AND hotel_code IN ('".$hotel_code_get."'))";
- }
- else{
- $between = " (hotel_code BETWEEN '$hotel_code_from' AND '$hotel_code_to') ";
- }
- break;}
- case "name":{ $list_by="Name";
- if($hotel_code_get!=''){
- $hotel_code_get=str_ireplace(',',"','",$hotel_code_get);
- $between = " ((hotel_code BETWEEN '$hotel_code_from' AND '$hotel_code_to' AND hotel_code IN ('".$hotel_code_get."'))";
- }
- else{
- $between = " (hotel_code BETWEEN '$hotel_code_from' AND '$hotel_code_to') ";
- }
- break;}
- case "statecode":{ $list_by="State";
- $between = " (hotel_state BETWEEN '$hotel_state_from' AND '$hotel_state_to')";
- break;}
- case "categorycode":{ $list_by="Category";
- $between = " (hotel_category BETWEEN '$hotel_category_from' AND '$hotel_category_to')";
- break;}
- }
- //new try end
- $reportTitle = "Hotel Listing by $list_by";
- $rpt->assign('report_title',$reportTitle);
- // assign "Hotel Name" instead of using "Name" --<@izah
- $rpt->assign('field_name', "Hotel Name1");
- $rpt->assign('field_name2', "Hotel Name2");
- $rpt->assign('field_state', "Hotel State");
- $rpt->assign('field_category', "Hotel Category");
- // set sql(s)
- //$order = $sorting == "code" ? " code " : " name1 ";
- $dynTable_statemst_col= "statemst.stte_name1";
- $dynTable_statemst_join= "LEFT JOIN statemst ON hotelmst.hotel_state = statemst.stte_no";
- //$dynTable_categorymst_col= "categorymst.cate_name1";
- //$dynTable_categorymst_join= "LEFT JOIN categorymst ON hotelmst.hotel_category = categorymst.cate_no";
- //------------------ sorting (tidied up by Izah)--------------------------
- switch($sorting)
- {
- case "code":{ $order=$sorting;
- $groupdisplay1=1;
- break;}//sorted by code
- case "name":{ $order="name1,name2";
- $groupdisplay1=1;
- break;}//sorted by hotel name1
- // case "name2":{$order="name2,name1";break;}//sorted by hotel name2(added by Izah)
- case "statecode":{ $order=$dynTable_statemst_col.",code";
- $groupdisplay1 = "concat(statemst.stte_code, ' -', statemst.stte_name1)";
- $rpt->assign('group','State :');
- break;}
- case "categorycode":{ $order=$sorting;
- $groupdisplay1=hotel_category ;
- $rpt->assign('group','Category :');
- break;}
- }
- function nllEvents_BeforePrintDetail(){
- //add the code here
- global $rpt;
- global $strSort;
- if($strSort=="statecode" || $strSort=="categorycode")
- {
- $rpt->assign('rec_no', $rpt->_groupCounter0);
- }
- else
- {
- $rpt->assign('rec_no', $rpt->_groupCounter1);
- }
- }
- if($sorting!="code" && $sorting!="name")
- {
- switch ($sorting)
- {
- case "statecode" :
- $grouping = "statecode";
- break;
- case "categorycode" :
- $grouping = "categorycode";
- break;
- }
- $groupBreaks[] = array("column" => $grouping
- , "page_break" => true
- , "h_rows" => 1
- , "h_index" => 1
- , "f_rows" => 0
- , "f_index" => 3
- );
- $rpt->setGroupBreaks($groupBreaks);
- $rpt->setPageReset(true);
- }
- //------------------------------------------------------------------------
- echo
- $sql = array(
- "detail" => "SELECT hotel_no AS ano, hotel_code AS code, hotel_name1 AS name1, hotel_name2 AS name2,statemst.stte_name1 AS statecode, hotel_category as categorycode, $dynTable_statemst_col AS state, $groupdisplay1 AS groupdisplay1 FROM hotelmst $dynTable_statemst_join WHERE $between GROUP BY $order"
- );
- $rpt->setSql($sql);
- // do the looping execution
- $rpt->generate();
- //ends
- die();
- //Include Common Files @1-23CB326C
- define("RelativePath", "..");
- define("PathToCurrentPage", "/report/");
- define("FileName", "master_list_hotelmst_dt1.php");
- include(RelativePath . "/Common.php");
- include(RelativePath . "/Template.php");
- include(RelativePath . "/Sorter.php");
- include(RelativePath . "/Navigator.php");
- //End Include Common Files
- //Initialize Page @1-B976B109
- // Variables
- $FileName = "";
- $Redirect = "";
- $Tpl = "";
- $TemplateFileName = "";
- $BlockToParse = "";
- $ComponentName = "";
- // Events;
- $CCSEvents = "";
- $CCSEventResult = "";
- $FileName = FileName;
- $Redirect = "";
- $TemplateFileName = "master_list_hotelmst_dt1.html";
- $BlockToParse = "main";
- $TemplateEncoding = "ISO-8859-1";
- $PathToRoot = "../";
- //End Initialize Page
- //Initialize Objects @1-E10C591F
- $CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize", $MainPage);
- $Charset = $Charset ? $Charset : "iso-8859-1";
- if ($Charset)
- header("Content-Type: text/html; charset=" . $Charset);
- //End Initialize Objects
- //Initialize HTML Template @1-6CC97037
- $CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView", $MainPage);
- $Tpl = new clsTemplate();
- $Tpl->LoadTemplate(PathToCurrentPage . $TemplateFileName, $BlockToParse, "ISO-8859-1");
- $Tpl->block_path = "/$BlockToParse";
- $CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow", $MainPage);
- //End Initialize HTML Template
- //Go to destination page @1-FBA93089
- if($Redirect)
- {
- $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
- header("Location: " . $Redirect);
- unset($Tpl);
- exit;
- }
- //End Go to destination page
- //Show Page @1-8F693D6B
- $Tpl->block_path = "";
- $Tpl->Parse($BlockToParse, false);
- $main_block = $Tpl->GetVar($BlockToParse);
- if(preg_match("/<\/body>/i", $main_block)) {
- $main_block = preg_replace("/<\/body>/i", "<center><font" . " face=\"Arial\"" . "><small>G" . ";enerate&" . "#100; <!-- CCS" . " -->wit" . "h <!-- SCC" . " -->CodeC
" . "4;arge " . "<!-- CCS -->" . "Studio.<" . "/small></font><" . "/center>" . "</body>", $main_block);
- } else if(preg_match("/<\/html>/i", $main_block) && !preg_match("/<\/frameset>/i", $main_block)) {
- $main_block = preg_replace("/<\/html>/i", "<center><font" . " face=\"Arial\"" . "><small>G" . ";enerate&" . "#100; <!-- CCS" . " -->wit" . "h <!-- SCC" . " -->CodeC
" . "4;arge " . "<!-- CCS -->" . "Studio.<" . "/small></font><" . "/center>" . "</html>", $main_block);
- } else if(!preg_match("/<\/frameset>/i", $main_block)) {
- $main_block .= "<center><font" . " face=\"Arial\"" . "><small>G" . ";enerate&" . "#100; <!-- CCS" . " -->wit" . "h <!-- SCC" . " -->CodeC
" . "4;arge " . "<!-- CCS -->" . "Studio.<" . "/small></font><" . "/center>";
- }
- $CCSEventResult = CCGetEvent($CCSEvents, "BeforeOutput", $MainPage);
- if ($CCSEventResult) echo $main_block;
- //End Show Page
- //Unload Page @1-74A7C1E7
- $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
- unset($Tpl);
- //End Unload Page
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement