<?php 
session_start();
ini_set('display_errors', 0);

	//require_once('functions.php');
		require_once('mysql.php');
		//require_once('date.js');
			//require_once('menu.php');
			$user=$_SESSION['user_name'];
	//$level=$_SESSION['admin_level'];
	ini_set('display_errors', 0);


?>

<? require_once('functions.php');?>
<link rel="stylesheet" href="menu.css" media="screen">
     <link rel="stylesheet" href="style.responsive.css" media="all">
 <script src="jquery.js"></script>
        <script src="script.js"></script>
        <script src="script.responsive.js"></script>
 <nav class="art-nav clearfix">
             <?php headermenu($_SESSION['department'],'SALES'); ?> 
            </nav>
<!DOCTYPE html>
<html dir="ltr" lang="en-US"><head><!-- Created by Artisteer v4.0.0.58475 -->
        <meta charset="utf-8">
        <title>Create Invoice</title>
        <!--<meta name="viewport" content="initial-scale = 1.0, maximum-scale = 1.0, user-scalable = no, width = device-width">-->
        <meta name="HandheldFriendly" content="True"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
        <meta name="HandheldFriendly" content="true" />
        <meta name="MobileOptimized" content="true" />

        <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
      
        <!--[if lte IE 7]><link rel="stylesheet" href="style.ie7.css" media="screen" /><![endif]-->
        <link rel="stylesheet" href="style.responsive.css" media="all">


        <script src="jquery.js"></script>
        <script src="script.js"></script>
    
        <meta name="description" content="NEURO DATA">
        <meta name="keywords" content="EZ-SACCO">
<link rel="stylesheet" type="text/css" href="tcal.css" />
<link rel="stylesheet" type="text/css" href="datepicker.css" />
<script type="text/javascript" src="tcal.js"></script> 
<title></title>
<script language="JavaScript" type="text/javascript" src="datepicker.js"></script>

<script language="JavaScript" type="text/javascript" src="lpo_serch.js"></script>
<style type="text/css">
    .fieldset-auto-width {
         display: inline-block;
    }
</style>
<style type="text/css">
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
</style>

<script type="text/javascript">
    function ShowTime()
    {
      var time=new Date()
      var h=time.getHours()
      var m=time.getMinutes()
      var s=time.getSeconds()
      // add a zero in front of numbers<10
      m=checkTime(m)
      s=checkTime(s)
      document.getElementById('txt').value=h+" : "+m+" : "+s
      t=setTimeout('ShowTime()',1000)

    }
    function checkTime(i)
    {
      if (i<10)
      {
        i="0" + i
      }
      return i
    }
    </script>
	
<script language="javascript" type="text/javascript">

function multiply(){

a=Number(document.abc.QTY.value);

b=Number(document.abc.PPRICE.value);
h=Number(document.abc.DISC.value);
g=Number(document.abc.TAX.value);
f=Number(document.abc.TOTAL.value);
q=Number(document.abc.DISCOUNT.value);

c=a*b;
e=c*h/100;
d=g/100*(a*b);
n=a*b;
z=a*b-q;
k=z*g/100;
p=a*b*h/100;
m=n-p;
l=n-k;

document.abc.TOTAL.value=l;
document.abc.VAT.value=k;
document.abc.DISCOUNT.value=p;
document.abc.TOTALL.value=m;
}
function tax(){

a=Number(document.abc.TAX.value);

b=Number(document.abc.TOTAL.value);


c=a/100*b;

h=b+c;

document.abc.VAT.value=c;
document.abc.TOTALL.value=h;
}
function total(){



b=Number(document.abc.PPRICE.value);

c=Number(document.abc.QTY.value);


e=b*c;

document.abc.TOTALL.value=e.toFixed(2);


}

function minus(){

a=Number(document.sumary.totala.value);

b=Number(document.sumary.aba.value);


c=a*b;
d=a+c;
f=d;

document.sumary.less.value=c.toFixed(2);
document.sumary.vatableless.value=f.toFixed(2);
document.sumary.totalamountdue.value=d.toFixed(2);
}


</script>


</script>


<SCRIPT LANGUAGE="JavaScript">
function checkIt(evt) {
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        status = "This field accepts numbers only."
        return false
    }
    status = ""
    return true
}
</SCRIPT>
 <link rel="stylesheet" href="s.css" media="screen">
 <div id="art-main">
          
           



<link rel="stylesheet" href="css.css" type="text/css" media="screen" />
<link href="h.css" rel="StyleSheet" type="text/css">
<style type="text/css">
<!--
.style1 {font-size: 36px}
-->
  </style>
</head>

<body onLoad="ShowTime()">

<?php

function formatMoney($number, $fractional=false) {
    if ($fractional) {
        $number = sprintf('%.2f', $number);
    }
    while (true) {
        $replaced = preg_replace('/(-?\d+)(\d\d\d)/', '$1,$2', $number);
        if ($replaced != $number) {
            $number = $replaced;
        } else {
            break;
        }
    }
    return $number;
}	


