ok
Direktori : /home/ngwcolle/public_html/mis/admin/ |
Current File : //home/ngwcolle/public_html/mis/admin/manage_dcr.php |
<?php include('includes/checklogin.php'); check_login(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content=""> <meta name="author" content=""> <link href="img/logo/logo.png" rel="icon"> <title>Daily Collection/Expense Report</title> <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css"> <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"> <link href="css/ruang-admin.min.css" rel="stylesheet"> <link href="vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet"> </head> <body id="page-top"> <div id="wrapper"> <!-- Sidebar --> <?php include('includes/sidebar.php'); ?> <!-- Sidebar --> <div id="content-wrapper" class="d-flex flex-column"> <div id="content"> <!-- TopBar --> <?php include('includes/header.php'); ?> <!-- Topbar --> <!-- Container Fluid--> <div class="container-fluid" id="container-wrapper"> <div class="d-sm-flex align-items-center justify-content-between mb-4"> <h1 class="h3 mb-0 text-gray-800">DCR Book</h1> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="dashboard.php">Home</a></li> <li class="breadcrumb-item active" aria-current="page">DCR Book</li> </ol> </div> <!-- Row --> <div class="row"> <!-- Datatables --> <!-- DataTable with Hover --> <div class="col-lg-12"> <div class="card mb-4"> <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between"> <h6 class="m-0 font-weight-bold text-primary">Daily Collection Expense</h6> </div> <!-- search area --> <form class="form-group" action="" method="post"> <h5 class="p-0 text-center">Search</h5> <div class="row p-3"> <div class="col-md-4"> <div class="form-group"> <input type="text" class="form-control" onfocus="(this.type='date')" name="pfrom" placeholder="Select Period from" required> </div> </div> <div class="col-md-4"> <div class="form-group "> <input type="text" class="form-control" onfocus="(this.type='date')" name="pto" placeholder="Select period To" required> </div> </div> <div class="col-md-4"><button type="submit" class="btn btn-dark" name="search">Search</button> <button type="button" onClick="window.location.href = 'manage_dcr.php'" class="btn btn-danger" name="search">Reset</button> </div> </div> </form> <!-- search area --> <!-- start modal --> <div id="editData4" class="modal fade"> <div class="modal-dialog modal-md"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Edit Ticket details</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body" id="info_update4"> <?php @include("edit_ticket.php"); ?> </div> <!-- <div class="modal-footer "> <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> </div> --> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> </div> <!-- end modal --> <div class="table-responsive p-3"> <table class="table align-items-center table-flush table-hover" id="dataTableHover"> <thead class="thead-light"> <tr> <th>No.</th> <th>Date</th> <th>Account Head</th> <th>Description</th> <th>Refrence</th> <th>Collection</th> <th>Expense</th> <th>Balance</th> </tr> </thead> <tbody> <?php $sql = "SELECT tblaccount.accounthead as acchad,txdate,tbltrans.accounthead,remark,paidto,sum(IF(txtype = 'Dr', txamount, NULL)) AS `credit`,sum(IF(txtype = 'Cr', txamount, NULL)) AS `Debit` FROM tbltrans INNER join tblaccount on tbltrans.accounthead=tblaccount.id where tbltrans.isyearclose='0' GROUP BY txdate,tbltrans.accounthead"; if(isset($_POST['search'])){ $pfrom = date("Y-m-d", strtotime($_POST['pfrom'])); $pto = date("Y-m-d", strtotime($_POST['pto'])); if(isset($pfrom)) { echo '<h5 class="text-warning">Your are viewing statement from ' .$pfrom." To ".$pto.'</h5>'; $sql="SELECT txdate,accounthead,remark,paidto,sum(IF(txtype = 'Dr', txamount, NULL)) AS `credit`,sum(IF(txtype = 'Cr', txamount, NULL)) AS `Debit` FROM tbltrans WHERE date(txdate) BETWEEN '$pfrom' AND '$pto' where tbltrans.isyearclose='0' GROUP BY txdate,accounthead;"; } else{ // $sql="SELECT pmtdate,remark,pmtmode,txrefno,party,MAX(IF(drcr = '1', amount, NULL)) AS `credit`,MAX(IF(drcr = '2', amount, NULL)) AS `Debit` FROM tbltrans GROUP BY pmtdate"; } // echo $sql; } // $sql="SELECT pmtdate,remark,pmtmode,txrefno,party,MAX(IF(drcr = '1', amount, NULL)) AS `credit`,MAX(IF(drcr = '2', amount, NULL)) AS `Debit` FROM tbltrans GROUP BY pmtdate"; $query = $dbh->prepare($sql); $query->execute(); $results = $query->fetchAll(PDO::FETCH_OBJ); $cnt=1; $cb=0; $dr=$cr=0; $cnt = 1; if ($query->rowCount() > 0) { foreach ($results as $result) { $dr+=$result->credit; $cr+=$result->Debit; ?> <!-- // --> <tr> <td><?php echo $cnt; ?></td> <td><?php echo htmlentities($result->txdate); ?></td> <td><a href="manage_cashbook.php?pid=<?php echo htmlentities($result->accounthead);?>"><?php echo htmlentities($result->acchad); ?></a></td> <td><?php echo htmlentities($result->paidto); ?></td> <td><?php echo htmlentities($result->remark); ?></td> <td><?php echo htmlentities($result->Debit); ?></td> <td><?php echo htmlentities($result->credit); ?></td> <td><?php echo htmlentities(($cb+$result->Debit)-$result->credit);?></td> </tr> <?php $cb+=$result->Debit-$result->Crdit; $cnt = $cnt + 1; } } ?> </tbody> </table> </div> </div> </div> </div> <!--Row--> <!-- Modal Logout --> <?php include('includes/modal.php'); ?> </div> <!---Container Fluid--> </div> <!-- Footer --> <?php include('includes/footer.php'); ?> <!-- Footer --> </div> </div> <!-- Scroll to top --> <a class="scroll-to-top rounded" href="#page-top"> <i class="fas fa-angle-up"></i> </a> <script src="vendor/jquery/jquery.min.js"></script> <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script> <script src="vendor/jquery-easing/jquery.easing.min.js"></script> <script src="js/ruang-admin.min.js"></script> <!-- Page level plugins --> <script src="vendor/datatables/jquery.dataTables.min.js"></script> <script src="vendor/datatables/dataTables.bootstrap4.min.js"></script> <!-- Page level custom scripts --> <script> $(document).ready(function() { $('#dataTable').DataTable(); // ID From dataTable $('#dataTableHover').DataTable(); // ID From dataTable with Hover }); </script> <script type="text/javascript"> $(document).ready(function() { $(document).on('click', '.edit_data4', function() { var edit_id4 = $(this).attr('id'); $.ajax({ url: "edit_ticket.php", type: "post", data: { edit_id4: edit_id4 }, success: function(data) { $("#info_update4").html(data); $("#editData4").modal('show'); } }); }); }); </script> </body> </html>