<?php include 'header1f.php';?>
<?php
$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";

?>


<?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";


													   ?>	
													   
  <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='index.php'">BACK </button>
              <div class="clearfix"></div>
            </div>
          </div>
        </div>
	 
	 <form name="chkForm" id="chkForm"  action="direct_challan.php" method="post">
			<input type="hidden" name="main_id" value="<?php echo $_REQUEST['main_id'];?>">	  
			<?php 
			$query2c = "select * from main_job_details where main_id='".$_REQUEST['main_id']."'";
		                 				$result2c = mysql_query($query2c,$conn);	
										while($row = mysql_fetch_array($result2c)){
													 $main_job_no = $row['main_job_no'];
													 $main_id = $row['main_id'];
													 $customer_id=$row['customer_id'];
													  $customer_name=$row['customer_name'];
													  $inv_type=$row['inv_type'];
												}
												?>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="panel panel-primary">
                                <div class="panel-heading">
                                    <h3 class="panel-title">Challan Master</h3></div>
                                <div class="panel-body">
                                    <div class="row">
                                                    <div class="col-sm-12 col-xs-12"><div class="form-group">
                                                        <label>Customer Name</label>
                                                          <select class="form-control select2" name="customer_id"/>
									<option value="<?php echo $customer_id;?>"><?php echo $customer_name;?>  </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-12 col-xs-12"><div class="form-group">
                                                        <label>Consignee Name</label>
                                                     <input type="text" class="form-control"  name="consignee">
                                                    </div>
													</div>
													
													<div class="col-sm-12 col-xs-12"><div class="form-group">
                                                        <label>Invoice type</label>
                                                      <select class="form-control" id="lsrc" name="inv_type"> 
<option value="<?php echo $inv_type;?>"><?php echo $inv_type?></option>
<option value="EXP">EXPORT</option>
<option value="IMP">IMPORT</option>
</select>
                                                    </div>
													</div>
													
														<div class="col-sm-12 col-xs-12"><div class="form-group">
                                                        <label>Date</label>
														<div class="input-group">
														 <input type="text" class="datepicker1 form-control"  name="trans_inv_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';?>