?>
<form action="add_inv.php" method="post" name="abc"><div class="wraper">
<fieldset class="fieldset-auto-width" style="border-color:#000000; border-width:4px; background-color:#e8e8e8;">

					<legend>Stock Details</legend>

  <div class="top">
    <div class="topleft">
     
      <input type="text" id="amot" name="amot" size="30" placeholder="Type Product Name Hint Here..... " onKeyUp="bleble();" autocomplete="off"/>
<div id="layer2" style="margin-right:-30px;"></div>

 
	
	
	</div>
    <div class="topright">
						<?php
						/*$q=20;
						$s=86400;
						$r=$q*$s;*/
						$timestamp=time(); //current timestamp
						/*$tm=$timestamp+$r; // Will add 2 days to the $timestamp*/
						$da=date("m/d/Y", $timestamp);
						/*
						echo "Current time string: $da <br>";
						$da1=date("F j, Y", $tm);
						echo "Modified time: $da1 <br>";*/
						?>
						




						<?php
							if (isset($_GET['id']))
							{
					  $dbc=mysqli_connect("localhost","u486354202_kgit","GH@@Y98it%9a#@!*&&","u486354202_kone");
						
						$p_id = $_GET['id'];
						$result = mysqli_query($dbc,("SELECT * FROM products WHERE product_id = $p_id"));
						
						$row = mysqli_fetch_array($result);
						$name=$row["p_name"];
						$price=$row["price"];
						$left=$row["left_p"];
						mysqli_close($dbc);
						}
						///$np=mysql_query("select num from in_num");
						//$ty=mysql_fetch_array($np);
						//$nk=$ty['num'];
						//$no=$nk;
						//$no=$_SESSION['num'];
						?>
						
						
						
						
						
						
						
						
						
						<table id="header" width="871" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="347"><div align="right"><b>Product Name : </div></td>
    <td colspan="3"><?ECHO"<input name='PNAME' type='text' value='{$row['p_name']}'  size='40'>";?>
	
	<input name="id" type="hidden" value="<?php echo $p_id ?>"  /></td>
  <td width="347"><div align="right"><b>Delivery No : </div></td>
    <td colspan="3"><input name="iss" type="text" value="<?php echo $_SESSION['invc'] ?>"  readonly/>
	<input name="id" type="hidden" value="<?php echo $no ?>"  /></td>
	
		<input name="id" type="hidden" value="<?php echo $_SESSION['sup']?>"  /></td>

    <td width="124" rowspan="3"><input name="submit" type="submit" 
	value="SAVE" style="height: 84px; width: 110px; cursor:pointer;" id="xx" /><input name="product_id" type="hidden" value="<?php echo $id ?>" readonly/><input name="PCODES" type="hidden" value="<?php echo $CODE ?>" readonly/></td>
  </tr>
    <tr>
    <td><div align="right"><b>QTY : </div></td>
    <td><input name="qty" type="text" value="" /></td>
    
  
	
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
   

  <tr>
      
    

       
  </tr>
  <tr>
     
      

    
  </tr>

</table>
	
	
	
	
	
  
  </fieldset>

  
  
  
  
  
  
  
  
  <fieldset style="border-width: 3px;">

					<legend>Goods List</legend>
  <div class="center">
    <table width="100%" border="1" cellspacing="0" cellpadding="0" style="border-color:#112244;background-color:#aabbcc;border-width:thin;">
      <tr>
       
        <td width="35%"><div align="center"><strong>DESCRIPTION</strong></div></td>
		<td width="10%"><div align="center"><strong>QUANTITY </strong></div></td>
	

		<td width="5%">CANCEL</td>

      </tr>
	  <?php
	  $no=$_SESSION['invc'];
  $dbc=mysqli_connect("localhost","u486354202_kgit","GH@@Y98it%9a#@!*&&","u486354202_kone");
$f=$_SESSION['invc'];
$result = mysqli_query($dbc,("SELECT * FROM trans  where cod='$no'"));

while($row = mysqli_fetch_array($result))
  {
      echo '<tr>';
       
		echo '<td><div align="left">&nbsp;&nbsp;'.$row['p_name'].'</div></td>';

	
	$tax+=$row['vat'];
	$total+=$row['amount'];
        echo '<td><div align="center">'.$row['qty'].'
		</td>';
				//echo'<td>'.$row['total'].'</td>';

   
	
	
		
			
        echo '<td>';

		echo '<a href=delete_lp.php?id=' . $row["trans_id"] .'>Remove</a>';
		echo '</td>';
      echo '</tr>';
	  
	  }
	

mysqli_close($dbc);
?>
    </table>
	</form><br><br>
	<fieldset class="fieldset-auto-width" style="border-color:#000000; border-width:4px; background-color:#e8e8e8;">
	   <form action="print_inv.php" method="post">
	   	<table id="header" width="550" border="0" cellpadding="0" cellspacing="0">


  <tr>
  	   <td colspan="3"><input name="submit" type="submit" value="PRINT DELIVERY">
	</table></fieldset>
    <br />
	
	<div align="right">
	
	
	


	


	

</body>
</html>
<table width="100%" height="-5%" cellspacing="0" border="0">
<TR height="100"><TD><?php require_once("footer.php"); ?></TD></TR>
