Guest User

Untitled

a guest
Mar 30th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.67 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * Manage all the client report features like add/edit/delete/list/sort/search
  5. *
  6. * Author : @Deepesh Kumar R
  7.  
  8. *
  9. * @license http://www.phpgrid.org (/opt/lampp/htdocs/billing/phpgrid/LICENSE.txt)
  10. * @link http://www.phpgrid.org
  11. */
  12.  
  13. // Include config for database connection
  14. Include "phpgrid/config.php";
  15.  
  16. // If the session is not set then redirecting to login page
  17. if ($_SESSION['uname'] == ''){
  18. header('Location: index.php');
  19. }
  20.  
  21. // include and create object
  22.  
  23. include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
  24. $g = new jqgrid();
  25.  
  26.  
  27. // set few params
  28. $grid["caption"] = "Signup status report"; // Caption of the grid
  29. $grid["width"] = "1500"; // Width of the grid
  30.  
  31. $g->set_options($grid);
  32.  
  33. // set database table for CRUD operations
  34. $g->table = "client";
  35.  
  36. // To select the values having display = 0 (Enabled clients)
  37. //$g->select_command = "select * from client where display=0";
  38.  
  39. // $col["hidden"] = true; // don't show this column in list
  40.  
  41. // Set the columns for grid report
  42. $col = array();
  43. $col["title"] = "SL NO:"; // caption of column
  44. $col["name"] = "id"; // grid column name, same as db field or alias from sql
  45. $cols[] = $col;
  46.  
  47. $col = array();
  48. $col["title"] = "Bug No"; // caption of column
  49. $col["name"] = "bugNo"; // grid column name, same as db field or alias from sql
  50. $col["width"] = "70"; // Width of the column
  51. $col["editable"] = true; // this column is editable
  52. $col["editrules"] = array("number"=>true); // Numbers only allowed
  53. $cols[] = $col;
  54.  
  55. $col = array();
  56. $col["title"] = "Client Name";
  57. $col["name"] = "clientName"; // grid column name, same as db field or alias from sql
  58. $col["width"] = "50";// Width of the column
  59. $col["editable"] = true; // this column is editable
  60. $col["editrules"] = array("required"=>true); // this field is required
  61. $cols[] = $col;
  62.  
  63. $col = array();
  64. $col["title"] = "Case Id"; // caption of column
  65. $col["name"] = "caseId"; // grid column name, same as db field or alias from sql
  66. $col["editrules"] = array("number"=>true); // Numbers only allowed
  67. $col["width"] = "50"; // Width of the column
  68. $col["editable"] = true; // this column is editable
  69. $cols[] = $col;
  70.  
  71.  
  72. $col = array();
  73. $col["title"] = "FollowUp Date"; // caption of column
  74. $col["name"] = "followUpDate"; // grid column name, same as db field or alias from sql
  75. $col["editable"] = true; // this column is editable
  76. $col["editoptions"]["placeholder"] = "YYYY-MM-DD";
  77. //$col["editrules"] = array("required"=>true); // this field is required // Based on issue #104015 commenting the FollowUp Date validation and required field
  78. //$col["editrules"] = array("date"=>true); //validation for the date format
  79. $cols[] = $col;
  80.  
  81. $col = array();
  82. $col["title"] = "SLA/Plan Change Status"; // caption of column // Based on issue #104015 changing the heading name
  83. $col["name"] = "slaStatus"; // grid column name, same as db field or alias from sql
  84. $col["editable"] = true; // this column is editable
  85. $col["editrules"] = array("required"=>true); // this field is required
  86. $col["edittype"] = "select";//For displaying dropdown
  87. $col["editoptions"] = array("value"=>'Yes:Yes;No:No;NA:NA', "multiple" => true);//options in dropdown
  88. $cols[] = $col;
  89.  
  90. $col = array();
  91. $col["title"] = "NDA Status"; // caption of column
  92. $col["name"] = "ndaStatus"; // grid column name, same as db field or alias from sql
  93. $col["editable"] = true; // this column is editable
  94. $col["edittype"] = "select"; //For displaying dropdown
  95. $col["editoptions"] = array("value"=>'Yes:Yes;No:No;NA:NA', "multiple" => true); //options in dropdown
  96.  
  97. $cols[] = $col;
  98.  
  99. $col = array();
  100. $col["title"] = "Questionnaire"; // caption of column
  101. $col["name"] = "questionnaire"; // grid column name, same as db field or alias from sql
  102. $col["editable"] = true; // this column is editable
  103. $col["edittype"] = "select"; //For displaying dropdown
  104. $col["editoptions"] = array("value"=>'Yes:Yes;No:No;NA:NA', "multiple" => true); //options in dropdown
  105.  
  106. $cols[] = $col;
  107. $col = array();
  108. $col["edittype"] = "";
  109. $col["title"] = "Payment Confirmed"; // caption of column
  110. $col["name"] = "paymentConfirmed"; // grid column name, same as db field or alias from sql
  111. $col["width"] = "50"; // Width of the column
  112. $col["editable"] = true; // this column is editable
  113. $col["edittype"] = "select"; //For displaying dropdown
  114. $col["editoptions"] = array("value"=>'Yes:Yes;No:No;NA:NA', "multiple" => true); //options in dropdown
  115.  
  116. $cols[] = $col;
  117.  
  118. $col = array();
  119. $col["title"] = "Hard Copy Updated"; // caption of column
  120. $col["name"] = "hardCopyUpdated"; // grid column name, same as db field or alias from sql
  121. $col["width"] = "50"; // Width of the column
  122. $col["editable"] = true; // this column is editable
  123. $col["edittype"] = "select"; //For displaying dropdown $col["editoptions"] = array("value"=>'yes:Yes;no:No', "multiple" => true); //options in dropdown
  124. $col["editoptions"] = array("value"=>'Yes:Yes;No:No;NA:NA', "multiple" => true); //options in dropdown
  125.  
  126. $col = array();
  127. $col["title"] = "Escalated"; // caption of column
  128. $col["name"] = "escalated"; // grid column name, same as db field or alias from sql
  129. $col["width"] = "50"; // Width of the column
  130. $col["editable"] = true; // this column is editable
  131. $col["edittype"] = "select";//For displaying dropdown
  132. $col["editoptions"] = array("value"=>'billing:Billing;sales:Sales Team;teamlead:Team Lead;qm:QM;core:Core', "multiple" => true); //options in dropdown
  133. $cols[] = $col;
  134.  
  135. $col = array();
  136. $col["title"] = "Comments"; // caption of column
  137. $col["name"] = "comments"; // grid column name, same as db field or alias from sql
  138. $col["editable"] = true; // this column is editable
  139. $col["edittype"] = "textarea";
  140. $cols[] = $col;
  141.  
  142.  
  143.  
  144. $g->set_columns($cols);
  145.  
  146. // Setting actions like add/eidt/ based on the role
  147. // Readonly user can only view the report
  148. if ($_SESSION['role'] == 'readonlyUser'){
  149.  
  150. $g->set_actions(array(
  151. "add"=>false, // allow/disallow add
  152. "edit"=>false, // allow/disallow edit
  153. "delete"=>false, // allow/disallow delete
  154. "rowactions"=>false, // show/hide row wise edit/del/save option
  155. )
  156. );
  157. // Billing User can only add clients
  158. }else if ($_SESSION['role'] == 'billingUser'){
  159.  
  160. $g->set_actions(array(
  161. "delete"=>false, // allow/disallow delete
  162. "rowactions"=>false, // show/hide row wise edit/del/save option
  163. )
  164. );
  165. }
  166.  
  167. // render grid
  168. $out = $g->render("list1");
  169. ?>
  170. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  171. <html>
  172. <head>
  173.  
  174. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  175. <!-- these css and js files are required by php grid -->
  176. <link rel="stylesheet" type="text/css" media="screen" href="phpgrid/lib/js/themes/redmond/jquery-ui.custom.css"></link>
  177. <link rel="stylesheet" type="text/css" media="screen" href="phpgrid/lib/js/jqgrid/css/ui.jqgrid.css"></link>
  178.  
  179. <script src="phpgrid/lib/js/jquery.min.js" type="text/javascript"></script>
  180. <script src="phpgrid/lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
  181. <script src="phpgrid/lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
  182. <script src="phpgrid/lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
  183. <!-- these css and js files are required by php grid -->
  184. </head>
  185. <body>
  186. <div class="heading">
  187. <div class="left"><p>Welcome <b><font color='#68A3D5'><?php echo $_SESSION[uname]; ?></font></b></p></div><!--Welcome text-->
  188. <div class="right"><a href="loginList.php?action=logout"><font color='#68A3D5'><b>Logout</b></font></a></div><!--Logout link-->
  189. </div>
  190.  
  191. <div style="margin:10px">
  192. <!-- display grid here -->
  193. <?php echo $out?>
  194. <!-- display grid here -->
  195. </div>
  196.  
  197. <script>
  198. $(document).ready(function(){
  199. //Set time delay to highlight the colors
  200. setTimeout(function() {
  201. // For giving background color for Suspended client
  202. $("td[aria-describedby='list1_status']:contains('Suspended')").parent('tr').css({'background-image':'None','background':'url("")','background-color': 'Orange'});
  203. // For giving background color for Cancelled cleint
  204. $("td[aria-describedby='list1_status']:contains('Cancelled')").parent('tr').css({'background-image':'None','background':'url("")','background-color': 'Red'});
  205.  
  206. }, 500);
  207. });
  208. </script>
  209.  
  210. </body>
  211. </html>
Add Comment
Please, Sign In to add comment