ok

Mini Shell

Direktori : /home2/selectio/www/lilyexpresslive/software/admin/
Upload File :
Current File : /home2/selectio/www/lilyexpresslive/software/admin/modicare-pickup-entry-add-backup.php

<?php require_once('header.php'); ?>

<?php
if(isset($_POST['form1'])) {
   // var_dump($_POST);
	$valid = 1;
//	print_r($_POST);

	if(empty($_POST['client_id'])) {
		$valid = 0;
		$error_message .= 'client identify can not be empty<br>';
	}

	if(empty($_POST['pincode'])) {
		$valid = 0;
		$error_message .= 'pincode can not be empty<br>';
	}
		if(empty($_POST['shipping_mode'])) {
		$valid = 0;
		$error_message .= 'shipping mode can not be empty<br>';
	}

	if(empty($_POST['customer_id'])) {
		$valid = 0;
		$error_message .= 'customer  can not be empty<br>';
	}
		if(empty($_POST['address'])) {
		$valid = 0;
		$error_message .= 'address Code can not be empty<br>';
	}
	if(empty($_POST['city'])) {
		$valid = 0;
		$error_message .= 'city can not be empty<br>';
	}
	if(empty($_POST['phone'])) {
		$valid = 0;
		$error_message .= 'phone can not be empty<br>';
	}
// 	if(empty($_POST['c_weight'])) {
// 		$valid = 0;
// 		$error_message .= 'Charged weight can not be empty<br>';
// 	}
	if(empty($_POST['a_weight'])) {
		$valid = 0;
		$error_message .= 'Actual weight can not be empty<br>';
	}
	if(empty($_POST['content_desc'])) {
		$valid = 0;
		$error_message .= 'Content Description can not be empty<br>';
	}
		if(empty($_POST['payment_mode'])) {
		$valid = 0;
		$error_message .= 'Payment Mode can not be empty<br>';
	}
// 		if(empty($_POST['other_charges'])) {
// 		$valid = 0;
// 		$error_message .= 'Other Charges can not be empty<br>';
// 	}
// 		if(empty($_POST['total_charges'])) {
// 		$valid = 0;
// 		$error_message .= 'Total Charges can not be empty<br>';
// 	}
	if(empty($_POST['pics'])) {
		$valid = 0;
		$error_message .= 'No of pieces can not be empty<br>';
	}
	
	
	
// 	**********************************  Generate AWB No Start ********************************************
                            $statement = $pdo->prepare("SELECT MAX(awb_no) as big_id FROM pickup_entry");
							$statement->execute();
							$result = $statement->fetchAll(PDO::FETCH_ASSOC);
							//$rows = mysqli_num_rows($result);
								foreach ($result as $row)
								{
								    $bid=$row['big_id'];
                                    //print_r($bid);
                                    
                                    if($bid!='')
                                    {
                                        $awb_no=$row['big_id']+1;
                                    }
                                    else
                                    {
                                        $awb_no=100001;
                                    }

								}
	
// 	**********************************  Generate AWB No End ********************************************
//$code=$_POST['awb_no'];
    //                     	$statement = $pdo->prepare("SELECT * FROM pickup_entry where awb_no='$code'");
				// 			$statement->execute();
				// 			$result = $statement->fetchAll(PDO::FETCH_ASSOC);
				// 			$rows = mysqli_num_rows($result);
    //                         if($result)
    //                         {
    //                             $valid=0;
    //                             $error_message .= 'AWB  No Alreay Exist<br>';
    //                         }
							

    if($valid==1)
    {
    
		$statement = $pdo->prepare("INSERT INTO pickup_entry (awb_no,ref_no,client_id,status,pincode,shipping_mode,customer_id,address,city,state,phone,c_weight,a_weight,content_desc,total_charges,other_charges,payment_mode,pics,gst_no,destination) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
		$statement->execute(array($awb_no,$_POST['awb_no'],$_POST['client_id'],'picked',$_POST['pincode'],$_POST['shipping_mode'],$_POST['customer_id'],$_POST['address'],$_POST['city'],$_POST['state'],$_POST['phone'],$_POST['a_weight'],$_POST['a_weight'],$_POST['content_desc'],$_POST['total_charges'],$_POST['other_charges'],$_POST['payment_mode'],$_POST['pics'],$_POST['gst_no'],$_POST['destination']));
			
	
		/*Tracking Module Start*/
		/* 	**********************************  Fetch Pickup Entry Id ******************************************** */
            $statement = $pdo->prepare("SELECT * FROM `pickup_entry` WHERE awb_no=? and ref_no=? and client_id=? order by client_id DESC LIMIT 1");
			$statement->execute(array($awb_no,$_POST['awb_no'],$_POST['client_id']));
			$result = $statement->fetchAll(PDO::FETCH_ASSOC);
			
				foreach ($result as $row)
				{
				    $pickup_ids=$row['id'];
				}
				
		$statement = $pdo->prepare("INSERT INTO tbl_tracking (pickup_entry_id,user_id,location,status,description,remark) VALUES (?,?,?,?,?,?)");
		$statement->execute(array($pickup_ids,$clientId,$clientLocation,'picked','Entry Successfully Picked','Material Safe...'));
			
			
		/*Tracking Module End*/
	
	
		$success_message = 'Pickup Entry is added successfully!';

		unset($_POST['client_id']);
		unset($_POST['pincode']);
		unset($_POST['shipping_mode']);
		unset($_POST['customer_name']);
		unset($_POST['address']);
		unset($_POST['city']);
		unset($_POST['state']);
		unset($_POST['phone']);
		unset($_POST['c_weight']);
		unset($_POST['content_desc']);
		unset($_POST['total_charges']);
		unset($_POST['other_charges']);
		unset($_POST['a_weight']);
		unset($_POST['gst_no']);
		unset($_POST['pics']);
		unset($_POST['payment_mode']);
    }
	
}
?>

<!--Script for onchange function on selection of pincode to get available shipping mode  -->
<!-- Script -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src='js/select2.full.min.js' type='text/javascript'></script>

<!-- CSS -->
<link href='css/select2.full.min.css' rel='stylesheet' type='text/css'>
<script>
    $(document).ready(function(){
 
  // Initialize select2
  $("#pincode").select2();
});
 $(document).ready(function(){
 
  // Initialize select2
  $("#customer_name").select2();
});
$(document).ready(function(){
 
  // Initialize select2
  $("#customer_id").select2();
});
</script>


<!--Script for onchange function on selection of pincode to get available shipping mode  -->
<script>
    $(document).ready(function(){
          /***********    For fetching customer address and phone number ***********/
         $('#customer_id').on('change',function(){
           var cust_id=$(this).val();
           if(cust_id){
                $.ajax({
                  type:'POST',
                  url:'get_customer_data.php',
                  data:{id:cust_id},
                   dataType: 'json',
                  success:function(response){
                      var len = response.length;
                     $('textarea#address').val(response[0]['address']);
                      $('#phone').val(response[0]['mobile']);
                      
                      $('#city').val(response[0]['city']);
                      $('#state').val(response[0]['state']);
                      $('#pincodes').val(response[0]['pincode']);
                      $('#destination').val(response[0]['destination']);
                      
                      
                  }
               });
           }
       });
    /***********    For fetching gst number ***********/
         $('#client_id').on('change',function(){
           var client_id=$(this).val();
         //  alert(client_id);
           if(client_id){
                $.ajax({
                  type:'POST',
                  url:'get_client_data.php',
                  data:{id:client_id},
                   dataType: 'json',
                  success:function(response){
                      var len = response.length;
                      $('#gst').val(response[0]['gst']);
                  }
               });
           }
       });
      /***********    For fetching Customer ***********/             
    $('#client_id').on('change',function(){
          var client_id=$(this).val();
         //  alert(client_id);
           if(client_id){
                $.ajax({
                type:'POST',
                url:'get_client_selection.php',
                data:{id:client_id},
                success:function(html){
                 //   alert('check');
                    // alert(html);
                    $('#customer_id').html(html);
    
                }
            }); 
           }
       });
        /***********    For fetching city ,state and shipping mode ***********/
       $('#pincode').on('change',function(){
          // alert('alertttttt');
           var pincode_id=$(this).val();
           if(pincode_id){
               $.ajax({
                  type:'POST',
                  url:'get_pincode_data.php',
                  data:{id:pincode_id},
                  success:function(html){
                      $('#shipping_mode').html(html);
                  }
               });
                $.ajax({
                  type:'POST',
                  url:'get_pin_data.php',
                  data:{id:pincode_id},
                   dataType: 'json',
                  success:function(response){
                      var len = response.length;
                    //   alert(response[0]['city']);
                      $('#city').val(response[0]['city']);
                      $('#state').val(response[0]['state']);
                  }
               });
           }
           else{
            $('#shipping_mode').html('<option value="">Select Pincode first</option>');
        }
       });
    });
     $(document).ready(function(){
       $('#payment_mode').on('change',function(){
            var mode=$(this).val();
            if(mode=='credit')
            {
                $('#total_charges').val('credit');
                $('#other_charges').val('credit');
                $('#total_charges').prop('readonly', true);
                $('#other_charges').prop('readonly', true);
            }
             if(mode=='cash')
            {
                $('#total_charges').val('');
                $('#other_charges').val('');
                $('#total_charges').prop('readonly', false);
                $('#other_charges').prop('readonly', false);
            }
            
       });
    });
</script>


<section class="content-header">
	<div class="content-header-left">
		<h1>Add Modicare Pickup Entry</h1>
	</div>
	<div class="content-header-right">
		<a href="pickup-entry.php" class="btn btn-primary btn-sm">View All</a>
	</div>
</section>


<section class="content">

	<div class="row">
		<div class="col-md-12">

			<?php if($error_message): ?>
			<div class="callout callout-danger">
				<p>
					<?php echo $error_message; ?>
				</p>
			</div>
			<?php endif; ?>

			<?php if($success_message): ?>
			<div class="callout callout-success">
				<p><?php echo $success_message; ?></p>
				<a href="awb_number_print.php?list_id=<?php echo $awb_no; ?>" target="_blank"><button class="btn btn-md btn-primary">Print AWB Number</button></a>
				<a href="lable_print.php?list_id=<?php echo $awb_no; ?>" target="_blank"><button class="btn btn-md btn-primary">Print Lable</button></a>
			</div>
			<?php endif; ?>
			
			<form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
				<div class="box box-info">
					<div class="box-body">
					    
					    	<div class="form-group">
							<label for="" class="col-sm-2 control-label">Select Client Name <span>*</span></label>
							<div class="col-sm-6">
							    <select class="form-control" name="client_id" id="client_id">
							        <option >Select Client Name </option>
							        <?php if(isset($_POST['client_id'])) { ?> <option value="<?php echo $_POST['client_id'];?>"><?php echo $_POST['client_id'];?></option>  <?php } ?>
							        <?php
									$statement = $pdo->prepare("SELECT * FROM tbl_user WHERE role='Modicare' ORDER BY id ASC");
									$statement->execute();
									$result = $statement->fetchAll(PDO::FETCH_ASSOC);	
									foreach ($result as $row) {
										?>
										<option value="<?php echo $row['id']; ?>"><?php echo $row['full_name']; ?></option>
										<?php
									}
									?>
							    </select>
							</div>
						</div>
							<div class="form-group">
							<label for="" class="col-sm-2 control-label">Select DB Number <span>*</span></label>
							<div class="col-sm-6">
							    <select class="form-control" name="customer_id" id="customer_id">
							        <option >Select Client First !</option>
							       
							    </select>
							</div>
						</div>
					
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">Pincode <span>*</span></label>
							<div class="col-sm-6">
								<input type="text" autocomplete="off" class="form-control" name="pincode" id="pincodes" value="<?php if(isset($_POST['pincode'])){echo $_POST['pincode'];} ?>">
							</div>
						</div>
						<input type="hidden" autocomplete="off" class="form-control" name="shipping_mode" id="shipping_mode" value="Air" >
						<!--	<div class="form-group">-->
						<!--	<label for="" class="col-sm-2 control-label">Select Shipping Mode <span>*</span></label>-->
						<!--	<div class="col-sm-6">-->
						<!--	    <select class="form-control" name="shipping_mode" id="shipping_mode">-->
						<!--	        <?php if(isset($_POST['shipping_mode'])) { ?> <option value="<?php echo $_POST['shipping_mode'];?>"><?php echo $_POST['shipping_mode'];?></option>  <?php } ?>-->
						<!--	        <option >Select Pincode First !</option>-->
							        <!--<option value="Air">Air</option>-->
						<!--	        <option value="Road">Road</option>-->
						<!--	    </select>-->
						<!--	</div>-->
						<!--</div>-->
						
						
						<!--<div class="form-group">-->
						<!--	<label for="" class="col-sm-2 control-label">Customer Name <span>*</span></label>-->
						<!--	<div class="col-sm-6">-->
						<!--		<input type="text" autocomplete="off" class="form-control" name="customer_name" value="<?php if(isset($_POST['customer_name'])){echo $_POST['customer_name'];} ?>">-->
						<!--	</div>-->
						<!--</div>-->
							<div class="form-group">
							<label for="" class="col-sm-2 control-label">Address <span>*</span></label>
							<div class="col-sm-6">
								<textarea class="form-control" name="address" id="address" style="height:100px;"></textarea>
							</div>
						</div>
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">City <span>*</span></label>
							<div class="col-sm-6">
								<input type="text" autocomplete="off" id="city" class="form-control" name="city" >
							</div>
						</div>
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">State </label>
							<div class="col-sm-6">
								<input type="text" autocomplete="off" id="state" class="form-control" name="state" >
							</div>
						</div>
							<div class="form-group">
							<label for="" class="col-sm-2 control-label">Destination <span>*</span></label>
							<div class="col-sm-6">
								<input type="text" autocomplete="off" id="destination" class="form-control" name="destination">
							</div>
						</div>
							<div class="form-group">
							<label for="" class="col-sm-2 control-label">Phone Number <span>*</span></label>
							<div class="col-sm-6">
								<input type="text" autocomplete="off" class="form-control" name="phone" id="phone" >
							</div>
						</div>
							<div class="form-group">
							<label for="" class="col-sm-2 control-label">AWB No <span>*</span></label>
							<div class="col-sm-6">
							    	<input type="text" autocomplete="off" id="awb_no" class="form-control" name="awb_no" >
							</div>
						</div>
							<!--<div class="form-group">-->
							<!--<label for="" class="col-sm-2 control-label">Content Description <span>*</span></label>-->
							<!--<div class="col-sm-6">-->
							<!--    <select class="form-control" name="content_desc" >-->
							        <!--<option >Select Description</option>-->
						        	 <input type="hidden" autocomplete="off" class="form-control" name="content_desc" id="content_desc" value="1" >
							        <?php
									$statement = $pdo->prepare("SELECT * FROM material_desc ORDER BY id ASC");
									$statement->execute();
									$result = $statement->fetchAll(PDO::FETCH_ASSOC);	
									foreach ($result as $row) {
										?>
										<!--<option value="<?php echo $row['id']; ?>"><?php echo $row['short_desc']; ?></option>-->
										<?php
									}
									?>
						<!--	    </select>-->
						<!--	</div>-->
						<!--</div>-->
						
						<!--	<div class="form-group">-->
						<!--	<label for="" class="col-sm-2 control-label">Payment Mode <span>*</span></label>-->
						<!--	<div class="col-sm-6">-->
							    <!--<select class="form-control" name="payment_mode" id="payment_mode" >-->
							       <!-- <option >Select Payment Mode</option>-->
							        <input type="hidden" autocomplete="off" class="form-control" name="payment_mode" id="payment_mode" value="credit" >
							    <!--    <option value="credit" <?php if(isset($_POST['payment_mode'])) {if($_POST['payment_mode']=='credit'){echo "selected";}} ?>>CREDIT</option>-->
							    <!--    <option value="cash"  <?php if(isset($_POST['payment_mode'])) {if($_POST['payment_mode']=='cash'){echo "selected";}} ?>>CASH</option>-->
							    <!--</select>-->
						<!--	</div>-->
						<!--</div>-->
						
						<!--<div class="form-group" id="oc">-->
						<!--	<label for="" class="col-sm-2 control-label">Other Charges <span>*</span></label>-->
						<!--	<div class="col-sm-6">-->
								<input type="hidden" autocomplete="off" class="form-control" name="other_charges" id="other_charges" value="0" >
						<!--	</div>-->
						<!--</div>-->
						<!--<div class="form-group" id="oc">
						<!--	<label for="" class="col-sm-2 control-label">Total Charges <span>*</span></label>-->
						<!--	<div class="col-sm-6">-->
								<input type="hidden" autocomplete="off" class="form-control" name="total_charges" id="total_charges" value="0" >
						<!--	</div>-->
						<!--</div>-->
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">Actual Weight <span>*</span></label>
							<div class="col-sm-6">
								<input type="text" autocomplete="off" class="form-control" name="a_weight" >
							</div>
						</div>
						<!--	<div class="form-group">-->
						<!--	<label for="" class="col-sm-2 control-label">Charged Weight <span>*</span></label>-->
						<!--	<div class="col-sm-6">-->
						<!--		<input type="text" autocomplete="off" class="form-control" name="c_weight" value="<?php if(isset($_POST['c_weight'])){echo $_POST['c_weight'];} ?>">-->
						<!--	</div>-->
						<!--</div>-->
							<div class="form-group">
							<label for="" class="col-sm-2 control-label">Number of Pieces <span>*</span></label>
							<div class="col-sm-6">
								<input type="number" autocomplete="off" class="form-control" name="pics" >
							</div>
						</div>
					 <!--   	<div class="form-group">-->
						<!--	<label for="" class="col-sm-2 control-label">GST Number </label>-->
						<!--	<div class="col-sm-6">-->
								<input type="hidden" autocomplete="off" id="gst" class="form-control" name="gst_no" value="<?php if(isset($_POST['gst_no'])){echo $_POST['gst_no'];} ?>" >
						<!--	</div>-->
						<!--</div>-->
					
						<div class="form-group">
							<label for="" class="col-sm-2 control-label"></label>
							<div class="col-sm-6">
								<button type="submit" class="btn btn-success pull-left" name="form1">Submit</button>
							</div>
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>

</section>

<?php require_once('footer.php'); ?>

Zerion Mini Shell 1.0