<div class="content-header">
    <div class="container-fluid">
        <div class="row mb-2">
            <div class="col-sm-6">
                <!-- <h1 class="m-0">Deactive Member </h1> -->
            </div>
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-right">
                    <li class="breadcrumb-item"><a href="#">Ledger Balance</a></li>
                    <li class="breadcrumb-item active">Ledger Balance</li>
                </ol>
            </div>
        </div>
    </div>
</div>




<section class="content">
    <div class="container-fluid">




        <div class="row">

            <section class="col-lg-12 connectedSortable">

                <div class="card">
                    <div class="card-header " style="background-color:#31708e;color:white">
                        <h3 class="card-title">
                        Ledger Balance Details
                        </h3>
                        <div class="card-tools">
                            <ul class="nav nav-pills ml-auto">
                            </ul>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="tab-content p-0">


                        <form method="post" action="<?php echo base_url() ?>index.php/member/dcp_search">
                            <div class="row mt-3">
                                <div class="col-sm-4">
                                    Type :
                                    <select name="type" class="form-control">
                                        <option value="">Select</option>
                                        <option value="principal">Principal</option>
                                        <option value="share">Share</option>
                                        <option value="thrift">Thrift</option>

                                    </select>
                                </div>
                                <div class="col-sm-4">
                                    <div>Year</div>
                                    <?php $y = date('Y'); ?>
                                    <select name="year" class="form-control">
                                        <option value="">Select Year</option>
                                        <?php for ($j = $y; $j >= 2022; $j--) { ?>
                                            <option <?php if ($j == $year) {
                                                        echo "selected";
                                                    } ?> value="<?php echo $j; ?>"><?php echo $j; ?></option>
                                        <?php } ?>
                                    </select>
                                </div>
                                <div class="col-sm-4 " >
                                    <input type="submit" class="btn btn-primary col-sm-2" value="search">

                                </div>
                            </div><br>




                        </form>

                        <div class="row mb-2">
                            <div class="col-sm-4">

                            </div>
                            <div class="col-sm-5 text-center">
                                <?php if ($type == "thrift") { ?>
                                    <h2><b>Thrift ( <?php echo $year . " - " . $next_year; ?> )</b></h2>
                                <?php } else if ($type == "share") { ?>
                                    <h2><b>Share ( <?php echo $year . " - " . $next_year; ?> )</b></h2>
                                <?php } else { ?>
                                    <h2><b>Principal ( <?php echo $year . " - " . $next_year; ?> )</b></h2>
                                <?php } ?>

                            </div>
                            <div class="col-sm-3 float-left">
                                <b>
                                </b>
                            </div>
                        </div><br><br>
                        <table id="recover_table_id" class="table table-striped table-bordered" style="width:100%">
                            <thead>
                                <tr>
                                    <th class="text-center">M.No</th>
                                    <th class="text-center">Member Name</th>
                                    <th class="text-center">April</th>
                                    <th class="text-center">May</th>

                                    <th class="text-center">June</th>

                                    <th class="text-center">July</th>

                                    <th class="text-center">Augest</th>

                                    <th class="text-center">September</th>

                                    <th class="text-center">October</th>

                                    <th class="text-center">November</th>

                                    <th class="text-center">December</th>

                                    <th class="text-center">January</th>

                                    <th class="text-center">Febraury</th>

                                    <th class="text-center">March</th>

                                    <th class="text-center">Total</th>

                                    <th class="text-center">Total + CB</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php if (isset($value) && count($value) > 0) { ?>
                                    <?php $sno = 1; ?>
                                    <?php foreach ($value as $val => $data) : ?>
                                        <tr>
                                            <td class="text-center">
                                                <?= $data[0]['me_no']; ?>
                                            </td>
                                            <td class="text-center">
                                                <?= $data[0]['mem_name']; ?>
                                            </td>



                                            <?php if ($data[0]['payment_month'] == "April"  && $data[0]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[0]['amt']; ?>
                                                    <?php $apr = $data[0]['amt']; ?>
                                                    <?php $tapr += $apr; ?>
                                                </td>
                                            <?php } else { ?>
                                                <td class="text-center">
                                                    0
                                                    <?php $apr = 0; ?>
                                                    <?php $tapr += $apr; ?>
                                                </td>
                                            <?php } ?>



                                            <?php if ($data[0]['payment_month'] == "May"  && $data[0]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[0]['amt']; ?>
                                                    <?php $may = $data[0]['amt']; ?>
                                                    <?php $tmay += $may; ?>

                                                <?php } else if ($data[1]['payment_month'] == "May"  && $data[1]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[1]['amt']; ?>
                                                    <?php $may = $data[1]['amt']; ?>
                                                    <?php $tmay += $may; ?>

                                                <?php } else if ($data[2]['payment_month'] == "May"  && $data[2]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[2]['amt']; ?>
                                                    <?php $may = $data[2]['amt']; ?>
                                                    <?php $tmay += $may; ?>

                                                <?php } else if ($data[3]['payment_month'] == "May"  && $data[3]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[3]['amt']; ?>
                                                    <?php $may = $data[3]['amt']; ?>
                                                    <?php $tmay += $may; ?>

                                                <?php } else if ($data[4]['payment_month'] == "May"  && $data[4]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[4]['amt']; ?>
                                                    <?php $may = $data[4]['amt']; ?>
                                                    <?php $tmay += $may; ?>

                                                <?php } else if ($data[5]['payment_month'] == "May"  && $data[5]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[5]['amt']; ?>
                                                    <?php $may = $data[5]['amt']; ?>
                                                    <?php $tmay += $may; ?>

                                                <?php } else  if ($data[6]['payment_month'] == "May"  && $data[6]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[6]['amt']; ?>
                                                    <?php $may = $data[6]['amt']; ?>
                                                    <?php $tmay += $may; ?>

                                                <?php } else  if ($data[7]['payment_month'] == "May"  && $data[7]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[7]['amt']; ?>
                                                    <?php $may = $data[7]['amt']; ?>
                                                    <?php $tmay += $may; ?>

                                                <?php } else if ($data[8]['payment_month'] == "May"  && $data[8]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[8]['amt']; ?>
                                                    <?php $may = $data[8]['amt']; ?>
                                                    <?php $tmay += $may; ?>

                                                <?php } else { ?>
                                                <td class="text-center">
                                                    0
                                                    <?php $may = 0; ?>
                                                    <?php $tmay += $may; ?>
                                                </td>
                                            <?php } ?>



                                            <?php if ($data[0]['payment_month'] == "June"  && $data[0]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[0]['amt']; ?>
                                                    <?php $jun = $data[0]['amt']; ?>
                                                    <?php $tjun += $jun; ?>

                                                <?php } else if ($data[1]['payment_month'] == "June"  && $data[1]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[1]['amt']; ?>
                                                    <?php $jun = $data[1]['amt']; ?>
                                                    <?php $tjun += $jun; ?>

                                                <?php } else if ($data[2]['payment_month'] == "June"  && $data[2]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[2]['amt']; ?>
                                                    <?php $jun = $data[2]['amt']; ?>
                                                    <?php $tjun += $jun; ?>

                                                <?php } else if ($data[3]['payment_month'] == "June"  && $data[3]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[3]['amt']; ?>
                                                    <?php $jun = $data[3]['amt']; ?>
                                                    <?php $tjun += $jun; ?>

                                                <?php } else if ($data[4]['payment_month'] == "June"  && $data[4]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[4]['amt']; ?>
                                                    <?php $jun = $data[4]['amt']; ?>
                                                    <?php $tjun += $jun; ?>

                                                <?php } else if ($data[5]['payment_month'] == "June"  && $data[5]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[5]['amt']; ?>
                                                    <?php $jun = $data[5]['amt']; ?>
                                                    <?php $tjun += $jun; ?>

                                                <?php } else  if ($data[6]['payment_month'] == "June"  && $data[6]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[6]['amt']; ?>
                                                    <?php $jun = $data[6]['amt']; ?>
                                                    <?php $tjun += $jun; ?>

                                                <?php } else { ?>
                                                <td class="text-center">
                                                    0
                                                    <?php $jun = 0; ?>
                                                    <?php $tjun += $jun; ?>
                                                </td>
                                            <?php } ?>



                                            <?php if ($data[0]['payment_month'] == "July"  && $data[0]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[0]['amt']; ?>
                                                    <?php $jul = $data[0]['amt']; ?>
                                                    <?php $tjul += $jul; ?>

                                                <?php } else if ($data[1]['payment_month'] == "July"  && $data[1]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[1]['amt']; ?>
                                                    <?php $jul = $data[1]['amt']; ?>
                                                    <?php $tjul += $jul; ?>

                                                <?php } else if ($data[2]['payment_month'] == "July"  && $data[2]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[2]['amt']; ?>
                                                    <?php $jul = $data[2]['amt']; ?>
                                                    <?php $tjul += $jul; ?>

                                                <?php } else if ($data[3]['payment_month'] == "July"  && $data[3]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[3]['amt']; ?>
                                                    <?php $jul = $data[3]['amt']; ?>
                                                    <?php $tjul += $jul; ?>

                                                <?php } else if ($data[4]['payment_month'] == "July"  && $data[4]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[4]['amt']; ?>
                                                    <?php $jul = $data[4]['amt']; ?>
                                                    <?php $tjul += $jul; ?>

                                                <?php } else if ($data[5]['payment_month'] == "July"  && $data[5]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[5]['amt']; ?>
                                                    <?php $jul = $data[5]['amt']; ?>
                                                    <?php $tjul += $jul; ?>

                                                <?php } else { ?>
                                                <td class="text-center">
                                                    0
                                                    <?php $jul = 0; ?>
                                                    <?php $tjul += $jul; ?>
                                                </td>
                                            <?php } ?>


                                            <?php if ($data[0]['payment_month'] == "August"  && $data[0]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[0]['amt']; ?>
                                                    <?php $aug = $data[0]['amt']; ?>
                                                    <?php $taug += $aug; ?>

                                                <?php } else if ($data[1]['payment_month'] == "August"  && $data[1]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[1]['amt']; ?>
                                                    <?php $aug = $data[1]['amt']; ?>
                                                    <?php $taug += $aug; ?>

                                                <?php } else { ?>
                                                <td class="text-center">
                                                    0
                                                    <?php $aug = 0; ?>
                                                    <?php $taug += $aug; ?>
                                                </td>
                                            <?php } ?>


                                            <?php if ($data[0]['payment_month'] == "September"  && $data[0]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[0]['amt']; ?>
                                                    <?php $sept = $data[0]['amt']; ?>
                                                    <?php $tsept += $sept; ?>

                                                <?php } else if ($data[1]['payment_month'] == "September"  && $data[1]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[1]['amt']; ?>
                                                    <?php $sept = $data[1]['amt']; ?>
                                                    <?php $tsept += $sept; ?>

                                                <?php } else if ($data[2]['payment_month'] == "September"  && $data[2]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[2]['amt']; ?>
                                                    <?php $sept = $data[2]['amt']; ?>
                                                    <?php $tsept += $sept; ?>

                                                <?php } else if ($data[3]['payment_month'] == "September"  && $data[3]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[3]['amt']; ?>
                                                    <?php $sept = $data[3]['amt']; ?>
                                                    <?php $tsept += $sept; ?>

                                                <?php } else if ($data[4]['payment_month'] == "September"  && $data[4]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[4]['amt']; ?>
                                                    <?php $sept = $data[4]['amt']; ?>
                                                    <?php $tsept += $sept; ?>

                                                <?php } else if ($data[5]['payment_month'] == "September"  && $data[5]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[5]['amt']; ?>
                                                    <?php $sept = $data[5]['amt']; ?>
                                                    <?php $tsept += $sept; ?>

                                                <?php } else  if ($data[6]['payment_month'] == "September"  && $data[6]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[6]['amt']; ?>
                                                    <?php $sept = $data[6]['amt']; ?>
                                                    <?php $tsept += $sept; ?>

                                                <?php } else  if ($data[7]['payment_month'] == "September"  && $data[7]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[7]['amt']; ?>
                                                    <?php $sept = $data[7]['amt']; ?>
                                                    <?php $tsept += $sept; ?>

                                                <?php } else if ($data[8]['payment_month'] == "September"  && $data[8]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[8]['amt']; ?>
                                                    <?php $sept = $data[8]['amt']; ?>
                                                    <?php $tsept += $sept; ?>

                                                <?php } else if ($data[9]['payment_month'] == "September"  && $data[9]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[9]['amt']; ?>
                                                    <?php $sept = $data[9]['amt']; ?>
                                                    <?php $tsept += $sept; ?>

                                                <?php } else if ($data[9]['payment_month'] == "September"  && $data[9]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[9]['amt']; ?>
                                                    <?php $sept = $data[9]['amt']; ?>
                                                    <?php $tsept += $sept; ?>

                                                <?php } else if ($data[10]['payment_month'] == "September"  && $data[10]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[10]['amt']; ?>
                                                    <?php $sept = $data[10]['amt']; ?>
                                                    <?php $tsept += $sept; ?>

                                                <?php } else if ($data[11]['payment_month'] == "September"  && $data[11]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[11]['amt']; ?>
                                                    <?php $sept = $data[11]['amt']; ?>
                                                    <?php $tsept += $sept; ?>

                                                <?php } else { ?>
                                                <td class="text-center">
                                                    0
                                                    <?php $sept = 0; ?>
                                                    <?php $tsept += $sept; ?>
                                                </td>
                                            <?php } ?>



                                            <?php if ($data[0]['payment_month'] == "October"  && $data[0]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[0]['amt']; ?>
                                                    <?php $oct = $data[0]['amt']; ?>
                                                    <?php $toct += $oct; ?>

                                                <?php } else if ($data[1]['payment_month'] == "October"  && $data[1]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[1]['amt']; ?>
                                                    <?php $oct = $data[1]['amt']; ?>
                                                    <?php $toct += $oct; ?>

                                                <?php } else if ($data[2]['payment_month'] == "October"  && $data[2]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[2]['amt']; ?>
                                                    <?php $oct = $data[2]['amt']; ?>
                                                    <?php $toct += $oct; ?>

                                                <?php } else if ($data[3]['payment_month'] == "October"  && $data[3]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[3]['amt']; ?>
                                                    <?php $oct = $data[3]['amt']; ?>
                                                    <?php $toct += $oct; ?>

                                                <?php } else if ($data[4]['payment_month'] == "October"  && $data[4]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[4]['amt']; ?>
                                                    <?php $oct = $data[4]['amt']; ?>
                                                    <?php $toct += $oct; ?>

                                                <?php } else if ($data[5]['payment_month'] == "October"  && $data[5]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[5]['amt']; ?>
                                                    <?php $oct = $data[5]['amt']; ?>
                                                    <?php $toct += $oct; ?>

                                                <?php } else  if ($data[6]['payment_month'] == "October"  && $data[6]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[6]['amt']; ?>
                                                    <?php $oct = $data[6]['amt']; ?>
                                                    <?php $toct += $oct; ?>

                                                <?php } else  if ($data[7]['payment_month'] == "October"  && $data[7]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[7]['amt']; ?>
                                                    <?php $oct = $data[7]['amt']; ?>
                                                    <?php $toct += $oct; ?>

                                                <?php } else if ($data[8]['payment_month'] == "October"  && $data[8]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[8]['amt']; ?>
                                                    <?php $oct = $data[8]['amt']; ?>
                                                    <?php $toct += $oct; ?>

                                                <?php } else if ($data[9]['payment_month'] == "October"  && $data[9]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[9]['amt']; ?>
                                                    <?php $oct = $data[9]['amt']; ?>
                                                    <?php $toct += $oct; ?>

                                                <?php } else if ($data[9]['payment_month'] == "October"  && $data[9]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[9]['amt']; ?>
                                                    <?php $oct = $data[9]['amt']; ?>
                                                    <?php $toct += $oct; ?>

                                                <?php } else if ($data[10]['payment_month'] == "October"  && $data[10]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[10]['amt']; ?>
                                                    <?php $oct = $data[10]['amt']; ?>
                                                    <?php $toct += $oct; ?>

                                                <?php } else { ?>
                                                <td class="text-center">
                                                    0
                                                    <?php $oct = 0; ?>
                                                    <?php $toct += $oct; ?>
                                                </td>
                                            <?php } ?>



                                            <?php if ($data[0]['payment_month'] == "November"  && $data[0]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[0]['amt']; ?>
                                                    <?php $nov = $data[0]['amt']; ?>
                                                    <?php $tnov += $nov; ?>

                                                <?php } else if ($data[1]['payment_month'] == "November"  && $data[1]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[1]['amt']; ?>
                                                    <?php $nov = $data[1]['amt']; ?>
                                                    <?php $tnov += $nov; ?>

                                                <?php } else if ($data[2]['payment_month'] == "November"  && $data[2]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[2]['amt']; ?>
                                                    <?php $nov = $data[2]['amt']; ?>
                                                    <?php $tnov += $nov; ?>

                                                <?php } else if ($data[3]['payment_month'] == "November"  && $data[3]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[3]['amt']; ?>
                                                    <?php $nov = $data[3]['amt']; ?>
                                                    <?php $tnov += $nov; ?>

                                                <?php } else if ($data[4]['payment_month'] == "November"  && $data[4]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[4]['amt']; ?>
                                                    <?php $nov = $data[4]['amt']; ?>
                                                    <?php $tnov += $nov; ?>

                                                <?php } else if ($data[5]['payment_month'] == "November"  && $data[5]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[5]['amt']; ?>
                                                    <?php $nov = $data[5]['amt']; ?>
                                                    <?php $tnov += $nov; ?>

                                                <?php } else  if ($data[6]['payment_month'] == "November"  && $data[6]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[6]['amt']; ?>
                                                    <?php $nov = $data[6]['amt']; ?>
                                                    <?php $tnov += $nov; ?>

                                                <?php } else  if ($data[7]['payment_month'] == "November"  && $data[7]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[7]['amt']; ?>
                                                    <?php $nov = $data[7]['amt']; ?>
                                                    <?php $tnov += $nov; ?>

                                                <?php } else if ($data[8]['payment_month'] == "November"  && $data[8]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[8]['amt']; ?>
                                                    <?php $nov = $data[8]['amt']; ?>
                                                    <?php $tnov += $nov; ?>

                                                <?php } else if ($data[9]['payment_month'] == "November"  && $data[9]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[9]['amt']; ?>
                                                    <?php $nov = $data[9]['amt']; ?>
                                                    <?php $tnov += $nov; ?>

                                                <?php } else { ?>
                                                <td class="text-center">
                                                    0
                                                    <?php $nov = 0; ?>
                                                    <?php $tnov += $nov; ?>
                                                </td>
                                            <?php } ?>


                                            <?php if ($data[0]['payment_month'] == "December"  && $data[0]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[0]['amt']; ?>
                                                    <?php $dec = $data[0]['amt']; ?>
                                                    <?php $tdec += $dec; ?>

                                                <?php } else if ($data[1]['payment_month'] == "December"  && $data[1]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[1]['amt']; ?>
                                                    <?php $dec = $data[1]['amt']; ?>
                                                    <?php $tdec += $dec; ?>

                                                <?php } else if ($data[2]['payment_month'] == "December"  && $data[2]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[2]['amt']; ?>
                                                    <?php $dec = $data[2]['amt']; ?>
                                                    <?php $tdec += $dec; ?>

                                                <?php } else { ?>
                                                <td class="text-center">
                                                    0
                                                    <?php $dec = 0; ?>
                                                    <?php $tdec += $dec; ?>
                                                </td>
                                            <?php } ?>


                                            <?php if ($data[0]['payment_month'] == "January"  && $data[0]['amt'] > 0 ) { ?>
                                                <td class="text-center">
                                                    <?= $data[0]['amt']; ?>
                                                    <?php $jan = $data[0]['amt'] ; ?>
                                                    <?php $tjan += $jan; ?>

                                                <?php } else if ($data[1]['payment_month'] == "January"  && $data[1]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[1]['amt']; ?>
                                                    <?php $jan = $data[1]['amt']; ?>
                                                    <?php $tjan += $jan; ?>

                                                <?php } else if ($data[2]['payment_month'] == "January"  && $data[2]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[2]['amt']; ?>
                                                    <?php $jan = $data[2]['amt']; ?>
                                                    <?php $tjan += $jan; ?>

                                                <?php } else if ($data[3]['payment_month'] == "January"  && $data[3]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[3]['amt']; ?>
                                                    <?php $jan = $data[3]['amt']; ?>
                                                    <?php $tjan += $jan; ?>

                                                <?php } else if ($data[4]['payment_month'] == "January"  && $data[4]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[4]['amt']; ?>
                                                    <?php $jan = $data[4]['amt']; ?>
                                                    <?php $tjan += $jan; ?>

                                                <?php } else { ?>
                                                <td class="text-center">
                                                    0
                                                    <?php $jan = 0; ?>
                                                    <?php $tjan += $jan; ?>
                                                </td>
                                            <?php } ?>


                                            <?php if ($data[0]['payment_month'] == "February"  && $data[0]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[0]['amt']; ?>
                                                    <?php $feb = $data[0]['amt']; ?>
                                                    <?php $tfeb += $feb; ?>

                                                <?php } else if ($data[1]['payment_month'] == "February"  && $data[1]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[1]['amt']; ?>
                                                    <?php $feb = $data[1]['amt']; ?>
                                                    <?php $tfeb += $feb; ?>

                                                <?php } else if ($data[2]['payment_month'] == "February"  && $data[2]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[2]['amt']; ?>
                                                    <?php $feb = $data[2]['amt']; ?>
                                                    <?php $tfeb += $feb; ?>

                                                <?php } else if ($data[3]['payment_month'] == "February"  && $data[3]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[3]['amt']; ?>
                                                    <?php $feb = $data[3]['amt']; ?>
                                                    <?php $tfeb += $feb; ?>

                                                <?php } else { ?>
                                                <td class="text-center">
                                                    0
                                                    <?php $feb = 0; ?>
                                                    <?php $tfeb += $feb; ?>
                                                </td>
                                            <?php } ?>









                                            <?php if ($data[0]['payment_month'] == "March"  && $data[0]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[0]['amt']; ?>
                                                    <?php $mar = $data[0]['amt']; ?>
                                                    <?php $tmar += $mar; ?>

                                                <?php } else if ($data[1]['payment_month'] == "March"  && $data[1]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[1]['amt']; ?>
                                                    <?php $mar = $data[1]['amt']; ?>
                                                    <?php $tmar += $mar; ?>

                                                <?php } else if ($data[2]['payment_month'] == "March"  && $data[2]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[2]['amt']; ?>
                                                    <?php $mar = $data[2]['amt']; ?>
                                                    <?php $tmar += $mar; ?>

                                                <?php } else if ($data[3]['payment_month'] == "March"  && $data[3]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[3]['amt']; ?>
                                                    <?php $mar = $data[3]['amt']; ?>
                                                    <?php $tmar += $mar; ?>

                                                <?php } else if ($data[4]['payment_month'] == "March"  && $data[4]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[4]['amt']; ?>
                                                    <?php $mar = $data[4]['amt']; ?>
                                                    <?php $tmar += $mar; ?>

                                                <?php } else if ($data[5]['payment_month'] == "March"  && $data[5]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[5]['amt']; ?>
                                                    <?php $mar = $data[5]['amt']; ?>
                                                    <?php $tmar += $mar; ?>

                                                <?php } else  if ($data[6]['payment_month'] == "March"  && $data[6]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[6]['amt']; ?>
                                                    <?php $mar = $data[6]['amt']; ?>
                                                    <?php $tmar += $mar; ?>

                                                <?php } else  if ($data[7]['payment_month'] == "March"  && $data[7]['amt'] > 0) { ?>
                                                <td class="text-center">
                                                    <?= $data[7]['amt']; ?>
                                                    <?php $mar = $data[7]['amt']; ?>
                                                    <?php $tmar += $mar; ?>

                                                <?php } else { ?>
                                                <td class="text-center">
                                                    0
                                                    <?php $mar = 0; ?>
                                                    <?php $tmar += $mar; ?>
                                                </td>
                                            <?php } ?>









                                            <td class="text-center">
                                                <?= $total = $jan + $feb + $mar + $apr + $may + $jun + $jul + $aug + $sept + $nov + $dec; ?>
                                                <?php $totals += $total; ?>

                                            </td>
                                            <?php if ($type == "thrift") { ?>
                                                <td class="text-center">
                                                    <?= $data[0]['cb']; ?>
                                                    <?php $cb = $data[0]['cb']; ?>
                                                    <?php $tcb += $cb; ?>
                                                </td>
                                            <?php } else { ?>
                                                <td class="text-center">
                                                    <?php $cbs =  $data[0]['cb'] + $jan + $feb + $mar + $apr + $may + $jun + $jul + $aug + $sept + $nov + $dec;  ?>
                                                    <?= $cbs   ?>
                                                    <?php $cb = $cbs ;  ?>
                                                    <?php $tcb += $cb; ?>
                                                </td>
                                            <?php } ?>


                                            <?php $sno++; ?>
                                        <?php endforeach; ?>
                                    <?php } else { ?>
                                        <tr>
                                            <td colspan="18">
                                                <center>
                                                    <h2>No Record Found</h2>
                                                </center>
                                            </td>
                                        </tr>
                                    <?php } ?>
                            </tbody>

                            <tfoot>
                                <tr>
                                    <td class="text-center" colspan="2">
                                        <b> Total </b>
                                    </td>
                                    <td class="text-center">
                                        <b> <?= $tapr; ?></b>

                                    </td>
                                    <td class="text-center">
                                        <b> <?= $tmay; ?></b>

                                    </td>
                                    <td class="text-center">
                                        <b> <?= $tjun; ?></b>

                                    </td>
                                    <td class="text-center">
                                        <b> <?= $tjul; ?></b>

                                    </td>
                                    <td class="text-center">
                                        <b> <?= $taug; ?></b>

                                    </td>
                                    <td class="text-center">
                                        <b> <?= $tsept; ?></b>

                                    </td>
                                    <td class="text-center">
                                        <b> <?= $toct; ?></b>

                                    </td>
                                    <td class="text-center">
                                        <b> <?= $tnov; ?></b>

                                    </td>
                                    <td class="text-center">
                                        <b> <?= $tdec; ?></b>

                                    </td>
                                    <td class="text-center">
                                        <b> <?= $tjan; ?></b>

                                    </td>
                                    <td class="text-center">
                                        <b> <?= $tfeb; ?></b>

                                    </td>
                                    <td class="text-center">
                                        <b> <?= $tmar; ?></b>

                                    </td>

                                    <td class="text-center">
                                        <b> <?= $totals; ?></b>
                                    </td>
                                    <td class="text-center">
                                        <b> <?= $tcb; ?></b>
                                    </td>

                                </tr>
                            </tfoot>

                        </table>





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



          
<style>
 div.dt-buttons{
        margin-left: 176px;
    }
    div.dataTables_wrapper div.dataTables_length label {
        position: absolute;
    }
    div.dataTables_wrapper div.dataTables_filter {
        text-align: right;
        margin-top: -37px;
    }

    .copyButton {
background-color: #dc3545;
border: 1px solid white;
}
.excelButton {
background-color: #dc3545;
border: 1px solid white;

}
.pdfButton{
background-color: #dc3545;
border: 1px solid white;

}
.printButton {
background-color: #dc3545;
border: 1px solid white;

}
.colvisButton{
background-color: #dc3545;
border: 1px solid white;

}
</style>
            


<script>
    var table = $('#recover_table_id').DataTable({
        "processing": true,
        "dom": 'lBfrtip',
        "lengthMenu": [
            [100, 250, 500, 1000, -1],
            [100, 250, 500, 1000, "All"]
        ],
        "buttons": 
        {
    buttons: [
        { extend: 'copy', className: 'copyButton' },
        { extend: 'excel', className: 'excelButton' },
        { extend: 'pdf', className: 'pdfButton' },
        { extend: 'print', className: 'printButton' },
        { extend: 'colvis', className: 'colvisButton' },
    ]
}
        
    });
</script>