<?php include("../core/kfunctions.php");

role("tech");

?>

<html>

<head>

<?php kheader(); ?>



<link href="../css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">

<script src="../js/sorttable.js"></script>

   <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.js"></script>





</head>

<body>



    <div id="wrapper">



        <!-- Navigation -->

        <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">

            <!-- Brand and toggle get grouped for better mobile display -->

            <?php ktopbar(); ?>

            <!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->

            <?php kleftbar(); ?>

            <!-- /.navbar-collapse -->

        </nav>



        <div id="page-wrapper">



            <div class="container-fluid">



                <!-- Page Heading -->

                <div class="row">

                    <div class="col-lg-12">

                                                <ol class="breadcrumb">

                            <li>

                                <i class="fa fa-dashboard"></i>  <?php echo $dashboardlink; ?>

                            </li>

                            <li class="active">

                                <i class="fa fa-wrench"></i> 

                            </li>

                        </ol>

                    </div>

                </div>

                <!-- /.row -->



                <div class="row">

                    <div class="col-lg-12">

                        <div class="panel panel-default">

                            <div class="panel-body">

                            

<div class="panel panel-green"><!--Initiative-->

<div class="panel-heading"><h3 class="panel-title">Delete Lead ID here </h3></div>

<div class="panel-body">

<?php

if(isset($_POST["submit890"])){

    $trid = $_POST["trid"];

    $rolenumber = $_SESSION["rolenumber"];

$result = $dbh->query("select * from received where trid='$trid'");

$row = $result->fetchObject();

$count = $result->rowCount();



if($count>0){

$deleted=$dbh->exec("insert into deleted

   (trid,datez,ouruser,cid,schoolyear,schoolclass,term,am_bslip,id_bslip,am_mobile,id_mobile,am_cash,am_cheque,id_cheque,am_banktfer,id_banktfer,

    p_fees,p_uniform,p_contribution,p_registration,p_holiday,p_admission,p_transport,p_mockfa,p_other1,p_other2,p_other3,comment) 

  

  values('$row->trid','$row->datez','$rolenumber','$row->cid','$row->schoolyear','$row->schoolclass','$row->term','$row->am_bslip','$row->id_bslip','$row->am_mobile','$row->id_mobile','$row->am_cash','$row->am_cheque','$row->id_cheque','$row->am_banktfer','$row->id_banktfer',

    '$row->p_fees','$row->p_uniform','$row->p_contribution','$row->p_registration','$row->p_holiday','$row->p_admission','$row->p_transport','$row->p_mockfa','$row->p_other1','$row->p_other2','$row->p_other3','$row->comment')"); 





$deleteclo = $dbh->query("delete from received WHERE trid='$trid'");



echo "<div class='alert alert-success'>Success: Transaction ID : ".$trid." has been deleted. </div>";



}else{

    echo "<div class='alert alert-danger'>Sorry: Transaction ID : ".$trid." doesn't exist. </div>";

}

}

?>

<table class="table table-bordered table-hover table-striped sortable">

 <thead>

<tr>

<th>Transaction ID</th>

<th>Action</th>

</tr>

</thead>

<tbody>

<form method='post' onsubmit="return deletez();">

<tr>

<td>

<input type='text' class='form-control' id="x" name='trid' placeholder='Please paste the Transaction ID'>

</td>

<td>

<input type='submit' name='submit890' class='btn btn-sm btn-danger' value='Delete transaction'>

<input type='reset' class='btn btn-sm btn-success' value='Clear field'>

</td>

</tr>

</form>

</tbody>

</table>



</div></div>



</div>

                            </div> </div>

                    </div>

                </div>

                <!-- /.row -->

               



            </div>

            <!-- /.container-fluid -->



        </div>

        <!-- /#page-wrapper -->



    </div>

    <!-- /#wrapper -->



    <!-- jQuery -->

 <script>





$('input').keydown(function(e) {

   e.preventDefault();

   return false;

});





function deletez(){

var x = document.getElementById("x").value;



if(x==""){

    alert("Please paste the Transaction ID");

    return false;

}else{

var r = confirm("Are you sure, you want to delete the Transaction ID : "+x);

if(r==false){

    return false;

}

 }

 }



 </script>



    <!-- Bootstrap Core JavaScript -->

    <script type="text/javascript" src="../js/bootstrap.min.js"></script>

    <script type="text/javascript" src="../js/jquery-1.8.3.min.js" charset="UTF-8"></script>

</body>



</html>

