<?php
// ini_set('display_errors', '1');
// ini_set('display_startup_errors', '1');
// error_reporting(E_ALL);

error_reporting(0);
ini_set('display_errors', 0);


include 'include/config.php';

$ID = $_GET['id'];


$get_edit = mysqli_query($connect,"select * from donations where donation_id ='$ID'") or die(mysqli_error());

// `donation_id`, `donation_date`, `user_id`, `payment_type`, `amount`, `remarks`SELECT * FROM `donations` WHERE 1
while($get_value = mysqli_fetch_array($get_edit)) {

$donation_id = $get_value['donation_id'];
$donation_date = $get_value['donation_date'];
$user_id = $get_value['user_id'];
$payment_type = $get_value['payment_type'];
$amount = $get_value['amount'];
$remarks = $get_value['remarks'];
$ref_no = $get_value['ref_no'];



}

?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="ta" xml:lang="ta">
  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />   
  <head>
    <meta charset="utf-8" />
    <title>Buy Business Enquiry | 
      <?php echo $site_title; ?>
    </title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1" name="viewport" />
    <meta content="" name="description" />
    <meta content="" name="author" />
    <!-- BEGIN GLOBAL MANDATORY STYLES -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">    
    <link rel="stylesheet" href="assets/font-awesome/font-awesome.min.css"> 
    <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&amp;subset=all" rel="stylesheet" type="text/css" />
    <link href="assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
    <!-- END GLOBAL MANDATORY STYLES -->
    <!-- BEGIN PAGE LEVEL PLUGINS -->
    <link href="assets/global/plugins/datatables/datatables.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/global/plugins/datatables/plugins/bootstrap/datatables.bootstrap.css" rel="stylesheet" type="text/css" />
    <!-- END PAGE LEVEL PLUGINS -->
    <!-- BEGIN THEME GLOBAL STYLES -->
    <link href="assets/global/css/components.min.css" rel="stylesheet" id="style_components" type="text/css" />
    <link href="assets/global/css/plugins.min.css" rel="stylesheet" type="text/css" />
    <!-- END THEME GLOBAL STYLES -->
    <!-- BEGIN THEME LAYOUT STYLES -->
    <link href="assets/layouts/layout/css/layout.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/layouts/layout/css/themes/darkblue.min.css" rel="stylesheet" type="text/css" id="style_color" />
    <link href="assets/layouts/layout/css/custom.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/global/plugins/select2/css/select2.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/global/plugins/select2/css/select2-bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/global/plugins/bootstrap-fileinput/bootstrap-fileinput.css" rel="stylesheet" type="text/css" />
    <link href="assets/layouts/customer.css" rel="stylesheet" type="text/css" />
    <link href="../css/receipt.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    


    <!-- END PAGE LEVEL PLUGINS -->
    <style type="text/css">
      .dt-buttons {
        display: none;
      }
    </style>
    <script type="text/javascript">
      function delete_menu(idurl)
      {
        go_on = confirm("Are you sure ? ");
        if(go_on)
        {
          document.location.href=idurl;
        }
      }
    </script>




<!-- whatsapp -->






<style>
.wp-share {
    display: inline-block;
    background-color: #25D366; /* WhatsApp green */
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    font-family: Arial, sans-serif;
}

.wp-share i {
    margin-right: 8px; /* Space between icon and text */
}

.wp-share:hover {
    background-color: #20B856; /* Darker green on hover */
    color: white;
}
</style>




  </head>
  <!-- END HEAD -->
  <body class="page-header-fixed page-sidebar-closed-hide-logo page-content-white" onload="window.print();">
    <div class="page-wrapper">
      <!-- BEGIN HEADER -->
      
      <!-- END HEADER -->
      <!-- BEGIN HEADER & CONTENT DIVIDER -->
      <div class="clearfix"> 
      </div>
      <!-- END HEADER & CONTENT DIVIDER -->
      <!-- BEGIN CONTAINER -->
      <div class="page-container">
        <!-- BEGIN SIDEBAR -->
        
        <!-- END SIDEBAR -->
        <!-- BEGIN CONTENT -->
        <div class="page-content-wrapper">
          <!-- BEGIN CONTENT BODY -->
          <div class="page-content">
            <!-- END THEME PANEL -->
            <!-- BEGIN PAGE BAR -->
            <div class="page-bar">
              <ul class="page-breadcrumb">
                <li>
                  <a href="index.php">Home
                  </a>
                  <i class="fa fa-circle">
                  </i>
                </li>
                <li>
                  <span>Contact 
                  </span>
                </li>
              </ul>
              <div class="page-toolbar">
                <div id="dashboard-report-range" class="pull-right tooltips btn btn-sm" data-container="body" data-placement="bottom" data-original-title="Change dashboard date range">
                  <i class="icon-calendar">
                  </i>&nbsp;
                  <span class="thin uppercase hidden-xs">
                  </span>&nbsp;
                  <i class="fa fa-angle-down">
                  </i>
                </div>
              </div>

              

             

              <div style="text-align: right; margin-right: 20px; margin-top: 6px;">
    <!-- WhatsApp Share Button -->
    <a class='wp-share' id="whatsapp-share" href="javascript:void(0);" target="_blank">
        <i class="fab fa-whatsapp"></i> Share on WhatsApp
    </a>
    
    <!-- Print Button -->
    <button class="mt-2 btn btn-info" onclick="printReceipt()" style="padding: 5px 10px; font-size: 14px;">
        Print
    </button>
