<?php session_start();



if($_SESSION[invcox] == ""){



header("location:login.php?action=need");



}else{







include("config.php");?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<html xmlns="http://www.w3.org/1999/xhtml">



<head>



<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />



<title>Arnim Holidays Accounting Software</title>



<link href="style.css" rel="stylesheet" type="text/css" />

 


<SCRIPT LANGUAGE="JavaScript">







<!-- Begin



function popUp(URL) {

day = new Date();
id = day.getTime();



eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=yes,width=950,height=650,left = 100,top = 100');");



}



// End -->



</script>
<?php include("calendar.php"); ?>
<style type="text/css">

<!--

-->
 
    body {
        font-family: 'Segoe UI', Arial, sans-serif;
        
    }

    .invoice-container {
        width: 950px;
        margin: 40px auto;
        background: #ffffff;
        padding: 40px 45px;
        border: 2px solid #000;
        box-shadow: 0 0 12px rgba(0,0,0,0.15);
    }

    .logo {
        text-align: center;
        margin-bottom: 10px;
    }

    .logo img {
        
        height: auto;
    }

    .heading {
        text-align: center;
        font-size: 20px;
        font-weight: 700;
        letter-spacing: 2px;
        margin-bottom: 25px;
        border-bottom: 2px solid #000;
        padding-bottom: 10px;
    }

    .section-title {
        font-size: 18px;
        font-weight: 600;
        margin-bottom: 8px;
        color: #333;
        text-transform: uppercase;
    }

    .section {
        margin-bottom: 25px;
        padding-bottom: 10px;
        border-bottom: 1px dashed #aaa;
    }

    .section table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 12px;
        font-size: 15px;
    }



    .invoice-container  th {
        padding: 12px;
        text-align: center;
        background: #f0f0f0;
        font-weight: 600;
        letter-spacing: 0.5px;
    }

    .invoice-container  td {
        padding: 12px;
    }
.bill td {
        padding: 8px;
    }
    .right {
        text-align: right;
        font-weight: 600;
    }

    .summary-table td:first-child {
        text-align: right;
        width: 70%;
    }

    .grand-total {
        background: #f6f6f6;
        font-size: 17px;
        font-weight: 700;
    }

    .footer {
        margin-top: 35px;
        text-align: center;
        font-size: 14px;
        padding-top: 15px;
        border-top: 1px solid #aaa;
    }

  .bangla td {
        border: 1px solid #000;
    }
  .bangla th {
        border: 1px solid #000;
    }	
	 .bill td {
        border: 1px solid #000;
    }
    .print-btn {
        background-color: #007bff;
        color: white;
        padding:5px 5px;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        font-size: 16px;
        transition: 0.3s;
		margin-bottom:3px;
		white-space: nowrap;
    }
	#datebox{
		white-space: nowrap;
		
	}

    .print-btn:hover {
        background-color: #0056b3;
    }
	</style>
</head>







<body>



<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="box-wrap">



  <tr>



    <td><?php include("top.php")?></td>



  </tr>



  <tr>



    <td>&nbsp;</td>



  </tr>



  <tr>



    <td class="center_page_white"><table width="100%" border="0" cellspacing="1" cellpadding="0">



      <tr>



        <td valign="top"><br />



          <form id="form1" name="form1" method="get" action="">



            <table width="100%" border="0" cellpadding="3" cellspacing="1"  class="round_box">



              <tr>



                <td width="16%"><strong>Search Bill List</strong></td>



                <td width="84%">&nbsp;</td>



              </tr>

<?php 

if($_POST[ds]!=""){$ds=$_POST[ds];}

if($_POST[de]!=""){$de=$_POST[de];}



if($_GET[ds]!=""){$ds=$_GET[ds];}

if($_GET[de]!=""){$de=$_GET[de];}



if($ds == ""){



$dddez = strtotime("-60 day");

$ds=date('d-m-Y', $dddez);



}

