<?php
session_start();
// ============
include("../../asset/theme/css/myfunc.php");
include("../../php_crud/my_class.php");
include("../../php_crud/db.php");
$obj=new my_class();
//$obj1=new my_class_db();


// ============
$branchid = $_SESSION['LOGIN_BRANCH'];
//$sql ="select * from _fee_details_invoice where _id=1696";
//$qry = mysql_query($sql);
//$row = mysql_fetch_array($qry);
//echo $fee_head = $row['_fee_head'];
$month = $_POST['month'];
$year = $_POST['year'];
$std_uniq_id = $_POST['std_uniq_id'];

?>


<script src="module/fees/js/check_inv_std_list.js" type="text/javascript"></script>
<?php

$student_info = $obj->View_Student_Id("_pf_std_personal_info"," _uniq_id ='$std_uniq_id'");
$student_id = $student_info['_id'];
$student_name = $student_info['_full_name'];


$class_no = $obj->View_Summary("_fee_details_invoice"," _month ='$month' and _year='$year' and _std_id='$student_id' and _br_id='$branchid' GROUP BY _class_id");
$section_no = $obj->View_Summary_Section("_fee_details_invoice"," _month ='$month' and _year='$year' and _std_id='$student_id' and _br_id='$branchid' GROUP BY _section_id");
$student_no = $obj->View_Summary_Student("_fee_details_invoice"," _month ='$month' and _year='$year' and _std_id='$student_id' and _br_id='$branchid' GROUP BY _std_id");
$total = $obj->View_Total_Amount("_fee_details_invoice ","sum(_amount) as total","_month ='$month' and _year='$year' and _std_id='$student_id' and _br_id='$branchid'");



 ?>

<div class="row-fluid">
	<div class="widget-header header-color-green2">
    	<h4 class="lighter smaller" >Fee Summary</h4>
    </div>
    
</div>


<div class="row-fluid" id="fee_std_list">


<div class="row-fluid">
<div class="span10 offset1">
    <div class="widget-box transparent invoice-box">
        <div class="widget-header widget-header-large">
            <h3 class="grey lighter pull-left position-relative">
                <i class="icon-leaf green"></i>
                <b><?php echo $student_name;?>'s</b> Fee Generate Summary
            </h3>

            <div class="widget-toolbar no-border invoice-info">
                <!--<span class="invoice-info-label">Invoice:</span>
                <span class="red">#121212</span>

                <br>-->
                <span class="invoice-info-label"><b>Month:</b></span>
                <span class="blue"><?php $month_name = $obj->Month($month); echo $month_name;?></span>
                <span class="invoice-info-label"><b>Year:</b></span>
                <span class="blue"><?php echo $year;?></span>
            </div>

            <!--<div class="widget-toolbar hidden-480">
                <a href="#">
                    <i class="icon-print"></i>
                </a>
            </div>-->
        </div>

        <div class="widget-body">
            <div class="widget-main padding-24">
                <div class="row-fluid">
                    <div class="row-fluid">
                        <div class="span6">
                            <div class="row-fluid">
                                <div class="span12 label label-info arrowed-in arrowed-in-right">
                                    <b>Fee Head Info</b>
                                </div>
                            </div>

                            <div class="row-fluid" >
                                <ul class="unstyled spaced">
                                    <?php
									foreach($obj->View_Fee_Head("_fee_details_invoice"," _month ='$month' and _year='$year' and _std_id='$student_id' and _br_id='$branchid'  GROUP BY _fee_head") as $value){	
									$fee_head = $value['_fee_head'];
									
									
									?>
                                    <li>
                                        <i class="icon-caret-right blue"></i>
                                        <?php echo $value['_fee_head']; ?>
                                        
                                    </li>
									<?php 
										
									}?>
                                    
                                </ul>
                            </div>
                        </div><!--/span-->

                        <div class="span6">
                            <div class="row-fluid">
                                <div class="span12 label label-success arrowed-in arrowed-in-right">
                                    <b>Total Amount</b>
                                </div>
                            </div>

                            <div class="row-fluid">
                                <ul class="unstyled spaced">
                                    <?php
									foreach($obj->View_Fee_Head("_fee_details_invoice"," _month ='$month' and _year='$year' and _std_id='$student_id' and _br_id='$branchid'  GROUP BY _fee_head") as $value){	
									$fee_head = $value['_fee_head'];
									foreach($obj->Fee_Head_Student_Amount($branchid,$fee_head,$student_id,$month,$year) AS $value_s){
									
									?>
                                    <li>
                                        <i class="icon-caret-right blue"></i>
                                       <?php echo $value_s['amount']; ?>
                                        Taka (BDT).
                                    </li>
									<?php 
										}
									}?>

                                    
                                </ul>
                            </div>
                        </div><!--/span-->
                    </div><!--row-->

                    <div class="space"></div>

                    <div class="row-fluid">
                        <table class="table table-striped table-bordered">
                            <thead>
                                <tr>
                                    <th class="center">#</th>
                                    <th>Head Info</th>
                                    <th class="hidden-phone">Total</th>
                                    
                                </tr>
                            </thead>

                            <tbody>
                                
                                <tr>
                                    <td class="center">1. </td>
                                    <td>Number Of class</td>
                                    <td><span class="label label-warning" style="font-size:14px"><?php echo $class_no;?></span></td>
                                </tr>
                                <tr>
                                    <td class="center">2. </td>
                                    <td>Number Of Section</td>
                                    <td><span class="label label-success" style="font-size:14px"><?php echo $section_no;?></span></td>
                                </tr>
                                <tr>
                                    <td class="center">3. </td>
                                    <td>Student Name</td>
                                    <td><span class="label label-warning" style="font-size:14px"><?php echo $student_name;?></span></td>
                                </tr>
                                 <tr>
                                    <td class="center">4. </td>
                                    <td>Total Amount</td>
                                    <td><span class="label label-success" style="font-size:14px"><?php echo $total['total'];?></span> Taka (BDT)</td>
                                </tr>

                                
                            </tbody>
                        </table>
                    </div>

                    <div class="hr hr8 hr-double hr-dotted"></div>

                    <div class="row-fluid">
                        <div class="span5 pull-right">
                            <h4 class="pull-right">
                                Total amount :
                                <span class="red"><?php echo $total['total'];?>  Taka (BDT).</span>
                            </h4>
                        </div>
                        
                    </div>

                    <div class="space-6"></div>

                    
                </div>
            </div>
        </div>
    </div>
</div>
</div>




</div>

<!-- ==================================== -->

<div id="modal-table_edit" class="modal hide fade  " style="left: 42%; width: 60%;"   tabindex="-1">
	<form class="form-vertical" >
	<div class="modal-header no-padding">
		<div class="table-header">
			<button type="button" class="close" data-dismiss="modal">&times;</button>
			Student Invoice Edit
		</div>
	</div>
	<div class="modal-body" id="model_table_value_edit" style="min-height: 350px !important;
    overflow-y: none;">
	</div>

	<div class="modal-footer">
		<button onclick="call_update_invoice()" id="btn_invoice" class="btn btn-small btn-success" data-dismiss="modal" type="button" style=" display: block; float: left;">
			<i class="icon-ok bigger-100"></i>
			Save
		</button>

		<button class="btn btn-small btn-danger pull-left" data-dismiss="modal" style="float: left;">
			<i class="icon-remove"></i>
			Close
		</button>		
	</div>
	</form>
									
</div>
