<?php include 'connection.php';
date_default_timezone_set('Asia/Calcutta');
$today = date("Y-m-d");
$current_month=date("m");
?>

<? 										   
													   							  
$month1=date("m");
if($month1>'4')
  {
  $currentyear = date("Y");
 $curr_full_year=date("Y");
$curr_short_year=date("y");
$future=$curr_short_year+1;
} else {
$currentyear1 = date("Y");
$currentyear = $currentyear1-1;
$curr_full_year1=date("Y");
 $curr_full_year=$curr_full_year1-1;
 $curr_short_year1=date("y");

$curr_short_year=$curr_short_year1-1;
$future=$curr_short_year+1;
}
?>


<?   $curr_fy=$currentyear .'-'. $future;?>
<?php 

$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'];
													   $full_name11 = $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;
													  }	
													   ?>			
 <? include('sahavas_dropdown_function.php');?>

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Shipping :: CRM Software</title>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
  <!-- daterange picker -->
  <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker.css">
  <!-- bootstrap datepicker -->
  <link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
  <!-- iCheck for checkboxes and radio inputs -->
  <link rel="stylesheet" href="plugins/iCheck/all.css">
  <!-- Bootstrap Color Picker -->
  <link rel="stylesheet" href="plugins/colorpicker/bootstrap-colorpicker.min.css">
  <!-- Bootstrap time Picker -->
  <link rel="stylesheet" href="plugins/timepicker/bootstrap-timepicker.min.css">
  <!-- Select2 -->
  <link rel="stylesheet" href="plugins/select2/select2.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
 <link rel="stylesheet" href="public/css/default.css" type="text/css">
 <script src="jquery.min.js"></script>
<script src="jquery-ui.js"></script>

<link rel="stylesheet" href="jquery-ui.css">
<style>table {
  border: 1px solid #ccc;
  border-collapse: collapse;
  margin: 0;
  padding: 0;
  width: 100%;
  table-layout: fixed;
}
table caption {
  font-size: 1.2em;
  margin: .5em 0 .75em;
}
table tr {
  
  border: 1px solid #ddd;
  padding: .35em;
}
table th,
table td {
  padding: .625em;
  
}
table th {
  font-size: .85em;
  letter-spacing: .0em;
  text-transform: uppercase;
}
@media screen and (max-width: 600px) {
  table {
    border: 0;
  }
  table caption {
    font-size: 1.3em;
  }
  table thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  }
  table tr {
    border-bottom: 3px solid #ddd;
    display: block;
    margin-bottom: .625em;
  }
  table td {
    border-bottom: 1px solid #ddd;
    display: block;
    font-size: .6em;
    text-align: right;
  }
  table td:before {
    /*
    * aria-label has no advantage, it won't be read inside a table
    content: attr(aria-label);
    */
    content: attr(data-label);
    float: left;
    font-weight: bold;
    text-transform: uppercase;
  }
  table td:last-child {
    border-bottom: 0;
  }
}

</style>												   


</head>
<body class="hold-transition skin-blue sidebar-mini"  onLoad="calendarSetup()">
<div class="wrapper">

<?php depat_check($department_name,$designation);?>

<?php
$short_form = $_REQUEST['short_form'];
?>

 
<!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
   
    <!-- Main content -->
    <section class="content">


<?php

$query2t = "select * from transport_master where trans_inv_no = '".$_REQUEST['trans_inv_no']."'";
$result2t = mysql_query($query2t,$conn);	
$rowcount=mysql_num_rows($result);				
if($rowcount!='0'){
while($row = mysql_fetch_array($result2t))
{
$short_form = $row['short_form'];
}
}else {
$str = $_REQUEST['trans_inv_no'];
				$resultset = explode("/",$str);
				
			$short_form = current($resultset);
				
		}		
				

	$query2t = "select * from tax_transtax where trans_inv_no = '".$_REQUEST['trans_inv_no']."'";
$result2t = mysql_query($query2t,$conn);	
$rowcount=mysql_num_rows($result);				

