<?php

error_reporting(0);
include "fetch_data55.php";
include "connection.php";

$MEM_ID = $_GET['id'];

$sql = "SELECT 
  M.MEM_NAME,  M.MEM_MOBILE_NO,M.YR_OF_PASS,M.COLL_ROLL_NO,Y.YEAR_NAME,M.PRE_EMAIL,E.EVENT_DETAILS AS EVENT_NAME,R.EVENT_CODE,
  R.REG_NO,R.NO_OF_MEM,R.MEM_RATE,R.TOTAL_AMT,P.PAY_TIME FROM NAA_MEMBERS M JOIN NAA_EVENTS_REG R ON M.MEM_ID = R.MEM_ID
LEFT JOIN NAA_PAYMENT P ON M.MEM_MOBILE_NO = P.MEM_MOBILE_NO LEFT JOIN NAA_YEAR_MST Y ON M.YR_OF_PASS = Y.YEAR_CODE
LEFT JOIN NAA_EVENTS E ON R.EVENT_CODE = E.EVENT_CODE WHERE R.PAYMENT_STATUS = 'P' 
  AND M.MEM_ID = '$MEM_ID'";

// $sql = "SELECT NAA_MEMBERS.MEM_NAME,NAA_MEMBERS.MEM_MOBILE_NO,NAA_MEMBERS.SMS_MOBILE_NO,NAA_MEMBERS.YR_OF_PASS, 
// (SELECT NAA_YEAR_MST.YEAR_NAME FROM NAA_YEAR_MST WHERE NAA_MEMBERS.YR_OF_PASS=NAA_YEAR_MST.YEAR_CODE ) AS YEAR_NAME,
// NAA_MEMBERS.PRE_EMAIL, NAA_MEMBERS.COLL_ROLL_NO,
// NAA_EVENTS.EVENT_CODE, NAA_EVENTS.EVENT_DETAILS, NAA_EVENTS_REG.CHANNEL, NAA_EVENTS_REG.REG_NO, NAA_EVENTS_REG.NO_OF_MEM, NAA_EVENTS_REG.MEM_RATE,
// NAA_EVENTS_REG.NO_OF_SPOUSE, NAA_EVENTS_REG.SPOUSE_RATE, NAA_EVENTS_REG.NO_OF_CHILD, NAA_EVENTS_REG.CHILD_RATE,NAA_EVENTS_REG.PRE_CODE,NAA_EVENTS_REG.TOTAL_AMT,
// (SELECT NAA_PRE_DATE.PRE_DATE FROM NAA_PRE_DATE WHERE NAA_EVENTS_REG.PRE_CODE=NAA_PRE_DATE.PRE_CODE ) AS PRE_DATE, (select pay_time from naa_payment where mem_id= NAA_MEMBERS.MEM_ID  and PAY_STATUS='Successful'  and INV_TYPE='05') PAY_TIME, trunc(NAA_EVENTS_REG.CREATE_DATE) reg_date  ,decode(CHANNEL,'O','Online','Offline') CHANNEL 
// FROM NAA_MEMBERS,NAA_EVENTS,NAA_EVENTS_REG WHERE NAA_MEMBERS.MEM_ID = NAA_EVENTS_REG.MEM_ID AND  NAA_EVENTS_REG.EVENT_CODE='05'
// AND NAA_EVENTS.EVENT_CODE='05' AND   NAA_EVENTS_REG.PAYMENT_STATUS ='P' AND NAA_MEMBERS.MEM_ID='$MEM_ID'
// and (NAA_EVENTS_REG.channel='M' or  NAA_MEMBERS.mem_id in (select mem_id from naa_payment where INV_TYPE='05' and PAY_STATUS='Successful' ) )";
$parse = ociparse($conn, $sql);
oci_execute($parse);

// print_r($sql);
while ($row = oci_fetch_assoc($parse)) {
    $user_row[] = $row;
}

// var_dump($division);
// echo count($division);
oci_free_statement($parse);

$YER_TYPE = $user_row[0]['YEAR_TYPE'];
// echo "$YER_TYPE";


$MEM_NAME = $user_row[0]['MEM_NAME'];
// echo "$MEM_NAME";
$MEM_MOBILE_NO = $user_row[0]['MEM_MOBILE_NO'];
// echo "$MEM_MOBILE_NO";

