<?php include 'header1f.php';?>
<?php include 'connection.php';
session_start();
if (!isset($_SESSION['is_logged_in'])) {
    header("Location:login.php");
    die();
    }
	 
$query2job = "select * from check_month";
$resultjob = mysql_query($query2job,$conn);
while($rowmonth=mysql_fetch_array($resultjob))

{
$check_month = $rowmonth['check_month'];
 }

date_default_timezone_set('Asia/Calcutta');
$today = date("d-m-Y");
$time = date("h:i A"); 
$currentmonth = date("m");
date_default_timezone_set('Asia/Calcutta');
$today = date("d-m-Y");
$today8days = date("d-m-Y")+8;

$time = date("h:i A");
$currentmonth = date("m"); 
$currentyear = date("y");
 
if($currentmonth>$check_month) { 
$cuyear = date("Y");
$cuyear1 = date("y")+1;

} else { 
$cuyear = date("Y")-1;
$cuyear1 =  date("y");
 } 
  $fin_year = "$cuyear"."-"."$cuyear1";

?>

<? include('sahavas_dropdown_function.php');?>
<?php 
$query2job = "select * from auto_number_job where f_year='$fin_year'";
//echo $query2job;
$resultjob = mysql_query($query2job,$conn);
while($rowjob=mysql_fetch_array($resultjob))

{
$auto_number1 = $rowjob['auto_number'];
 }
 $auto_number=$auto_number1+1;
 $main_job_no= sprintf("%03d", $auto_number);
 if($currentmonth>$check_month) { 
 $datey=date("Y");
 $datey01 =date("y")+1;
  } 
 else {
 $datey=date("Y")-1;
 $datey01 =date("y");
 }
  $noc_type=$_REQUEST['noc_type'];
  

$job_no_series = "Job"."/"."$datey"."-"."$datey01"."/"."$main_job_no";


$query = "select * from users where username = '". $_SESSION["LOGIN_NAME"]."' AND password = '".$_SESSION["EMPLOYEE_PASSWORD"]."'";
//echo $query;
		                 $result = mysql_query($query,$conn);
						 while($row=mysql_fetch_array($result))
	                                              	{
													  $staff_name = $row['full_name'];
													  $full_name = $row['full_name'];
													  $avatar = $row['avatar'];
													  $department_name = $row['department_name'];
													  $staff_id  = $row['id'];
													  $username = $row['username'];
													  $our_company = $row['our_company'];
													  $designation = $row['designation'];
													  $sales_group = $row['sales_group'];
													  $head = $row['head'];
													  $region = $row['region'];
													  $district = $row['district'];
													  $email = $row['email'];
													  $mobile_no = $row['mobile_no'];
													  $staff_id_self  = $row['id'];
													  //echo $Branch;
													  }	
													   ?>	
													   
  <div class="content-page">
    <div class="content">
      <div class="container">
	  <div class="row">
          <div class="col-sm-12">
            <div class="page-header-title">
            <button type="button" class="btn btn-dark waves-effect waves-light" onclick="location.href='qtn_status.php'">BACK </button>
              <div class="clearfix"></div>
            </div>
          </div>
        </div>
	  
	 <form name="chkForm" id="chkForm"  action="insert_main_job.php" method="post">
			<input name="fin_year" value="<?php echo $fin_year?>" type="hidden">	 
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="panel panel-primary">
                                <div class="panel-heading">
                                    <h3 class="panel-title"><?php echo $fin_year;?>Job No. <?php echo $job_no_series; ?></h3></div>
                                <div class="panel-body">
                                    <div class="row">
                                                    <div class="col-sm-3 col-xs-12"><div class="form-group">
                                                        <label>Customer Name</label>
                                                          <select class="form-control" name="customer_id"/>
									<option value="">Select Customer </option>
									 <? $query2c = "select * from customer_master order by customer_name";
		                 				$result2c = mysql_query($query2c,$conn);	
										while($row = mysql_fetch_array($result2c)){
													 $customer_name = $row['customer_name'];
													 $customer_id = $row['customer_id'];
												?>
												<option value="<? echo $customer_id?>"><? echo $customer_name?></option>
												<? } ?></select>
                                                    </div>
													</div>
													
												
													<div class="col-sm-3 col-xs-12"><div class="form-group">
                                                        <label>Main Job No.</label>
                                                        <input type="text" class="form-control"  name="main_job_no" value="<?php echo $job_no_series;?>">
                                                    </div>
													</div>
													
													<div class="col-sm-3 col-xs-12"><div class="form-group">
                                                        <label>Ref. No</label>
                                                             <input type="text" class="form-control"  name="ref_no" value="<?php echo $ref_no;?>">
                                                    </div>
													</div>
													
													<div class="col-sm-3 col-xs-12"><div class="form-group">
                                                        <label>A/C of</label>
                                                      <select class="form-control" id="" name="account_of"> 
<option value="">Select Accounts</option>
<option value="Aashirvadh">Aashirvadh Global Logistic Pvt. Ltd.</option>
	<option value="Threestar">Threestar Solutions & Services Pvt. Ltd.</option>
	<option value="Vector">Vector Freight Forwarders</option>
<option value="None">None</option>
</select>
                                                    </div>
													</div>
													
													<div class="col-sm-3 col-xs-12"><div class="form-group">
                                                        <label>Invoice type</label>
                                                         <select class="form-control" id="lsrc" name="inv_type"> 
<option value="">Select Invoice Type</option>
<option value="EXP">EXPORT</option>
<option value="IMP">IMPORT</option>
</select>                    </div>
													</div>
													
													<div class="col-sm-3 col-xs-12"><div class="form-group">
                                                        <label>Date</label>
														<div class="input-group">
														  <input type="text" class="form-control" placeholder="yyyy-mm-dd" id="datepicker" name="job_date" value="<?php echo $today; ?>">
														<span class="input-group-addon bg-custom b-0"><i class="mdi mdi-calendar text-white"></i></span></div>
                                             
                                                    </div>
													</div>
													
												
                                              <div class="col-sm-12 col-xs-12">
                                           
                                            <div class="m-t-20">
                                                    <div class="form-group">
                                                        <div>
                                                          <input class="btn btn-primary " type="submit" name="Submit" value="NEXT" >
						
															
                                                           
                                                        </div>
                                                    </div>
                                               
                                            </div>
                                        </div>      
                                                    
                                        
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					</form>
        
        
      </div>
    </div>
   	<?php include 'footer1a.php';?>
