<?php session_start();

if($_SESSION[invcox] == ""){

header("location:login.php?action=need");

}else{



include("config.php");?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Accounting Software</title>

<link href="style.css" rel="stylesheet" type="text/css" />

<?php include("calendar.php");?>

<script language="javascript">

function prouct_list(){



 var config = {

      '.product'           : {},

      '.chosen-select-deselect'  : {allow_single_deselect:true},

      '.chosen-select-no-single' : {disable_search_threshold:10},

      '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},

      '.chosen-select-width'     : {width:"95%"}

    }

  

    for (var selector in config) {

      $(selector).chosen(config[selector]);

    }	

	}

</script>

</head>

<body>

<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="box-wrap">

  <tr>

    <td><?php include("top.php");?></td>

  </tr>

  <tr>

    <td><table width="100%" border="0" cellspacing="1" cellpadding="0">

        <tr>

          <td height="15" align="left" class="link2">&nbsp;</td>

        </tr>

        <tr>

          <td height="30" align="left" background="images/place_bg.jpg" class="location"><strong>&nbsp;<a href="index.php">Home</a> &gt; <a href="kitchen.php">kitchen</a></strong> &gt; <a href="add_product.php"><strong> Product Stock In</strong></a></td>

        </tr>

        <tr>

          <td align="center">&nbsp;</td>

        </tr>

        <tr>

          <td align="center"><?php if($_GET[info]!=""){echo '<span class="red"><strong>'.$_GET[info].'</strong></span>';}?></td>

        </tr>

		<?php if($_GET[action] == 'edit'){

		

		$dresult=mysql_query("select * from kitchen where id='$_GET[id]'");

			$drow=mysql_fetch_array($dresult);

			

		?>

        <tr>

          <td><form action="update_kitchen_stock_in.php" method="post" enctype="multipart/form-data" name="enquiryform" class="round_box" id="enquiryform2">

            <table width="100%" border="0" cellpadding="2" cellspacing="1">

              <tr>

                <td colspan="2" class="location"><strong>Edit kitchen Stock Out Entry</strong></td>

              </tr>

              <tr>

                <td width="14%" height="30">Date :</td>

                <td width="86%" class="input200"><table width="250" border="0" cellspacing="0" cellpadding="0">

                  <tr>

                    <td width="70%"><input name="date2" type="text" id="date2" size="15" value="<?php echo dtformat($drow[date1]);?>" required="required"/></td>

                    <td width="30%" align="center"><a title="Calendar" onclick="displayDatePicker('date2', this);" href="javascript:;"><img src="images/calendar.gif" width="20" height="20" border="0" /></a></td>

                    </tr>

                  </table></td>

              </tr>

              <tr>

                <td height="30">Product Category : </td>

                <td class="input200"><select name="category2" id="category2" data-placeholder="Select Product Category" class="category" >

                  <option value="">Select Product Category</option>

                  <?php 

				  $cresult=mysql_query("select * from kitchen_category  order by name ASC");

			$crow=mysql_fetch_array($cresult);

			do{

				  ?>

                  <option value="<?php echo $crow[id]; ?>" <?php if($drow[category] == $crow[id]){echo 'selected="selected"';}?>><?php echo $crow[name]; ?></option>

                  <?php }while($crow=mysql_fetch_array($cresult));?>

                  </select>

                  <script language="javascript" type="text/javascript">

				   var config = {

      '.category'           : {},

      '.chosen-select-deselect'  : {allow_single_deselect:true},

      '.chosen-select-no-single' : {disable_search_threshold:10},

      '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},

      '.chosen-select-width'     : {width:"95%"}

    }

  

    for (var selector in config) {

      $(selector).chosen(config[selector]);

    }

				  </script></td>

              </tr>

              <tr>

                <td height="30">Product Quantity :</td>

                <td class="input200"><input name="qty2" type="text" id="qty2" size="20" value="<?php echo $drow[qty]; ?>"  required="required"/>

                  <input name="id" type="hidden" id="id" value="<?php echo $drow[id]; ?>" /></td>

              </tr>

              <tr>

                <td height="30">Unit Price :</td>

                <td><span class="input200">

                  <input name="unit_price2" type="text" id="unit_price2" value="<?php echo $drow[unit_price]; ?>" />

                </span></td>

              </tr>

              <tr>

                <td height="30">&nbsp;</td>

                <td><input type="submit" name="Submit" value="Submit" /></td>

              </tr>

            </table>

          </form></td>

        </tr>

		<?php }else{?>

        <tr>

          <td><form action="insert_kitchen_stock_in.php" method="post" enctype="multipart/form-data" name="enquiryform" class="round_box" id="enquiryform">	 

              <table width="100%" border="0" cellpadding="2" cellspacing="1">

                <tr>

                  <td colspan="2" class="location"><strong>Add New kitchen Stock Out</strong></td>

                </tr>

                <tr>

                  <td width="14%" height="30">Date :</td>

                  <td width="86%" class="input200"><table width="250" border="0" cellspacing="0" cellpadding="0">

                    <tr>

                      <td width="70%"><input name="date1" type="text" id="date1" size="15"  value="<?php echo date("d-m-Y");?>" required="required"/></td>

                      <td width="30%" align="center"><a title="Calendar" onclick="displayDatePicker('date1', this);" href="javascript:;"><img src="images/calendar.gif" width="20" height="20" border="0" /></a></td>

                    </tr>

                  </table></td>

                </tr>

                <tr>

                  <td height="30">Product Category : </td>

                  <td class="input200"><select name="category" id="category" data-placeholder="Select Product Category" class="category" >

                    <option value="">Select Product Category</option>

                    <?php 

				  $cresult=mysql_query("select * from kitchen_category  order by name ASC");

			$crow=mysql_fetch_array($cresult);

			do{

				  ?>

                 <option value="<?php echo $crow[id]; ?>" <?php if($_GET[name] == $crow[id]){echo 'selected="selected"';}?>><?php echo $crow[name]; ?></option>

                    <?php }while($crow=mysql_fetch_array($cresult));?>

                  </select>

                    <script language="javascript" type="text/javascript">

				   var config = {

      '.category'           : {},

      '.chosen-select-deselect'  : {allow_single_deselect:true},

      '.chosen-select-no-single' : {disable_search_threshold:10},

      '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},

      '.chosen-select-width'     : {width:"95%"}

    }

  

    for (var selector in config) {

      $(selector).chosen(config[selector]);

    }

				  </script></td>

                </tr>

                <tr>

                  <td height="30">Product Quantity :</td>

                  <td class="input200"><input name="qty" type="text" id="qty" size="20" value="<?php echo $_GET[qty]; ?>"  required="required"/></td>

                </tr>

                <tr>

                  <td height="30">Unit Price :</td>

                  <td><span class="input200">

                    <input name="unit_price" type="text" id="unit_price" value="<?php echo $_GET[unit_price]; ?>" />

                    <input name="stype" type="hidden" id="stype" value="1" />

                    <input name="url" type="hidden" id="url" value="stock_out.php" />

                  </span></td>

                </tr>

                <tr>

                  <td height="30">&nbsp;</td>

                  <td><input type="submit" name="Submit2" value="Submit" /></td>

                </tr>

              </table>

          </form></td>

        </tr>

		<?php }?>

        <tr>

          <td>&nbsp;</td>

        </tr>

        <tr>

          <td class="round_box">

            <table width="100%" border="0" cellpadding="3" cellspacing="1"   class="list_table">

              <tr>

                <td colspan="10" bgcolor="#6EA749" class="location"><strong>Stock Out List </strong></td>

              </tr>

              <tr>

                <td ><strong>Sr.</strong></td>

                <td width="10%" ><strong>Date</strong></td>

                <td width="10%" align="center" ><strong> Category </strong></td>

        

             

                <td width="10%" align="center" ><strong>Product Qty</strong></td>

                <td width="10%" align="center" ><strong>Unit Price</strong></td>

				  <td width="10%" align="center" ><strong>Total Price</strong></td>

                <td width="5%" align="center" ><strong>Edit</strong></td>

                <td width="5%" align="center" ><strong>Delete</strong></td>

              </tr>

<?php 



$result=mysql_query("select * from kitchen where stype='1' order by date1 asc ");

$row=mysql_fetch_array($result);

	$sr=0;

do{

	$sr++;

?>

              <tr>

                <td width="3%" ><?php echo $sr;?></td>

                <td width="10%" ><?php echo dtformat($row[date1]);?></td>

                <td ><?php 



$aresult=mysql_query("select * from kitchen_category where id='$row[category]'");

$arow=mysql_fetch_array($aresult);

echo $arow[name];

?>



</td>

              

                

                

                <td align="center" ><?php 



echo $row[qty];

$qty=$qty+$row[qty];

?></td>

                <td align="center" ><?php 



echo $row[unit_price];

 

?></td>

				  <td align="center" ><?php 





$total=$row[unit_price]*$row[qty];

   echo $total;

$unit_price=$unit_price+$total;

?></td>

                <td align="center"  class="link"><a href="kitchen_stock_out.php?id=<?php echo $row[id];?>&amp;action=edit">Edit</a></td>

                <td align="center"  class="link"><a href="delete_kitchen_stock.php?id=<?php echo $row[id];?>&url=kitchen_stock_out.php" onclick="javascript:return confirm('Are you sure you want to Delete This Entry?')">Delete</a></td>

              </tr>



			  <?php 

         }while($row=mysql_fetch_array($result));?>

 <tr>

                <td colspan="4" >Total :</td>

                <td align="center" ><?php 



echo $qty;

?></td>

                <td align="center" ><?php 



echo $unit_price;

?></td>

                <td align="center"  class="link">&nbsp;</td>

                <td align="center"  class="link">&nbsp;</td>

              </tr>

 <tr>

                <td colspan="10" >&nbsp;</td>

              </tr>

		 



			

            </table>

          <br /></td>

        </tr>

    </table></td>

  </tr>

  <tr>

    <td><?php include("bot.php");?></td>

  </tr>

</table>

</body>

</html>

<?php }?>