if($de == ""){$de=date("d-m-Y");}



 ?>

              <tr>



                <td colspan="2"><table width="410" border="0" cellspacing="1" cellpadding="2">
                  <tbody>
                    <tr>
                      <td width="68" align="right">Bill No</td>
                      <td width="13">:</td>
                      <td width="215"><input type="text" name="id" id="id" /></td>
                      <td width="93"><input type="submit" name="Submit" value="Load" /></td>
                    </tr>
                  </tbody>
                </table></td>



                </tr>

              <tr>
                
                
                
                <td>&nbsp;</td>
                
                
                
                <td>&nbsp;</td>
                
                
                
              </tr>



            </table>



            </form>



          </td>



      </tr>



      <tr>



        <td height="30">&nbsp;</td>



      </tr>



      <tr>



       <td class="round_box">
<?php 	  $dresult=mysql_query("select * from bill WHERE bill_id='$_GET[id]' limit 1");
          $drow=mysql_fetch_array($dresult);
	
		  $eresult=mysql_query("select * from customer WHERE id='$drow[customer_id]' limit 1");
          $erow=mysql_fetch_array($eresult);
	
	if($drow!=""){
			?>
			<div align="center"> 
			
			<button class="print-btn" onclick="popUp('show_bill.php?id=<?php echo $_GET[id]; ?>');">🖨 Print</button>
			</div>
		   
		   <div align="center" class="red"> 
	  <?php echo $_GET[info];?>
			</div>
			
			

			<div class="invoice-container">

<div class="section" style="display:flex; justify-content:space-between; align-items:flex-start;">
    <div class="logo">
        <img src="images/wlogo.png" alt="Hotel Logo">
    </div>

   <div><strong>--------</strong>|<strong> ARNIM RESORT - COX'S BAZAR </strong>|<strong>-------<br>
      Address :</strong> 92, Marine Drive Road, Kolatoli, Cox's Bazar.<br>
      <strong>Phone :</strong> 01758-383938, 01866-000640, 0197-2288-526<br>
      <strong>E-mail : </strong>rsv@arnimresort.com, <strong>Web:</strong> arnimresort.com</div>
</div>
	
   

    <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:15px; border-bottom:2px solid #000; padding-bottom:10px;">
    <div class="heading" style="margin:0; border:none; padding:0;">HOTEL  RESERVATION INVOICE</div>
  </div>

    <div class="section" style="display:flex; justify-content:space-between; align-items:flex-start;">
    <div> <strong>Guest Information:</strong><br>
        Name: <?php echo $erow[customer_name];?>- <?php echo $erow[contact_person];?><br>
        Phone: <?php echo $erow[personal_phn];?><br>
        Email: <?php echo $erow[personal_email];?></div>

    <div style="text-align:right; font-size:15px; line-height:1.5;">
        <strong>Invoice No:</strong> <?php echo $drow[bill_id];?><br>
        <strong>Date:</strong> <?php echo mydate1($drow[cdate]);?><br />
        <strong>Reference By:</strong> <?php echo $drow[refr];?> - <?php echo $drow[rcom];?>   </div>
</div>
     

    <div class="section">
        <strong>Booking Details:</strong>
<table class="bangla">
            <tr>
              <td colspan="5" align="center">Change Room Status              </td>
              </tr>
            <tr>
                <td><button class="print-btn" onclick="window.location.href='hotel_booked_all.php?id=<?php echo $_GET[id]; ?>&status=Hold'">Hold All</button></td>
                <td><button class="print-btn" onclick="window.location.href='hotel_booked_all.php?id=<?php echo $_GET[id]; ?>&status=Booked'">Booked All</button></td>
                <td><button class="print-btn" onclick="window.location.href='hotel_booked_all.php?id=<?php echo $_GET[id]; ?>&status=Check-in'">Check-In All</button></td>
                <td>
					<?php  if($drow[last_due]<='0'){ ?>
					<button class="print-btn" onclick="window.location.href='hotel_booked_all.php?id=<?php echo $_GET[id]; ?>&status=Check-out'">Check-out All</button>   
				<?php  }else{ echo '<span class="style2">Please Pay Due First to "Check Out"</span>';}?>
				</td>
                <th> 
 <?php if($bill_verify == '1'){ ?>
  <button class="print-btn" onclick="if(confirm('Are you sure you want to Delte This Bill and Cancel Booking?')) window.location.href='hotel_delete_bill.php?id=<?php echo $_GET[id]; ?>';">
    Cancel All </button> <?php }?>
                </th>
            </tr>
 
   </table>
		
		
        <table class="bangla">
            <tr>
                <th width="34%" height="62">Room No</th>
                <th width="8%">Price</th>
                <th width="7%">Total</th>
                <th width="11%">Date and                 Status</th>
                <th width="8%">Hold</th>
                <th width="8%">Booked</th>
                <th width="8%">Check In</th>
                <th width="8%">Check Out</th>
                <th width="8%">Cancel</th>
                </tr>

<?php 

$fresult=mysql_query("SELECT 
hotel_room.rtype,  bookings.status ,bookings.additional_ser , bookings.addi_pax, bookings.rprice,bookings.room_no, COUNT( * ) AS days, MIN( bookings.check_in ) AS check_in, MAX( bookings.check_in ) AS check_out
FROM bookings
JOIN hotel_room ON hotel_room.room_no = bookings.room_no
WHERE bookings.bill_id = '$drow[bill_id]'
GROUP BY bookings.room_no
ORDER BY bookings.room_no ASC ;");
	
$frow=mysql_fetch_array($fresult);	
	do{
?>

<tr>
    <td><?php echo "$frow[room_no] - $frow[rtype]";
		
		if($frow[addi_pax]>"0"){
echo "<br> $frow[additional_ser] (for $frow[addi_pax])";
			}?></td>
    <td><?php echo $frow[rprice];?> BDT</td>
    <td><?php $tota=$frow[rprice]*$frow[days]; echo number_format($tota); $total=$total+$tota; ?> BDT</td>
    <td align="center" class="link"><?php 	
	 
		$eresult=mysql_query("SELECT  check_in, status FROM bookings WHERE bill_id = '$drow[bill_id]' and room_no='$frow[room_no]' ORDER BY check_in ASC");
$erow=mysql_fetch_array($eresult);
	   do{
		  ?><div id="datebox"><?php echo dtformat($erow[check_in]);?> <br />
      <br />
        <span class="red"><strong><?php echo $erow[status];?></strong></span></div>
      <?php 
		    
		   
	   }while($erow=mysql_fetch_array($eresult));
		?>
		 </td>
    <td align="center"><?php 	
	 
		$eresult=mysql_query("SELECT  check_in,id FROM bookings WHERE bill_id = '$drow[bill_id]' and room_no='$frow[room_no]' ORDER BY check_in ASC");
$erow=mysql_fetch_array($eresult);
	   do{
		   
		   ?>
      <button class="print-btn" onclick="window.location.href='hotel_booked_one.php?id=<?php echo $drow[bill_id];?>&amp;room_no=<?php echo $frow[room_no];?>&amp;aid=<?php echo $erow[id];?>&status=Hold'"><?php echo dtformat($erow[check_in]);?></button>
      <?php 
		   
	   }while($erow=mysql_fetch_array($eresult));
		?></td>
    <td align="center"><?php 	
	 
		$eresult=mysql_query("SELECT  check_in,id FROM bookings WHERE bill_id = '$drow[bill_id]' and room_no='$frow[room_no]' ORDER BY check_in ASC");
$erow=mysql_fetch_array($eresult);
	   do{
		   
		   ?>
      <button class="print-btn" onclick="window.location.href='hotel_booked_one.php?id=<?php echo $drow[bill_id];?>&amp;room_no=<?php echo $frow[room_no];?>&amp;aid=<?php echo $erow[id];?>&amp;status=Booked'"><?php echo dtformat($erow[check_in]);?></button>
      <?php 
		   
	   }while($erow=mysql_fetch_array($eresult));
		?></td>
    <td align="center"><?php 	
	 
		$eresult=mysql_query("SELECT  check_in,id FROM bookings WHERE bill_id = '$drow[bill_id]' and room_no='$frow[room_no]' ORDER BY check_in ASC");
$erow=mysql_fetch_array($eresult);
	   do{
		   
		   ?>
      <button class="print-btn" onclick="window.location.href='hotel_booked_one.php?id=<?php echo $drow[bill_id];?>&amp;room_no=<?php echo $frow[room_no];?>&amp;aid=<?php echo $erow[id];?>&amp;status=Check-in'"><?php echo dtformat($erow[check_in]);?></button>
      <?php 
		   
	   }while($erow=mysql_fetch_array($eresult));
		?></td>
    <td align="center"><?php 	
	 
	   if($drow[last_due]<='0'){
		$eresult=mysql_query("SELECT  check_in,id FROM bookings WHERE bill_id = '$drow[bill_id]' and room_no='$frow[room_no]' ORDER BY check_in ASC");
$erow=mysql_fetch_array($eresult);
	   do{
		   
		   ?>
      <button class="print-btn" onclick="window.location.href='hotel_booked_one.php?id=<?php echo $drow[bill_id];?>&amp;room_no=<?php echo $frow[room_no];?>&amp;aid=<?php echo $erow[id];?>&amp;status=Check-out'"><?php echo dtformat($erow[check_in]);?></button>
      <span class="red"><strong><?php 
		   
	   }while($erow=mysql_fetch_array($eresult));
		   }else{ echo '<span class="style2">Please Pay Due First to "Check Out"</span>';}
		?></strong></span></td>
    <td align="center"><?php 	
	   if($bill_verify == '1'){  
		$eresult=mysql_query("SELECT  id,check_in FROM bookings WHERE bill_id = '$drow[bill_id]' and room_no='$frow[room_no]' ORDER BY check_in ASC");
$erow=mysql_fetch_array($eresult);
	   do{
		   
		   ?>
      <button class="print-btn" onclick="window.location.href='hotel_cancel.php?id=<?php echo $drow[bill_id];?>&amp;room_no=<?php echo $frow[room_no];?>&amp;aid=<?php echo $erow[id];?>'"><?php echo dtformat($erow[check_in]);?></button>
      <?php 
		   
	   }while($erow=mysql_fetch_array($eresult));
	  }
		?></td>
    </tr>
<?php }while($frow=mysql_fetch_array($fresult)); ?>
   </table>
    </div>

    <div class="section">
        <table class="bill">
            <tr>
                <td class="right">Subtotal:</td>
                <td class="right"><?php echo number_format($total); ?> BDT</td>
            </tr>
<?php if($drow[discount]>'0'){?>
            <tr>
                <td class="right">Discount:</td>
                <td class="right"><?php echo number_format($drow[discount]); ?> BDT</td>
            </tr>
			<?php }?>
<?php if($drow[vat_amount]>'0'){?>
            <tr>
                <td class="right">VAT (<?php echo number_format($drow[vat]); ?>%):</td>
                <td class="right"><?php echo number_format($drow[vat_amount]); ?> BDT</td>
            </tr>
			<?php }?>
            <tr>
                <td class="right"><strong>Grand Total:</strong></td>
                <td class="right"><strong><?php $gtotal=($total-$drow[discount])+$drow[vat_amount]; echo number_format($gtotal);?> BDT</strong></td>
            </tr>
			<tr>
                <td class="right"><?php echo mydate2($drow[cdate]);?> - Payment  (<?php echo $drow[pay_methode];?>):</td>
                <td class="right"><?php $due=$gtotal-$drow[payment]; echo number_format($drow[payment]);?> BDT</td>
            </tr>
			
			

<?php 
				   
$xresult=mysql_query("SELECT  * FROM bill_payment WHERE bill_id = '$drow[bill_id]' ORDER BY cdate ASC");
$xrow=mysql_fetch_array($xresult);
if($xrow!=""){
do{
			?>
			<tr>
			  <td class="right"><?php echo mydate2($xrow[cdate]);?> - Payment (<?php echo $xrow[pay_methode];?>)</td>
			  <td class="right"><?php echo number_format($xrow[payment_amount]); $due=$due-$xrow[payment_amount];?> BDT</td>
			  </tr>
<?php
}while($xrow=mysql_fetch_array($xresult));
}?>
<?php if($due>'0'){?>
			<tr>
                <td bgcolor="#E0ECED" class="right">Due</td>
                <td bgcolor="#E0ECED" class="right"><strong><?php echo number_format($due);?> BDT</strong></td>
            </tr>
			<tr>
			  <td colspan="2" class="right">
				  
				<form action="hotel_payment_insert.php" method="post" enctype="multipart/form-data" name="enquiryform" id="enquiryform" >
						  
				  <table width="100%" border="0" cellspacing="0" cellpadding="2">
			    <tbody>
			      <tr>
			        <td width="31%">Payment Date</td>
			        <td width="26%">Pay Methode</td>
			        <td width="30%">Payment Amount</td>
			        <td width="13%">&nbsp;</td>
			        </tr>
			      <tr>
			        <td><input name="cdate" type="text" id="cdate" size="15"  value="<?php echo date("d-m-Y");?>" required="required"/>
			          <a title="Calendar" onclick="displayDatePicker('cdate', this);" href="javascript:;"><img src="images/calendar.gif" width="20" height="20" border="0" /></a></td>
			        <td><select name="pay_methode" id="pay_methode">
						<option value="" selected="selected">Select Pay Methode</option>
<?php 
$rresult=mysql_query("select * from bank_acc order by bank asc");
$rrow=mysql_fetch_array($rresult);
do{
	?>
<option value="<?php echo $rrow[bank];?> - <?php echo $rrow[accname];?> - <?php echo $rrow[accno];?>"><?php echo $rrow[bank];?> - <?php echo $rrow[accname];?> - <?php echo $rrow[accno];?></option>
<?php }while($rrow=mysql_fetch_array($rresult));?>
                           
                        </select>		          <input name="bill_id" type="hidden" id="bill_id" value="<?php echo $drow[bill_id];?>" />			        </td>
			        <td><span class="input200">
			          <input name="payment_amount" type="text" id="payment_amount"  onkeyup="total_price_cak();" value="0" onfocus="javascript:if(this.value=='0')this.value=''" onblur="javascript:if(this.value=='')this.value='0'" autocomplete="off"/>
			        </span></td>
			        <td><input type="submit" name="submit" id="submit" value="Submit" /></td>
			        </tr>
			      </tbody>
			    </table></form></td>
			  </tr>
			<?php }?>

		
			 
			
			
        </table>
    </div>

    
		 <div class="section" style="display:flex; justify-content:space-between; align-items:flex-start;">
    <div style="margin-top:20px; text-align:left;">
        <strong>Guest Signature:</strong><br><br>
        <div style="width:250px; height:60px; border:1px solid #000;"></div>
    </div>
			 
			 <div style="margin-top:20px; text-align:right;">
        <span style="display:inline-block; padding:10px 25px; border:2px solid #000; font-size:20px; font-weight:700; letter-spacing:2px;">
			<?php if($due>'0'){echo 'DUE';}else{echo 'PAID';};?></span>
    </div>
</div>
 <?php if($drow[unote]!=""){echo 'Note: ';}echo $drow[unote];?>
<div class="footer">
        Thank you for choosing ARNIM RESORT. We wish you a pleasant stay.
</div>

</div>
<?php }else{?>
		   
		   <div align="center">No Bill Found</div><?php }?>
		  </td>



      </tr>



    </table></td>



  </tr>



  <tr>



    <td><?php include("bot.php")?></td>



  </tr>



</table>



</body>



</html>



<?php }?>