Guest User

linkssssssss

a guest
Nov 22nd, 2016
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.54 KB | None | 0 0
  1. <?php
  2.  
  3. $servername = "localhost";
  4. $username = "";
  5. $password = "";
  6. $dbname = "";
  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. //$post_at_to_date = "";
  92.  
  93. $post_at = '0000-00-00';
  94. $post_at_todate = '0000-00-00';
  95.  
  96. $queryCondition = "";
  97.  
  98. if( !empty( $_POST[ 'post_at' ] ) )
  99. {
  100. $post_at = date( 'Y-m-d', strtotime( $_POST[ 'post_at' ] ) );
  101. $post_at_todate = date( 'Y-m-d' );
  102. if( !empty( $_POST[ 'post_at_to_date' ] ) )
  103. {
  104. $post_at_to_date = date( 'Y-m-d', strtotime( $_POST[ 'post_at_to_date' ] ) );
  105. $post_at_todate = $post_at_to_date;
  106. }
  107. $queryCondition .= "WHERE DATE( created_at ) >= '" . $post_at . "' AND DATE( created_at ) <= '" . $post_at_todate . "'";
  108. }
  109.  
  110. $sqlquery = "SELECT * FROM order_details $queryCondition";
  111. var_dump( $sqlquery );
  112.  
  113.  
  114. $result = $conn->query($sqlquery);
  115.  
  116. if ($result->num_rows > 0) {
  117. echo $result->num_rows.'result found'."<br>";
  118. while($row = $result->fetch_assoc()) {
  119. echo "id: " . $row["id"]. " - date: " . $row["post_at"];
  120. echo "<br>";
  121. }
  122. } else {
  123. echo "0 results found <br>";
  124. }
  125. $conn->close();
  126. ?>
  127.  
  128. <head>
  129.  
  130. <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  131. <script src= "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.js"></script>
  132.  
  133. <link rel="stylesheet" href="assets/css/jquery-ui.css">
  134. <script src="assets/js/jquery-1.10.2.js"></script>
  135. <script src="assets/js/jquery-ui.js"></script>
  136. <script src="assets/js/jquery-ui.js"></script>
  137.  
  138. <script>
  139. jQuery.datepicker.setDefaults({
  140. showOn: "button",
  141. buttonImage: "datepicker.png",
  142. buttonText: "Date Picker",
  143. buttonImageOnly: true,
  144. dateFormat: 'yy-mm-dd'
  145. });
  146. $(function() {
  147. $("#post_at").datepicker();
  148. $("#post_at_to_date").datepicker();
  149. });
  150. </script>
  151.  
  152. <script type="text/javascript" language="javascript" src="http://sbdev2.kidsdial.com:81/php/site6/bootstrap/js/outthinking/gt_msg_en.js"></script>
  153. <script type="text/javascript" language="javascript" src="http://sbdev2.kidsdial.com:81/php/site6/bootstrap/js/outthinking/gt_grid_all.js"></script>
  154.  
  155.  
  156. <link rel="stylesheet" type="text/css" href="http://sbdev2.kidsdial.com:81/php/site6/bootstrap/css/outthinking/css/skinstyle.css"/>
  157. <link rel="stylesheet" type="text/css" href="http://sbdev2.kidsdial.com:81/php/site6/bootstrap/css/outthinking/css/gt_grid.css"/>
  158.  
  159. </head>
  160.  
  161. <div>
  162. <div class="delete_grid" >
  163. Search:
  164. <select id="f_value2">
  165. <option value="entity_id">Order Id</option>
  166. <option value="designer_id">Designer Id</option>
  167. </select>
  168. <input type="text" onkeyup="doFilter()" value="" id="f_value1" >
  169.  
  170.  
  171. <br/>
  172.  
  173. <form name="frmSearch" method="post" action="">
  174. <input type="text" placeholder="From Date" id="post_at" value="" name="post_at" />
  175. <input type="text" placeholder="To Date" id="post_at_to_date" value="" name="post_at_to_date" />
  176. <input type="submit" name="search" value="search" />
  177. </form>
  178. </div>
  179. </div>
  180. <div id="myGrid"></div>
  181.  
  182. <script type="text/javascript">
  183.  
  184. var __TEST_DATA__=eval('<?php echo getDesignerCollection();?>');
  185. var grid_demo_id = "myGrid" ;
  186. var dsOption= {
  187. fields :[
  188. {name : 'entity_id' },
  189. {name : 'entity_id' },
  190. {name : 'product_id' },
  191. {name : 'product_name'},
  192. {name : 'designer_id' },
  193. {name : 'status' },
  194. {name : 'grand_total' },
  195. {name : 'customer_email' },
  196. {name : 'shipping_description' },
  197. {name : 'paid_status' },
  198. {name : 'created_at'},
  199. ],
  200. recordType : 'array',
  201. data : __TEST_DATA__
  202. }
  203.  
  204.  
  205. function my_renderId(value ,record,columnObj,grid,colNo,rowNo)
  206. {
  207. var no= record[columnObj.fieldIndex];
  208.  
  209. return "<input type='checkbox' value='"+record[0]+"' name='userID'/>";
  210. }
  211.  
  212. var colsOption = [
  213. {id: 'entity_id' , header: "Order Id" , width :"15",renderer : my_renderId},
  214. {id: 'entity_id' , header: "Order Id" , width :"75"},
  215.  
  216. {id: 'created_at' , header: "Order Date" , width :"120"}
  217.  
  218. ];
  219.  
  220. var gridOption={
  221. id : grid_demo_id,
  222. //height: "285", //"100%", // 330,
  223. pageSize:20,
  224. pageSizeList : [5,10,15,20],
  225. container : 'myGrid',
  226. replaceContainer : true,
  227. dataset : dsOption ,
  228. columns : colsOption ,
  229. toolbarContent : 'nav goto | pagesize | filter state | sortable | search',
  230. onRowClick:function(value, record , cell, row, colNO, rowNO,columnObj,grid){
  231. }
  232. };
  233. var mygrid=new Sigma.Grid(gridOption);
  234. Sigma.Util.onLoad( Sigma.Grid.render(mygrid) );
  235.  
  236. function doFilter() {
  237. var filterInfo=[
  238. {
  239. fieldName : $('select[id=f_value2]').val(),
  240. logic : "startWith",
  241. value : Sigma.Util.getValue("f_value1")
  242. },
  243. {
  244. fieldName : Sigma.Util.getValue("f_fieldName12"),
  245. logic : "greatEqual",
  246. value : Sigma.Util.getValue("f_value12")
  247. }
  248. ]
  249. var grid=Sigma.$grid("myGrid");
  250. var rowNOs=grid.applyFilter(filterInfo);
  251. }
  252. function doUnfilter(){
  253. var grid=Sigma.$grid("myGrid1");
  254. var rowNOs=grid.unfilterGrid();
  255.  
  256. }
  257.  
  258. function massAction()
  259. {
  260. var e=document.getElementById("massaction");
  261. var strUser = e.options[e.selectedIndex].value;
  262.  
  263. switch(strUser)
  264. {
  265. case "paid":
  266. retactiveVal=confirm("Are you sure want to Change the Paid status");
  267. if( retactiveVal == true )
  268. {
  269. massdesignerpaidstatus();
  270. return true;
  271. }else{
  272. return false;
  273. }
  274.  
  275. return false;
  276. }
  277. }
  278.  
  279. </script>
Add Comment
Please, Sign In to add comment