Guest User

full code1

a guest
Dec 27th, 2016
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.66 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['submit1'])){
  3.  
  4. require_once('tcpdf.php');
  5.  
  6. $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  7.  
  8. // set document information
  9. $pdf->SetCreator(PDF_CREATOR);
  10. $pdf->SetAuthor('Nicola Asuni');
  11. $pdf->SetTitle('TCPDF Example 001');
  12. $pdf->SetSubject('TCPDF Tutorial');
  13. $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  14.  
  15. // set default header data
  16. $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
  17. $pdf->setFooterData(array(0,64,0), array(0,64,128));
  18.  
  19. // set header and footer fonts
  20. $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  21. $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
  22.  
  23. // set default monospaced font
  24. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  25.  
  26. // set margins
  27. $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  28. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  29. $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  30.  
  31. // set auto page breaks
  32. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  33.  
  34. // set image scale factor
  35. $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  36.  
  37. // set some language-dependent strings (optional)
  38. if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
  39. require_once(dirname(__FILE__).'/lang/eng.php');
  40. $pdf->setLanguageArray($l);
  41. }
  42.  
  43. // ---------------------------------------------------------
  44.  
  45. // set default font subsetting mode
  46. $pdf->setFontSubsetting(true);
  47.  
  48. // Set font
  49. // dejavusans is a UTF-8 Unicode font, if you only need to
  50. // print standard ASCII chars, you can use core fonts like
  51. // helvetica or times to reduce file size.
  52. $pdf->SetFont('dejavusans', '', 14, '', true);
  53.  
  54. // Add a page
  55. // This method has several options, check the source code documentation for more information.
  56. $pdf->AddPage();
  57.  
  58. // set text shadow effect
  59. $pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
  60.  
  61. // Set some content to print
  62. $html = <<<EOD
  63. <h1>Welcome</h1>
  64. EOD;
  65.  
  66. $html='<table border="0" cellspacing="0" cellpadding="0" style="border:1px solid #e1e1e1">';
  67. $html.='<tr bgcolor="#cccccc" ><th height="20" >Commission</th><th>Paid status</th><th>Delivery date</th><th>Due date</th></tr>';
  68. foreach ($order as $orderData)
  69. {
  70. if(is_array($order[0]))
  71. {
  72.  
  73. foreach ($order as $orderData)
  74. {
  75. if($i%2==0){ $html.='<tr bgcolor="#d3d6ff">';}else{ $html.='<tr>';}
  76. if($orderData['status']=="0"){$status="Inactive";}else{$status="Active";}
  77. $html.='<td height="20" >&nbsp;'.$commission.'</td>';
  78. $html.='<td>'.$paid_status.'</td>';
  79. $html.='<td>'.$delivery_status.'</td>';
  80. $html.='<td>'.$due_date.'</td>';
  81. $i++;
  82. $html.='</tr>';
  83. }
  84. }
  85. else
  86. {
  87. if($i%2==0){ $html.='<tr bgcolor="#d3d6ff">';}else{ $html.='<tr>';}
  88. if($order['status']=="0"){$status="Inactive";}else{$status="Active";}
  89. $html.='<td height="20" >&nbsp;'.$commission.'</td>';
  90. $html.='<td>'.$paid_status.'</td>';
  91. $html.='<td>'.$delivery_status.'</td>';
  92. $html.='<td>'.$due_date.'</td>';
  93. $i++;
  94. $html.='</tr>';
  95. }
  96. }
  97.  
  98. $html.='</table>';
  99.  
  100.  
  101. // Print text using writeHTMLCell()
  102. $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
  103. // $pdf->writeHTML($html, true, 'true', true, false, '');
  104.  
  105. // ---------------------------------------------------------
  106.  
  107. // Close and output PDF document
  108. // This method has several options, check the source code documentation for more information.
  109. ob_end_clean();
  110. $pdf->Output('example_001.pdf', 'I');
  111. //$pdf->Output($filename, 'D');exit;
  112. }
  113. ?>
  114.  
  115. <?php
  116.  
  117. include 'home.php';
  118.  
  119. $is_admin = false;
  120. $user_home = new USER();
  121.  
  122. /* to show selected date */
  123.  
  124. if (isset($_POST['post_at']) && $_POST['post_at'] != '')
  125. {
  126. $orderFromDate = $_POST['post_at'] . " 00:00:00 ";
  127. }
  128. else
  129. {
  130. $orderFromDate = '';
  131. }
  132.  
  133. if (isset($_POST['post_at_to_date']) && $_POST['post_at_to_date'] != '')
  134. {
  135. $orderToDate = $_POST['post_at_to_date'] . " 23:59:59 ";
  136. }
  137. else
  138. {
  139. $orderToDate = '';
  140. }
  141.  
  142. /* to show selected date end*/
  143.  
  144. function getDesignerName($designerId)
  145. {
  146. $user_home = new USER();
  147. if (!$user_home->is_logged_in())
  148. {
  149. $user_home->redirect('index.php');
  150. }
  151.  
  152. $stmt = $user_home->runQuery("SELECT * FROM tbl_users WHERE userID=:uid");
  153. $stmt->execute(array(
  154. ":uid" => $designerId
  155. ));
  156. $row = $stmt->fetch(PDO::FETCH_ASSOC);
  157. return $row['name'];
  158. }
  159.  
  160. /* Fetching magento db details end */
  161.  
  162. function getDesignerCollection()
  163. {
  164. global $is_admin;
  165. $user_home = new USER();
  166. require_once '../../app/Mage.php';
  167.  
  168. Mage::app();
  169.  
  170. $stmts = $user_home->runQuery("SELECT * FROM tbl_users WHERE userID=:uid");
  171. $stmts->execute(array(
  172. ":uid" => $_SESSION['userSession']
  173. ));
  174. $rows = $stmts->fetch(PDO::FETCH_ASSOC);
  175.  
  176. $stmt = $user_home->runQuery("SELECT * FROM order_details");
  177. $stmt->execute(array(":uid" => $_SESSION['userSession']));
  178. $row = $stmt->fetch(PDO::FETCH_ASSOC);
  179. $stmt->execute();
  180.  
  181. /* date search */
  182. if (isset($_POST['post_at']) && $_POST['post_at'] != '')
  183. {
  184. $orderFromDate = $_POST['post_at'] . " 00:00:00 ";
  185.  
  186. }
  187. else
  188. {
  189. $orderFromDate = '';
  190. }
  191.  
  192. if (isset($_POST['post_at_to_date']) && $_POST['post_at_to_date'] != '')
  193. {
  194. $orderToDate = $_POST['post_at_to_date'] . " 23:59:59 ";
  195.  
  196. }
  197. else
  198. {
  199. $orderToDate = '';
  200. }
  201. /* date search end*/
  202.  
  203. $accountType = $rows['type'];
  204. if ($accountType == "admin")
  205. {
  206. $is_admin = true;
  207. $order = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('designer_id', array(
  208. 'nin' => '0'
  209. ));
  210. if ($orderFromDate != '') $order->addFieldToFilter('created_at', array(
  211. 'gteq' => $orderFromDate
  212. ));
  213. if ($orderToDate != '') $order->addFieldToFilter('created_at', array(
  214. 'lteq' => $orderToDate
  215. ));
  216. }
  217. else
  218. {
  219. $order = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('designer_id', array(
  220. 'like' => '%' . $_SESSION['userSession'] . '%'
  221. ));
  222. if ($orderFromDate != '') $order->addFieldToFilter('created_at', array(
  223. 'gteq' => $orderFromDate
  224. ));
  225. if ($orderToDate != '') $order->addFieldToFilter('created_at', array(
  226. 'lteq' => $orderToDate
  227. ));
  228. }
  229.  
  230. /* Fetching magento db details end */
  231.  
  232. $i = 0;
  233. foreach($order as $orderData)
  234. {
  235. $k = 0;
  236. $orderitems = $orderData['dproduct_id'];
  237. $orderitemsarray = explode(",", $orderitems);
  238.  
  239. $oDate = new DateTime($orderData['created_at']);
  240. $sDate = $oDate->format("M d, Y");
  241.  
  242. while ($k < count($orderitemsarray))
  243.  
  244. {
  245.  
  246. if ($orderitemsarray[$k] != '0')
  247. {
  248.  
  249. $stmtorders = $user_home->runQuery("SELECT * FROM order_details");
  250. $stmtorders->execute(array(":dorder_id" => $orderData['entity_id']));
  251.  
  252. $roworders = $stmtorders->fetch(PDO::FETCH_ASSOC);
  253.  
  254. $dorderStatus = $roworders['dpaid_status'];
  255.  
  256. $productdetail = Mage::getModel('catalog/product')->load($orderitemsarray[$k]);
  257. $designer_id = $productdetail->getDesignerID() ;
  258.  
  259. if($accountType == "admin")
  260. {
  261. $designerName = getDesignerName($productdetail->getDesignerID()) . " -(" . $productdetail->getDesignerID() . ")";
  262.  
  263. $stmt1 = $user_home->runQuery("SELECT * FROM order_details WHERE dproduct_id=:pid and designerorder_id=:doid");
  264. $stmt1->execute(array(
  265. ":doid" => $orderData->getIncrementId(),
  266. ":pid" => $orderitemsarray[$k],
  267. ));
  268.  
  269. $paid_status='';
  270. $delivery_status='';
  271. $due_date='';
  272. $sDate1='';
  273.  
  274. while($datas = $stmt1->fetch())
  275.  
  276. {
  277. $paid_status=$datas['dpaid_status'];
  278. $delivery_status=$datas['delivery_status'];
  279. $oDate1 = new DateTime($datas['due_date']);
  280. $due_date = $oDate1->format("M d, Y");
  281. $sDate1 = $oDate1->format("M d, Y");
  282.  
  283. if($datas['dpaid_status']=='P'){$paid_status='Paid';}
  284. if($datas['dpaid_status']=='U'){$paid_status='Unpaid';}
  285.  
  286. if($datas['delivery_status']=='P'){$delivery_status='Pending';}
  287. if($datas['delivery_status']=='D'){$delivery_status='Delivered';}
  288. if($datas['delivery_status']=='R'){$delivery_status='Returned';}
  289. if($datas['delivery_status']=='C'){$delivery_status='Cancelled';}
  290.  
  291. }
  292.  
  293. if ( $paid_status == ''){
  294. $paid_status='blank';
  295. }
  296.  
  297. if ( $delivery_status == ''){
  298. $delivery_status='blank1';
  299. }
  300.  
  301.  
  302.  
  303.  
  304. $stmt = $user_home->runQuery("SELECT commission1 FROM tbl_users where userID=:uid");
  305. $stmt->execute(array(":uid" => $_SESSION['userSession']));
  306. $row = $stmt->fetch(PDO::FETCH_ASSOC);
  307. $commission = $row['commission1'] ;
  308.  
  309. $responce[] = array(
  310. $orderData->getIncrementId() ,
  311. $orderData->getIncrementId() ,
  312. $orderitemsarray[$k],
  313. $productdetail->getName() ,
  314. $designerName,
  315. $orderData['status'], // magento [ pending / processing/complete]
  316. $orderData['grand_total'], // magento
  317. $orderData['customer_email'], // magento
  318. $commission,
  319. $paid_status,
  320. $delivery_status,
  321. $due_date,
  322. $sDate // magento
  323. );
  324.  
  325. }
  326.  
  327. else
  328. {
  329.  
  330. if( $designer_id== $_SESSION['userSession'] )
  331. {
  332. $designerName = getDesignerName($productdetail->getDesignerID()) . " -(" . $productdetail->getDesignerID() . ")";
  333.  
  334. $stmt1 = $user_home->runQuery("SELECT * FROM order_details WHERE dproduct_id=:pid and designerorder_id=:doid");
  335. $stmt1->execute(array(
  336. ":doid" => $orderData->getIncrementId(),
  337. ":pid" => $orderitemsarray[$k],
  338. ));
  339.  
  340. $paid_status='';
  341. $delivery_status='';
  342. $due_date='';
  343. $sDate1='';
  344.  
  345. while($datas = $stmt1->fetch())
  346.  
  347.  
  348. {
  349. $paid_status=$datas['dpaid_status'];
  350. $delivery_status=$datas['delivery_status'];
  351. $oDate1 = new DateTime($datas['due_date']);
  352. $due_date = $oDate1->format("M d, Y");
  353. $sDate1 = $oDate1->format("M d, Y");
  354.  
  355. if($datas['dpaid_status']=='P'){$paid_status='Paid';}
  356. if($datas['dpaid_status']=='U'){$paid_status='Unpaid';}
  357.  
  358. if($datas['delivery_status']=='P'){$delivery_status='Pending';}
  359. if($datas['delivery_status']=='D'){$delivery_status='Delivered';}
  360. if($datas['delivery_status']=='R'){$delivery_status='Returned';}
  361. if($datas['delivery_status']=='C'){$delivery_status='Cancelled';}
  362.  
  363. }
  364.  
  365. if ( $paid_status == ''){
  366. $paid_status='blank';
  367. }
  368.  
  369. if ( $delivery_status == ''){
  370. $delivery_status='blank1';
  371. }
  372.  
  373.  
  374. $stmt = $user_home->runQuery("SELECT commission1 FROM tbl_users where userID=:uid"); //I assume user_id is field of database in tbl_user table
  375. $stmt->execute(array(":uid" => $_SESSION['userSession']));
  376. $row = $stmt->fetch(PDO::FETCH_ASSOC);
  377. $commission = $row['commission1'] ;
  378.  
  379.  
  380.  
  381. $responce[] = array(
  382. $orderData->getIncrementId() ,
  383. $orderData->getIncrementId() ,
  384. $orderitemsarray[$k],
  385. $productdetail->getName() ,
  386. $designerName,
  387. $orderData['status'], // magento [ pending / processing/complete]
  388. $orderData['grand_total'], // magento
  389. $orderData['customer_email'], // magento
  390. $commission,
  391. $paid_status,
  392. $delivery_status,
  393. $due_date,
  394. $sDate // magento
  395. );
  396. }
  397.  
  398. }
  399.  
  400. }
  401.  
  402. $k++;
  403. $i++;
  404. }
  405.  
  406.  
  407. } // foreach
  408.  
  409. return json_encode($responce);
  410.  
  411. } // designer collection
  412.  
  413.  
  414. ?>
  415.  
  416. <head>
  417.  
  418. <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  419. <script src= "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.js"></script>
  420.  
  421. <link rel="stylesheet" href="assets/css/jquery-ui.css">
  422. <script src="assets/js/jquery-1.10.2.js"></script>
  423. <script src="assets/js/jquery-ui.js"></script>
  424. <script src="assets/js/jquery-ui.js"></script>
  425.  
  426.  
  427. <script type="text/javascript" language="javascript" src="http://sbdev2.kidsdial.com:81/php/site6/bootstrap/js/outthinking/gt_msg_en.js"></script>
  428. <script type="text/javascript" language="javascript" src="http://sbdev2.kidsdial.com:81/php/site6/bootstrap/js/outthinking/gt_grid_all.js"></script>
  429.  
  430.  
  431. <link rel="stylesheet" type="text/css" href="http://sbdev2.kidsdial.com:81/php/site6/bootstrap/css/outthinking/css/skinstyle.css"/>
  432. <link rel="stylesheet" type="text/css" href="http://sbdev2.kidsdial.com:81/php/site6/bootstrap/css/outthinking/css/gt_grid.css"/>
  433. <h2> Orders</h2><div id="msgresult" style="display:none;color:blue;text-align:center;">Paid status changed.</div>
  434.  
  435. </head>
  436.  
  437.  
  438. <form action="#" name="pdfForm" method="POST">
  439. <button type="submit1" name="submit1" value="Submit"> Export To PDF </button>
  440. </form>
  441. <br/>
  442.  
  443.  
  444. <div>
  445. <div class="delete_grid" >
  446.  
  447. <form>
  448. Search:
  449.  
  450. <select id="f_value2">
  451. <option value="entity_id">Order Id</option>
  452. </select>
  453.  
  454.  
  455. <input type="text" onkeyup="doFilter()" value="" id="f_value1" >
  456. <input type="reset" value="Reset" onClick="window.location.reload()">
  457. </form>
  458.  
  459. <br/>
  460.  
  461.  
  462.  
  463. <form name="frmSearch" method="post" action="">
  464. <input type="text" placeholder="From Date" id="post_at"
  465.  
  466. value="<?php
  467.  
  468. if ($orderFromDate != '')
  469. {
  470.  
  471. $newPostStartDate = date('Y-m-d', strtotime($_POST['post_at']));
  472. echo $newPostStartDate;
  473.  
  474. } ?>" name="post_at" />
  475.  
  476. <input type="text" placeholder="To Date" id="post_at_to_date"
  477.  
  478.  
  479. value="<?php
  480.  
  481. if ($orderToDate != '')
  482. {
  483.  
  484.  
  485. $newPostEndDate = date('Y-m-d', strtotime($_POST['post_at_to_date']));
  486. echo $newPostEndDate;
  487.  
  488. } ?>"name="post_at_to_date" />
  489.  
  490. <input type="submit" name="search" value="search" id="searchButton">
  491.  
  492.  
  493.  
  494. <input type="button" value="Reset" id="clear-dates">
  495. </form>
  496.  
  497.  
  498. <br/>
  499.  
  500. <?php
  501.  
  502. $stmts = $user_home->runQuery("SELECT * FROM tbl_users WHERE userID=:uid");
  503. $stmts->execute(array(
  504. ":uid" => $_SESSION['userSession']
  505. ));
  506. $rows = $stmts->fetch(PDO::FETCH_ASSOC);
  507.  
  508. $accountType = $rows['type'];
  509. if ($accountType == "admin")
  510. {
  511. ?>
  512.  
  513.  
  514. <div class="delete_grid_select">
  515.  
  516. <div class="delete_grid_select1" id = "hide">
  517.  
  518. <form action='' method="post" enctype="multipart/form-data">
  519. <input type="hidden" name="delete_package_id" id="delete_package_id" value=""/>
  520. Paid Status:
  521.  
  522. <select name="massaction" id="massaction">
  523. <option value="">Select</option>
  524. <option value="P">Paid</option>
  525. <option value="U">Unpaid</option>
  526. </select>
  527.  
  528. <input type="button" value="Submit" id="delete-grid-button" onclick="massAction()" />
  529. </form>
  530.  
  531. <form action='' method="post" enctype="multipart/form-data">
  532. <input type="hidden" name="delete_package_id1" id="delete_package_id1" value=""/>
  533. Delivery status:
  534.  
  535. <select name="massaction1" id="massaction1">
  536. <option value="">Select</option>
  537. <option value="P">Pending</option>
  538. <option value="D">Delivered</option>
  539. <option value="R">Returned</option>
  540. <option value="C">Cancelled</option>
  541. </select>
  542.  
  543. <input type="button" value="Submit" id="delete-grid-button" onclick="massAction1()" />
  544. </form>
  545.  
  546.  
  547. </div>
  548.  
  549. <?php
  550. }
  551. else
  552. {
  553.  
  554. ?>
  555. <style type="text/css">
  556. #hide { display:none; }
  557. </style>
  558.  
  559. <?php
  560. }
  561. ?>
  562.  
  563. </div>
  564.  
  565.  
  566. </div>
  567. </div>
  568.  
  569.  
  570. <div id="myGrid"></div>
  571.  
  572. <script type="text/javascript">
  573.  
  574. var __TEST_DATA__=eval('<?php
  575. echo getDesignerCollection(); ?>');
  576. var grid_demo_id = "myGrid" ;
  577. var dsOption= {
  578. fields :[
  579. {name : 'entity_id' },
  580. {name : 'entity_id' },
  581. {name : 'product_id' },
  582. {name : 'product_name'},
  583. {name : 'designer_id' },
  584. {name : 'status' },
  585. {name : 'grand_total' },
  586. {name : 'customer_email' },
  587. {name : 'commission1' },
  588. {name : 'dpaid_status' },
  589. {name : 'delivery_status' },
  590. {name : 'due_date' },
  591. {name : 'created_at'},
  592. ],
  593. recordType : 'array',
  594. data : __TEST_DATA__
  595. }
  596.  
  597.  
  598. function my_renderId(value ,record,columnObj,grid,colNo,rowNo)
  599. {
  600. var no= record[columnObj.fieldIndex];
  601.  
  602. return "<input type='checkbox' value='"+record[0]+"-"+record[2]+"' name='userID[]'/>";
  603.  
  604. }
  605.  
  606. var colsOption = [
  607. // {id: '' , header: "" , width :"15",renderer : my_renderId , width :"60"},
  608. <?php if ($is_admin) echo "{id: '' , header: '' , width :'15',renderer : my_renderId , width :'60'},"; ?>
  609. {id: 'created_at' , header: "Order Date" , width :"100"},
  610. {id: 'entity_id' , header: "Order Id" , width :"70"},
  611. // {id: 'product_id' , header: "Product Id" , width :"70"},
  612. <?php if ($is_admin) echo "{id: 'product_id' , header: 'Product ID' , width :'110'},"; ?>
  613. {id: 'product_name' , header: "Product Name" , width :"400"},
  614. <?php if ($is_admin) echo "{id: 'designer_id' , header: 'Designer' , width :'110'},"; ?>
  615. // {id: 'status' , header: "Order Status" , width :"100"},
  616. // {id: 'grand_total' , header: " Order Amount" , width :"120"},
  617. // {id: 'customer_email' , header: "User Email" , width :"150"},
  618. {id: 'dpaid_status' , header: "Paid status" , width :"80"},
  619. {id: 'commission1' , header: "commission [Rs] " , width :"110"},
  620. {id: 'delivery_status' , header: "Delivery Status" , width :"110"},
  621. {id: 'due_date' , header: "Payment Due Date" , width :"140"},
  622.  
  623. ];
  624.  
  625. var gridOption={
  626. id : grid_demo_id,
  627.  
  628. // height: "285", //"100%", // 330,
  629.  
  630. pageSize:30,
  631. pageSizeList : [5,10,15,20],
  632. container : 'myGrid',
  633. replaceContainer : true,
  634. sortable : false,
  635.  
  636. dataset : dsOption ,
  637. columns : colsOption ,
  638. toolbarContent : 'nav goto | pagesize | filter state | sortable | search',
  639. onRowClick:function(value, record , cell, row, colNO, rowNO,columnObj,grid){
  640. }
  641. };
  642. var mygrid=new Sigma.Grid(gridOption);
  643. Sigma.Util.onLoad( Sigma.Grid.render(mygrid) );
  644.  
  645. function doFilter() {
  646. var filterInfo=[
  647. {
  648. fieldName : $('select[id=f_value2]').val(),
  649. logic : "startWith",
  650. value : Sigma.Util.getValue("f_value1")
  651. },
  652. {
  653. fieldName : Sigma.Util.getValue("f_fieldName12"),
  654. logic : "greatEqual",
  655. value : Sigma.Util.getValue("f_value12")
  656. }
  657. ]
  658. var grid=Sigma.$grid("myGrid");
  659. var rowNOs=grid.applyFilter(filterInfo);
  660. }
  661. function doUnfilter(){
  662. var grid=Sigma.$grid("myGrid1");
  663. var rowNOs=grid.unfilterGrid();
  664.  
  665. }
  666.  
  667.  
  668. function doUnfilter(){
  669. var grid=Sigma.$grid("myGrid1");
  670. var rowNOs=grid.unfilterGrid();
  671.  
  672. }
  673.  
  674. // payment
  675.  
  676. function massAction()
  677. {
  678. var e=document.getElementById("massaction");
  679. var strUser = e.options[e.selectedIndex].value;
  680.  
  681. massStatusChangeVerified(strUser);
  682.  
  683. }
  684.  
  685. // payment end
  686.  
  687. // Delivery
  688. function massAction1()
  689. {
  690. var e=document.getElementById("massaction1");
  691. var strUser1 = e.options[e.selectedIndex].value;
  692.  
  693. massStatusChangeVerified1(strUser1);
  694.  
  695. }
  696.  
  697. //Delivery end
  698.  
  699. //payment
  700.  
  701. function massStatusChangeVerified(status)
  702. {
  703. var vals = "";
  704. var checkboxes=$("input[name='userID[]']:checked").each( function () {
  705.  
  706. vals += ","+$(this).val();
  707.  
  708. })
  709. alert(vals);
  710. if(vals=='')
  711. {
  712. alert("No record selected");
  713. return false;
  714. }
  715. retactiveVal=confirm("Are you sure want to Change the status");
  716. if( retactiveVal == true )
  717. {
  718. if (vals) vals = vals.substring(1);
  719. document.getElementsByName('delete_package_id').value=vals;
  720. var url="http://sbdev2.kidsdial.com:81/php/site6/update_order_status.php?designer_id="+vals+"&order_status="+status;
  721. var request = jQuery.ajax( {
  722. url: url ,
  723. type: 'POST',
  724. } );
  725.  
  726. request.done( function (result)
  727. {
  728. document.getElementById('msgresult').style.display="block";
  729. var explode = function(){
  730. location.reload();
  731. };
  732. setTimeout(explode, 2000);
  733.  
  734.  
  735. } );
  736. request.fail( function ( error )
  737. {
  738. console.dir(error);
  739. } );return true;
  740. }else{
  741. return false;
  742. }
  743.  
  744. }
  745.  
  746. // payment end
  747.  
  748. //Delivery
  749.  
  750.  
  751. function massStatusChangeVerified1(status)
  752. {
  753. var vals = "";
  754. var checkboxes=$("input[name='userID[]']:checked").each( function () {
  755.  
  756. vals += ","+$(this).val();
  757.  
  758. })
  759. alert(vals);
  760. if(vals=='')
  761. {
  762. alert("No record selected");
  763. return false;
  764. }
  765. retactiveVal=confirm("Are you sure want to Change the status");
  766. if( retactiveVal == true )
  767. {
  768. if (vals) vals = vals.substring(1);
  769. document.getElementsByName('delete_package_id1').value=vals;
  770. var url="http://sbdev2.kidsdial.com:81/php/site6/update_delivery_status.php?designer_id="+vals+"&delivery_status="+status;
  771. var request = jQuery.ajax( {
  772. url: url ,
  773. type: 'POST',
  774. } );
  775.  
  776. request.done( function (result)
  777. {
  778. document.getElementById('msgresult').style.display="block";
  779. var explode = function(){
  780. location.reload();
  781. };
  782. setTimeout(explode, 2000);
  783.  
  784.  
  785. } );
  786. request.fail( function ( error )
  787. {
  788. console.dir(error);
  789. } );return true;
  790. }else{
  791. return false;
  792. }
  793.  
  794. }
  795.  
  796. //Delivery end
  797.  
  798. <!-- Date Picker -->
  799.  
  800.  
  801. jQuery.datepicker.setDefaults({
  802. showOn: "button",
  803. buttonImage: "assets/img/datepicker.png",
  804. buttonText: "Date Picker",
  805. buttonImageOnly: true,
  806. dateFormat: 'yy-mm-dd'
  807. });
  808. $(function() {
  809. $("#post_at").datepicker();
  810. $("#post_at_to_date").datepicker();
  811. });
  812.  
  813.  
  814. <!-- reset date -->
  815. var $dates = $('#post_at, #post_at_to_date').datepicker();
  816.  
  817.  
  818. $("#clear-dates").click(function(){
  819. location.reload();
  820. $("#post_at").removeAttr('value');
  821. $("#post_at_to_date").removeAttr('value');
  822. if(!$("#post_at_to_date").val()) {
  823. $( "#searchButton" ).trigger( "click" );
  824. }
  825. });
  826.  
  827. // Total rows
  828.  
  829. $(".delete_grid").append("Number of rows : "+mygrid.dataset.getSize());
  830.  
  831. // Total Commission
  832. var numRows=mygrid.dataset.getSize();
  833. var commission =(mygrid.dataset.data[0][8]);
  834. var total_commission=numRows * commission;
  835. $(".delete_grid").append(" , Total commission : "+total_commission);
  836.  
  837.  
  838. </script>
Add Comment
Please, Sign In to add comment