        <html lang="en">
          <head>
            <meta charset="utf-8">
            <meta name="viewport" content="width=device-width, initial-scale=1">
            <meta http-equiv="x-ua-compatible" content="ie=edge">

              <link rel="stylesheet" href="../../plugins/fontawesome-free/css/all.min.css">
              <!-- Ionicons -->
              <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
              <!-- DataTables -->
              <link rel="stylesheet" href="../../plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
              <link rel="stylesheet" href="../../plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
              <!-- Theme style -->
              <link rel="stylesheet" href="../../dist/css/adminlte.min.css">
              <!-- Google Font: Source Sans Pro -->
              <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">

              <link rel="preconnect" href="https://fonts.googleapis.com">
              <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
              <link href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap" rel="stylesheet"><head>
              <style>
                   .flex-container {
                    display: flex;
                  }

                  .flex-container > div {

                    margin: 10px;
                    padding: 20px;
                 
                  }

                  .flex-container2 > div {

                    margin: 10px;
                    padding: 20px;

                  }

                 body {
                        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
                        margin: 20px;
                        font-size: 12px;

                    }



                    p {

                        padding: 0;
                        margin-bottom: 10px;
                    }


                    @media print {

                        .no-print,
                        .no-print * {
                            display: none !important;
                        }
                    }

                    .title {
                        font-size: 18px;
                    }

                  @media print {
                      #printbtn {
                          display :  none;
                      }
                  }


                    @media print {
                        body {
                            -webkit-print-color-adjust: exact;
                        }
                    }

                    textarea,
                    input {
                        border: none;
                    }
                </style>
              </head>

              <body >

               <div class="flex-container" >
                   <div>  
                      <div class="" style="width: 240px" >
                            <div class="" style="background: white; margin-right:10px; border: 2px solid black;">
                                <center><image src="../../images/SAP1.png" style="width:90%;height:164px;"/></center>
                                <div style="margin-top:20px; text-align: center; word-wrap: break-word;">
                                  <p style="color: #d63e0b"> <strong>BARANGAY OFFICIALS </strong></p>
                                    <?php
                                         include_once('../../config/conn/db-connection.php');
                                        $data = $db->query("SELECT * FROM tbl_official")->fetchAll();
                                        foreach ($data as $row) {
                                            if($row['position'] == "Punong Barangay"){
                                                echo '
                                                <p>
                                                <strong style="color:#1b8bbf">'.strtoupper(htmlentities($row['full_name'])).'</strong><br>
                                                <span style="font-size:12px;">Punong Barangay</span>
                                                </p>
                                                ';
                                            }elseif($row['position'] == "Chairman, Committee on Education and Agriculture"){
                                                echo '
                                                <p>
                                                 <strong style="color:#1b8bbf">'.strtoupper(htmlentities($row['full_name'])).'</strong><br>
                                                <span style="font-size:12px;">Chairman, Committee on Education and Agriculture</span>
                                                </p>
                                                ';
                                            }elseif($row['position'] == "Chairman, Committee on infrastructure"){
                                                echo '
                                                <p>
                                                <strong style="color:#1b8bbf">'.strtoupper(htmlentities($row['full_name'])).'</strong><br>
                                                <span style="font-size:12px;">Chairman, Committee on infrastructure</span>
                                                </p>
                                                ';
                                            }elseif($row['position'] == "Chairman, Committee on Appropriation, Woman and Family, VAWC"){
                                                echo '
                                                <p>
                                               <strong style="color:#1b8bbf"> '.strtoupper(htmlentities($row['full_name'])).'</strong><br>
                                                <span style="font-size:12px;">Chairman, Committee on Appropriation, Woman and Family, VAWC</span>
                                                </p>
                                                ';
                                            }elseif($row['position'] == "Chairman, Committee on Peace & Order"){
                                                echo '
                                                <p>
                                                <strong style="color:#1b8bbf">'.strtoupper(htmlentities($row['full_name'])).'</strong><br>
                                                <span style="font-size:12px;">Chairman, Committee on Peace & Order</span>
                                                </p>
                                                ';
                                            }elseif($row['position'] == "Chairman, Committee on Social Services & Human Right"){
                                                echo '
                                                <p>
                                                <strong style="color:#1b8bbf"> '.strtoupper(htmlentities($row['full_name'])).'</strong><br>
                                                <span style="font-size:12px;">Chairman, Committee on Social Services & Human Right</span>
                                                </p>
                                                ';
                                            }elseif($row['position'] == "Chairman, Committee on Solid Waste, Vice-Chairman of Peace & Order"){
                                                echo '
                                                <p>
                                                 <strong style="color:#1b8bbf">'.strtoupper(htmlentities($row['full_name'])).'</strong><br>
                                                <span style="font-size:12px;">Chairman, Committee on Solid Waste, Vice-Chairman of Peace & Order </span>
                                                </p>
                                                ';
                                            }elseif($row['position'] == "Chairman, Committee on Health & Sanitation"){
                                                echo '
                                                <p>
                                                <strong style="color:#1b8bbf">'.strtoupper(htmlentities($row['full_name'])).'</strong><br>
                                                <span style="font-size:12px;">Chairman, Committee on Health & Sanitation</span>
                                                </p>';
                                           }elseif($row['position'] == "SK Chairperson"){
                                                echo '
                                                <p>
                                                <strong style="color:#1b8bbf">'.strtoupper(htmlentities($row['full_name'])).'</strong><br>
                                                <span style="font-size:12px;">SK Chairperson </span>
                                                </p>';
                                           }elseif($row['position'] == "Barangay Secretary"){
                                                echo '
                                                <p>
                                                <strong style="color:#1b8bbf">'.strtoupper(htmlentities($row['full_name'])).'</strong><br>
                                                <span style="font-size:12px;">Barangay Secretary</span>
                                                </p>';
                                           }elseif($row['position'] == "Barangay Treasurer"){
                                                echo '
                                                <p>
                                                <strong style="color:#1b8bbf">'.strtoupper(htmlentities($row['full_name'])).'</strong><br>
                                                <span style="font-size:12px;">Barangay Treasurer </span>
                                                </p>';
                                           }elseif($row['position'] == "Barangay Administrative Assistant"){
                                                echo '
                                                <p>
                                                 <strong style="color:#1b8bbf">'.strtoupper(htmlentities($row['full_name'])).'</strong><br>
                                                <span style="font-size:12px;">Barangay Administrative Assistant </span>
                                                </p>';
                                           }elseif($row['position'] == "Barangay Clerk"){
                                                echo '
                                                <p>
                                                <strong style="color:#1b8bbf">'.strtoupper(htmlentities($row['full_name'])).'</strong><br>
                                                <span style="font-size:12px;">Barangay Clerk </span>
                                                </p>';
                                           }
                                        }
                                    ?>
                                </div>
                            </div>  
                      </div>
                   </div>
                   <div>       
                        <div class="" style="background: white;  ">
                             <div class="flex-container">
                                <div style="width: 300px">
                                  <div style="font-size: 16px;" style="width: 600px"><b>
                                    Republic of the Philippines<br>
                                    Municipality of San Pablo City<br>
                                    Province of Laguna<br>
                                    BARANGAY SAN LUCAS 1<br>
                                    Tel. (049) 503-4025<br></b>
                                </div>
                                </div>
                                <div>
                             <div style="border: 2px solid black;">
                              <?php
                                   include_once('../../config/conn/db-connection.php');
                                   $sapformID = intval($_GET["sapform_id"]);
                                   $query = $db->prepare("SELECT * FROM tbl_sapform a INNER JOIN tbl_beneficiaries b ON a.beneficiaries_id = b.beneficiaries_id WHERE a.sapform_id = ?");
                                   $query->execute([$sapformID]);
                                   $results = $query->fetchAll(\PDO::FETCH_ASSOC);
                                   foreach ($results as $row){
                                    $image = htmlentities($row['image_profile']);
                                    ?>
                                    <image src="../../<?php echo $image;?>" style="width:160px;height:160px;"/>
                                  <?php } ?>
                                </div>
                              </div>
                              </div>
                                   <div >
                                    <p class="text-center" style="font-size: 20px; font-size:bold;">OFFICE OF THE SANGGUNIANG BARANGAY<br><b style="font-size: 28px;">QUALIFIED BENEFICIARIES OF SAP</b></p>
                                    <p style="font-size: 18px;">TO WHOM IT MAY CONCERN:</p>
                                    <p class="mb-4" style="text-indent:40px;text-align: justify;font-size: 15px; margin-bottom: 80px;">This is to certify that the person whose photo,signature and  right thumb mark  appear herein, is a <br>qualified beneficiaries of Barangay San Lucas 1, San Pablo City, Laguna and that the person had requested a financial check from this office following is/are our findings.</p>
                                        <?php
                                           include_once('../../config/conn/db-connection.php');
                                           $sapformID = intval($_GET["sapform_id"]);
                                           $query = $db->prepare("SELECT * FROM tbl_sapform a INNER JOIN tbl_beneficiaries b ON a.beneficiaries_id = b.beneficiaries_id WHERE a.sapform_id = ?");
                                           $query->execute([$sapformID]);
                                           $results = $query->fetchAll(\PDO::FETCH_ASSOC);
                                           foreach ($results as $row){
                                                $lname = htmlentities(strtoupper($row['lastname']));
                                                $fname = htmlentities(strtoupper($row['firstname']));
                                                $mname = htmlentities(strtoupper($row['middlename']));
                                                $formeraddress = htmlentities(strtoupper($row['former_address']));
                                                $bdate = date_create($row['birthdate']);
                                                $bplace = htmlentities(strtoupper($row['birthplace']));
                                                $gender = htmlentities(strtoupper($row['gender']));
                                                $civilstatus = htmlentities(strtoupper($row['civil_status']));
                                                $nationality = htmlentities(strtoupper($row['nationality']));
                                                $religion = htmlentities(strtoupper($row['religion']));
                                                $purpose = htmlentities(strtoupper($row['purpose']));
                                                $sapformno = htmlentities(strtoupper($row['sapform_no']));
                                                $date = date_create($row['dateRecorded']);
                                                $financialserviceprovider = htmlentities(strtoupper($row['financial_serviceprovider']));

                                           
                                           ?>
                                         
                                            <p style="font-size: 14px;"><b>
                                                SURNAME: <u><?php echo $lname;?></u><br>
                                                FIRST NAME: <u><?php echo $fname;?></u><br>
                                                MIDDLE NAME: <u><?php echo $mname;?></u><br>
                                                ADDRESS: <u><?php echo $formeraddress;?></u><br>
                                                BIRTHDATE & PLACE: <u><?php echo strtoupper(date_format($bdate,"m-d-Y")).'/'.$bplace;?></u><br>
                                                GENDER/CIVIL STATUS: <u><?php echo $gender;?> / <?php echo $civilstatus;?></u><br>
                                                NATIONALITY: <u><?php echo $nationality;?></u><br>
                                                RELIGION: <u><?php echo $religion;?></u><br>
                                                PURPOSE: <u><?php echo $purpose;?></u><br>
                                 <!--                FINDINGS: <u>Sample</u><br> -->
                                            </b></p>
                                            <p style="font-size: 14px;"><b>
                                                RES. CERT. NO.: <u><?php echo $sapformno;?></u><br>
                                                ISSUED ON: <u><?php echo strtoupper(date_format($date,"F j, o"));?></u><br>
                                                ISSUED AT: <u>SAN LUCAS 1 OFFICE</u><br>
                                               FINANCIAL SERVICE PROVIDER : <u><?php echo $financialserviceprovider;?></u><br>
                                                ISSUED ON: <u><?php echo strtoupper(date_format($date,"F j, o"));?></u><br><br>
                                            </b></p>
                               <?php } ?>
                                </div>  
                                <div class="col-md-5 col-xs-4" style="float:right;margin-top: -160px;" style="font-size: 12px">
                                    <div style="height:100px; width:140px; border: 1px solid black;">
                                        <center><span style="text-align: center; line-height: 160px;font-size: 12px;">Right Thumb Mark</span></center>
                                    </div><br><br><br><br>
                                    <p>Tax Payer's Signature</p>
                                </div>
                            </div><br><br><br>

                            <div class="flex-container">
                              <div >
                             <div style="width: 400px">
                                <?php
                                  include_once('../../config/conn/db-connection.php');
                                  $data = $db->query("SELECT * FROM  tbl_official")->fetchAll();
                                    foreach ($data as $row2) {
                                    if($row2['position'] == "Punong Barangay"){
                                        echo '
                                        <p>
                                        <b style="font-size:18px;">'.strtoupper(htmlentities($row2['full_name'])).'<br>
                                        <span style=" text-align: center;">Barangay Chairman</span></b>
                                        </p>
                                        ';
                                    }
                                }
                              ?>
                            </div>
                            </div>
                              <div>
                                  <div class="col-xs-3 pull-right" style="margin-bottom:40px;">
                                   <?php 
                                    // include 2D barcode class (search for installation path)
                                    require_once('TCPDF-main/tcpdf_barcodes_2d.php');

                                    $sapformID = intval($_GET["sapform_id"]);
                                    // set the barcode content and type
                                    $barcodeobj = new TCPDF2DBarcode($sapformID, 'PDF417');

                                    echo $barcodeobj->getBarcodeHTML(2, 2, 'black');
                                    // output the barcode as HTML object
                              
                                    ?>
                                       <span class="pull-right"> </span>
                           
                            </div>
                        </div>
                     </div>
                 </div>
              </div>
              </body>
              </html>

               </div>
                  <div class="modal-footer justify-content-end">
                      <button type="button" class="btn btn-primary noprint" id="printbtn"  onClick="window.print();"  ><i class="fa fa-print"></i> Print</button>
                  </div>
               </form>
              </div>
          </div>
      </div>

</body>
</html>