$MEM_RATE = $user_row[0]['MEM_RATE'];
$SPOUSE_RATE = $user_row[0]['SPOUSE_RATE'];
$CHILD_RATE = $user_row[0]['CHILD_RATE'];
// $CHILD2_RATE = $user_row[0]['CHILD2_RATE'];
// $GUEST_RATE = $user_row[0]['GUEST_RATE'];
// $DRIVER_RATE = $user_row[0]['DRIVER_RATE'];

$MEM_NOS = $user_row[0]['NO_OF_MEM'];
$SPOUSE_NOS = $user_row[0]['NO_OF_SPOUSE'];
$NO_OF_CHILD = $user_row[0]['NO_OF_CHILD'];
// $NO_OF_CHILD2 = $user_row[0]['NO_OF_CHILD2'];
// $NO_OF_GUEST = $user_row[0]['NO_OF_GUEST'];
// $NO_OF_DRIVER = $user_row[0]['NO_OF_DRIVER'];

$FAMILY_RATE = $MEM_RATE + $SPOUSE_RATE + $CHILD_RATE;
// echo "$FAMILY_RATE";
// $FAMILY_NOS  = $MEM_NOS + $SPOUSE_NOS + $NO_OF_CHILD1 + $NO_OF_CHILD2 + $NO_OF_GUEST + $NO_OF_DRIVER;
$FAMILY_NOS  = $MEM_NOS + $SPOUSE_NOS + $NO_OF_CHILD;
// echo "$FAMILY_NOS";


?>


<html lang="en">

<head>

    <!-- Google tag (gtag.js) -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-GQPGJ4YN30"></script>
    <script>
        window.dataLayer = window.dataLayer || [];

        function gtag() {
            dataLayer.push(arguments);
        }
        gtag('js', new Date());

        gtag('config', 'G-GQPGJ4YN30');
    </script>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Holy Cross Event Card</title>
    <link rel="icon" href="./image/shaab.png" type="image/ico">

    <!-- using online links -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">

    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">

    <link rel="stylesheet" href="//malihu.github.io/custom-scrollbar/jquery.mCustomScrollbar.min.css">

    <!-- CSS only -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">

    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">


    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>




    <style>
        body {
            /* margin-top: 20px; */
            background: #eee;
        }





        .pay_img {
            float: right;
            display: inline-block;
        }

        
        .pay_det{
            width: 350px;
            height:180px;
            font-size: 22px;

        }

        

        .payment-details {
            width: 350px;
            height:175px;
        }

        .payment-details img {
            float: left;
            /* width: 100px;
            height: 100px; */
            /* background: #555; */
        }

        .payment-details h2 {
            position: relative;
            top: 18px;
            left: 10px;
        }

        h1,
        h2,
        h3,
        h4,
        h5,
        h6,
        p {
            /* color: #41469C; */
            color: #559526;
            font-weight: bold;
        }



        .header img {
            float: left;
            width: 120px;
            height: 120px;
            /* background: #555; */
        }


        .header h3,
        h5 {
            position: relative;
            color: #559526;
            top: 10px;
            font-weight: bold;
            font-size: 18px;
            text-align: center;
        }



        .header .abcd {
            float: right;
            width: 100px;
            height: 100px;
            margin-top: -85px;

        }



        .text {
            font-size: 20px;
            text-align: center;
        }

        .text1 {
            font-size: 18px;
            text-align: center;
        }

        .date_pay{
                font-size: 15px;
            }


        @media screen and (max-width: 1000px) {
            .header img {
                float: left;
                width: 60px;
                height: 60px;
                /* background: #555; */
            }

            .header h3,
            h5 {
                position: relative;
                color: #559526;
                top: 10px;
                font-weight: bold;
                font-size: 15px;
                text-align: center;
            }


            .payment-details {
            width: 320px;
            height:220px;
        }

        .pay_det{
            width: 320px;
            height:220px;
            font-size: 15px;

        }




            .header .abcd {
                float: right;
                width: 50px;
                height: 50px;
                margin-top: -35px;
                /* background: #555; */
                margin-right: -5px;
            }

            .text {
                font-size: 8px;
                text-align: center;
            }

            .text1 {
                font-size: 8px;
                text-align: center;
            }



            h1,
            h2,
            h3,
            h4,
            h5,
            h6,
            p {
                /* color: #41469C; */
                color: #559526;
                font-weight: bold;
            }

            .date_pay{
                font-size: 15px;
            }
        }
    </style>


</head>

