<?php 

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

<html>

<head>

<?php kheader(); ?>

<?php 

require_once("../core/connect.php");



?>

<script src="../js/sorttable.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">

                        <h1 class="page-header">

                            

                        </h1>

                        

                    </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">Edit fees structure</h3></div>

<div class="panel-body">

    <?php



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

$scfs2=$_POST["scfs2"];

$uni2=$_POST["uni2"];

$cont2=$_POST["cont2"];

$reg2=$_POST["reg2"];

$hol2=$_POST["hol2"];

$adm2=$_POST["adm2"];

$tp2=$_POST["tp2"];

$mockfa2=$_POST["mockfa2"];

$o12=$_POST["o12"];

$o22=$_POST["o22"];

$o32=$_POST["o32"];

$comment2=$_POST["comment2"];

$paystructureid=$_POST["paystructureid"];



useractivity("(schoolfees ".$scfs2.")(uniform ".$uni2.")(contribution ".$cont2.")(registration ".$reg2.")

  (holiday ".$hol2.")(admission ".$adm2.")(transport ".$tp2.")(mock and facilitation ".$mockfa2.")(other1 ".$o12.")

  (other2 ".$o22.")(other3 ".$o32.") have been updated","2.5.5");



include ("../core/connect.php");



$updatepaystructure = $dbh->query("update paystructure set ownfee='$scfs2', uniform='$uni2', contribution='$cont2', registration='$reg2', holiday='$hol2', admission='$adm2', transport='$tp2', mockfa='$mockfa2', other1='$o12', other2='$o22', other3='$o32' where paystructureid='$paystructureid'");



echo "<div class='alert alert-success'>Success: Updates have been submitted. </div>";



header("location:feesstructure.php");

}





include ("../core/connect.php");

$yearedit = $_POST["yearedit"];

$termedit = $_POST["termedit"];

$classedit = $_POST["classedit"];



useractivity("(year ".$yearedit.")(term ".$termedit.")(class ".$classedit.") have been submitted for editting","2.5");



$result = $dbh->query("select * from paystructure where schoolyear='$yearedit' and term='$termedit' and schoolclass='$classedit'");

$row = $result->fetchObject();

$count = $result->rowCount();



if($count>0){

echo "

             <form method='post'> 

             <input type='hidden' name='paystructureid' value='".$row->paystructureid."'>



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

                                <div class='col-lg-3'>



                  <select name='year2' class='form-control'>

<option value='".$row->schoolyear."'>20".$row->schoolyear."</option>

<option value='17'>2017</option>

<option value='16'>2016</option>

<option value='18'>2018</option>

<option value='19'>2019</option>

<option value='20'>2020</option>



                  </select>

                  </div>



                  <div class='col-lg-3'>

<select class='form-control' name='term2'>

<option value='".$row->term."'>Term ".$row->term."</option>

<option value='1'>Term 1 </option>

<option value='2'>Term 2 </option>

<option value='3'>Term 3 </option>

<option value='4'>All Terms</option>

</select>

</div>



                  <div class='col-lg-3'>



<select class='form-control' name='class2' id='schoolclass'  required>

";

include ("../core/connect.php");

$result26 = $dbh->query("select * from scrap where type='clas' or type='secclas' ");

$row26 = $result26->fetchObject();

$count26 = $result26->rowCount();



if($count26>0){

do{

echo "<option value='".$row26->item."'>".$row26->item2."</option>";

}while($row26 = $result26->fetchObject());

}else{

  echo "<option value=''>Sorry: please contact the IT department</option>";

}

   echo "

</select></div>

                  

</div>               



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

                  <div class='col-lg-3'>

                    

                    School Fees

                    <input type='text' name='scfs2' class='form-control' value='".$row->ownfee."' >

                  </div>



                  <div class='col-lg-3'>

Uniform <input type='text' name='uni2' class='form-control' value='".$row->uniform."'>

                  </div>



                  <div class='col-lg-3'>

Contribution <input type='text' name='cont2' class='form-control' value='".$row->contribution."'>

                  </div>



                  <div class='col-lg-3'>

Registration <input type='text' name='reg2' class='form-control' value='".$row->registration."'>

                  </div>

                </div>



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

                  <div class='col-lg-3'>

Holiday <input type='text' name='hol2' class='form-control' value='".$row->holiday."'>

                  

                  </div>

                  

                  <div class='col-lg-3'>

Admission <input type='text' name='adm2' class='form-control' value='".$row->admission."'>

                  </div>



                  <div class='col-lg-3'>

Transport <input type='text' name='tp2' class='form-control' value='".$row->transport."'>

                  </div>



                  <div class='col-lg-3'>

Mocks and Facilitation <input type='text' name='mockfa2' class='form-control' value='".$row->mockfa."'>

                  </div>

</div>



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

                  <div class='col-lg-3'>

Other 1  <input type='text' name='o12' class='form-control' value='".$row->other1."'>

                  

                  </div>



<div class='col-lg-3'>

Other 2  <input type='text' name='o22' class='form-control' value='".$row->other2."'>

                  </div>



                  <div class='col-lg-3'>

Other 3  <input type='text' name='o32' class='form-control' value='".$row->other3."'>

                  </div>



<div class='col-lg-3'> 

 <textarea name='comment2' class='form-control' placeholder='Comment'>".$row->comment."</textarea>

                  </div> 

</div>

<br><br>

<div style='float:right;' class='col-lg-3'> 

<input type='submit' name='adminupdate' class='btn btn-sm btn-success' value='Update Form'>



</div>

</form>";

}else{echo "There is NO match for the data submitted. ";}







?>

</div></div>



</div>

                            </div> </div>

                    </div>

                </div>

                <!-- /.row -->



               



            </div>

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



        </div>

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



    </div>

    <!-- /#wrapper -->



    <!-- jQuery -->

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



    <!-- Bootstrap Core JavaScript -->

    <script src="../js/bootstrap.min.js"></script>



</body>



</html>

