Guest User

full code

a guest
Nov 22nd, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.48 KB | None | 0 0
  1. <?php
  2.  
  3. $servername = "localhost";
  4. $username = "root";
  5. $password = "Outthinking123@";
  6. $dbname = "designer6";
  7.  
  8. include 'home.php';
  9. $user_home = new USER();
  10.  
  11.  
  12. echo "<pre>";print_r($_POST);
  13.  
  14. // Create connection
  15. $conn = new mysqli($servername, $username, $password, $dbname);
  16. // Check connection
  17. if ($conn->connect_error) {
  18. die("Connection failed: " . $conn->connect_error);
  19. }
  20.  
  21.  
  22.  
  23. $stmt = $user_home->runQuery("SELECT * FROM tbl_users");
  24. $stmt->execute(array(":uid" => $_SESSION['userSession']));
  25. $row = $stmt->fetch(PDO::FETCH_ASSOC);
  26. $stmt->execute();
  27. $queryCondition='';
  28. // echo 'SELECT * FROM order_details '.$queryCondition;
  29. ?>
  30.  
  31. <?php
  32.  
  33. function getDesignerCollection()
  34. {
  35. $user_home = new USER();
  36. require_once '../../app/Mage.php';
  37. Mage::app();
  38. $stmts = $user_home->runQuery("SELECT * FROM tbl_users WHERE userID=:uid");
  39. $stmts->execute(array(":uid"=>$_SESSION['userSession']));
  40. $rows = $stmts->fetch(PDO::FETCH_ASSOC);
  41.  
  42. $accountType=$rows['type'];
  43. if($accountType=="admin"){
  44.  
  45. $order = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('designer_id',array('nin'=>'0'));
  46.  
  47. }
  48. else
  49. {
  50. $order = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('designer_id',array('like' => '%'.$_SESSION['userSession'].'%'));
  51. }
  52.  
  53. $i=0;
  54. foreach ($order as $orderData)
  55. {
  56.  
  57. $orderitems=$orderData['dproduct_id'];
  58. $orderitemsarray=explode(",",$orderitems);
  59. $k=0;
  60.  
  61. $oDate = new DateTime($orderData['created_at']);
  62. $sDate = $oDate->format("Y-m-d");
  63. while($k < count($orderitemsarray))
  64. {
  65. if($orderitemsarray[$k]!='0')
  66. {
  67.  
  68. $stmtorders = $user_home->runQuery("SELECT * FROM order_details WHERE designerorder_id=:designerorder_id");
  69. $stmtorders->execute(array(":designerorder_id"=>$orderData['entity_id']));
  70.  
  71. $roworders = $stmtorders->fetch(PDO::FETCH_ASSOC);
  72.  
  73. if($roworders['designerorder_id']==''){$dorderStatus="Unpaid";}else{$dorderStatus=$roworders['paid_status'];}
  74.  
  75. $productdetail=Mage::getModel('catalog/product')->load($orderitemsarray[$k]);
  76.  
  77. $responce[]=array($orderData->getIncrementId(),$orderData->getIncrementId(),$orderitemsarray[$k],$productdetail->getName(),$designerName,$orderData['status'],$orderData['grand_total'],$orderData['customer_email'],$orderData['shipping_description'],$dorderStatus,$sDate);
  78.  
  79. }
  80. $k++; $i++;
  81. }
  82.  
  83. } echo json_encode($responce);
  84.  
  85. }
  86.  
  87. /* Date */
  88. $reg_user='';
  89.  
  90. $post_at = "";
  91.  
  92. $post_at_to_date = "";
  93. $queryCondition = "";
  94. if(!empty($_POST["post_at"]))
  95. {
  96. $post_at = date('Y-m-d 0:0:0',strtotime($_POST["post_at"]));
  97. $post_at_todate = date('Y-m-d:59:59:59');
  98. if(!empty($_POST["post_at_to_date"])) {
  99. $post_at_to_date = date('Y-m-d 59:59:59',strtotime($_POST["post_at_to_date"]));
  100. $post_at_todate = $post_at_to_date;
  101. }
  102. $queryCondition .= "WHERE post_at >= '" . $post_at . "' AND post_at <= '" . $post_at_todate . "'";
  103. }
  104.  
  105. $sqlquery = "SELECT * FROM order_details $queryCondition";
  106. $result = $conn->query($sqlquery);
  107.  
  108. if ($result->num_rows > 0) {
  109. echo $result->num_rows.'result found'."<br>";
  110. while($row = $result->fetch_assoc()) {
  111. echo "id: " . $row["id"]. " - date: " . $row["post_at"];
  112. echo "<br>";
  113. }
  114. } else {
  115. echo "0 results found <br>";
  116. }
  117. $conn->close();
  118. ?>
  119.  
  120. <head>
  121.  
  122. <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  123. <script src= "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.js"></script>
  124.  
  125. <link rel="stylesheet" href="assets/css/jquery-ui.css">
  126. <script src="assets/js/jquery-1.10.2.js"></script>
  127. <script src="assets/js/jquery-ui.js"></script>
  128. <script src="assets/js/jquery-ui.js"></script>
  129.  
  130. <script>
  131. jQuery.datepicker.setDefaults({
  132. showOn: "button",
  133. buttonImage: "datepicker.png",
  134. buttonText: "Date Picker",
  135. buttonImageOnly: true,
  136. dateFormat: 'yy-mm-dd'
  137. });
  138. $(function() {
  139. $("#post_at").datepicker();
  140. $("#post_at_to_date").datepicker();
  141. });
  142. </script>
  143.  
  144. <script type="text/javascript" language="javascript" src="http://sbdev2.kidsdial.com:81/php/site6/bootstrap/js/outthinking/gt_msg_en.js"></script>
  145. <script type="text/javascript" language="javascript" src="http://sbdev2.kidsdial.com:81/php/site6/bootstrap/js/outthinking/gt_grid_all.js"></script>
  146.  
  147.  
  148. <link rel="stylesheet" type="text/css" href="http://sbdev2.kidsdial.com:81/php/site6/bootstrap/css/outthinking/css/skinstyle.css"/>
  149. <link rel="stylesheet" type="text/css" href="http://sbdev2.kidsdial.com:81/php/site6/bootstrap/css/outthinking/css/gt_grid.css"/>
  150.  
  151. </head>
  152.  
  153. <div>
  154. <div class="delete_grid" >
  155. Search:
  156. <select id="f_value2">
  157. <option value="entity_id">Order Id</option>
  158. <option value="designer_id">Designer Id</option>
  159. </select>
  160. <input type="text" onkeyup="doFilter()" value="" id="f_value1" >
  161.  
  162.  
  163. <br/><br/>
  164.  
  165. <form name="frmSearch" method="post" action="">
  166. <input type="text" placeholder="From Date" id="post_at" value="" name="post_at" />
  167. <input type="text" placeholder="To Date" id="post_at_to_date" value="" name="post_at_to_date" />
  168. <input type="submit" name="search" value="search" />
  169. </form>
  170. </div>
  171. </div>
  172. <div id="myGrid"></div>
  173.  
  174. <script type="text/javascript">
  175.  
  176. var __TEST_DATA__=eval('<?php echo getDesignerCollection();?>');
  177. var grid_demo_id = "myGrid" ;
  178. var dsOption= {
  179. fields :[
  180. {name : 'entity_id' },
  181. {name : 'entity_id' },
  182. {name : 'product_id' },
  183. {name : 'product_name'},
  184. {name : 'designer_id' },
  185. {name : 'status' },
  186. {name : 'grand_total' },
  187. {name : 'customer_email' },
  188. {name : 'shipping_description' },
  189. {name : 'paid_status' },
  190. {name : 'created_at'},
  191. ],
  192. recordType : 'array',
  193. data : __TEST_DATA__
  194. }
  195.  
  196.  
  197. function my_renderId(value ,record,columnObj,grid,colNo,rowNo)
  198. {
  199. var no= record[columnObj.fieldIndex];
  200.  
  201. return "<input type='checkbox' value='"+record[0]+"' name='userID'/>";
  202. }
  203.  
  204. var colsOption = [
  205. {id: 'entity_id' , header: "Order Id" , width :"15",renderer : my_renderId},
  206. {id: 'entity_id' , header: "Order Id" , width :"75"},
  207.  
  208. {id: 'created_at' , header: "Order Date" , width :"120"}
  209.  
  210. ];
  211.  
  212. var gridOption={
  213. id : grid_demo_id,
  214. //height: "285", //"100%", // 330,
  215. pageSize:20,
  216. pageSizeList : [5,10,15,20],
  217. container : 'myGrid',
  218. replaceContainer : true,
  219. dataset : dsOption ,
  220. columns : colsOption ,
  221. toolbarContent : 'nav goto | pagesize | filter state | sortable | search',
  222. onRowClick:function(value, record , cell, row, colNO, rowNO,columnObj,grid){
  223. }
  224. };
  225. var mygrid=new Sigma.Grid(gridOption);
  226. Sigma.Util.onLoad( Sigma.Grid.render(mygrid) );
  227.  
  228. function doFilter() {
  229. var filterInfo=[
  230. {
  231. fieldName : $('select[id=f_value2]').val(),
  232. logic : "startWith",
  233. value : Sigma.Util.getValue("f_value1")
  234. },
  235. {
  236. fieldName : Sigma.Util.getValue("f_fieldName12"),
  237. logic : "greatEqual",
  238. value : Sigma.Util.getValue("f_value12")
  239. }
  240. ]
  241. var grid=Sigma.$grid("myGrid");
  242. var rowNOs=grid.applyFilter(filterInfo);
  243. }
  244. function doUnfilter(){
  245. var grid=Sigma.$grid("myGrid1");
  246. var rowNOs=grid.unfilterGrid();
  247.  
  248. }
  249.  
  250. function massAction()
  251. {
  252. var e=document.getElementById("massaction");
  253. var strUser = e.options[e.selectedIndex].value;
  254.  
  255. switch(strUser)
  256. {
  257. case "paid":
  258. retactiveVal=confirm("Are you sure want to Change the Paid status");
  259. if( retactiveVal == true )
  260. {
  261. massdesignerpaidstatus();
  262. return true;
  263. }else{
  264. return false;
  265. }
  266.  
  267. return false;
  268. }
  269. }
  270.  
  271. </script>
Add Comment
Please, Sign In to add comment