<?php
session_start();
if($_SESSION["username"]=="")
{
 	echo "You are not Logged in Please <a href='index.html'>Sign in </a> First ";
}
else
{
include 'dbc.php';
$username=$_SESSION["username"];
$current_file_name = basename($_SERVER['PHP_SELF']);
$sql = "SELECT * FROM adduser where feedisc2 = '$current_file_name' and uname = '$username'";
$result=$conn->query($sql);
$row = $result->fetch_assoc();
$status=$row['feedisc3'] ;

if ($status =="")
{
echo "You are not Authorized This Page <a href='maindashboard.php'>Back </a> ";
}
else
{
include 'dbc.php';
date_default_timezone_set("Asia/Karachi");
$today=date("Y-m-d");
$month = date("m",strtotime($today));
		$year = date("Y",strtotime($today));
		 $month_name = date("F", mktime(0, 0, 0, $month, 10));
		 $my=$month_name . " " . $year;
$userid=$_SESSION["userid"];
$sql = "SELECT MAX( id ) AS max FROM `items`;" ;
$result = $conn->query($sql);
$row = $result ->fetch_assoc();
$largestNumber = $row['max'];
$largestNumber = $largestNumber +1;
$sql3="Select * from addclass where user_id='$userid'";
$result1 = $conn->query($sql3);
$sql7="Select * from vendor where user_id='$userid'";
$result7 = $conn->query($sql7);
//$rows3=$result1 ->fetch_assoc();
?>
<!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->

<head>
   <?php include("includes/header.php") ?>
</head>

<body>


    <!-- Left Panel -->

    
    <!-- Left Panel -->

    <!-- Right Panel -->

    <div id="right-panel" class="right-panel">

        <!-- Header-->
        <header id="header" class="header">

             <?php include("includes/product_menu.php") ?>

        </header><!-- /header -->
        <!-- Header-->

        <div class="breadcrumbs">
            <div class="col-sm-6">
                <div class="page-header float-left">
                    <div class="page-title">
                        <h1><? echo "" . $_SESSION["userid"]; ?></h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="page-header float-right">
                    <div class="page-title">
                        <ol class="breadcrumb text-right">
                            <li class="active"><? echo "" . $_SESSION["username"]; ?></li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>

        <div class="content mt-3">

           


          <div class="col-lg-12">
                                                <div class="card">
                                                    <div class="card-header">
                                                        <strong>Add New Items</strong> Form
                                                    </div>
                                                    <div class="card-body card-block">
                                                        <form action="save_app.php" method="post" enctype="multipart/form-data" class="form-horizontal">
                                                            
                                                            <div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">S.No</label></div>
                                                                <div class="col-12 col-md-3"><input type="text" id="sno" name="sno" placeholder="Text" class="form-control" value=" <? echo $largestNumber ?>" readonly><small class="form-text text-muted">This is a Software genrated no</small></div>
                                                            </div>
                                                       
															
                                                            <div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">Item No/Barcode No</label></div>
                                                                <div class="col-12 col-md-3"><input type="text" id="item_no" name="item_no" placeholder="Item No" class="form-control"><small class="form-text text-muted">This is Item No</small></div>
                                                            </div>
                                                            
															
															<div class="row form-group">
                                                                    <div class="col col-md-3"><label for="select" class=" form-control-label">Select Item Type</label></div>
                                                                    <div class="col-12 col-md-4">
                                                                        <select name="type_name" id="type_name" class="form-control">
                                                                            <?php
  while($user_data3=$result1->fetch_assoc())
  {
  ?>
              <option value="<? echo $user_data3['cname']; ?>"><? echo $user_data3["cname"]; ?></option>
              <?php
  }
  ?>
                                                                        </select>
                                                                    </div>
                                                                </div>
																
																
																
																<div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">Item Name </label>
                                                                </div>
                                                                <div class="col-12 col-md-6"><input type="text" id="item_name" name="item_name" placeholder="Item Name" class="form-control"><small class="form-text text-muted">This is Item Name</small></div>
                                                            </div>
																
																<div class="row form-group">
                                                                    <div class="col col-md-3"><label for="select" class=" form-control-label">Item Untit Details</label></div>
                                                                    <div class="col-12 col-md-4">
                                                                        <select name="barcode" id="barcode" class="form-control">
                                                                           
                                                                             <option value="PCS">PCS</option>
																			 <option value="BAG">BAG</option>
																			  <option value="KG">KG</option>
																			   <option value="LTR">LTR</option>
																			   <option value="ML">ML</option>
																			    <option value="MM">MM</option>
																				<option value="GRM">GRM</option>
																				<option value="BOX">BOX</option>
																				<option value="CTN">CTN</option>
                                                                           
                                                                           
                                                                        </select>
                                                                    </div>
                                                                </div>
																
																<div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">Cost Price</label></div>
                                                                <div class="col-12 col-md-6"><input type="text" id="cost_price" name="cost_price" placeholder="Cost Price" class="form-control"><small class="form-text text-muted">This is Cost Price</small></div>
                                                            </div>
																
																
																<div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">Sale Price</label></div>
                                                                <div class="col-12 col-md-4"><input type="text" id="retail_price" name="retail_price" placeholder="Retail Price" class="form-control"><small class="form-text text-muted">This is Retail Price</small></div>
                                                            </div>
															<div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">Disc %</label></div>
                                                                <div class="col-12 col-md-4"><input type="text" id="disc" name="disc" placeholder="Disc %" class="form-control"><small class="form-text text-muted">This is Disc %</small></div>
                                                            </div>
														
															<div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">Brand Name</label></div>
                                                                <div class="col-12 col-md-4"><input type="text" id="bname" name="bname" placeholder="Brand Name" class="form-control"><small class="form-text text-muted">This is Brand Name</small></div>
                                                            </div>
															
															
															
														<div class="row form-group">
                                                                    <div class="col col-md-3"><label for="select" class=" form-control-label">Select Vendor</label></div>
                                                                    <div class="col-12 col-md-12">
                                                                        <select name="ven_name" id="ven_name" class="form-control">
                                                                            <?php
  while($user_data7=$result7->fetch_assoc())
  {
  ?>
              <option value="<? echo $user_data7['bname']; ?>"><? echo $user_data7["bname"]; ?></option>
              <?php
  }
  ?>
                                                                        </select>
                                                                    </div>
                                                                </div>
																
                                                                	<div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">Stock Alert</label></div>
                                                                <div class="col-12 col-md-4"><input type="text" id="salert" name="salert" placeholder="Stock Alert" class="form-control"><small class="form-text text-muted">This is Stock Alert</small></div>
                                                            </div>
																<div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">Opening Bal</label></div>
                                                                <div class="col-12 col-md-4"><input type="text" id="bal" name="bal" placeholder="Opening Bal" class="form-control"><small class="form-text text-muted">This isOpening Bal</small></div>
                                                            </div>
                                                     
                                                       
                                                    </div>
                                                    <div class="card-footer">
                                                        <button type="submit" class="btn btn-primary btn-sm">
                                                            <i class="fa fa-dot-circle-o"></i> Save
                                                        </button>
                                                        <button type="reset" class="btn btn-danger btn-sm">
                                                            <i class="fa fa-ban"></i> Reset
                                                        </button>
                                                    </div>
													 </form>
                                                </div>
                                                
                                            </div>

            


        </div> <!-- .content -->
    </div><!-- /#right-panel -->

    <!-- Right Panel -->

   <?php include("includes/footermenu.php") ?>

</body>

</html>
<?php
}
}
?>