<?php
session_start();
// ini_set('session.gc_maxlifetime', 30 * 60 * 60 * 60);

if ($_SESSION["dev"] != "") {
    ?>
   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="imagetoolbar" content="no" />
<title>Administration Panel</title>
<link media="screen" rel="stylesheet" type="text/css" href="css/admin.css"  />
<!--[if lte IE 6]><link media="screen" rel="stylesheet" type="text/css" href="css/admin-ie.css" /><![endif]-->
<script src="js/user.js"></script> 
</head>
       
        <body>
            <!--[if !IE]>start wrapper<![endif]-->
            <div id="wrapper">
                <!--[if !IE]>start head<![endif]-->
                <div id="head">

                    <!--[if !IE]>start logo and user details<![endif]-->
                    

                    <!--[if !IE]>end logo end user details<![endif]-->



                    <!--[if !IE]>start menus_wrapper<![endif]-->
                    <?php
                    include('menu_index.php');
                    ?>
                    <!--[if !IE]>end menus_wrapper<![endif]-->

                </div>
                <!--[if !IE]>end head<![endif]-->

                <!--[if !IE]>start content<![endif]-->

                <table style="width:100%">
                    <tr>
                        <th>
                            <div id="content" style="margin-top: -250px;">
                              	<?php
            	include('connectioni.php');
	
		$sqltmp="select * from invpara";
		$resulttmp=mysqli_query($GLOBALS['dbinv'],$sqltmp);
		$rowtmp = mysqli_fetch_array($resulttmp);
			
		  echo "<label>";
//			if ($rowtmp["form_loc"]=="1"){
//				echo "<input type=\"radio\" name=\"radio\" id=\"rd_lock\" value=\"rd_lock\" checked=\"checked\" onclick=\"set_check();\"/> Lock</br></br>";
//				echo "<input type=\"radio\" name=\"radio\" id=\"rd_unlock\" value=\"rd_unlock\"  onclick=\"set_check();\"/> Un Lock</br>";
//			} else {
//				echo "<input type=\"radio\" name=\"radio\" id=\"rd_lock\" value=\"rd_lock\" onclick=\"set_check();\"/> Lock</br></br>";
//				echo "<input type=\"radio\" name=\"radio\" id=\"rd_unlock\" value=\"rd_unlock\"  checked=\"checked\" onclick=\"set_check();\"/> Un Lock</br>";
//			}
            if ($_SESSION["UserName"] == "malabe"){
			   if ($rowtmp["block_c"]=="1"){
			      echo "<input type=\"radio\" name=\"radio\" id=\"rd_lock\" value=\"rd_lock\" checked=\"checked\" onclick=\"set_check('1');\"/> Lock</br></br>";
				  echo "<input type=\"radio\" name=\"radio\" id=\"rd_unlock\" value=\"rd_unlock\"  onclick=\"set_check('0');\"/> Un Lock</br>";
			   } else {
			        echo "<input type=\"radio\" name=\"radio\" id=\"rd_lock\" value=\"rd_lock\" onclick=\"set_check('1');\"/> Lock</br></br>";
				    echo "<input type=\"radio\" name=\"radio\" id=\"rd_unlock\" value=\"rd_unlock\"  checked=\"checked\" onclick=\"set_check('0');\"/> Un Lock</br>";
			 }	
				
                }			
                          ?>
                            </div>
                        </th>
                        
                        <th style=""></th>
                        <th><div style="width: 350px; "> 
                                <div style="overflow:scroll;height: 500px;width: 500px;" class='info'>
                                    <?php
                                    
                                // $sql_20="Select * from s_trn ";
                                // $result_20 = mysqli_query($GLOBALS['dbinv'], $sql_20);
                                // while ($row_20 = mysqli_fetch_array($result_20)) {
                                //     $sql_21="select * from s_mas where   STK_NO= '".$row_20['STK_NO']."'"; 
                                //     $result_21 = mysqli_query($GLOBALS['dbinv'], $sql_21);
                                //     if (!$row_21 = mysqli_fetch_array($result_21)) {
                                //         echo $row_20['STK_NO'].'/';
                                //     }
                                // }
                                
                                // $sql_20="Select * from s_mas ";
                                // $result_20 = mysqli_query($GLOBALS['dbinv'], $sql_20);
                                // while ($row_20 = mysqli_fetch_array($result_20)) {
                                //     $M_STOCODE='01';
                                //     $stkNo=$row_20["STK_NO"];
                                //     $sql_21="select * from s_submas where sto_code= '".trim($M_STOCODE)."' and stk_no= '".trim($stkNo)."'"; 
                                //     $result_21 = mysqli_query($GLOBALS['dbinv'], $sql_21);
                                //     if ($row_21 = mysqli_fetch_array($result_21)) {
 
                                //     // meka wardi check krnn
                                //     } else {
                                //         $sql2="Insert into s_submas (STO_CODE, STK_NO, DESCRIPt,QTYINHAND) values ('".trim($M_STOCODE)."', '".trim($stkNo)."', '".$row_20["DESCRIPT"]."','0')";
                                //          $result_2 = mysqli_query($GLOBALS['dbinv'], $sql2);
                                //           $row_2 = mysqli_fetch_array($result_2);
                                //         echo $stkNo.'<br>';
                                    
                                //     }
                                // }
//                                   echo "<table class='CSSTableGenerator' style=\"overflow-y:scroll; color:red; height:100px;overflow:scroll;\">";
//                                         echo "<tr><th colspan=4' style='color:blue'>Problem Items</th></tr>";

//                                         echo "<tr><th width ='50' style='color:blue'>STK NO</th>";
//                                         echo "<th width ='200' style='color:blue'>Qty IN Hand</th>";
//                                         echo "<th width ='80' style='color:blue'>True QTY</th>";
//                                         echo "<th width ='80' style='color:blue'>Department</th></tr>";
     
//                                         $sql11 = "update s_trn set tru_qty = qty where (ledindi = 'ARN' or ledindi ='GRN' or ledindi = 'GINR' or ledindi ='IIN' or ledindi = 'TRN')    ";
//                                         $result_1 = mysqli_query($GLOBALS['dbinv'], $sql11);
//                                         $row_1 = mysqli_fetch_array($result_1);
                                                  
//                                         $sql12 = "update s_trn set tru_qty = qty * -1 where (ledindi = 'ISO' or ledindi = 'ARR' or ledindi ='INV' or ledindi = 'GINI' or ledindi ='IOU')   ";
//                                         $result_2 = mysqli_query($GLOBALS['dbinv'], $sql12);
//                                         $row_2 = mysqli_fetch_array($result_2);
                                                  
//                                         $sql13 = "select stk_no,QTYINHAND,sum(tru_qty),department  from view_trn_submas   group by stk_no,department  having qtyinhand <> sum(tru_qty)	";
//                                         $result_3 = mysqli_query($GLOBALS['dbinv'], $sql13); 
                                        
//                                         while ($row_3 = mysqli_fetch_array($result_3)) {
//                                             echo "<tr><td>" . $row_3['STK_NO'] . "</td>";
//                                             echo "<td>" . $row_3['QTYINHAND'] . "</td>";
//                                             echo "<td>" . $row_3['sum(tru_qty)'] . "</td>";
//                                             echo "<td>" . $row_3['DEPARTMENT'] . "</td></tr>";
//                                         }
                                        
//                                         echo "<tr><th width ='50' style='color:blue' >STK NO</th>";
//                                         echo "<th width ='200' style='color:blue'>Qty IN Hand</th>";
//                                         echo "<th width ='80' style='color:blue'>True QTY</th>"; 
     
// //                                        $sql14 = "update s_trn set tru_qty = qty where (ledindi = 'ARN' or ledindi ='GRN' or ledindi = 'GINR' or ledindi ='IIN'  or ledindi='TRN');";
// //                                        $result_4 = mysqli_query($GLOBALS['dbinv'], $sql14);
// //                                        $row_4 = mysqli_fetch_array($result_4);
// //                                                  
// //                                        $sql15 = "update s_trn set tru_qty = qty * -1 where (ledindi = 'ISO' or ledindi = 'ARR' or ledindi ='INV' or ledindi = 'GINI' or ledindi ='IOU');";
// //                                        $result_5 = mysqli_query($GLOBALS['dbinv'], $sql15);
// //                                        $row_5 = mysqli_fetch_array($result_5);
                                                  
//                                         $sql16 = "select stk_no,QTYINHAND,sum(tru_qty)  from view_trn_smas    group by stk_no  having qtyinhand <> sum(tru_qty)";;
//                                         $result_6 = mysqli_query($GLOBALS['dbinv'], $sql16); 
//                                         while ($row_6 = mysqli_fetch_array($result_6)) {
//                                             echo "<tr><td>" . $row_6['STK_NO'] . "</td>";
//                                             echo "<td>" . $row_6['QTYINHAND'] . "</td>";
//                                             echo "<td>" . $row_6['sum(tru_qty)'] . "</td></tr>";
//                                         }
                                    ?>
                                </div>
                                <!--[if !IE]>end content<![endif]-->
                            </div>
                        </th> 

                    </tr>
                     

                </table>

                <!--[if !IE]>end content<![endif]-->

            </div>
            <!--[if !IE]>end wrapper<![endif]-->
<!-- <div id="footer">
                
            </div>-->
            <!--[if !IE]>start footer<![endif]-->
           

            <?php
            //echo $_SERVER['SERVER_NAME'];
            //     ?>
            //     <!--[if !IE]>end footer<![endif]-->
            //     <script>
            //             getLocation();
            //     </script>
            //     <?php
            // }
            // ?>

        </body>
    </html>
    <?php
} else {
    echo "Invalied User !!!";
}
?>
 