while($row = mysql_fetch_array($result2t))
{
$challan_id = $row['challan_id'];
$inv_type=$row['inv_type'];
}	
		
		
		
		
		?>
				<?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'];
													  $account_of=$row['account_of'];
												}
												
											

$query2 = "select * from customer_master where customer_id = '".$_REQUEST['customer_id']."'";
				//echo $query2;
		                 $result2 = mysql_query($query2,$conn);	
while($row = mysql_fetch_array($result2))
{
$address_exp = $row['billing_address'];
$city_exp = $row['bcity'];
$customer_name = $row['customer_name'];
}?>
												
	  

      <div class="row">
	  
	
        <div class="col-md-12">
          <div class="box box-danger">
            <div class="box-header with-border">
               <h3 class="box-title" style="color:#000; font-family:Calibri; font-weight:bold;">Make Bill for Job: <?php echo $final_job_no?> </h3>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
              <div class="row">
			              <div class="box-body">
			
			<form name="deptdetail" id="deptdetail" action="insert_direct_tranexp.php" method="post" enctype="multipart/form-data">
			<input  type="hidden" name="customer_id" value="<?php echo $_REQUEST['customer_id'];?>" />
			<input  type="hidden" name="trans_inv_date" value="<?php echo $_REQUEST['trans_inv_date'];?>" />
			<input  type="hidden" name="trans_inv_no" value="<?php echo $_REQUEST['trans_inv_no'];?>" />
			<input  type="hidden" name="inv_type" value="<?php echo $_REQUEST['inv_type'];?>" />
			


			<input  type="hidden" name="main_id" value="<?php echo $_REQUEST['main_id'];?>" />


<table class="table table-bordered">
  <tr>
    <td width="52%"><table width="100%">
      <?php if($inv_type=='EXP'){?>
      <tr>
        <td width="144">Customer Name: </td>
        <td width="397" colspan="2"><input type="text" name="expoter_name"  value="<? echo $customer_name?>" readonly="readonly" class="form-control">
												<? if($sub_party_name!='') { ?>
												<b style="font-weight:bold; padding-top:5px;">3 Party Name </b>: <? echo $sub_party_name;?>
							<? } ?> </td>
      </tr>
      <tr>
        <td>Address:</td>
        <td colspan="2"><textarea name="exporter_address" class="form-control" required><? echo $address_exp?></textarea></td>
      </tr>
	  
	  
	  <?php } ?>
	  
	        <?php if($inv_type=='IMP'){?>

	  
	  <tr>
        <td width="144">Customer Name: </td>
        <td width="397" colspan="2"><input type="text" name="importer_name"  value="<? echo $customer_name?>" readonly="readonly" class="form-control">
												<? if($sub_party_name!='') { ?>
												<b style="font-weight:bold; padding-top:5px;">3 Party Name </b>: <? echo $sub_party_name;?>
							<? } ?> </td>
      </tr>
      <tr>
        <td>Address:</td>
        <td colspan="2"><textarea name="importer_address" class="form-control" required><? echo $address_exp?></textarea></td>
      </tr>
	  
	  <?php }?>
	  
	  
    </table></td>
    <td width="48%" valign="top"><table width="100%">
      <tr>
        <td width="15%">Bill No. : </td>
        <td width="42%"><input class="form-control" id="trans_inv_no" name="trans_inv_no" value="<?php echo $_REQUEST['trans_inv_no']?>" readonly="readonly" type="text"></td>
      </tr>
      <tr>
        <td>Bill Date: </td>
        <td colspan="2"><input type="text" class="datepicker1 form-control"  name="trans_inv_date" value="<?php echo $_REQUEST['trans_inv_date']?>"  readonly="readonly" ></td>
      </tr>
	  <tr>
        <td> A/C of </td>
        <td colspan="2"><input type="text" class="form-control"  name="an_ac_of"  <?php if($account_of==''){?>value="Shigmoda Carriers and Lifters Pvt Ltd" <?php } else {?> value="<?php echo $account_of?>"<?php }?>></td>
      </tr>
      
    </table></td>
  </tr>
  

  
  </table>
  
