Guest User

Untitled

a guest
Feb 23rd, 2018
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 34.18 KB | None | 0 0
  1. <?php
  2. ini_set('display_errors', 1);
  3. ini_set('display_startup_errors', 1);
  4. error_reporting(E_ALL);
  5. require_once("dbcontroller.php");
  6. $db_handle = new DBController();
  7. if (isset($_GET['pageno'])) {
  8.    $pageno = $_GET['pageno'];
  9. } else {
  10.    $pageno = 1;
  11. }
  12. ?>
  13. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  14. <html xmlns="http://www.w3.org/1999/xhtml">
  15. <head>
  16.     <title>Main Order Details</title>
  17.     <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"/>
  18.     <link rel="icon" href="images/favicon.ico" type="image/x-icon"/>
  19.     <link href="SpryAssets/style.css" rel="stylesheet" type="text/css" />
  20.     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  21.     <link href="SpryAssets/Tab.css" rel="stylesheet" type="text/css" />
  22.     <script src="SpryAssets/jquery-2.1.1.min.js" type="text/javascript"></script>
  23.     <script src="SpryAssets/jquery-ui.min.js"></script>
  24.     <link href="SpryAssets/jquery.dataTables.min.css" rel="stylesheet" type="text/css" />
  25.     <link rel="shortcut icon" href="images/2DO_1.png" type="image/x-icon"> 
  26.    
  27.     <link href="SpryAssets/jquery-ui.css" rel="stylesheet" type="text/css" />
  28.    
  29. </head>
  30. <body>
  31.     <div id="wrapper">  
  32.         <?php include "Header.php";?>  
  33.         <?php
  34.  
  35.             $sqluser = "SELECT * from Admin_Master where UserName!='".$loginuser."' AND TYPE !=0" ;
  36.             $userresult = $db_handle->runSelectQuery($sqluser);
  37.             //print_r($userresult);die;
  38.             $numrowsuser =count($userresult);
  39.         ?>
  40.         <div id="ordercontent">    
  41.             <div class="tab">
  42.                 <button class="tablinks" onclick="openTab(event, 'LeadManager')" id="<?php if($logintype=='1'){echo"defaultOpen";}?>">ORDERS</button>
  43.                
  44.                
  45.             </div>
  46.             <!-- Tab content -->
  47.             <div id="AllTeam" >
  48.             <?php if($logintype=="2" && ($userdepart=="1" || $userdepart=="2" || $userdepart=="3" || $userdepart=="4")){?>
  49.                 <input type="text" name="tag" id="focus" placeholder="Use handheld RFID scanner"/>
  50.                 <?php }?>
  51.             </div>
  52.             <div id="LeadManager" class="tabcontent">
  53.                 <h3><?php echo $usertype;?></h3>
  54.                 <input type="hidden" name="orderids" id="orderids" value=""/>
  55.                 <?php if($logintype!="2"){?>
  56.                            
  57.                 <!-- Import Order -->
  58.                
  59.                        
  60.                 <div class="importorder">
  61.                     <form name="importorderform" id="importorderform" method="post" enctype="multipart/form-data" action="importOrder.php" >
  62.                         <input type="file" name="file" id="file" class="ajax-action-file"> 
  63.                         <button type="submit" id="submit" name="Import" class="ajax-assign-button" data-loading-text="Loading...">Import CSV</button>
  64.                     </form>
  65.                 </div>
  66.                 <div style="clear:both;"></div>
  67.                 <!-- Assign Orders -->
  68.                    
  69.                 <!-- Conformed Order From Pending To conformed -->
  70.                
  71.                 <?PHP }?>
  72.                 <div style="clear:both;"></div>
  73.                 <?php
  74.  
  75.                     $userToSearch='';
  76.                 /*  if($logintype=="2"){
  77.                         $userToSearch = "WHERE conformed_by LIKE '%".$loginuser."%'";
  78.                     }
  79.                     else
  80.                     {
  81.                         $userToSearch = "WHERE conformed_by LIKE '%%' OR conformed_by IS NULL";
  82.                     }*/
  83.                     $sqlresultdoorder = "SELECT * from do_order";
  84.                     $resultdoorder = $db_handle->runSelectQuery($sqlresultdoorder);
  85.                     $numrows =count($resultdoorder);
  86.                     $rows_per_page = 20;
  87.                     $lastpage= ceil($numrows/$rows_per_page);
  88.                     $pageno = (int)$pageno;
  89.                     if ($pageno > $lastpage) {
  90.                        $pageno = $lastpage;
  91.                     } // if
  92.                     if ($pageno < 1) {
  93.                        $pageno = 1;
  94.                     }
  95.                     $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page;
  96.                     $sqlresult = "SELECT * from do_order ORDER BY id DESC ".$limit;
  97.                     $orderrecords = $db_handle->runSelectQuery($sqlresult);
  98.                    
  99.                 ?>
  100.                
  101.             <!-- madhu please check from below code -->
  102.                
  103.                
  104.             <?php
  105.  
  106.            $tabindex=1;
  107.           function checkecomstatus($orderid)
  108.           {
  109.             $data['username']='outthinking781346';
  110.             $data['password']='ouhk78epe34csmed46d';
  111.             $data['awb']=$orderid;
  112.  
  113.             $url = 'https://plapi.ecomexpress.in/track_me/api/mawbd/?awb=awbnumber&order='.$orderid.'&username=outthinking781346&password=ouhk78epe34csmed46d';
  114.             $ch = curl_init();                    
  115.             curl_setopt($ch, CURLOPT_URL,$url);
  116.             curl_setopt($ch, CURLOPT_POST, true);  
  117.             curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  118.             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  119.            
  120.             curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  121.             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  122.            
  123.            
  124.             $output = curl_exec ($ch);
  125.             curl_close($ch);
  126.             $res = explode("\n",$output);
  127.            
  128.             if ( ! isset($res[13]))
  129.             {
  130.                $res[13] = null;
  131.             }
  132.             $status = str_replace('</field>.','',$res[13]);
  133.             $statusfinal = str_replace('<field type="CharField" name="status">','',$status);
  134.             if($statusfinal!='')
  135.             {
  136.             $sqlecom = "UPDATE do_order set in_transit='".$statusfinal.".',tconformed_by='Ecom' where order_id=".$orderid;
  137.             $db_handleecom = new DBController();
  138.             $resultecom = $db_handleecom->executeUpdate($sqlecom);     
  139.             }
  140.            
  141.             return $statusfinal;
  142.           }
  143.  
  144. ?>       
  145.                
  146.                
  147.                
  148.          <p><button type= "button" id="show_status" >Show Status</button></p>
  149.           <table class="tbl-qa" border="1">
  150.            <thead>
  151.             <tr>            
  152.               <th class="table-header">ID</th>
  153.               <th class="table-header">ORDERID</th>            
  154.               <th class="table-header">Status</th>        
  155.             </tr>
  156.           </thead>
  157.           <tbody id="table-body">
  158.           <?php
  159.          
  160.           if(!empty($orderrecords))
  161.           {
  162.             foreach($orderrecords as $k=>$v)
  163.             {?>
  164.               <tr class="table-row" id="table-row-<?php echo $orderrecords[$k]["id"]; ?>" tabindex="<?php echo $tabindex;?>">
  165.                 <td>
  166. <input type="checkbox" name="assigneeid" class="assigneeid-order" value="<?php echo $orderrecords[$k]["order_id"]; ?>">
  167. </td>
  168.  
  169.                 <td><?php echo $orderrecords[$k]["order_id"]; ?></td>
  170.                
  171.                <td id="<?php echo $orderrecords[$k]["order_id"];?>"></td>          
  172.                
  173.             </tr>
  174.             <?php
  175.             $tabindex++;
  176.             }
  177.           }?>
  178.           </tbody>
  179.         </table>
  180.         <input type="hidden" name="ordercheckallIDs" id="ordercheckallIDs" value="<?php echo $ordercheckall;?>"/>
  181.                
  182.                
  183.                 <!-- madhu please check from until here -->
  184.                
  185.                
  186.                 <div class="pagination">
  187.                     <?php if ($pageno == 1) {
  188.                        echo " <span class='firstspan'>FIRST</span>";
  189.                     } else {
  190.                        echo " <span class='firstpage'><a href='{$_SERVER['PHP_SELF']}?wtype=".$wtype."&pageno=1'>FIRST</a></span> ";
  191.                        $prevpage = $pageno-1;
  192.                        echo " <span class='prvpage'><a href='{$_SERVER['PHP_SELF']}?wtype=".$wtype."&pageno=$prevpage'>PREV</a></span> ";
  193.                     }
  194.  
  195.                     if ($pageno == $lastpage) {
  196.                        echo " <span class='nextlastpage'>LAST</span> ";
  197.                     } else {
  198.                        $nextpage = $pageno+1;
  199.                        echo " <span class='nextpage'><a href='{$_SERVER['PHP_SELF']}?wtype=".$wtype."&pageno=$nextpage'>NEXT</a></span> ";
  200.                        echo " <span class='lastpage'><a href='{$_SERVER['PHP_SELF']}?wtype=".$wtype."&pageno=$lastpage'>LAST</a></span> ";
  201.                     }
  202.                     echo " ( Page $pageno of $lastpage ) ";
  203.                     ?>
  204.                 </div>
  205.             </div>
  206.             <div id="Graphice" class="tabcontent">
  207.             <input type="hidden" name="gorderids" id="gorderids" value=""/>
  208.                 <h3>Graphice</h3>
  209.                 <?php if($logintype=="2" && $userdepart=="1"){?>
  210.                 <div class="orderconform">
  211.                     <form name="gconformedform" id="gconformedform" method="post" enctype="multipart/form-data" action="conformedOrders.php" >
  212.                         <input type="hidden" name="gconformorderid" id="gconformorderid" value=""/>
  213.                         <input type="hidden" name="columnName" id="columnName" value="image_ready"/>
  214.                         <input type="button" class="ajax-assign-button" id="conformed" value="Conform" onclick="conformorder('gorderids','gconformorderid','gconformedform');"/>   
  215.                     </form>
  216.                 </div>
  217.               <?php
  218.                 }
  219.                 if($logintype=="2")
  220.                 {
  221.                     $userToSearch = "WHERE conformed_by LIKE '%".$loginuser."%' AND status='Conformed' AND (image_ready IS NULL OR image_ready='')";
  222.                 }
  223.                 else
  224.                 {
  225.                     $userToSearch = "WHERE conformed_by LIKE '%%' AND status='Conformed' AND (image_ready IS NULL OR image_ready='')";
  226.                 }
  227.                 $sqlgrapicsresult = "SELECT * from do_order ".$userToSearch. " ORDER BY id DESC ".$limit;
  228.                 $grapicsrecords = $db_handle->runSelectQuery($sqlgrapicsresult);
  229.                
  230.               ?>
  231.                 <table class="tbl-qa" border="1">
  232.                     <thead>
  233.                         <tr>                           
  234.                             <th class="table-header">ID</th>
  235.                             <th class="table-header">ORDERID</th>
  236.                             <th class="table-header">ORDER DATE</th>                           
  237.                             <th class="table-header">ASSIGN</th>
  238.                             <th class="table-header">STATUS</th>
  239.                             <th class="table-header">IMAGE READY</th>
  240.                         </tr>
  241.                     </thead>
  242.                     <tbody id="table-body">
  243.                     <?php
  244.                     $gtabindex=1;
  245.                     if(!empty($grapicsrecords))
  246.                     {
  247.                         foreach($grapicsrecords as $g=>$v1)
  248.                         {?>
  249.                         <tr>
  250.                             <td><input type="checkbox" onclick="graphicsorderids('<?php echo $grapicsrecords[$g]["order_id"]?>');" name="gorderid" id="gorderid-<?php echo $grapicsrecords[$g]["order_id"]; ?>" value="<?php echo $grapicsrecords[$g]["order_id"]; ?>"></td>                   
  251.                             <td><?php echo $grapicsrecords[$g]["order_id"]; ?></td>
  252.                             <td><?php echo $grapicsrecords[$g]["order_date"]; ?></td>
  253.                             <td><?php echo $grapicsrecords[$g]["conformed_by"]; ?></td>
  254.                             <td><?php echo $grapicsrecords[$g]["status"]; ?></td>
  255.                             <td contenteditable="true" <?php if($logintype=="2" && $userdepart=="1"){?>onClick="saveToDatabase('Conformed','image_ready','<?php echo $grapicsrecords[$g]["id"]; ?>')" <?php }?>><?php echo $grapicsrecords[$g]["image_ready"]; ?></td>
  256.                         </tr>
  257.                         <?php $gtabindex++;
  258.                         }
  259.                     }
  260.                     ?>
  261.                     </tbody>
  262.                 </table>
  263.             </div>
  264.             <div id="Printing" class="tabcontent">
  265.             <input type="hidden" name="porderids" id="porderids" value=""/>
  266.               <h3>Printing</h3>
  267.               <?php if($logintype=="2" && $userdepart=="2"){?>
  268.                 <div class="orderconform">
  269.                     <form name="pconformedform" id="pconformedform" method="post" enctype="multipart/form-data" action="conformedOrders.php" >
  270.                         <input type="hidden" name="pconformorderid" id="pconformorderid" value=""/>
  271.                         <input type="hidden" name="columnName" id="columnName" value="ready_to_print"/>
  272.  
  273.                         <input type="button" class="ajax-assign-button" id="conformed" value="Conform" onclick="conformorder('porderids','pconformorderid','pconformedform');"/>   
  274.                     </form>
  275.                 </div>
  276.               <?php
  277.                 }
  278.                 if($logintype=="2")
  279.                 {
  280.                     $printToSearch = "WHERE conformed_by LIKE '%".$loginuser."%' AND image_ready='Conformed' AND (ready_to_print IS NULL OR ready_to_print='')";
  281.                 }
  282.                 else
  283.                 {
  284.                     $printToSearch = "WHERE conformed_by LIKE '%%' AND image_ready='Conformed' AND (ready_to_print IS NULL OR ready_to_print='')";
  285.                 }
  286.                 $sqlprintsresult = "SELECT * from do_order ".$printToSearch. " ORDER BY id DESC ".$limit;
  287.                 $printsrecords = $db_handle->runSelectQuery($sqlprintsresult);
  288.               ?>
  289.                <table class="tbl-qa" border="1">
  290.                     <thead>
  291.                         <tr>                           
  292.                             <th class="table-header">ID</th>
  293.                             <th class="table-header">ORDERID</th>
  294.                             <th class="table-header">ORDER DATE</th>                           
  295.                             <th class="table-header">ASSIGN</th>
  296.                             <th class="table-header">STATUS</th>
  297.                             <th class="table-header">READY TO PRINT</th>
  298.                         </tr>
  299.                     </thead>
  300.                     <tbody id="table-body">
  301.                     <?php
  302.                     $ptabindex=1;
  303.                     if(!empty($printsrecords))
  304.                     {
  305.                         foreach($printsrecords as $p=>$v1)
  306.                         {?>
  307.                         <tr>
  308.                             <td><input type="checkbox" onclick="printsids('<?php echo $printsrecords[$p]["order_id"]?>');" name="porderid" id="porderid-<?php echo $printsrecords[$p]["order_id"]; ?>" value="<?php echo $printsrecords[$p]["order_id"]; ?>"></td>                 
  309.                             <td><?php echo $printsrecords[$p]["order_id"]; ?></td>
  310.                             <td><?php echo $printsrecords[$p]["order_date"]; ?></td>
  311.                             <td><?php echo $printsrecords[$p]["conformed_by"]; ?></td>
  312.                             <td><?php echo $printsrecords[$p]["status"]; ?></td>
  313.                             <td contenteditable="true" <?php if($logintype=="2" && $userdepart=="2"){?>onClick="saveToDatabase('Conformed','ready_to_print','<?php echo $printsrecords[$p]["id"]; ?>')" <?php }?>><?php echo $printsrecords[$p]["ready_to_print"]; ?></td>
  314.                         </tr>
  315.                         <?php $ptabindex++;
  316.                         }
  317.                     }
  318.                     ?>
  319.                     </tbody>
  320.                 </table>
  321.             </div>
  322.             <div id="Packing" class="tabcontent">
  323.               <h3>Packing</h3>
  324.               <input type="hidden" name="pacorderids" id="pacorderids" value=""/>            
  325.               <?php if($logintype=="2" && $userdepart=="3"){?>
  326.                 <div class="orderconform">
  327.                     <form name="pacconformedform" id="pacconformedform" method="post" enctype="multipart/form-data" action="conformedOrders.php" >
  328.                         <input type="hidden" name="pacconformorderid" id="pacconformorderid" value=""/>
  329.                         <input type="hidden" name="columnName" id="columnName" value="ready_to_packaging"/>
  330.  
  331.                         <input type="button" class="ajax-assign-button" id="conformed" value="Conform" onclick="conformorder('pacorderids','pacconformorderid','pacconformedform');"/> 
  332.                     </form>
  333.                 </div>
  334.               <?php
  335.                 }
  336.                 if($logintype=="2")
  337.                 {
  338.                     $packingToSearch = "WHERE conformed_by LIKE '%".$loginuser."%' AND ready_to_print='Conformed' AND (ready_to_packaging IS NULL OR ready_to_packaging='')";
  339.                 }
  340.                 else
  341.                 {
  342.                     $packingToSearch = "WHERE conformed_by LIKE '%%' AND ready_to_print='Conformed' AND (ready_to_packaging IS NULL OR ready_to_packaging='')";
  343.                 }
  344.                 $sqlpackingsresult = "SELECT * from do_order ".$packingToSearch. " ORDER BY id DESC ".$limit;
  345.                 $packingsrecords = $db_handle->runSelectQuery($sqlpackingsresult);
  346.               ?>
  347.                <table class="tbl-qa" border="1">
  348.                     <thead>
  349.                         <tr>                           
  350.                             <th class="table-header">ID</th>
  351.                             <th class="table-header">ORDERID</th>
  352.                             <th class="table-header">ORDER DATE</th>                           
  353.                             <th class="table-header">ASSIGN</th>
  354.                             <th class="table-header">STATUS</th>
  355.                             <th class="table-header">READY TO PRINT</th>
  356.                         </tr>
  357.                     </thead>
  358.                     <tbody id="table-body">
  359.                     <?php
  360.                     $pactabindex=1;
  361.                     if(!empty($packingsrecords))
  362.                     {
  363.                         foreach($packingsrecords as $pac=>$v1)
  364.                         {?>
  365.                         <tr>
  366.                             <td><input type="checkbox" onclick="packingsids('<?php echo $packingsrecords[$pac]["order_id"]?>');" name="pacorderid" id="pacorderid-<?php echo $packingsrecords[$pac]["order_id"]; ?>" value="<?php echo $packingsrecords[$pac]["order_id"]; ?>"></td>                   
  367.                             <td><?php echo $packingsrecords[$pac]["order_id"]; ?></td>
  368.                             <td><?php echo $packingsrecords[$pac]["order_date"]; ?></td>
  369.                             <td><?php echo $packingsrecords[$pac]["conformed_by"]; ?></td>
  370.                             <td><?php echo $packingsrecords[$pac]["status"]; ?></td>
  371.                             <td contenteditable="true" <?php if($logintype=="2" && $userdepart=="3"){?>onClick="saveToDatabase('Conformed','ready_to_packaging','<?php echo $packingsrecords[$pac]["id"]; ?>')" <?php }?>><?php echo $packingsrecords[$pac]["ready_to_packaging"]; ?></td>
  372.                         </tr>
  373.                         <?php $pactabindex++;
  374.                         }
  375.                     }
  376.                     ?>
  377.                     </tbody>
  378.                 </table>
  379.             </div>
  380.            
  381.             <!-- my code -->
  382.            
  383.             <div id="ReadytoDispatch" class="tabcontent">
  384.              
  385.                 <h3><?php echo $usertype;?></h3>
  386.                 <input type="hidden" name="orderids" id="orderids" value=""/>
  387.                 <?php if($logintype!="2"){?>
  388.                            
  389.                 <!-- Import Order -->
  390.                
  391.                
  392.                 <!-- Assign Orders -->
  393.                 <div class="orderassign" style="float: left;">
  394.                     <!-- Move to InTransit for Non ecom orders -->
  395.                        
  396.                     <input type="button" class="ajax-assign-button" id="assign" value="" onclick="assignorder();"/>
  397.                    
  398.                 </div>             
  399.                 <!-- Conformed Order From Pending To conformed -->
  400.                 <div class="orderconform">
  401.                    
  402.                 </div>
  403.                 <?PHP }?>
  404.                 <div style="clear:both;"></div>
  405.                 <?php
  406.  
  407.                     $userToSearch='';
  408.                 /*  if($logintype=="2"){
  409.                         $userToSearch = "WHERE conformed_by LIKE '%".$loginuser."%'";
  410.                     }
  411.                     else
  412.                     {
  413.                         $userToSearch = "WHERE conformed_by LIKE '%%' OR conformed_by IS NULL";
  414.                     }*/
  415.                     $sqlresultdoorder = "SELECT * from do_order";
  416.                     $resultdoorder = $db_handle->runSelectQuery($sqlresultdoorder);
  417.                     $numrows =count($resultdoorder);
  418.                     $rows_per_page = 20;
  419.                     $lastpage= ceil($numrows/$rows_per_page);
  420.                     $pageno = (int)$pageno;
  421.                     if ($pageno > $lastpage) {
  422.                        $pageno = $lastpage;
  423.                     } // if
  424.                     if ($pageno < 1) {
  425.                        $pageno = 1;
  426.                     }
  427.                     $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page;
  428.                     $sqlresult = "SELECT * from do_order ORDER BY id DESC ".$limit;
  429.                     $orderrecords = $db_handle->runSelectQuery($sqlresult);
  430.                    
  431.                 ?>
  432.                 <table class="tbl-qa" border="1">
  433.                     <thead>
  434.                         <tr>                           
  435.                             <th class="table-header">ID</th>
  436.                             <th class="table-header">ORDERID</th>
  437.                             <th class="table-header">ORDER DATE</th>
  438.                             <th class="table-header">PAYMENT TYPE</th>                         
  439.                             <th class="table-header">CUSTOMER NAME</th>
  440.                             <th class="table-header">CONTACT NO</th>
  441.                             <th class="table-header">ADDRESS</th>                          
  442.                            
  443.  
  444.                         </tr>
  445.                     </thead>
  446.                     <tbody id="table-body">
  447.                     <?php
  448.                     $tabindex=1;
  449.                     if(!empty($orderrecords))
  450.                     {
  451.                         foreach($orderrecords as $k=>$v)
  452.                         {?>
  453.                             <tr class="table-row" id="table-row-<?php echo $orderrecords[$k]["id"]; ?>" tabindex="<?php echo $tabindex;?>">
  454.                                 <td><input onclick="assignorderids('<?php echo $orderrecords[$k]["order_id"]; ?>')" type="checkbox" name="assigneeid" id="assigneeid-<?php echo $orderrecords[$k]["order_id"]; ?>" value="<?php echo $orderrecords[$k]["order_id"]; ?>"></td>
  455.  
  456.                                 <td><?php echo $orderrecords[$k]["order_id"]; ?></td>
  457.  
  458.                                 <td><?php if($orderrecords[$k]["order_date"]==''){ ?><input type="date" name="order_date" onchange="handler(event,'order_date','<?php echo $orderrecords[$k]["id"]; ?>')"><?php }else{ echo $orderrecords[$k]["order_date"];}?></td>
  459.  
  460.                                 <td <?php if($logintype!="2"){?>contenteditable="true" onBlur="saveToDatabase(this,'payment_type','<?php echo $orderrecords[$k]["id"]; ?>')" "<?php }?>><?php echo $orderrecords[$k]["payment_type"]; ?></td>
  461.  
  462.                                
  463.  
  464.                                 <td <?php if($logintype!="2"){?>contenteditable="true" onBlur="saveToDatabase(this,'customer_name','<?php echo $orderrecords[$k]["id"]; ?>')"<?php }?>><?php echo $orderrecords[$k]["customer_name"]; ?></td>
  465.  
  466.                                
  467.                                 <td <?php if($logintype!="2"){?>contenteditable="true" onBlur="saveToDatabase(this,'phone_number','<?php echo $orderrecords[$k]["id"]; ?>')"<?php }?>><?php echo $orderrecords[$k]["phone_number"]; ?></td>
  468.  
  469.                                 <td <?php if($logintype!="2"){?>contenteditable="true" onBlur="saveToDatabase(this,'address','<?php echo $orderrecords[$k]["id"]; ?>')" <?php }?>><?php echo $orderrecords[$k]["address"]; ?></td>
  470.                                
  471.                                
  472.                             </tr>
  473.                     <?php
  474.                      $tabindex++;
  475.                         }
  476.                     }?>
  477.                     </tbody>
  478.                 </table>
  479.                 <div class="pagination">
  480.                     <?php if ($pageno == 1) {
  481.                        echo " <span class='firstspan'>FIRST</span>";
  482.                     } else {
  483.                        echo " <span class='firstpage'><a href='{$_SERVER['PHP_SELF']}?wtype=".$wtype."&pageno=1'>FIRST</a></span> ";
  484.                        $prevpage = $pageno-1;
  485.                        echo " <span class='prvpage'><a href='{$_SERVER['PHP_SELF']}?wtype=".$wtype."&pageno=$prevpage'>PREV</a></span> ";
  486.                     }
  487.  
  488.                     if ($pageno == $lastpage) {
  489.                        echo " <span class='nextlastpage'>LAST</span> ";
  490.                     } else {
  491.                        $nextpage = $pageno+1;
  492.                        echo " <span class='nextpage'><a href='{$_SERVER['PHP_SELF']}?wtype=".$wtype."&pageno=$nextpage'>NEXT</a></span> ";
  493.                        echo " <span class='lastpage'><a href='{$_SERVER['PHP_SELF']}?wtype=".$wtype."&pageno=$lastpage'>LAST</a></span> ";
  494.                     }
  495.                     echo " ( Page $pageno of $lastpage ) ";
  496.                     ?>
  497.                 </div>
  498.             </div>
  499.            
  500.             <!-- my code end -->
  501.            
  502.             <!-- my code 2-->
  503.            
  504.            
  505.             <div id="Intransit" class="tabcontent">
  506.              
  507.                 <h3><?php echo $usertype;?></h3>
  508.                 <input type="hidden" name="orderids" id="orderids" value=""/>
  509.                 <?php if($logintype!="2"){?>
  510.                            
  511.                 <!-- Import Order -->
  512.                
  513.                
  514.                 <!-- Assign Orders -->
  515.                 <div class="orderassign" style="float: left;">
  516.                    
  517.                     <!--    Call Api -->
  518.                     <input type="button" class="ajax-assign-button" id="assign" value="" onclick="assignorder();"/>
  519.                    
  520.                 </div>             
  521.                 <!-- Conformed Order From Pending To conformed -->
  522.                 <div class="orderconform">
  523.                    
  524.                 </div>
  525.                 <?PHP }?>
  526.                 <div style="clear:both;"></div>
  527.                 <?php
  528.  
  529.                     $userToSearch='';
  530.                 /*  if($logintype=="2"){
  531.                         $userToSearch = "WHERE conformed_by LIKE '%".$loginuser."%'";
  532.                     }
  533.                     else
  534.                     {
  535.                         $userToSearch = "WHERE conformed_by LIKE '%%' OR conformed_by IS NULL";
  536.                     }*/
  537.                     $sqlresultdoorder = "SELECT * from do_order";
  538.                     $resultdoorder = $db_handle->runSelectQuery($sqlresultdoorder);
  539.                     $numrows =count($resultdoorder);
  540.                     $rows_per_page = 20;
  541.                     $lastpage= ceil($numrows/$rows_per_page);
  542.                     $pageno = (int)$pageno;
  543.                     if ($pageno > $lastpage) {
  544.                        $pageno = $lastpage;
  545.                     } // if
  546.                     if ($pageno < 1) {
  547.                        $pageno = 1;
  548.                     }
  549.                     $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page;
  550.                     $sqlresult = "SELECT * from do_order ORDER BY id DESC ".$limit;
  551.                     $orderrecords = $db_handle->runSelectQuery($sqlresult);
  552.                    
  553.                 ?>
  554.                
  555.                 <div class="pagination">
  556.                     <?php if ($pageno == 1) {
  557.                        echo " <span class='firstspan'>FIRST</span>";
  558.                     } else {
  559.                        echo " <span class='firstpage'><a href='{$_SERVER['PHP_SELF']}?wtype=".$wtype."&pageno=1'>FIRST</a></span> ";
  560.                        $prevpage = $pageno-1;
  561.                        echo " <span class='prvpage'><a href='{$_SERVER['PHP_SELF']}?wtype=".$wtype."&pageno=$prevpage'>PREV</a></span> ";
  562.                     }
  563.  
  564.                     if ($pageno == $lastpage) {
  565.                        echo " <span class='nextlastpage'>LAST</span> ";
  566.                     } else {
  567.                        $nextpage = $pageno+1;
  568.                        echo " <span class='nextpage'><a href='{$_SERVER['PHP_SELF']}?wtype=".$wtype."&pageno=$nextpage'>NEXT</a></span> ";
  569.                        echo " <span class='lastpage'><a href='{$_SERVER['PHP_SELF']}?wtype=".$wtype."&pageno=$lastpage'>LAST</a></span> ";
  570.                     }
  571.                     echo " ( Page $pageno of $lastpage ) ";
  572.                     ?>
  573.                 </div>
  574.             </div>
  575.            
  576.             <!-- my code end -->
  577.            
  578.            
  579.              
  580.         </div>
  581.         <div style="clear:both;"></div>
  582.         <?php include "Footer.php"; ?>
  583.     </div>
  584. <script type="text/javascript">
  585.     //document.getElementById("defaultOpen").click();
  586.     function openTab(evt,tabname)
  587.     {
  588.         // Declare all variables
  589.         var i, tabcontent, tablinks;
  590.  
  591.         // Get all elements with class="tabcontent" and hide them
  592.         tabcontent = document.getElementsByClassName("tabcontent");
  593.         for (i = 0; i < tabcontent.length; i++) {
  594.             tabcontent[i].style.display = "none";
  595.         }
  596.         // Get all elements with class="tablinks" and remove the class "active"
  597.         tablinks = document.getElementsByClassName("tablinks");
  598.         for (i = 0; i < tablinks.length; i++) {
  599.             tablinks[i].className = tablinks[i].className.replace(" active", "");
  600.         }
  601.         // Show the current tab, and add an "active" class to the button that opened the tab
  602.         document.getElementById(tabname).style.display = "block";
  603.         evt.currentTarget.className += " active";
  604.     }
  605.    
  606.     function assignallorderids()
  607.   {
  608.    var checkstatus=$("#checkall").is(":checked");
  609.  
  610.     if(checkstatus==true)
  611.     {
  612.       var id=document.getElementById("ordercheckallIDs").value;  
  613.       document.getElementById("orderids").value=id;
  614.       $("input:checkbox[name='checkassigneeid']").prop('checked',true);
  615.     }
  616.     else
  617.     {
  618.       $("input:checkbox[name='checkassigneeid']").prop('checked',false);  
  619.       document.getElementById("orderids").value='';
  620.     }    
  621.   }
  622.    
  623.     function assignorderids(oid)
  624.     {
  625.        var checkstatus=$("#assigneeid-"+oid).is(":checked");      
  626.         var morderId =document.getElementById("orderids").value;
  627.         if(checkstatus==false)
  628.         {
  629.             var arrayorder = JSON.parse("[" + morderId + "]");
  630.             document.getElementById("orderids").value='';
  631.             for (var i = 0; i < arrayorder.length; i++) {          
  632.                 var orderstatusValue=arrayorder[i];
  633.                 if(orderstatusValue!=oid){
  634.                     if (document.getElementById("orderids").value=='')
  635.                     {
  636.                         document.getElementById("orderids").value=orderstatusValue;
  637.                     }
  638.                     else
  639.                     {
  640.                         var newvalue=document.getElementById("orderids").value;
  641.                         document.getElementById("orderids").value=newvalue+","+orderstatusValue;                        
  642.                     }
  643.                 }                      
  644.             }
  645.         }
  646.         else
  647.         {
  648.             if(morderId=='')
  649.             {
  650.                 document.getElementById("orderids").value=oid;
  651.             }
  652.             else
  653.             {
  654.                 document.getElementById("orderids").value=morderId+","+oid;
  655.             }
  656.         }
  657.     }
  658.     function graphicsorderids(goid)
  659.     {
  660.         var checkstatus=$("#gorderid-"+goid).is(":checked");       
  661.         var gmorderId =document.getElementById("gorderids").value;
  662.         if(checkstatus==false)
  663.         {
  664.             var garrayorder = JSON.parse("[" + gmorderId + "]");
  665.             document.getElementById("gorderids").value='';
  666.             for (var i = 0; i < garrayorder.length; i++) {         
  667.                 var gorderstatusValue=garrayorder[i];
  668.                 if(gorderstatusValue!=goid){
  669.                     if (document.getElementById("gorderids").value=='')
  670.                     {
  671.                         document.getElementById("gorderids").value=gorderstatusValue;  
  672.                     }
  673.                     else
  674.                     {
  675.                         var gnewvalue=document.getElementById("gorderids").value;
  676.                         document.getElementById("gorderids").value=gnewvalue+","+gorderstatusValue;                    
  677.                     }
  678.                 }                      
  679.             }
  680.         }
  681.         else
  682.         {
  683.             if(gmorderId=='')
  684.             {
  685.                 document.getElementById("gorderids").value=goid;
  686.             }
  687.             else
  688.             {
  689.                 document.getElementById("gorderids").value=gmorderId+","+goid;
  690.             }
  691.         }
  692.     }
  693.     function packingsids(pacoid)
  694.     {
  695.         var checkstatus=$("#pacorderid-"+pacoid).is(":checked");       
  696.         var pacmorderId =document.getElementById("pacorderids").value;
  697.         if(checkstatus==false)
  698.         {
  699.             var pacarrayorder = JSON.parse("[" + pacmorderId + "]");
  700.             document.getElementById("pacorderids").value='';
  701.             for (var i = 0; i < pacarrayorder.length; i++) {           
  702.                 var pacorderstatusValue=pacarrayorder[i];
  703.                 if(pacorderstatusValue!=pacoid){
  704.                     if (document.getElementById("pacorderids").value=='')
  705.                     {
  706.                         document.getElementById("pacorderids").value=pacorderstatusValue;  
  707.                     }
  708.                     else
  709.                     {
  710.                         var pacnewvalue=document.getElementById("pacorderids").value;
  711.                         document.getElementById("pacorderids").value=pacnewvalue+","+pacorderstatusValue;                      
  712.                     }
  713.                 }                      
  714.             }
  715.         }
  716.         else
  717.         {
  718.             if(pacmorderId=='')
  719.             {
  720.                 document.getElementById("pacorderids").value=pacoid;
  721.             }
  722.             else
  723.             {
  724.                 document.getElementById("pacorderids").value=pacmorderId+","+pacoid;
  725.             }
  726.         }
  727.     }
  728.     function dispatchsids(dpoid)
  729.     {
  730.         var checkstatus=$("#dporderid-"+dpoid).is(":checked");     
  731.         var dpmorderId =document.getElementById("dporderids").value;
  732.         if(checkstatus==false)
  733.         {
  734.             var dparrayorder = JSON.parse("[" + dpmorderId + "]");
  735.             document.getElementById("dporderids").value='';
  736.             for (var i = 0; i < dparrayorder.length; i++) {        
  737.                 var dporderstatusValue=dparrayorder[i];
  738.                 if(dporderstatusValue!=dpoid){
  739.                     if (document.getElementById("dporderids").value=='')
  740.                     {
  741.                         document.getElementById("dporderids").value=dporderstatusValue;
  742.                     }
  743.                     else
  744.                     {
  745.                         var dpnewvalue=document.getElementById("dporderids").value;
  746.                         document.getElementById("dporderids").value=dpnewvalue+","+dporderstatusValue;                     
  747.                     }
  748.                 }                      
  749.             }
  750.         }
  751.         else
  752.         {
  753.             if(dpmorderId=='')
  754.             {
  755.                 document.getElementById("dporderids").value=dpoid;
  756.             }
  757.             else
  758.             {
  759.                 document.getElementById("dporderids").value=dpmorderId+","+dpoid;
  760.             }
  761.         }
  762.     }
  763.    
  764.     function printsids(poid)
  765.     {
  766.         var checkstatus=$("#porderid-"+poid).is(":checked");       
  767.         var pmorderId =document.getElementById("porderids").value;
  768.         if(checkstatus==false)
  769.         {
  770.             var parrayorder = JSON.parse("[" + pmorderId + "]");
  771.             document.getElementById("porderids").value='';
  772.             for (var i = 0; i < parrayorder.length; i++) {         
  773.                 var porderstatusValue=parrayorder[i];
  774.                 if(porderstatusValue!=poid){
  775.                     if (document.getElementById("porderids").value=='')
  776.                     {
  777.                         document.getElementById("porderids").value=porderstatusValue;  
  778.                     }
  779.                     else
  780.                     {
  781.                         var pnewvalue=document.getElementById("porderids").value;
  782.                         document.getElementById("porderids").value=pnewvalue+","+porderstatusValue;                    
  783.                     }
  784.                 }                      
  785.             }
  786.         }
  787.         else
  788.         {
  789.             if(pmorderId=='')
  790.             {
  791.                 document.getElementById("porderids").value=poid;
  792.             }
  793.             else
  794.             {
  795.                 document.getElementById("porderids").value=pmorderId+","+poid;
  796.             }
  797.         }
  798.     }
  799.     function assignorder()
  800.     {
  801.        
  802.         var assignee=$("#assignee option:selected" ).val();
  803.         var orderids=document.getElementById("orderids").value;    
  804.         document.getElementById("assignedid").value=orderids;  
  805.         var orderId=document.getElementById("assignedid").value;
  806.         if(assignee == '0'){alert("Please Select Name To Assign.");}
  807.         else{if(orderId ==''){alert("Please Checked Order To Assign.");}}          
  808.         if(assignee != '0' && orderId!=''){
  809.             $("#assigneeform").submit();
  810.         }              
  811.     }
  812.     function conformorder(id,neworderids,formname)
  813.     {      
  814.         var orderids=document.getElementById(id).value;
  815.  
  816.         if(orderids!='')
  817.         {
  818.             document.getElementById(neworderids).value=orderids;
  819.         }
  820.         if(orderids=='')
  821.         {
  822.             alert("Please Checked Order To Conformed.");
  823.         }
  824.         else
  825.         {
  826.             $("#"+formname).submit();
  827.         }
  828.     }
  829.     function insertToDatabase(editableObj,column) {
  830.       $.ajax({
  831.         url: "insertOrder.php",
  832.         type: "POST",
  833.         data:'column='+column+'&editval='+$(editableObj).text(),
  834.         success: function(data){
  835.           $(editableObj).css("background","#FDFDFD");
  836.            location.reload();
  837.         }
  838.       });
  839.     }
  840.     function saveToDatabase(editableObj,column,id) {
  841.            
  842.     if(column=="image_ready" || column=="ready_to_print" || column=="ready_to_packaging" || column=="ready_to_dispatch"){cvalue=editableObj;}else{var cvalue=$(editableObj).text();}
  843.    
  844.       $.ajax({
  845.         url: "editOrder.php",
  846.         type: "POST",
  847.         data:'column='+column+'&editval='+cvalue+'&id='+id,
  848.         success: function(data){
  849.           $(editableObj).css("background","#dddddd");
  850.           if(column=="image_ready" || column=="ready_to_print" || column=="ready_to_packaging" || column=="ready_to_dispatch"){location.reload();}
  851.         }
  852.       });
  853.     }
  854.  
  855.     function handler(e,column,id){ 
  856.  
  857.     editableObj=e.target.value;
  858.       $.ajax({
  859.         url: "editOrder.php",
  860.         type: "POST",
  861.         data:'column='+column+'&editval='+editableObj+'&id='+id,
  862.         success: function(data){
  863.           $(editableObj).css("background","#dddddd");
  864.            location.reload();
  865.         }
  866.       });
  867.  
  868.     }
  869. //add new row
  870.     function createNew() {
  871.     $("#add-more").hide();
  872.     var data = '<tr class="table-row" id="new_row_ajax">' +    
  873.     '<td contenteditable="false" id="txt_id"></td>' +  
  874.     '<td contenteditable="true" id="txt_order_id" onBlur="insertToDatabase(this,\'order_id\')" ></td>'+
  875.     '<td contenteditable="true" id="txt_order_date"></td>'+
  876.     '<td contenteditable="true" id="txt_payment_type" ></td>'+
  877.     '<td contenteditable="true" id="txt_conformed_by" ></td>'+
  878.     '<td contenteditable="true" id="txt_status" ></td>' +
  879.     '<td contenteditable="true" id="txt_customer_name"></td>' +
  880.     '<td contenteditable="true" id="txt_phone_number"></td>' +
  881.     '<td contenteditable="true" id="txt_address"></td>' +
  882.     '<td contenteditable="false"  id="txt_image_ready"></td>' +
  883.     '<td contenteditable="false" id="txt_ready_to_print"></td>' +
  884.     '<td contenteditable="false" id="txt_ready_to_packaging"></td>' +
  885.     '<td contenteditable="false" id="txt_ready_to_dispatch"></td>' +
  886.    
  887.     '</tr>';
  888.     $("#table-body").prepend(data);
  889. }
  890. $(document).ready(function () {
  891.      $("#fromdate").datepicker();
  892.      $('#todate').datepicker();  
  893.     $("#importorder").click(function() {    
  894.         var todate = $("#todate").val();
  895.         var fromdate = $("#fromdate").val();
  896.         var selectedfromtime = $("#formtime option:selected").val();
  897.         var selectedtotime = $("#totime option:selected").val();
  898.         if (fromdate === "") {
  899.             alert("Please select departing and returning dates.");
  900.         } else {
  901.             $("#toorderdate").val(todate);
  902.             $("#fromorderdate").val(fromdate);         
  903.             $("#directorderform").submit();
  904.         }
  905.     });
  906.     $("#focus").select();
  907.     //setTimeout(selectBarcode(),1000);
  908.     $('input[name="tag"]').change(function()
  909.     {
  910.         txt = $("#focus").val();//alert('You have changed the input'+txt);
  911.         $.ajax({
  912.             url: "scanupdates.php",
  913.             type: "POST",
  914.             data:'order_id='+txt+'&wtype='+<?php echo $userdepart?>+'&uname='+'<?php echo $loginuser?>',
  915.             success: function(data){
  916.                 alert(data);
  917.                 if(data=="")
  918.                 {
  919.                     alert(data);   
  920.                 }  
  921.                 location.reload();         
  922.             //  $(editableObj).css("background","#FDFDFD");
  923.             }
  924.           });
  925.         //
  926.     });      
  927. });
  928.  
  929. $('#show_status').click(function(){
  930. var selected = [];
  931. $('.assigneeid-order:checked').each(function() {
  932. selected.push($(this).val());
  933. });
  934.  
  935.  
  936. var jsonString = JSON.stringify(selected);
  937.  
  938. $.ajax({
  939. type: "POST",
  940. url: "api.php",
  941. data: {data : jsonString},
  942. success: function(response){
  943.  
  944. response = $.parseJSON(response);
  945.  
  946. $.each(response, function(index, val) {
  947.  
  948. $("#"+index+"").html(val);
  949. });
  950. }
  951. });
  952.  
  953. });
  954.  
  955. </script>
  956. </body>
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963. </html>
  964.  
  965.  
  966.  
  967.  
  968.  
  969. </html>
Add Comment
Please, Sign In to add comment