<?php session_start();





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




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




}else{




include("config.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);



	



	    $watermark_font="12";



		$watermark="Paid";



	if($drow[last_due] == "0"){$watermark="PAID"; $watermark_font="14";}



	if($drow[last_due]>"0"){$watermark="UNPAID";}



	if($drow[total_payeble] == "0"){$watermark="CANCELLED"; $watermark_font="9";}



	



?>



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



<html lang="en">



<head>



<meta charset="UTF-8">



<title>Invoice - ARNIM RESORT</title>



<style>



    body {



        font-family: 'Segoe UI', Arial, sans-serif;



        margin: 0;



        padding: 0;



        background: #e9eef3;



    }







	



.invoice-container::before {



    content: "<?php echo $watermark;?>";



    position: absolute;



    left: 50%;



    top: 50%;



    transform: translate(-50%, -50%) rotate(-28deg);



    font-size: <?php echo $watermark_font;?>.5rem;       /* very large */



    font-weight: 800;



    color: rgba(0, 0, 0, 0.06);



    letter-spacing: 8px;



    pointer-events: none;



    white-space: nowrap;



    z-index: 0;



  }



	



	



    .invoice-container {



        width: 820px;



        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;



    }







    table {



        width: 100%;



        border-collapse: collapse;



        margin-top: 12px;



        font-size: 15px;



    }







    table, th, td {



        border: 1px solid #000;



    }







    th {



        padding: 12px;



        text-align: center;



        background: #f0f0f0;



        font-weight: 600;



        letter-spacing: 0.5px;



    }







    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;



    }







    



	



	



	@media print {



  body {



    background: #fff !important;



  }







  .invoice-container {



    border: 2px solid #000 !important;



    box-shadow: none !important;



    -webkit-print-color-adjust: exact;



    print-color-adjust: exact;



  }







  table, th, td, .section, .heading, .footer, div {



    border-color: #000 !important;



  }







  * {



    color-adjust: exact !important;



  }



}

.style2 {text-align: right}

</style>



</head>



<body>







<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 COPY</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>RESERVATION NO:</strong> <?php echo $drow[bill_id];?><br>



        <strong>Date:</strong> <?php echo mydate1($drow[cdate]);?>



    </div>



</div>



     







    <div class="section">



        <strong>Booking Details:</strong>



        <table>



            <tr>



                <th width="31%">Room No and Type </th>



                <th width="13%">Check-In</th>



                <th width="13%">Check-Out</th>



                <th width="9%">Nights</th>



                <th width="17%">Price/Night</th>



                <th width="17%">Total</th>



            </tr>







<?php 











	



$fresult=mysql_query("SELECT 







hotel_room.rtype,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);	



	



if($frow!=""){



	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 mydate2($frow[check_in]);?></td>



    <td><?php 



		



$date = $frow[check_out]; // your date



$check_out = date("d-M-Y", strtotime($date . " +1 day"));



echo $check_out; // Output: 2025-11-13







  



		?></td>



    <td><?php echo $frow[days];?></td>



    <td><?php echo $frow[rprice];?> BDT</td>



    <td><?php $tota=$frow[rprice]*$frow[days]; echo number_format($tota); $total=$total+$tota; ?> BDT</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>

<?php 

$due=$gtotal-$drow[payment];

if($drow[payment]>"0"){ 

		  ?>

        <tr>



          <td align="right" class="style2"><?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 align="right" class="style2"><?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>



       



        <?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:left;">



        <br>



        <div style="width:250px; height:60px;">Check-In time: 12PM TO 01 PM <br />



Check-Out time: 11 AM </div>
Breakfast time: 8 AM to 10 AM



    </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 echo $watermark;?></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>







</body>



</html>



<?php }?>



