 <?php


 //collect invoice id
 if(isset($_GET['iid']))
 {

   //collect it
   $iid = $_GET['iid'];


   //collect matric number
   $a_no = get_user_application_number($user_id);


   //invoice to
   $invoice_type  = get_invoice_type($iid);//get invoice type
   $invoice_to = get_invoice_invoice_to($iid);
   $pay_to = get_invoice_pay_to($iid); //get who to pay the invoce to
   $invoice_for = get_invoice_for($iid); //get what the invoice is made for
   $title = get_invoice_title($iid); // get the invocie title
   $description = get_invoice_desc($iid); //get the invoice desc
   $amount = get_invoice_amount($iid); //get the invocie amount
   $total_amount = get_invoice_total_amount($iid); //get invoice total amount
   $credit = 0; //get_invoiced_credit($iid); //get invoice credit



   $payment_status = get_invoice_payment_status($iid); //get the invoice payment status


   $txnref = 'COEDP'.generate_remita_txn_ref();



   // I added jdlab share from db already, so no need to indicate here
     $jdlab_share = 165; //ICT INFRASCTURE CHARGESS
   //$remita_share = 315;
   $remita_share = 0;

   $total_amount = $total_amount ;
   $total_amountt = $total_amount;



 //get current session
 $session = get_current_session($id = 1); //get current session

 //$session = 3;



  $session_title = get_session_title($session); //get session title

 //get current semester
  $semester = get_current_semester($id = 1); //get current semester
 $semester_title = get_semester_title($semester); //get semester title


 ?>
 <!--<div style="height:20px; displat:block;"></div>-->
  <ul class="breadcrumb">

        <li><a href="dashboard.php?act=payments&qlk=<?php echo md5(8); ?>">Payments</a> <span class="divider"></span> </li>
       <!-- <li> <a href="dashboard.php?act=school_fee_payments&qlk=<?php //echo md5(2); ?>"> School fee payments </a><span class="divider"></span> </li>
       -->
        <li class="active" > Invoice<span class="divider"></span> </li>
    </ul>


<div class="well"><!-- well starts -->


      <div class="row" style="padding-left:0px; padding-right:0px;">

                      <ul class="list-group">
                          <li class="list-group-item list-group-item-success">
                              <h4>INVOICE</h4>
                          </li>
                      </ul>

                      <div class="col-md-12">
                          <div class="form-actions pull-right" style="margin-top:10px; padding-left:0px; padding-right:0px;">
                                  <form  name="form" action="" method="POST">
                                      <!--<img src="images/interswitch.jpg" height="30" width="150" />-->

                                        <!-- play with invoice for here -->
<!--                                        <span class="btn btn-info active"><i class="glyphicon glyphicon-info-sign"></i> Please print this invoice slip and take it to Skye Bank Branch </span>
-->




                    <?php if($payment_status == '1'){ ?>
                                        <input type="submit" name="" class="btn btn-info" value="Paid"  data-toggle="tooltip" data-placement="top" title="You have made payment for this invoice" disabled="disabled"/>
                                        <?php }else{ ?>
                                        <!--<input type="submit" name="submit" class="btn btn-info" value="Print this Invoice and take it to COEMINNA Microfinance Bank" id="submit" data-toggle="tooltip" data-placement="top" title="Print the Invoice and take it COEMINNA Microfinance Bank" disabled="disabled"/>-->
                                        <input  type="submit" name="submit" class="btn btn-info" value="Pay With Remita RRR" id="submit" data-toggle="tooltip" data-placement="top" title="Click here to Pay via Remita RRR" />

                                      <?php } ?>



                                        <input name="amount" type="hidden" value="<?php echo $total_amountt; ?>" />
                                        <input name="txnref" type="hidden" value="<?php echo $txnref; ?>" />


                                        <input  type="hidden" name="iid" Value="<?php echo $iid; ?>">
                                      <input  type="hidden" name="qlk" Value="<?php echo $encripted_qlk; ?>">


                                         <input  type="hidden" name="act" Value="confirm_af_payments_r"><!-- move to confirmation page -->

                                       <!-- <a class="btn btn-danger" target="_blank"  href="create_af_invoice.php?u=<?php //echo $user_id.'&s='.$session.'&me='.sha1(md5('fucku')).'&e='.sha1(md5('10000')).'&m='.sha1(md5('567')).'&iid='.$iid; ?>" data-toggle="tooltip" data-placement="top" title="Click here to Print / Download invoice"><i class="glyphicon glyphicon-print"> </i> Print / Download Invoice</a>-->

                                  </form>

                              </div>


                    </div><!-- /.col md 12 -->
                    <div class="clearfix"> </div>

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

                        <div class="col-md-4 help-block">
                          <p class="help-block">Invoice # <span class="badge badge-success"><?php echo $iid ;?></span></p>
                            Invoice Date: <?php echo get_invoice_date($iid) ;?><br>
                            Due Date: <?php echo get_invoice_due_date($iid) ;?><br>
                            Expire Date / Time: <?php echo get_invoice_exp_date($iid) ;?>

                        </div><!-- /.col  md 4-->

                        <div class="col-md-4">
                          <p class="help-block">Invoice To </p>
                            <?php echo get_user_fullname($invoice_to); ?><br><?php echo '<b>APP NO.: '.strtoupper($a_no).'</b><br/>'; ?>
                            <?php echo get_user_address($invoice_to); ?><br>
                            <?php echo show_state(get_user_state_id($invoice_to)); ?><br>
                             <?php //echo show_country(get_user_country_id($invoice_to)); ?>.<br>


                        </div><!-- /.col  md 4-->


                        <div class="col-md-4">

                          <p class="help-block">Pay To </p>
                            <?php echo $pay_to; ?><br>

                        </div><!-- /.col  md 4-->




                      </div><!-- /.col  md 12-->

                         <div style="height:100px"></div><!-- giv space -->

                        <div class="col-md-12">
                          <li class="list-group-item help-block">Description  ( <?php echo $session_title; ?> Academic Session  <?php //echo $semester_title; ?> ) <span class="pull-right">Amount</span> </li>

                          <li class="list-group-item help-block" style="height:auto;">
                              <span><strong><?php  echo $title; ?>  </strong><br/>
                                  <?php  echo $description; ?>
                                </span>
                                <hr/>
                                <span><strong><?php //echo 'N'.number_format($amount ,2); ?></strong>
                                </span>
                            </li>


                            <li class="list-group-item help-block">
                              <span>Sub Total:
                                </span>
                                <span class="pull-right"><?php echo 'N'.number_format($amount,2); ?>
                                </span>
                            </li>

                            <li class="list-group-item help-block">
                              <span>Credit:
                                </span>
                                <span class="pull-right"><?php echo 'N'.number_format($credit,2); ?>
                                </span>
                            </li>

                            <li class="list-group-item help-block">
                              <span>Convinience Fee:
                                </span>
                                <span class="pull-right"><?php echo 'N'.number_format($remita_share,2); ?>
                                </span>
                            </li>

                            <li class="list-group-item help-block" style="min-height:60px;">
                               <span>Total:
                                </span>
                                <span class="pull-right text-success" style="font-size:35px; font-weight:bold;"><?php echo 'N'.number_format($total_amount + $remita_share,2).'K'; ?>
                                </span>

                            </li>


                         </div>







      </div><!-- /.col md 12 -->


</div><!-- /.well -->

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

       <br/><br/><br/>

        <hr>

       </div>


        <div class="col-md-12">
              <div class="col-sm-6  help-block">



<!--                     <img src="images/secured pay opt.png" class="img-responsive" />
-->                      <img src="images/remita-payment-logo-horizonal-opt.png" class="img-responsive" />



                  </div>

                <div class="col-sm-6  help-block">
                    <h4>For Support, Email or Call : </h4>
                    <h5><span class="glyphicon glyphicon-envelope"></span> eportals@coeminna.edu.ng </h5>
                     <h5><span class="glyphicon glyphicon-phone"></span> +234- 08142411717 OR 07068401380 </h5>


                     <img src="images/support.png" class="pull-right" />

                  </div>
         </div>



<?php

 }//end of iid exist
else
{
  //do nothing for now
}
?>
