<div class='row'>
    <div class='col-md-5'>

        <?php
        $query = mysqli_query($conn, "SELECT *,SUM(NetSalary) AS TOTAL FROM payroll WHERE Year = '$year' AND Month = '$month'");
        while ($spec = mysqli_fetch_assoc($query)) {
            echo "<span style='font-weight:500; font-size:12px; text-transform:uppercase;'>TOTAL TAKE HOME SALARIES:</span> <span style='font-size:10px;'>GH&#8373;</span> <span style='font-size:20px;'>" . number_format($spec['TOTAL'], 2, '.', ',') . "</span><br>";
        }

        $query = mysqli_query($conn, "SELECT *,SUM(NetSalary) AS TOTAL FROM payroll WHERE Year = '$year' AND Month = '$month' AND StaffType = 'Teacher' ");
        while ($spec = mysqli_fetch_assoc($query)) {
            echo "<span style='font-weight:500; font-size:9px;'><span style='font-weight:700; color:red;'>TEACHING</span>:</span> <span style='font-size:10px;'>GH&#8373;</span> <span style='font-size:15px;'>" . number_format($spec['TOTAL'], 2, '.', ',') . "</span> |";
        }

        $query = mysqli_query($conn, "SELECT *,SUM(NetSalary) AS TOTAL FROM payroll WHERE Year = '$year' AND Month = '$month' AND StaffType = 'Non-Teacher'");
        while ($spec = mysqli_fetch_assoc($query)) {
            echo "<span style='font-weight:500; font-size:9px;'><span style='font-weight:700; color:green;'>NON-TEACHING</span>:</span> <span style='font-size:10px;'>GH&#8373;</span> <span style='font-size:15px;'>" . number_format($spec['TOTAL'], 2, '.', ',') . "</span>";
        }

        ?>

    </div>

    <div class='col-md-7'>
        <div class='row'>
            <div class='col-md-6' style='padding:0px;'>
                <?php
                echo "<div class='col-md-12'  style='padding:0px;'>";
                $query = mysqli_query($conn, "SELECT *,SUM(GrossSalary) AS TOTAL FROM payroll WHERE Year = '$year' AND Month = '$month'");
                while ($spec = mysqli_fetch_assoc($query)) {
                    echo "
                                    <a href='#' style='text-decoration:none;'  data-id='myModal_newStudentTotal'>
                                    <span style='font-weight:500; font-size:9px;'>TOTAL <span style='font-size:12px; color: orange;'>GROSS</span> SALARIES: GH&#8373; </span> <span style='font-size:18px;'>" . number_format($spec['TOTAL'], 2, '.', ',') . "</span>
                                    </a>
                                    ";
                }
                echo "</div>";
                ?>

                <div class='col-md-12' style='padding:0px;'>
                    <div class='row'>
                        <?php
                        echo "<div class='col-md-6'>";
                        $query = mysqli_query($conn, "SELECT *,SUM(BasicSalary) AS TOTAL FROM payroll WHERE Year = '$year' AND Month = '$month'");
                        while ($spec = mysqli_fetch_assoc($query)) {
                            echo "
                                            <a href='#' style='text-decoration:none;'  data-id='myModal_defaultersTotal'>
                                            <span style='font-weight:500; font-size:1px;'><span style='font-size:10px;'>BASIC: GH&#8373; </span> <span style='font-size:15px;'>" . number_format($spec['TOTAL'], 2, '.', ',') . "</span> 
                                            </a> 
                                            ";
                        }
                        echo "</div> ";


                        echo "<div class='col-md-6'>";
                        $query = mysqli_query($conn, "SELECT *,SUM(Allowances) AS TOTAL FROM payroll WHERE Year = '$year' AND Month = '$month'");
                        while ($spec = mysqli_fetch_assoc($query)) {
                            echo "
                                            <a href='#' style='text-decoration:none;'  data-id='myModal_defaultersTotal'>
                                            <span style='font-weight:500; font-size:1px;'><span style='font-size:10px;'>ALLOWANCES: GH&#8373; </span> <span style='font-size:15px;'>" . number_format($spec['TOTAL'], 2, '.', ',') . "</span>
                                            </a>
                                            ";
                        }
                        echo "</div>";
                        ?>
                    </div>
                </div>
            </div>

            <div class='col-md-6' style='padding:0px;'>
                <?php
                echo "<div class='col-md-12'  style='padding:0px;'>";
                $query = mysqli_query($conn, "SELECT *,SUM(SsnitContribution) AS TOTAL,SUM(PAYE) AS TOTAL1, SUM(OtherDeductions) AS TOTAL2 FROM payroll WHERE Year = '$year' AND Month = '$month'");
                while ($spec = mysqli_fetch_assoc($query)) {
                    $ssnitcontribution = $spec['TOTAL'];
                    $paye = $spec['TOTAL1'];
                    $otherdeductions = $spec['TOTAL2'];
                    $deductions = $ssnitcontribution + $paye + $otherdeductions;
                    echo "
                                    <a href='#' style='text-decoration:none;'  data-id='myModal_newStudentTotal'>
                                    <span style='font-weight:500; font-size:9px;'>TOTAL <span style='font-size:12px; color: fuchsia;'>DEDUCTIONS</span>: GH&#8373; </span> <span style='font-size:18px;'>" . number_format($deductions, 2, '.', ',') . "</span>
                                    </a>
                                    ";
                }
                echo "</div>";
                ?>

                <div class='col-md-12' style='padding:0px;'>
                    <div class='row'>
                        <?php
                        echo "<div class='col-md-6'>";
                        $query = mysqli_query($conn, "SELECT *,SUM(SsnitContribution) AS TOTAL, SUM(PAYE) AS TOTAL1 FROM payroll WHERE Year = '$year' AND Month = '$month'");
                        while ($spec = mysqli_fetch_assoc($query)) {
                            $ssnitcontribution = $spec['TOTAL'];
                            $paye = $spec['TOTAL1'];
                            $taxssnit = $ssnitcontribution + $paye;
                            echo "
                                            <a href='#' style='text-decoration:none;'  data-id='myModal_defaultersTotal'>
                                            <span style='font-weight:500; font-size:1px;'><span style='font-size:10px;'>SSNIT & TAX: GH&#8373; </span> <span style='font-size:15px;'>" . number_format($taxssnit, 2, '.', ',') . "</span> 
                                            </a> 
                                            ";
                        }
                        echo "</div> ";


                        echo "<div class='col-md-6'>";
                        $query = mysqli_query($conn, "SELECT *,SUM(OtherDeductions) AS TOTAL FROM payroll WHERE Year = '$year' AND Month = '$month'");
                        while ($spec = mysqli_fetch_assoc($query)) {
                            echo "
                                            <a href='#' style='text-decoration:none;'  data-id='myModal_defaultersTotal'>
                                            <span style='font-weight:500; font-size:1px;'><span style='font-size:10px;'>OTHER: GH&#8373; </span> <span style='font-size:15px;'>" . number_format($spec['TOTAL'], 2, '.', ',') . "</span>
                                            </a>
                                            ";
                        }
                        echo "</div>";
                        ?>
                    </div>
                </div>
            </div>
        </div>



    </div>


</div>