</div>
<!-- whatsapp script -->
<script>
    // Pass donation ID from PHP to JavaScript
    const donationId = "<?php echo $donation_id; ?>";
    
    if (donationId) {
        const whatsappUrl = `https://api.whatsapp.com/send?text=http://localhost/N/admin/receiptprint.php?donation_id=${donationId}`;
        document.getElementById('whatsapp-share').setAttribute('href', whatsappUrl);
        console.log("WhatsApp URL:", whatsappUrl);
    } else {
        console.warn("No donation_id found");
    }

    // Print function for the Print button
    function printReceipt() {
        window.print();
    }
</script>

<script>
    function printReceipt() {
        window.print();
    }
</script>
  </div>


            <section class="panel">


            <br><br><br>

<div class="panel-body">

    <form action="" id="form_sample_1" method="post" class="form-horizontal" novalidate="novalidate">

        <div id="inv-broder1">

            <div class="receipt-header">


            <div class="col-xs-12 text-center" style="padding: 0px">                                        


                <center> <img src="receipt_logo.jpg" ><br><br>

<!-- 
                <h5 class="bold in-address" style="color:black;">Judge Road, Ayyanthirumaligai, Salem - 636008, Tamilnadu, India</h5>

                <h5 class="bold in-address" style="color:black;">Ph: 0427 2403101, +91 9894069951</h5> -->
          </center>
            

            </div>

            

        </div>

        <!-- End Detial -->

        <div class="col-xs-4">

            <h4 style="margin-left: 40px;">No : <?php echo $donation_id ;?></h4>

        </div>

        <div class="col-xs-4 text-center">

         <h4 id="RECEIPT"><strong><u>RECEIPT</u></strong></h4>

        </div>

        <div class="col-xs-4">

            <h5 >Date : <?php echo date('d-m-Y',strtotime($donation_date)) ;?></h5>

            <h5 style="margin-top: -5px">Ref No : <?php echo $ref_no ;?></h5>

        </div>

        <div class="row">

            <div class="col-xs-12" style="padding:0px 0px 5px 70px;">

                <!-- receipt address -->

                <div class="receipt-address1">

                    <strong><p>Sir /M/s.</p></strong>

                </div>

                <div class="receipt-address2">

                    <p id="sign"><strong><?php  
                         $get_sorganic = mysqli_query($connect,"SELECT * FROM `users` WHERE userid='$user_id'") or die(mysqli_error());
                    while($get_value1 = mysqli_fetch_array($get_sorganic)) 
                    {
                    $userid = $get_value1['userid'];
                    echo $username = $get_value1['username'];
                    }
                     ?></strong></p>

                </div>

                <!-- End receipt address -->

                <!-- Amount text -->

                <div class="receipt-amount1">

                    <strong><p>the sum of Rupees</p></strong>

                </div>

                <div class="receipt-amount2">

                    <p id="content"><?php echo numberTowords("$amount");?> rupees only</p>

                </div>

                <!-- End Amount text -->

                

                <!-- Cash text -->

                <div class="receipt-cash1">

                    <strong><p><span >payment by </span></strong></p>

                </div>

                <div class="receipt-cash2">

                    <p id="content"><?php echo $payment_type;?></p>

                </div>

                <!-- End Cash text -->

                <!-- receipt towards -->

                <div class="receipt-towards1">

                    <strong><p>Towards</p></strong>

                </div>

                <div class="receipt-towards2">

                    <p id="content"><?php echo $remarks ;?></p>

                </div>

                <!-- End receipt towards -->

                <!-- receipt Footer -->

                <div class="receipt-footer1">

                    <div id="rs"><strong>&#8377;. <?php echo number_format($amount, 2, '.', ''); ?> /-</strong></div>

                    <p>(Cheque Subject to Realisation)</p>

                </div>

                <div class="receipt-footer2">

                    <p id="sign">For <strong>NESACKKARANGAL</strong></p>

                </div>

                <!-- End Footer -->

                

                

            </div>

        </div>

        

        

    </div>

    

</div>

</section>







