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

<? 	

$query2job = "select * from check_month";
$resultjob = mysql_query($query2job,$conn);
while($rowmonth=mysql_fetch_array($resultjob))

{
$check_month = $rowmonth['check_month'];
 }
									   
													   							  
$month1=date("m");
if($month1>$check_month)
  {
  $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;?>
 <? 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">
      			  <? 
	//$sql = mysql_query("select * from job_register_import where job_imp_reg_id = '".$_REQUEST['job_imp_reg_id']."' "); 


$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'];
}



?>	
<?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);
				
		}		?>
				
	  <?php
date_default_timezone_set('Asia/Calcutta');
$today = date("Y-m-d");
$time = date("h:i A"); 
$currentyear = date("Y");
$currentmonth = date("m");

if($currentmonth>$check_month) { 
$cuyear = date("y");
$cuyear1 = date("y")+1;

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



   $query1 = "select * from challan_no where auto_challan_no!='' and f_year='$f_year' order by challan_id ";
$result1 = mysql_query($query1,$conn);
 $num_rows2a = mysql_num_rows($result1);
if($num_rows2a =='0') { 
$auto_challan_no1 = 0;
 $challan_no1=$auto_enquiry_no1+1;
$challan_no= sprintf("%03d", $challan_no1);
} else {
while($row=mysql_fetch_array($result1))
{
$auto_challan_no1 = $row['auto_challan_no'];
$challan_no1=$auto_challan_no1+1;
$challan_no= sprintf("%03d", $challan_no1);
}
} 

//$challan_no01 = "AR/".$challan_no."/".$f_year;

$challan_no01 = $challan_no."/".$f_year;

?>


      <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 Challan: <?php echo $challan_no01?> </h3>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
              <div class="row">
			              <div class="box-body">
			
			<form name="deptdetail" id="deptdetail" action="insert_direct_challan_master.php" method="post" enctype="multipart/form-data">
			<input  type="hidden" name="customer_id" value="<?php echo $_REQUEST['customer_id'];?>" />
			<input  type="hidden" name="main_id" value="<?php echo $_REQUEST['main_id'];?>" />
			<input  type="hidden" name="trans_inv_no" value="<?php echo $_REQUEST['trans_inv_no'];?>" />
			<input  type="hidden" name="auto_challan_no" value="<?php echo $challan_no;?>" />
<input type="hidden" name="f_year" value="<?php echo $f_year;?>">
			<input  type="hidden" name="inv_type" value="<?php echo $_REQUEST['inv_type'];?>" />

			<input  type="hidden" name="challan_no01" value="<?php echo $challan_no01;?>" />


<table class="table table-bordered">
  <tr>
    <td width="52%"><table width="100%">
      <?php if($_REQUEST['inv_type']=='EXP'){?>
      <tr>
        <td width="144">Consignor Name: </td>
        <td width="397" colspan="2"><input type="text" name="consignor"  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="consignor_address" class="form-control" required><? echo $address_exp?></textarea></td>
      </tr>
	  
	  
	  <?php } ?>
	  
	        <?php if($_REQUEST['inv_type']=='IMP'){?>

	  
	  <tr>
        <td width="144">Customer Name: </td>
        <td width="397" colspan="2"><input type="text" name="consignor"  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="consignor_address" class="form-control" required><? echo $address_exp?></textarea></td>
      </tr>
	  
	  <?php }?>
	  
	  
    </table></td>
    <td width="48%" valign="top"><table width="100%">
      <tr>
        <td>consignee Name</td>
        <td><input class="form-control" id="consignee" name="consignee" value="<?php echo $_REQUEST['consignee']?>" readonly="readonly" type="text"></td>
      </tr>

       <tr>
        <td>Address:</td>
        <td colspan="2"><textarea name="consignee_addess" class="form-control" required></textarea></td>
      </tr>
      <tr>
        <td>Bill Date: </td>
        <td colspan="2"><input type="text" class="datepicker1 form-control"  name="date" value="<?php echo $_REQUEST['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($an_ac_of==''){?>value="Shigmoda Carriers and Lifters Pvt Ltd" <?php } else {?> value="<?php echo $an_ac_of?>"<?php }?>></td>
      </tr>
 -->
      
    </table></td>


<!----------------------------------------------------->



<table class="table table-bordered">
  <tr>
    <td width="52%"><table width="100%">
     <tr>
        <td width="15%">Consignee GST No </td>
        <td width="42%"><input class="form-control" name="consignee_gst_no" type="text" id="consignee_gst_no"  required><div id="disp1"></td>
      </tr>
      
       <tr>
        <td width="15%">From: </td>
        <td width="42%"><input class="form-control" name="from_consignor" type="text" id="from_consignor"  required><div id="disp1"></td>
      </tr>
      
	  
	  

	  
	  <tr>
        <td width="15%">To : </td>
        <td width="42%"><input class="form-control" name="to_consignor" id="to_consignor" type="text"></td>
      </tr>
      


       <tr>
        <td width="17%">Vehicle No </td>
        <td width="42%"> <input class="form-control" name="vehicle_no" id="vehicle_no" type="text"></td>
      </tr>
      
       <tr>
        <td width="15%">	Nos of Pkgs </td>
        <td width="42%"><input class="form-control" name="no_of_pkgs" id="no_of_pkgs" type="number" > 
		<input class="form-control" name="type_pkgs" id="type_pkgs" type="text" placeholder="Type of PKG"> </td>
      </tr>
      
	  <tr>
        <td >Actual Weight : </td>        
		 <td ><input class="form-control" name="actual_weight" id="actual_weight" type="text" ></td></tr><tr>
<td >Charged Weight : </td>
		 <td><input class="form-control" name="charged_weight" id="charged_weight" type="text" ></td>

        
      </tr>
	   <tr>
        <td >Topay Freight : </td>        
		 <td ><input class="form-control" name="topay_freight" id="topay_freight" type="text" ></td></tr><tr>
<td >Paid Freight : </td>
		 <td><input class="form-control" name="paid_freight" id="paid_freight" type="text" ></td>

        
      </tr>
	  <tr>
        <td width="15%">Seal No </td>
        <td width="42%"><input class="form-control" name="seal_no" id="seal_no" type="text"></td>
      </tr>
      
      <tr>
        <td width="15%">Destinations</td>
        <td width="42%"><input class="form-control" name="destinations" id="articles_no" type="text"></td>
      </tr>
      
      <tr>
        <td width="15%">Shipping_agent </td>
        <td width="42%"> <input class="form-control" name="shipping_agent" id="shipping_agent" type="text"></td>
      </tr>
      
      <tr>
        <td width="15%">Booking No </td>
        <td width="42%"><input class="form-control" name="booking_no" id="booking_no" type="text"></td>
      </tr>
      
	   <tr>
        <td >Receiver Signature With Seal: </td>
       <td><input class="form-control" name="receiver_signature_with_seal" id="receiver_signature_with_seal" type="text"></td>
      </tr>
      <tr>
        <td >Delivery at : </td>
       <td > <input class="form-control" name="delivery_at" id="delivery_at" type="text"></td>
      </tr>
    </table></td>
    <td width="48%" valign="top"><table width="100%">
      <tr>
        <td >Freight : </td>
       <td colspan="2"> <input class="form-control" name="freight" id="freight" type="text"></td>
      </tr>
      <tr>
        <td>Transportations Service: </td>
        <td colspan="2"> <input class="form-control" name="transportations_service" id="transportations_service" type="text"></td>
      </tr>
	  <tr>
        <td>Description </td>
        <td colspan="2"><textarea class="form-control" rows="4" style="resize:vertical;" name="description" id="description" maxlength="250" required></textarea>
											</td>
      </tr>

      <tr>
        <td >Loaded Export / Import / Local : </td>
       <td colspan="2"> <input class="form-control" name="loaded_export_import" id="loaded_export_import" type="text"></td>
      </tr><tr>
        <td >	Total Container nos : </td>
       <td colspan="2"> <input class="form-control" name="total_container_no" id="total_container_no" type="text"></td>
      </tr>
        <tr>
        <td >Container No : </td>
       <td colspan="2"> <input class="form-control" name="container_no" id="container_no" type="text"></td>
      </tr>
<tr>
        <td >Container Type : </td>
       <td colspan="2"> <input class="form-control" name="container_type" id="container_type" type="text"></td>
      </tr>
	  
	  
	  <tr>
        <td>B/E No : </td>
       <td colspan="2"> <input class="form-control" name="b_e_no" id="b_e_no" type="text"></td>
      </tr>
 <tr>
        <td>B/E Date: </td>
       <td colspan="2"> <input class="form-control datepicker1" name="b_e_date" id="b_e_date" type="text"></td>
      </tr>

	    <tr>
        <td>SB No : </td>
       <td colspan="2"> <input class="form-control" name="sb_no" id="sb_no" type="text"></td>
      </tr>
 <tr>
        <td>SB Date: </td>
       <td colspan="2"> <input class="form-control datepicker1" name="sb_date" id="sb_date" type="text"></td>
      </tr>

	 	
      <tr>
        <td >In Time: </td>
       <td colspan="2"> <input class="form-control" name="in_time" id="in_time" type="text"></td>
      </tr>
      <tr>
        <td >Out  Time : </td>
       <td colspan="2">  <input class="form-control" name="out_time" id="out_time" type="text"></td>
      </tr>
     
      
    </table></td>

<!---------------------------------------------------->















  </tr>
  
  <tr>
    <td colspan="2">
	
				

	<div id="sigthseeing" style="visibility:hidden;">
			  
			  </div>
			  <div align="right" class="col-sm-12">
						
	          				 <input type="submit" name="Submit" value="Save" class="btn bg-btn-save">
					</div>			  </td>
  </tr>
</table>
              </form>
</div> 
                <!-- /.col -->
                
                <!-- /.col -->
              </div>
              <!-- /.row -->
            </div>
            <!-- ./box-body -->
            
            <!-- /.box-footer -->
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->
		
		
		
      </div>
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  <script type="text/Javascript">
	function callAddContact2()
	{
	
   var tbl = document.getElementById('cntTable2');
	 var lastRow = tbl.rows.length;
	 // if there's no header row in the table, then iteration = lastRow + 1
	 var iteration = lastRow;
	 var row = tbl.insertRow(lastRow);
	 var node1;
	 var lineno = lastRow;
	 // cell 0
	 var cellLeft = row.insertCell(0);
	 cellLeft.className = "center";
		var node = document.createElement('span');
		node.className = "glyphicon glyphicon-remove";
		node.title="Delete line";
		var link = document.createElement("a");
		link.className = "btn bg-btn-delete";
		link.style.padding = "0px 2px";
		link.href="javascript:callRemoveContact("+lineno+");";
		link.appendChild(node);
		//cellLeft.appendChild(link);
	 
	 node = document.createElement("input");
	 node.type = 'hidden';
	 node.name = 'cid'+lineno;
	 node.value = '';
	 node.id = 'cid'+lineno;
	 cellLeft.appendChild(node);
	 node = document.createElement("input");
	 node.type = 'text';
	 node.style.width = "50px";
	
	 node.name = 'clinenum'+lineno;
	 node.value = lineno;
	 node.readOnly = true;
	 node.id = 'clinenum'+lineno;
	 cellLeft.appendChild(node);
	 
	 
	 
	  var cell1 = row.insertCell(1);
	  
	 node = document.createElement("textarea");
	 node.className = 'form-control';
	 node.type = 'text';	
	 node.name = 'particular'+lineno;
	 node.placeholder='';
	 node.value = "";
	 node.id = '';
	 cell1.appendChild(node);
	 
	
	 

	<?php if($short_form=='SMCL' or $short_form=='PSGR' or $short_form=='TCS' or $short_form=='SPM' or $short_form=='SE' or $short_form=='DGK'){?> 
	  var cell2 = row.insertCell(2);
	 node = document.createElement("input");
	 node.className = 'form-control';
	 node.type = 'text';	
	 node.name = 'vehicle_no'+lineno;
	 node.placeholder='';
	 node.value = "";
	 node.id = '';
	 cell2.appendChild(node);
	 
	 	  var cell3 = row.insertCell(3);
	  
	 node = document.createElement("input");
	 node.className = 'form-control';
	 node.type = 'text';	
	 node.name = 'chargable_amount'+lineno;
	 node.placeholder='Amount';
	 node.value = "";
	 node.id = '';
	 cell3.appendChild(node);
	 <?php } else {?>
	 
	 
		  var cell2 = row.insertCell(2);
	  
	 node = document.createElement("input");
	 node.className = 'form-control';
	 node.type = 'text';	
	 node.name = 'chargable_amount'+lineno;
	 node.placeholder='Amount';
	 node.value = "";
	 node.id = '';
	 cell2.appendChild(node);
	
		<?php } ?>
		
	document.getElementById('cntcount2').value = lineno;
	document.getElementById('sigthseeing').style.visibility='visible';
	
}
function delRow()
{

    var tableName = document.getElementById('cntTable2');

    var prev = tableName.rows.length;

    if(prev > 1)

{
    

/////////////////////////////////////////////////////////////////////////////////////
   
	 // if there's no header row in the table, then iteration = lastRow + 1
	
	 var row = document.getElementById('cntTable2').deleteRow(prev-1);
	 
	 }
	 var node1;
	  var iteration = lastRow;
	 var lastRow = tableName.rows.length;
	 var lineno = lastRow;
document.getElementById('cntcount2').value = lineno-1;




}
</script>
<script>$( ".datepicker1").datepicker({
  inline: true,
  
  nextText: '&rarr;',
  prevText: '&larr;',
  showOtherMonths: true,
  changeMonth: true,
   changeYear: true,
  dateFormat: 'dd-mm-yy',
  dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
      showAnim: "slide"
 });</script> 

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