<table>  <tr><td>Sr.No.</td><td>From </td><td>To </td> <td>Actual Weight </td><td>Charged Weight</td><td>Fright </td><td>Services </td><td>Vechicle No.</td><td>Amt.</td></tr>

      			  <? $i=1;
	//$sql = mysql_query("select * from job_register_import where job_imp_reg_id = '".$_REQUEST['job_imp_reg_id']."' "); 

//$challan_id_p=$_POST['challan_id'];
    $person_to_contact2 = explode(",", $challan_id);
foreach ($person_to_contact2 as $challan_id)
{

$query2 = "select * from  challan_master where challan_id='$challan_id'";
			//echo $query2;
$result2 = mysql_query($query2,$conn);	
while($row=mysql_fetch_array($result2))
	                                              	{
$consignor= $row['consignor'];
$consignee= $row['consignee'];
$consignee_gst_no= $row['consignee_gst_no'];
$from_consignor= $row['from_consignor'];
$to_consignor= $row['to_consignor'];
$vehicle_no = $row['vehicle_no'];
$articles_no= $row['articles_no'];
$challan_to= $row['challan_to'];
$weight= $row['weight'];
$freight= $row['freight'];
$transportations_service= $row['transportations_service'];
$description= $row['description'];
$loaded_export_import= $row['loaded_export_import'];
$container_no= $row['container_no'];
$paid= $row['paid'];
$transportation= $row['transportation'];
$loaded= $row['loaded'];
$container_no= $row['container_no'];
$seal_no= $row['seal_no'];
$destinations= $row['destinations'];
$shipping_agent= $row['shipping_agent'];
$booking_no= $row['booking_no'];
$in_time= $row['in_time'];
$out_time= $row['out_time'];
$receiver_signature_with_seal= $row['receiver_signature_with_seal'];
$delivery_at= $row['delivery_at'];
$description= $row['description'];	
	$date= $row['date'];
  $consignor_address= $row['consignor_address'];
  $consignee_addess= $row['consignee_addess'];
  $actual_weight=$row['actual_weight'];
$charged_weight=$row['charged_weight'];
$topay_freight=$row['topay_freight'];
$no_of_pkgs=$row['no_of_pkgs'];
$paid_freight=$row['paid_freight'];		
$challan_no=$row['challan_no'];	

  		$b_e_no=$row['b_e_no'];
$b_e_date=$row['b_e_date'];
$sb_no=$row['sb_no'];
$sb_date=$row['sb_date'];
$seal_no=$row['seal_no'];
$container_type=$row['container_type'];
$consignee_gst_no=$row['consignee_gst_no'];
					}		
		
?>
<input type="hidden" name="challan_id<? echo $i?>" value="<?php echo $challan_id?>">
<tr><td><?php echo $i;?> </td><td>From <?php echo $from_consignor;?><br>
To <?php echo $to_consignor;?> </td><td><?php echo $no_of_pkgs;?> <br>
Container No : <?php $container_no?> </td> <td><? echo $actual_weight;?> </td><td><?php echo $charged_weight;?></td><td><?php echo $paid_freight;?> </td><td><textarea name="particular<?php echo $i?>" class="form-control"></textarea> </td>
<td><textarea name="vehicle_no<?php echo $i?>" class="form-control"><? echo $vehicle_no;?></textarea> </td><td><input type="text" name="chargable_amount<?php echo $i?>" class="form-control"></td></tr><? $i++;?>

<?  }?></table>  
 
				
<input type="hidden" name="cntcount2" value="<?php echo $i?>">
 <div align="right" class="col-sm-12">
						
	          				 <input type="submit" name="Submit" value="Save" class="btn bg-btn-save">
					</div>	
              </form>
</div> 
                <!-- /.col -->
                
                <!-- /.col -->
              </div>
              <!-- /.row -->
            </div>
            <!-- ./box-body -->
            
            <!-- /.box-footer -->
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->
		
		
		
      </div>
    </section>
    <!-- /.content -->
  </div>
 

	
 </form>
    <? include'footer.php'; ?>