<!-- end: page -->


    <!-- BEGIN CORE PLUGINS -->
    <script src="//cdn.ckeditor.com/4.5.7/standard/ckeditor.js">
    </script>
    <script src="assets/global/plugins/jquery.min.js" type="text/javascript">
    </script>
    <script src="assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript">
    </script>
    <script src="assets/global/plugins/js.cookie.min.js" type="text/javascript">
    </script>
    <script src="assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript">
    </script>
    <script src="assets/global/plugins/jquery.blockui.min.js" type="text/javascript">
    </script>
    <script src="assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript">
    </script>
    <!-- END CORE PLUGINS -->
    <!-- BEGIN PAGE LEVEL PLUGINS -->
    <script src="assets/global/scripts/datatable.js" type="text/javascript">
    </script>
    <script src="assets/global/plugins/datatables/datatables.min.js" type="text/javascript">
    </script>
    <script src="assets/global/plugins/datatables/plugins/bootstrap/datatables.bootstrap.js" type="text/javascript">
    </script>
    <!-- END PAGE LEVEL PLUGINS -->
    <!-- BEGIN THEME GLOBAL SCRIPTS -->
    <script src="assets/global/scripts/app.min.js" type="text/javascript">
    </script>
    <!-- END THEME GLOBAL SCRIPTS -->
    <!-- BEGIN PAGE LEVEL SCRIPTS -->
    <script src="assets/pages/scripts/table-datatables-colreorder.min.js" type="text/javascript">
    </script>
    <!-- BEGIN PAGE LEVEL PLUGINS -->
    <script src="assets/global/plugins/select2/js/select2.full.min.js" type="text/javascript">
    </script>
    <!-- END PAGE LEVEL PLUGINS -->
    <!-- BEGIN PAGE LEVEL SCRIPTS -->
    <script src="assets/pages/scripts/components-select2.min.js" type="text/javascript">
    </script>
    <!-- END PAGE LEVEL SCRIPTS -->
    <!-- END PAGE LEVEL SCRIPTS -->
    <!-- BEGIN THEME LAYOUT SCRIPTS -->
    <script src="assets/layouts/layout/scripts/layout.min.js" type="text/javascript">
    </script>
    <script src="assets/layouts/layout/scripts/demo.min.js" type="text/javascript">
    </script>
    <script src="assets/layouts/global/scripts/quick-sidebar.min.js" type="text/javascript">
    </script>
    <script src="assets/layouts/global/scripts/quick-nav.min.js" type="text/javascript">
    </script>
    <script src="assets/global/plugins/bootstrap-fileinput/bootstrap-fileinput.js" type="text/javascript">
    </script>
    <!-- END THEME LAYOUT SCRIPTS -->
    <!-- Password Check -->
    <script language="javascript">
      function pswcheck()
      {
        pass=document.getElementById("password").value;
        repassword=document.getElementById("repassword").value;
        if(pass!=repassword)
        {
          alert("password Mismatch");
          document.getElementById("password").value="";
          document.getElementById("repassword").value="";
          document.getElementById("password").focus();
        }
      }
    </script>
    <script language="javascript" type="text/javascript">
      function CheckFormData()
      {
        var organic_menu  = document.getElementById("organic_menu");
        var image  = document.getElementById("image");
        if(organic_menu.value == '')
        {
          alert('Please Fill Category.');
          organic_menu.focus();
          organic_menu.style.border = 'thin solid red';
          return false;
        }
        if(image.value == '')
        {
          alert('Please Select Image.');
          image.focus();
          image.style.border = 'thin solid red';
          return false;
        }
        return true;
      }
    </script>

<script>

function numberTowords($number)

{ 

	   $no = round($number);

   $point = round($number - $no, 2) * 100;

   $hundred = null;

   $digits_1 = strlen($no);

   $i = 0;

   $str = array();

   $words = array('0' => '', '1' => 'one', '2' => 'two',

    '3' => 'three', '4' => 'four', '5' => 'five', '6' => 'six',

    '7' => 'seven', '8' => 'eight', '9' => 'nine',

    '10' => 'ten', '11' => 'eleven', '12' => 'twelve',

    '13' => 'thirteen', '14' => 'fourteen',

    '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen',

    '18' => 'eighteen', '19' =>'nineteen', '20' => 'twenty',

    '30' => 'thirty', '40' => 'forty', '50' => 'fifty',

    '60' => 'sixty', '70' => 'seventy',

    '80' => 'eighty', '90' => 'ninety');

   $digits = array('', 'hundred', 'thousand', 'lakh', 'crore');

   while ($i < $digits_1) {

     $divider = ($i == 2) ? 10 : 100;

     $number = floor($no % $divider);

     $no = floor($no / $divider);

     $i += ($divider == 10) ? 1 : 2;

     if ($number) {

        $plural = (($counter = count($str)) && $number > 9) ? 's' : null;

        $hundred = ($counter == 1 && $str[0]) ? ' and ' : null;

        $str [] = ($number < 21) ? $words[$number] .

            " " . $digits[$counter] . $plural . " " . $hundred

            :

            $words[floor($number / 10) * 10]

            . " " . $words[$number % 10] . " "

            . $digits[$counter] . $plural . " " . $hundred;

     } else $str[] = null;

  }

  $str = array_reverse($str);

  $result = implode('', $str);

  $points = ($point) ?

    "." . $words[$point / 10] . " " . 

          $words[$point = $point % 10] : '';





          return $result;

} 
</script>
  </body>
</html>
