first when i click the issue of indigency the modal should open and the details of the person is there but probably it inserted directly to database. and the modal didnt open for me to view and print the indigency. before its working i just leave it for a few days. but when i cameback not working anymore i didnt touch any code too.
the image is the one that work before. thats the modal working before
heres the indigency.php
<?php include'header.php' ?>
<div style="padding: 0px;" class="container-fluid" id="banner">
<?php include'sidebar.php' ?>
<div class="col-md-10 right-section">
<?php include'babaw.php' ?>
<?php include'code.php' ?>
<div class="tittle-header">
<h3 style="text-align: center;font-size: 30px">Indigency Page</h3>
<div class="text-right adminauth">
<h2 class='text-admin'>Welcome: <span><a style='font-family: Lucida Fax;color: black;text-decoration: none;' href=""><?php echo $_SESSION['admin_name']; ?></a></span></h2>
</div>
</div>
<div class="staffrecords">
<div class="flex-parent">
<div class="flex1">
<label class="Search-text">Search Resident:</label>
<input class='search-input' type='text' name='number' id="myInput" onkeyup="myFunction()" placeholder="Enter Resident Name...">
</div>
</div>
<div class="table-scroll" style="margin-top:25px;">
<div class="table-responsive">
<table id="myTable" class="table table-stripes">
<thead>
<tr>
<th>ID</th>
<th>Image</th>
<th>Full Name</th>
<th>Age</th>
<th>Gender</th>
<th>Purok</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
include("database/db_connection.php");
$recordperpage = 5;
if (isset($_GET['page']) && !empty($_GET['page'])) {
$currentpage = $_GET['page'];
}else{
$currentpage = 1;
}
$startfrom = ($currentpage * $recordperpage) - $recordperpage;
$select = mysqli_query($dbcon,"SELECT * FROM tblresident WHERE CivilStatus != ''");
$totalrecords = mysqli_num_rows($select);
$firstpage = 1;
$nextpage = $currentpage + 1;
$previouspage = $currentpage -1;
$lastpage = ceil($totalrecords/$recordperpage);
$select2=mysqli_query($dbcon,"SELECT * FROM `tblresident` WHERE CivilStatus != '' LIMIT $startfrom, $recordperpage");
while($row=mysqli_fetch_array($select2))
{
?>
<tr>
<input type='hidden' name='id' value='<?php echo $row['id']; ?>'>
<td><?php
echo $row['id'];
$_SESSION['id'] = $row['id'];
?></td>
<?php
$count = strlen($row['Picture']);
if ($count < 100) {?>
<td><img class="image" src="image/<?php echo $row['Picture'] ?>"></td>
<?php
}else{?>
<td><img class="image" src="<?php echo $row['Picture'] ?>"></td>
<?php
}
?>
<td><?php echo $row['FirstName'] ." ". $row['LastName']; ?></td>
<td><?php echo $row['Age']; ?></td>
<td><?php echo $row['Gender']; ?></td>
<td><?php echo $row['Purok']; ?></td>
<td><a class='btn btn-primary' data-toggle="modal" data-target="#myModal" residentid="<?php echo $row['id']; ?>" >Issue Certificate of Indigency</a></td>
</tr>
<?php } ?>
</tbody>
</table>
<!-- pagination button -->
<div class="text-right" id="navigate" style='margin-right: 100px;'>
<nav aria-label="Page navigation">
<ul class="pagination">
<?php
if ($currentpage != $firstpage) {?>
<li class="page-item">
<a class='page-link' href="?page=<?php echo $firstpage ?>" tabindex="-1" aria-label="previous">
<span aria-hidden="true">First</span>
</a>
</li>
<?php
}
?>
<?php
if ($currentpage >= 2) {?>
<li class="page-item">
<a class="page-link" href="?page=<?php echo $previouspage; ?>"><?php echo $previouspage; ?></a>
</li>
<?php
}
?>
<li class="page-item active">
<a class="page-link" href="?page=<?php echo $currentpage; ?>"><?php echo $currentpage; ?></a>
</li>
<?php
if ($currentpage != $lastpage) {?>
<li class="page-item">
<a class="page-link" href="?page=<?php echo $nextpage; ?>"><?php echo $nextpage; ?></a>
</li>
<li class="page-item">
<a class='page-link' href="?page=<?php echo $lastpage ?>" aria-label="next">
<span aria-hidden="true">Last</span>
</a>
</li>
<?php
}
?>
</ul>
</nav>
</div>
<script>
function myFunction() {
var input, filter, table, tr, td, i, navigate;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
navigate = document.getElementById("navigate");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[2];
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
navigate.style.display ="block";
} else {
tr[i].style.display = "none";
navigate.style.display ="none";
}
}
}
}
</script>
</div>
</div>
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content modal-dialog modal-sm">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Certification Of Indigency</h4>
</div>
<div class="modal-body " id="profileForm">
<form method='POST' action='code.php'>
<?php
include 'database/db_connection.php';
$select = mysqli_query($dbcon,"SELECT * FROM tblbarangay");
while ($row2 = mysqli_fetch_assoc($select)) {?>
<input type='hidden' name='admin' value='<?php echo $_SESSION['admin_name']; ?>'>
<input type='hidden' name='municipality' value='<?php echo $row2['Municipality'];; ?>'>
<input type='hidden' name='barangay' value='<?php echo $row2['Barangay'];; ?>'>
<input type='hidden' name='province' value='<?php echo $row2['Province'];; ?>'>
<?php
}
?>
<input type='hidden' name='id'>
<h4>Enter OR No.</h4>
<input class='form-control' type='number' name='OR' >
<div class="buttons text-right" style='margin-top:20px;'>
<input class='btn btn-primary' type='submit' name='submit-indigency' value='Proceed'>
<a data-dismiss="modal" class='btn btn-danger'>Cancel</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include 'footer.php' ?>
indigency_print.php
<html>
<head>
<title>BARANGAY CLEARANCE SYSTEM</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initialscale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/bootstrap.min.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="css/bootstrap.css">
<style>
.print{
text-align: justify;
}
.flex-parent{
display: flex;
}
.flex1{
flex: 1;
}
img{
width: 130px;
height: 130px;
}
.margin-top-50{
margin-top: 50px;
}
.uppercase{
text-transform: uppercase;
}
</style>
</head>
<body>
<div class="container-fluid print">
<div class="flex-parent">
<?php
include 'database/db_connection.php';
$select = mysqli_query($dbcon,"SELECT * FROM tblbarangay");
while ($row = mysqli_fetch_assoc($select)) {?>
<div class="flex1 text-left">
<div class="img">
<img src="image/<?php echo $row['Logo'] ?>">
</div>
</div>
<div class="flex1 text-center">
<h5>Republic of the Philippines</h5>
<h5>Province of Leyte</h5>
<h5>Municipality of <?php echo $row['Municipality']; ?> </h5>
<h5>Barangay <?php echo $row['Barangay']; ?> </h5>
</div>
<?php
}
?>
<div class="flex1">
<div class="text-right">
<?php
include 'database/db_connection.php';
$select = mysqli_query($dbcon,"SELECT * FROM tblofficials WHERE role = 'Barangay Captain' ");
while ($row = mysqli_fetch_assoc($select)) {?>
<?php
$count = strlen($row['img']);
if ($count < 100) {?>
<td><img class="image" src="image/<?php echo $row['img'] ?>"></td>
<?php
}else{?>
<td><img class="image" src="<?php echo $row['img'] ?>"></td>
<?php
}
?>
<?php
}
?>
</div>
</div>
</div>
<div class="text-center">
<h3 style="text-decoration: underline;">OFFICE OF THE PUNONG BARANGAY</h3>
</div>
<div class="content margin-top-50">
<h4>SUBJECT: <b style="text-decoration: underline;">CERTIFICATE OF INDIGENCY</b></h4>
</div>
<div class="content margin-top-50">
<h4>To whom it may concern;</h4>
</div>
<?php
include 'database/db_connection.php';
$id = $_GET['id'];
$select = mysqli_query($dbcon,"SELECT * FROM tblresident WHERE id = '$id' ");
while ($row = mysqli_fetch_assoc($select)) {?>
<div class="content margin-top-50" style='text-indent: 50px;'>
<h4>THIS IS TO CERTIFY that <b class="uppercase"><?php echo $row['FirstName'] . " " . $row['LastName']; ?></b>
<?php
$status = $row['Gender'];
if ($status == 'Female') {?>
the Daughter of <b class="uppercase"><?php echo "Mr.".$row['FathersName']; ?></b>
<?php
}else{?>
the Son of <b class="uppercase"><?php echo "Mr.".$row['FathersName']; ?></b>
<?php
}
?>
legal age, a resident of Barangay
<?php echo $_GET['barangay'].','.$_GET['municipal'].','.$_GET['province']; ?>.</h4>
</div>
<div class="content margin-top-50" style='text-indent: 50px;'>
<h4>This is to certify further that <b class="uppercase"><?php echo $row['FirstName'] . " " . $row['LastName']; ?></b> is one of the Indigent members in this Barangay.
.</h4>
</div>
<div class="content margin-top-50" style='text-indent: 50px;'>
<h4>This Certification is issued upon the request of the interested party for whatever legal purpose it may serve her most.</h4>
</div>
<div class="content margin-top-50" style='text-indent: 50px;'>
<h4>
GIVEN this <b><span id='date'></span> day of <span id='month'></span> <span id='year'></span></b> at <?php echo $_GET['barangay'].','
.$_GET['municipal'].','.$_GET['province']; ?> Philippines.
</h4>
</div>
<?php
}
?>
<?php
include 'database/db_connection.php';
$select = mysqli_query($dbcon,"SELECT * FROM tblbarangay");
while ($row = mysqli_fetch_assoc($select)) {?>
<div class=" margin-top-50">
<div class="margin-top-50">
<div class="flex-parent">
<div class="flex1"></div>
<div class="flex1">
<h4 class="text-center">Certified Correct</h4>
<h4 class="uppercase text-center">
<?php
$select2 = mysqli_query($dbcon,"SELECT * FROM tblofficials WHERE role = 'Barangay Captain'");
$row2 = mysqli_fetch_assoc($select2);
echo $row2['FirstName']." ".$row2['MiddleName'].". ".$row2['LastName'];
?>
</h4>
<h4 class="text-center">Punong Barangay</h4>
</div>
</div>
</div>
</div>
<div class=" margin-top-50">
<h4 style="width: 100xp;">Paid OR No <span style="margin-left: 20px;">:<?php echo $_GET['OR'] ?></span></h4>
<h4>Issued on <span style="margin-left: 38px;"></span>:<span id="month2"></span> <span id="date2"></span> <span id="year2"></span><h4>
<h4>Issued at <span style="margin-left: 43px;"></span>:Barangay <?php echo $row['Barangay'] . " " . $row['Municipality']. ", ". $row['Province'] ; ?></h4>
</div>
<?php
}
?>
</div>
<script>
var y = new Date();
var m = new Date();
var d = new Date();
var month = ["January","February","March","April","May","June","July","August","September","October","November","December"];
var day = d.getDate("1-31");
if (day == 1 && day != 11) {
document.getElementById("date").innerHTML = d.getDate("1-31") + "st";
}else if(day == 2 && day != 12){
document.getElementById("date").innerHTML = d.getDate("1-31") + "nd";
}else if(day == 3 && day != 13){
document.getElementById("date").innerHTML = d.getDate("1-31") + "rd";
}else{
document.getElementById("date").innerHTML = d.getDate("1-31") + "th";
}
document.getElementById("year").innerHTML = y.getFullYear("yyyyy");
document.getElementById("month").innerHTML = month[m.getMonth("0-11")];
document.getElementById("date2").innerHTML = d.getDate("1-31") + ",";
document.getElementById("year2").innerHTML = y.getFullYear("yyyyy");
document.getElementById("month2").innerHTML = month[m.getMonth("0-11")];
</script>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
function myFunction() {
window.print();
}
myFunction();
</script>
</body>
</html>
code.php
//print residency
if (isset($_POST['submit-indigency'])) {
$admin = $_POST['admin'];
$municipal = $_POST['municipality'];
$barangay = $_POST['barangay'];
$province = $_POST['province'];
$id = $_POST['id'];
$OR = $_POST['OR'];
$transaction = "Barangay Indigency";
$type = "Indigency";
$issued = date("Y-m-d");
$y = Date("Y");
$m = Date("m");
$d = Date("d");
if ($m < 10) {
$month = "0".$m;
}else{
$month = $m;
}
$calmonth = $month + 6;
if ($calmonth > 12) {
$totalmonth = $calmonth - 12;
$totalyear = $y + 1;
$expire = $totalyear."-".$totalmonth."-".$d;
}else{
$expire = $y."-".($month + 6)."-". $d;
}
$select = mysqli_query($dbcon,"SELECT * FROM tblresident WHERE id = $id");
if (mysqli_num_rows($select) > 0) {
$row = mysqli_fetch_assoc($select);
$fn = $row['FirstName'];
$ln = $row['LastName'];
$fullname = $fn." ".$ln;
$insert = "INSERT INTO tbltransaction VALUES (NULL,'$id','$fullname','$type','$transaction','$issued','$expire','$admin','')";
if (mysqli_query($dbcon,$insert)) {
echo"<script>window.open('indigency_print.php?id=$id&OR=$OR&municipal=$municipal&barangay=$barangay&province=$province','_blank','location=yes,height=1200,width=1200,scrollbars=yes,status=yes')</script>";
echo "<script>window.open('indigency.php','_self')</script>";
}
}
}