<? include("header.php");


//session_start();
//error_reporting(0);

include "checksession.php";

include ("include/db-connect.php");


 $pid= $_REQUEST['pid'];

	if(isset($_REQUEST['submit']))
	{
		
	$supplier_name= $_REQUEST['supplier_name'];
	$tin_num= $_REQUEST['tin_num'];
	$supplier_address= $_REQUEST['supplier_address'];
	$contact_no= $_REQUEST['contact_no'];
	$email_id= $_REQUEST['email_id'];
	$balc_amount= $_REQUEST['balc_amount'];
	
	

	$query_select=mysql_query("select supplier_name from  ".$SUPPLIER." ");
		   $run=mysql_fetch_array($query_select);
		$supp_name=$run['supplier_name'];   
		   
		   
	
	if($supp_name!=$supplier_name)
	{
	 $ins_qur = "insert into  ".$SUPPLIER."
 (supplier_name,tin_num,supplier_address,contact_no,email_id,bal_amount) 
 values 
 ('$supplier_name','$tin_num','$supplier_address','$contact_no','$email_id','$balc_amount')";
 
 mysql_query($ins_qur);	
  
	        ?><script>window.location="add_suplier.php?add=success";</script><?
	}else{
	?><script>window.location="add_suplier.php?no=success";</script><?}}?>		 

<script type="text/javascript">
function showstate(str){
if (str==""){
document.getElementById("txtHint").innerHTML="";
return;}
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();}
else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("txtHintstate").innerHTML=xmlhttp.responseText;}}
xmlhttp.open("GET","loadData1.php?q="+str,true);
xmlhttp.send();}
function showcity(str){
if (str==""){
document.getElementById("txtHint").innerHTML="";
return;}
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();}
else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("txtHintcity").innerHTML=xmlhttp.responseText;}}
xmlhttp.open("GET","city_ajax.php?q="+str,true);
xmlhttp.send();}
</script>
<div id="content">
  <div class="breadcrumb">
      </div>
              <div class="box">
    <div class="heading">
      <h1><img src="view/image/home.png" alt="" />ADD SUPPLIER</h1>
    </div>
    <div class="content">
      <div class="overview" style="width:50%; margin-left:300px;">
        <div class="dashboard-heading"> ADD SUPPLIER</div>
        <div class="dashboard-content">
 
 <?php if($_REQUEST['add']=='success'){ ?>
 <div style="color:#060;font-size:18px;margin-bottom:10px;">One Supplier Details Added Successfully.</div>
 <? } ?>

 <form method="post" id="client" enctype="multipart/form-data">
 <!-- <script type="text/javascript" src="../prototype.js"></script> 
  <script type="text/javascript" src="../validation.js"></script>-->
  
      <div style="margin-left:00px;"><a href="view_supplier.php">VIEW SUPPLIER</a></div>
        <div class="mainrow" style="margin-left:100px;">
          <div class="maintext" style="width:120px;">Supplier Name<font color="#FF0000"><b> *</b></font> </div>
                <div class="maintextbox"><input type="text"  name="supplier_name" size="55" class="required"></div>
        </div>               
               
               <br />
               
                <div class="mainrow" style="margin-left:100px;">
                <div class="maintext" style="width:120px;">VAT TIN num<font color="#FF0000"><b> *</b></font> </div>
                <div class="maintextbox"><input type="text"  name="tin_num" size="55" class="required"></div>
                </div>
                <br />
                
                <div class="mainrow" style="margin-left:100px;">
                <div class="maintext" style="width:120px;">Contact no<font color="#FF0000"><b> *</b></font> </div>
                <div class="maintextbox"><input type="text"  name="contact_no" size="55" class="required && validate-pho" maxlength="10"></div>
                </div>
                
                <br />
                
                <div class="mainrow" style="margin-left:100px;">
                <div class="maintext" style="width:120px;">Email ID<font color="#FF0000"><b> *</b></font> </div>
                <div class="maintextbox"><input type="text"  name="email_id" size="55" class="required validate-email"></div>
                </div>
                <br />
                
        <div class="mainrow" style="margin-left:100px;">
                <div class="maintext" style="width:120px;">Supplier Address<font color="#FF0000"><b> *</b></font> </div>
                <div class="maintextbox"><input type="text"  name="supplier_address" size="55" class="required"></div>
                </div>
                <br />
                 <div class="mainrow" style="margin-left:100px;">
                <div class="maintext" style="width:120px;">Balance Amount<font color="#FF0000"><b> *</b></font> </div>
                <div class="maintextbox"><input type="text"  name="balc_amount" size="55" class="required"></div>
                </div>
                <br />
                
        <div class="mainrow" style="margin-left:100px;">
          <div class="maintext"><font color="#FF0000"><b></b></font> </div>
        <div class="maintextbox"><input type="submit" name="submit"value="Submit" ></div></div>
 
 
   </form>
        </div>
      </div>
      
      
    </div>
  </div>
</div>
<!--[if IE]>
<script type="text/javascript" src="view/javascript/jquery/flot/excanvas.js"></script>
<![endif]--> 
<script type="text/javascript" src="view/javascript/jquery/flot/jquery.flot.js"></script> 
<script type="text/javascript"><!--
function getSalesChart(range) {
	$.ajax({
		type: 'get',
		url: 'index.php?route=common/home/chart&token=b735cc089ec2d51abb9a8e1901f501fb&range=' + range,
		dataType: 'json',
		async: false,
		success: function(json) {
			var option = {	
				shadowSize: 0,
				lines: { 
					show: true,
					fill: true,
					lineWidth: 1
				},
				grid: {
					backgroundColor: '#FFFFFF'
				},	
				xaxis: {
            		ticks: json.xaxis
				}
			}

			$.plot($('#report'), [json.order, json.customer], option);
		}
	});
}

getSalesChart($('#range').val());
//--></script> 
</div>
<div id="footer">Copyright &copy; 2014 | Powered by <a href="http://linikantech.com/" target="_blank">Linikantech</a><!--<a href="http://www.opencart.com">OpenCart</a> &copy; 2009-2016 All Rights Reserved.<br />Version 1.5.6.4--></div>
</body></html>