Advertisement
Guest User

STATE

a guest
Sep 18th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.65 KB | None | 0 0
  1. <?php
  2.  
  3. global $strSort;
  4. $strSort = $sorting;
  5.  
  6. //include the report generator class
  7. require_once("../common/nll_global_include_classes.php");
  8. require_once("engine/nll_classes_report_factory.php");
  9.  
  10. $Redirect = "../menu_dynamic.php?menu_no=1600&menu_key=1l-30&menu_name={stxtMenuHotel}";
  11. if ($Cancel=="Cancel")
  12. {
  13. header("Location: " . $Redirect);
  14.  
  15. die;
  16. }
  17.  
  18. /* Report Types:
  19. * 1. detail
  20. * 2. label
  21. */
  22. // get the appropriate class from factory
  23. $rpt = nllReportFactory::getWrapperClass("detail");
  24.  
  25. // load the template for this report
  26. $rpt->loadTemplate("templates/master_list_hotelmst_dt1.tpl");
  27.  
  28. // assign the necessary values to template variables
  29. // 1. title
  30. //$list_by = $sorting == "code" ? " Code " : " Name ";
  31.  
  32. //new try
  33. switch($sorting)
  34. {
  35. case "code":{ //$list_by="Code";
  36. if($hotel_code_get!=''){
  37. $hotel_code_get=str_ireplace(',',"','",$hotel_code_get);
  38. $between = " (hotel_code BETWEEN '$hotel_code_from' AND '$hotel_code_to' AND hotel_code IN ('".$hotel_code_get."'))";
  39. }
  40. else{
  41. $between = " (hotel_code BETWEEN '$hotel_code_from' AND '$hotel_code_to') ";
  42. }
  43. break;}
  44. case "name":{ $list_by="Name";
  45. if($hotel_code_get!=''){
  46. $hotel_code_get=str_ireplace(',',"','",$hotel_code_get);
  47. $between = " ((hotel_code BETWEEN '$hotel_code_from' AND '$hotel_code_to' AND hotel_code IN ('".$hotel_code_get."'))";
  48. }
  49. else{
  50. $between = " (hotel_code BETWEEN '$hotel_code_from' AND '$hotel_code_to') ";
  51. }
  52. break;}
  53. case "statecode":{ $list_by="State";
  54. $between = " (hotel_state BETWEEN '$hotel_state_from' AND '$hotel_state_to')";
  55. break;}
  56. case "categorycode":{ $list_by="Category";
  57. $between = " (hotel_category BETWEEN '$hotel_category_from' AND '$hotel_category_to')";
  58. break;}
  59. }
  60. //new try end
  61.  
  62. $reportTitle = "Hotel Listing by $list_by";
  63. $rpt->assign('report_title',$reportTitle);
  64.  
  65. // assign "Hotel Name" instead of using "Name" --<@izah
  66. $rpt->assign('field_name', "Hotel Name1");
  67. $rpt->assign('field_name2', "Hotel Name2");
  68. $rpt->assign('field_state', "Hotel State");
  69. $rpt->assign('field_category', "Hotel Category");
  70.  
  71. // set sql(s)
  72.  
  73. //$order = $sorting == "code" ? " code " : " name1 ";
  74.  
  75.  
  76. $dynTable_statemst_col= "statemst.stte_name1";
  77. $dynTable_statemst_join= "LEFT JOIN statemst ON hotelmst.hotel_state = statemst.stte_no";
  78. //$dynTable_categorymst_col= "categorymst.cate_name1";
  79. //$dynTable_categorymst_join= "LEFT JOIN categorymst ON hotelmst.hotel_category = categorymst.cate_no";
  80. //------------------ sorting (tidied up by Izah)--------------------------
  81. switch($sorting)
  82. {
  83. case "code":{ $order=$sorting;
  84. $groupdisplay1=1;
  85. break;}//sorted by code
  86. case "name":{ $order="name1,name2";
  87. $groupdisplay1=1;
  88. break;}//sorted by hotel name1
  89. // case "name2":{$order="name2,name1";break;}//sorted by hotel name2(added by Izah)
  90. case "statecode":{ $order=$dynTable_statemst_col.",code";
  91. $groupdisplay1 = "concat(statemst.stte_code, ' -', statemst.stte_name1)";
  92. $rpt->assign('group','State :');
  93. break;}
  94. case "categorycode":{ $order=$sorting;
  95. $groupdisplay1=hotel_category ;
  96. $rpt->assign('group','Category :');
  97. break;}
  98. }
  99.  
  100. function nllEvents_BeforePrintDetail(){
  101. //add the code here
  102. global $rpt;
  103. global $strSort;
  104.  
  105. if($strSort=="statecode" || $strSort=="categorycode")
  106. {
  107. $rpt->assign('rec_no', $rpt->_groupCounter0);
  108. }
  109. else
  110. {
  111. $rpt->assign('rec_no', $rpt->_groupCounter1);
  112. }
  113. }
  114.  
  115.  
  116. if($sorting!="code" && $sorting!="name")
  117. {
  118. switch ($sorting)
  119. {
  120. case "statecode" :
  121. $grouping = "statecode";
  122. break;
  123. case "categorycode" :
  124. $grouping = "categorycode";
  125. break;
  126. }
  127.  
  128. $groupBreaks[] = array("column" => $grouping
  129. , "page_break" => true
  130. , "h_rows" => 1
  131. , "h_index" => 1
  132. , "f_rows" => 0
  133. , "f_index" => 3
  134. );
  135. $rpt->setGroupBreaks($groupBreaks);
  136. $rpt->setPageReset(true);
  137.  
  138. }
  139. //------------------------------------------------------------------------
  140. echo
  141. $sql = array(
  142. "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"
  143. );
  144.  
  145. $rpt->setSql($sql);
  146.  
  147. // do the looping execution
  148. $rpt->generate();
  149.  
  150. //ends
  151. die();
  152.  
  153. //Include Common Files @1-23CB326C
  154. define("RelativePath", "..");
  155. define("PathToCurrentPage", "/report/");
  156. define("FileName", "master_list_hotelmst_dt1.php");
  157. include(RelativePath . "/Common.php");
  158. include(RelativePath . "/Template.php");
  159. include(RelativePath . "/Sorter.php");
  160. include(RelativePath . "/Navigator.php");
  161. //End Include Common Files
  162.  
  163. //Initialize Page @1-B976B109
  164. // Variables
  165. $FileName = "";
  166. $Redirect = "";
  167. $Tpl = "";
  168. $TemplateFileName = "";
  169. $BlockToParse = "";
  170. $ComponentName = "";
  171.  
  172. // Events;
  173. $CCSEvents = "";
  174. $CCSEventResult = "";
  175.  
  176. $FileName = FileName;
  177. $Redirect = "";
  178. $TemplateFileName = "master_list_hotelmst_dt1.html";
  179. $BlockToParse = "main";
  180. $TemplateEncoding = "ISO-8859-1";
  181. $PathToRoot = "../";
  182. //End Initialize Page
  183.  
  184. //Initialize Objects @1-E10C591F
  185.  
  186. $CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize", $MainPage);
  187.  
  188. $Charset = $Charset ? $Charset : "iso-8859-1";
  189. if ($Charset)
  190. header("Content-Type: text/html; charset=" . $Charset);
  191. //End Initialize Objects
  192.  
  193. //Initialize HTML Template @1-6CC97037
  194. $CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView", $MainPage);
  195. $Tpl = new clsTemplate();
  196. $Tpl->LoadTemplate(PathToCurrentPage . $TemplateFileName, $BlockToParse, "ISO-8859-1");
  197. $Tpl->block_path = "/$BlockToParse";
  198. $CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow", $MainPage);
  199. //End Initialize HTML Template
  200.  
  201. //Go to destination page @1-FBA93089
  202. if($Redirect)
  203. {
  204. $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
  205. header("Location: " . $Redirect);
  206. unset($Tpl);
  207. exit;
  208. }
  209. //End Go to destination page
  210.  
  211. //Show Page @1-8F693D6B
  212. $Tpl->block_path = "";
  213. $Tpl->Parse($BlockToParse, false);
  214. $main_block = $Tpl->GetVar($BlockToParse);
  215. if(preg_match("/<\/body>/i", $main_block)) {
  216. $main_block = preg_replace("/<\/body>/i", "<center><font" . " face=\"Arial\"" . "><small>&#71" . ";enera&#116;e&" . "#100; <!-- CCS" . " -->w&#105;&#116;" . "&#104; <!-- SCC" . " -->CodeC&#10" . "4;ar&#103;&#101; " . "<!-- CCS -->" . "&#83;tudi&#111;.<" . "/small></font><" . "/center>" . "</body>", $main_block);
  217. } else if(preg_match("/<\/html>/i", $main_block) && !preg_match("/<\/frameset>/i", $main_block)) {
  218. $main_block = preg_replace("/<\/html>/i", "<center><font" . " face=\"Arial\"" . "><small>&#71" . ";enera&#116;e&" . "#100; <!-- CCS" . " -->w&#105;&#116;" . "&#104; <!-- SCC" . " -->CodeC&#10" . "4;ar&#103;&#101; " . "<!-- CCS -->" . "&#83;tudi&#111;.<" . "/small></font><" . "/center>" . "</html>", $main_block);
  219. } else if(!preg_match("/<\/frameset>/i", $main_block)) {
  220. $main_block .= "<center><font" . " face=\"Arial\"" . "><small>&#71" . ";enera&#116;e&" . "#100; <!-- CCS" . " -->w&#105;&#116;" . "&#104; <!-- SCC" . " -->CodeC&#10" . "4;ar&#103;&#101; " . "<!-- CCS -->" . "&#83;tudi&#111;.<" . "/small></font><" . "/center>";
  221. }
  222. $CCSEventResult = CCGetEvent($CCSEvents, "BeforeOutput", $MainPage);
  223. if ($CCSEventResult) echo $main_block;
  224. //End Show Page
  225.  
  226. //Unload Page @1-74A7C1E7
  227. $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
  228. unset($Tpl);
  229. //End Unload Page
  230.  
  231.  
  232. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement