MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //home/cafsindia/allyindian_com/backend/application/views/cancel_ticket/cancel_form.php
<?php $this->load->view("partial/header");?>
<?php
$tr_line = "";
	$i = 1;
	foreach ($ticket_data as $rslt){	
			$passid         = $rslt['passid'];
			$pnrno          = $rslt['pnrno'];
			$orderid        = $rslt['orderid'];
			$order_date     = date("d-M-Y",strtotime($rslt['orderdate']));
			$pack_date      = date("d-M-Y",strtotime($rslt['doj']));
			$order          = $rslt['orderdate'];
			$package_date   = $rslt['doj'];
			$nopass         = $rslt['nopass'];
			$boarding       = $rslt['boarding_name'];
			$dep_time       = $rslt['dep_time'];
			$custid         = $rslt['custid'];	
			$custmobile     = $rslt['custmobile'];
			$custaddress    = $rslt['custaddress'];
			$package_title  = $rslt['package_title'];
			$package_title2 = $rslt['package_title2'];
			$package_title3 = $rslt['package_title3'];
			$passname       = $rslt['passname'];
			$passgender     = $rslt['passgender'];
			$passage        = $rslt['passage'];
			$seatno         = $rslt['seatno'];
			$passtripid     = $rslt['passtripid'];
			$packid         = $rslt['packid'];
			$cashpaid       = $rslt['cashpaid'];
			$discount       = $rslt['discount'];
			$tariffamt      = $rslt['tariffamt'];
			$ticketamt      = $rslt['ticketamt'];
			$cancelfee      = $rslt['cancelfee'];
			$passstatus     = $rslt['passstatus'];
			$pack_name      = $package_title." ".$package_title2." ".$package_title3;
			// if($discount !== "0"){
			// 	$disc = ($tariffamt * ($discount / 100));
			// 	$tariffamt = $tariffamt - $disc;
			// }

			//Cancel Fees Calculation
			$today = date('Y-m-d');

		 	$days  = ((abs((strtotime($package_date)) - (strtotime($today))))/86400); 	
			$cancel_qry = $this->db->query("SELECT cancelfees from sblttweb_cancelfee where cancelmindays <= ".$days." and cancelmaxdays >= ".$days." and cancelfeeid in (".$cancelfee.")");			
			$cancel_info = $cancel_qry->result_array();
	 		$cancelfees  = $cancel_info[0]['cancelfees'];
	 		if(!$cancelfees){
	 			$cancelfees = 0;
	 		}
	 		
	 		$fees        = ($ticketamt * ($cancelfees / 100));
	 		$refund      = $cashpaid - $fees; 
	 		if($passstatus === "1"){
	 			$btn = "<span style='color:red;'>Ticket Cancelled</span>";
	 		}else{
	 			$btn ="<button id='cancel_btn$passid' class='btn btn-info btn-sm' onclick=cancel_ticket($passid,$orderid,'$package_date',$seatno,$passtripid,$packid,$cancelfees,$fees,$refund,'$order',$pnrno,$custid,$ticketamt,$cashpaid);>Cancel Ticket</button>";
	 		}

			$tr_line .= "<tr>
							<td style='text-align:center;'>$i</td>	
							<td style='text-align:center;'>$passname</td>
							<td style='text-align:center;'>$passgender</td>
							<td style='text-align:center;'>$passage</td>
							<td style='text-align:center;'>$ticketamt</td>
							<td style='text-align:center;'>$cashpaid</td>
							<td style='text-align:center;color:red;'>$fees</td>	
							<td style='text-align:center;' id='refund'>$refund</td>
							<td style='text-align:center;'>$btn</td>
						</tr>";	
			$i++;	
	} ?>
	
<table class='table table-bordered col-style'>
	<tr>
		<td style="padding:10px;">
			<button class="btn btn-info btn-sm" id="layout_back">Back</button><h4 align="center">Cancel Ticket Details</h4>
			<table class='table table-bordered col-style' style="margin-left: 10%;
    width: 80%;">
    			<tr>
					<td  style="font-weight:bold;">Package Name</td>
					<td colspan="3"><?php echo $pack_name; ?></td>
					<td  style="font-weight:bold;">Boarding Point</td>
					<td ><?php echo $boarding; ?></td>
				</tr>					
				<tr>
					<td style="font-weight:bold;">Customer Address</td>
					<td colspan="3"><?php echo $custaddress; ?></td>
					<td  style="font-weight:bold;">Customer Mobile</td>
					<td ><?php echo $custmobile; ?></td>
				</tr>
				<tr>
					<td style="font-weight:bold;">PNR No</td>
					<td ><?php echo $pnrno; ?></td>
					<td style="font-weight:bold;width: 25%;">Date of Journey</td>
					<td style="width: 25%;"><?php echo $pack_date; ?></td>
					<td style="font-weight:bold;">Date of Booking</td>
					<td style="width: 25%;"><?php echo $order_date; ?></td>
				</tr>
				<tr>	
				<td style="font-weight:bold;">Ticket No</td>
					<td><?php echo $orderid; ?></td>				
					
					<td style="font-weight:bold;width: 25%;">No of Passengers</td>
					<td><?php echo $nopass; ?></td>
					<td style="font-weight:bold;width: 25%;">Departure Time</td>
					<td><?php echo $dep_time; ?></td>
				</tr>
				<tr><td colspan="6" style="text-align: center;color:red;font-weight: bold;">Cancel Charges : <?php echo $cancelfees; ?>% of Ticket Amount</td></tr>				
			</table>
		</td>
	</tr>
</table>
<div class="row" style="margin-left: 5px;width: 99%;">
	<table id='detail_list' class='table table-hover table-striped col-style'>
       	<thead>
	        <tr style='color:#FFFFFF;font-weight:bold;text-align:center !important;background:#D8343F ;'>
	          <th style='text-align:center !important;'>SNo</th>
	          <th style='text-align:center !important;'>Passenger Name</th>
	          <th style='text-align:center !important;'>Gender</th>
	          <th style='text-align:center !important;'>Age</th>
	          <th style='text-align:center !important;'>Ticket Amount </th>
	          <th style='text-align:center !important;'>Cash Paid</th>
	          <th style='text-align:center !important;'>Cancelation Fees </th>
	          <th style='text-align:center !important;'>Refund Amount </th>
	          <th style='text-align:center !important;'>Operations</th>
	        </tr>       
      </thead>
      <tbody>
      	<?php echo $tr_line; ?>
      </tbody>
    </table>
</div>
<script>
function cancel_ticket(passid,orderid,pack_date,seatno,passtripid,packid,can,fees,refund,orderdate,pnrno,custid,ticketamt,paid){	
    var press = confirm("Do You Want to Cancel This Ticket?");
	if(press === true){
		$("#cancel_btn"+passid).html("<i class='fa fa-spinner fa-spin'></i> Processing...");
		$('#cancel_btn'+passid).attr('disabled','disabled');		
		if(passid){
			$.ajax({
				type: "POST",
				url: "<?php echo site_url('cancel_ticket/cancel_pass_ticket'); ?>",
				data:{passid:passid,orderid:orderid,pack_date:pack_date,seatno:seatno,passtripid:passtripid,packid:packid,can:can,fees:fees,refund:refund,orderdate:orderdate,pnrno:pnrno,custid:custid,ticketamt:ticketamt,paid:paid},
				success: function(data){
					var result = JSON.parse(data);
					toastr.success(result.message);
					setTimeout(function() {
					window.location.reload();
					}, 3000);
				},
				
			});
		}
	}    
}
$('#layout_back').click(function(){
	history.go(-1);
});
</script>