<body style="background-color: #fff;" onLoad="download()" id="invoice1">



    <!-- <div class="ml-2">
        <a href="#" class="btn btn-danger" onclick="printContent('print_doc')">Print</a>
    </div> -->

    <div class="container bootstrap snippets bootdeys" id="print_doc">
        <div class="row">
            <div class="col-xs-12 col-md-12 col-lg-12 col-sm-12 col-12">
                <div class="panel panel-default invoice" id="invoice">
                    <div class="panel-body">

                        <div class="row" style="margin-top: 20px;">
                            <div class="col-md-2 col-2"></div>
                            <div class="col-md-8 col-8">
                                <div class="header">
                                    <img src="images/Holy_Cross.png" alt="logo" width="60px" height="60px" />
                                    <!-- <h2 class="text-center" style="color: #0c0a8a; font-size:25px;">NOTRE DAME COLLEGE, DHAKA </h2> -->
                                    <h2 style="color: #ddbe4d; font-style: oblique;">
                                75<sup style="font-size: 0.5em; vertical-align: super;">th</sup> Foundation Of Holy Cross Girls High School
                               </h2>
                                    <h3 class="text-center" style="color: Black;">Venue :Holy Cross Girls High School, Dhaka</h3>
                                    <h3 class="text-center" style="color: #0c0a8a;">Date :January 8-10, 2026 </h3>
                                </div>
                            </div>
                            <div class="col-md-2 col-2"></div>
                        </div>
                        <!-- <div class="row" style="background-color: #fff;">
                            <div class="col-md-2 col-sm-2"></div>
                            <div class="col-md-8 col-sm-12">

                                <img src="./image/shaab.png" style="border: 1px solid black;" class="mr-4 " alt="BD Logo">
                            <h2>
                                Suhrawardy Hall Alumni Association, BUET </h2>

                                <img src="images/ndc_alm.jpeg" alt="BD Logo" width="152%" height="100px">





                            </div>
                            <div class="col-md-2 col-sm-2">
                    </div>
                        </div> -->
                        <hr>


                        <div class="row">

                            <div class="col-xs-11 col-md-11 col-lg-11 col-sm-12 col-12 ml-2">



                                <img src="data:image/jpeg;base64,<?php echo $photoout; ?>" class="img-responsive pay_img" alt="iamgurdeeposahan" id="output_image" onerror="this.onerror=null; this.src='images/default profile pic.png'" style="width: 80px; height: 80px; border-radius: 50%;float: right;"></img>
                                <input type="text" class="form-control" name="basedata" id="basedata" hidden value="<?php echo $photoout; ?>">

                                <h3 class="marginright" style="font-family:normal;font-size:25px; ">SL No <span style="color: black;"> <?php echo $user_row[0]['REG_NO']; ?> </span></h3>

                            </div>

                            <div class="col-xs-1 col-md-1 col-lg-1 col-sm-12 col-12">






                            </div>






                        </div>



                        <div class="row" style="margin-top: 20px; ">

                            <div class="col-xs-6 col-md-6 col-lg-6 col-sm-12 col-6 from ml-2">


                                <p style="font-family:normal;font-size:25px; "> Name : <span style="color: black;"> <?php echo $user_row[0]['MEM_NAME']; ?> </span></p>
                                <p style="font-family:normal;font-size:25px; "> Cell Phone : <span style="color: black;"> <?php echo $user_row[0]['MEM_MOBILE_NO']; ?> </span></p>
                                <!-- <p style="font-family:normal;font-size:25px; ">Email: <span style="color: black;"> <?php echo $user_row[0]['PRE_EMAIL']; ?> </span> </p> -->

                                <p style="font-family:normal;font-size:25px;"> School Roll No : <span style="color: black;"><?php echo $user_row[0]['COLL_ROLL_NO']; ?></span> </p>

                                <p style="font-family:normal;font-size:25px;">Passing Year : <span style="color: black;"><?php echo $user_row[0]['YR_OF_PASS']; ?></span> </p>



                                <!-- <p style="font-size:25px;font-family: Monotype Corsiva; ">Department  : <span style="color: black;"><?php echo $user_row[0]['CAT_NAME']; ?></span> </p> -->
                                <!-- <p>California, 94103</p> -->

                            </div>







                            <!-- <div class="col-xs-5 col-md-5 col-lg-5 col-sm-12 text-center payment-details" style="border: 1px solid green;background-color: #fff;width: 350px;height:175px;margin-left: 30px;"> -->

                            <div class="col-xs-5 col-md-5 col-lg-5 col-sm-12 col-5 text-center payment-details" style="border: 1px solid green;background-color: #fff;margin-left: 30px;">
                            <?php
                                $val = 'qrcode_entry.php?bn=' . urlencode($user_row[0]['REG_NO'] . ' ') .
                               urlencode($user_row[0]['MEM_NAME'] . ' ') .
                               '&an=' . urlencode($user_row[0]['MEM_MOBILE_NO'] . ' ') .
                               '&vat=';
                            ?>
                               <img src="<?php echo $val ?>" class="imgs" / height="150px" width="150px" style="margin-top: 15px;"> 


                                <p class="lead marginbottom payment-info" style="margin-top: 10px; font-size: 25px; font-weight: bold;font-family:normal; ">Event Name <br> <span style="color: black; font-size: 15px;color: red;font-weight: bold;"><!-- <?php echo $user_row[0]['EVENT_DETAILS']; ?> -->75th Foundation Of Holy Cross Girls High School</span> </p>


                               <!--  <p class="lead marginbottom payment-info" style="margin-top: 10px; font-size: 25px; font-weight: bold;font-family:normal; ">Event Date <br> <span style="font-size: 20px;color: red;font-weight: bold;">26-Jan 2024</span> </p> -->
                                <!-- <p style="margin-left: 50px;font-weight: bold;">Total Amount: $1019</p> -->
                                <!-- <p>Date: 14 April 2014</p> -->
                                <!-- <p>VAT: DK888-777 </p> -->
                                <!-- <p style="margin-left: 50px;">Total Amount: $1019</p> -->
                                <!-- <p>Account Name: Flatter</p> -->

                            </div>


                            <div class="col-xs-1 col-md-1 col-lg-1 col-sm-12 col-1 to">





                            </div>

                        </div>

                        <div class="row " style="margin-top: 10px;">


                            <div class="col-xs-6 col-md-6 col-lg-6 col-sm-12 col-6 ml-2">
                                <table class="table table-bordered ">
                                    <thead>
                                        <tr>
                                            <th style="color: #559526;font-family:normal;font-size:18px;">Type of Participant</th>
                                            <th style="color: #559526;font-family:normal; font-size:18px;">Number of Participant</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td style="color: #559526;font-family:normal;font-size:18px;font-weight: bold;">Member</td>
                                            <td style="font-size:18px;font-family:normal;font-weight: bold;text-align: center;"> <?php echo $user_row[0]['NO_OF_MEM']; ?></td>
                                        </tr>
                                        <!-- <tr>
                                            <td style="color: #559526;font-family:normal;font-size:18px;font-weight: bold;">Spouse</td>
                                            <td style="color: black;font-family:normal;font-size:18px;font-weight: bold;text-align: center;"> <?php echo $user_row[0]['NO_OF_SPOUSE']; ?></td>
                                        </tr>
                                        <tr>
                                            <td style="color: #559526;font-family:normal;font-size:18px;font-weight: bold;">Child </td>
                                            <td style="color: black;font-family:normal;font-size:18px;font-weight: bold;text-align: center;"> <?php echo $user_row[0]['NO_OF_CHILD']; ?></td>
                                        </tr> -->



                                        <!-- <tr>
                                    <td style="color: #559526;font-family: Monotype Corsiva;font-size:18px;font-weight: bold;">Parent/Guest</td>
                                    <td style="color: #559526;font-family: Monotype Corsiva;font-size:18px;font-weight: bold;text-align: center;"> <?php echo $user_row[0]['NO_OF_GUEST']; ?></td>
                                </tr> -->

                                        <!-- <tr>
                                            <td style="color: #559526;font-family: Monotype Corsiva;font-size:18px;font-weight: bold;">Driver</td>
                                            <td style="color: black;font-family: Monotype Corsiva;font-size:18px;font-weight: bold;text-align: center;"> <?php echo $user_row[0]['NO_OF_DRIVER']; ?></td>
                                        </tr> -->

                                        <tr>

                                            <td class="text-right">
                                                <p style="color: #559526;font-family:normal;font-size:18px;font-weight: bold;"><strong>Total Participant: </strong></p>
                                            </td>
                                            <td class="text-left text-danger">
                                                <p style="color: black;font-family:normal;font-size:18px;font-weight: bold;text-align: center;"><strong> <?php echo $FAMILY_NOS; ?></strong></p>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>


                                <!-- <p style="font-size:25px;">I Will Join : <span style="color: red;"><?php echo $user_row[0]['PRE_DATE']; ?></span> </p> -->



                            </div>

                            <!-- <div class="col-xs-5 col-md-5 col-lg-5 col-sm-12 text-center" style="border: 1px solid green;background-color: #fff;width: 350px;height:175px;margin-left: 30px;"> -->

                            <div class="col-xs-5 col-md-5 col-lg-5 col-sm-12 col-5 pay_det text-center" style="border: 1px solid green;background-color: #fff;margin-left: 30px;">

                                <img src="images/paid.png" class="pay_img" height="100px" width="100px" />
                                <p class="lead marginbottom payment-info" style="font-weight: bold;font-family:normal; ">Payment details</p>
                                <p style="margin-right: 50px;font-weight: bold; font-weight: bold;font-family:normal;  ">Total Amount: <span style="color: black;font-family: Monotype Corsiva; "><?php echo $user_row[0]['TOTAL_AMT']; ?> /=</span> </p>

                                <?php
                                  if($user_row[0]['PAY_TIME'] !=null){
                                ?>
                                <p style="font-weight: bold;font-family:normal; " >Date: <span style="color:black;font-family:normal; " class="date_pay"><?php echo $user_row[0]['PAY_TIME']; ?></span> </p>

                                <?php
                                }
                               

                                ?>

                                <?php
                                  if($user_row[0]['CHANNEL'] !='M'){
                                ?>
                                <!-- <p style="font-weight: bold;font-family:normal; margin-right:90px;" >Channel : <span style="color:black;font-family:normal; " class="date_pay"><?php echo $user_row[0]['CHANNEL']; ?></span> </p> -->

                                <?php
                                }else{
                                    ?>
                                    <p style="font-weight: bold;font-family:normal; margin-left: 700px;" >Channel: <span style="color:black;font-family:normal; " class="date_pay"><?php echo $user_row[0]['CHANNEL']; ?></span> </p>
    
                                    <?php
                                    }

                                ?>



                            </div>

                            <div class="col-xs-1 col-md-1 col-lg-1 col-1 col-sm-12">


                            </div>







                        </div>


                        <div class="row">
                            <div class="col-xs-4 col-lg-4 col-md-4 col-sm-12 ">

                            </div>

                            <div class="col-xs-4 col-lg-4 col-md-4 col-sm-12 text-center">
                                <p class="lead marginbottom" style="color: #061442;font-family:normal; font-size: 20px; font-weight: bold;">Powered by </p>

                                <!-- <p class="lead marginbottom" style="color: #061442;font-family: Monotype Corsiva; font-size: 40px; font-weight: bold;">Ishop Trading</p> -->
                                <img src="images/ishop1.jpeg" height="50px" width="250px" alt="">
                                <p style="color: #061442; font-size: 8px; font-weight: bold;">Mobile No: 01718929297, Email : mzr071@gmail.com</p>
                                <!-- <p style="color: #061442; font-size: 22px; font-weight: bold;">Email : mzr071@gmail.com</p> -->
                                <p style="color: #061442; font-size: 8px; font-weight: bold;">Address : 32 Topkhana Road,Chattagram Bhaban, 3rd Floor,
                                    Purana Paltan, Dhaka - 1000</p>


                            </div>


                            <div class="col-xs-4 col-lg-4 col-md-4 col-sm-12 ">
                            </div>


                            <div class="col-xs-12 col-lg-12 col-md-12 col-sm-12 ml-3">
                                <h6 class="lead marginbottom" style="color: red; font-size: 15px; "> * অনুষ্ঠানে অংশগ্রহণ করার সময় কার্ডটি সঙ্গে রাখুন । </h6>





                            </div>


                        </div>




                        <!-- <div class="row">
                            <div class="col-xs-6 margintop">
                                <p class="lead marginbottom" style="color: green; font-size: 20px; font-weight: bold;">THANK YOU!</p>

                            </div>
                            <div class="col-xs-6 text-right pull-right invoice-total">
                               
                            </div>
                        </div> -->



                    </div>
                </div>
            </div>
        </div>















        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
        <script src="//malihu.github.io/custom-scrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
        <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>

        <script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.2/html2pdf.bundle.js"></script>




        <script>
            function download() {
                const invoice1 = this.document.getElementById("invoice1");
                console.log(invoice1);
                console.log(window);
                var opt = {
                    filename: '<?php echo $user_row[0]['MEM_NAME']; ?>.pdf',
                    image: {
                        type: 'jpeg',
                        quality: 0.98
                    },
                    html2canvas: {
                        scale: 1
                    },
                    jsPDF: {
                        unit: 'in',
                        format: 'a4',
                        orientation: 'portrait'
                    }
                };
                //html2pdf().from(invoice).save();
                html2pdf().from(invoice1).set(opt).save();
            }
        </script>





</body>

</html>