<?php include 'controller/pageCode.php' ?>
<!DOCTYPE html>
<html lang="en">
 <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<head>
    <meta charset="utf-8">
    <title>Income Summary</title>
    <?php include 'inc/meta_inc.php'; ?>
    <!-- base css -->
    <?php include 'inc/styles_inc.php'; ?>
    <link rel="stylesheet" media="screen, print" href="assets/css/markdown.css">
    <link rel="stylesheet" media="screen, print" href="assets/css/page-invoice.css">
    <link rel="stylesheet" media="screen, print" href="assets/css/formplugins/bootstrap-datepicker/bootstrap-datepicker.css">
</head>
    <body class="mod-bg-1 ">
        <!-- DOC: script to save and load page settings -->
        <?php include 'inc/theme_script_inc.php'; ?>
        <!-- BEGIN Page Wrapper -->
        <div class="page-wrapper" id="app">
            <div class="page-inner">
                <!-- BEGIN Left Aside -->
        <?php include 'inc/aside_inc.php'; ?>
<!-- END Left Aside -->
                <div class="page-content-wrapper">
                    <!-- BEGIN Page Header -->
        <?php include 'inc/header_inc.php'; ?>
<!-- END Page Header -->
                    <!-- BEGIN Page Content -->
                    <!-- the #js-page-content id is needed for some plugins to initialize -->
                    <main id="js-page-content" role="main" class="page-content">
                        <ol class="breadcrumb page-breadcrumb">
                            <li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li>
                        </ol>
                        <?php if(isset($slip_id)): ?>
                            <?php if($pay_slip_details&&$pay_slip_details[0]['employee_email']): ?>
                        
                        <div class="container">
                            <div data-size="A4">
                                <div class="row">
                                    <div class="col-sm-12">
                                        <div class="d-flex align-items-center mb-5">
                                            <h2 class="keep-print-font fw-500 mb-0 text-primary flex-1 position-relative">
                                                3f3 Training Academy
                                                <small class="text-muted mb-0 fs-xs">
                                                Kronum Kwapra Street,Kumasi, Ghana
                                                </small>
                                                
                                                <small class="text-muted mb-0 fs-xs">
                                                <b>Tel:</b> +233 (0) 559184881
                                                </small>
                                                <!-- barcode demo only -->
                                                <!-- <div  class="float-right">
                                                    <img src="assets/img/3f3logo.png" class="img img-responsive" alt="">
                                                </div> -->
                                            </h2>
                                            
                                            <div  class="float-left">
                                            <img class="img img-reponsive" style="width:100px;height:auto" src="pictures/<?php echo $pay_slip_details[0]['employee_picture'] ?>" alt="">
                                            <br>
                                            <h2 class="keep-print-font fw-500 mb-0 text-primary flex-1 position-relative">
                                                <?php echo $pay_slip_details[0]['employee_name'] ?>
                                                <small class="text-muted mb-0 fs-xs">
                                                <?php echo $pay_slip_details[0]['employee_email'] ?>
                                                </small>
                                                
                                                <small class="text-muted mb-0 fs-xs">
                                                <b><?php echo $pay_slip_details[0]['employee_phone'] ?></b>
                                                </small>
                                                <small class="text-muted mb-0 fs-xs">
                                                 <?php  $newDate = strtotime($pay_slip_details[0]['payment_date']); echo date('D M j, Y',$newDate) ?>
                                                </small>
                                                <!-- barcode demo only -->
                                                <div  class="float-right">
                                                </div>
                                            </h2>
                                            </div>
                                            
                                            
                                        </div>
                                        <hr>
                                    </div>
                                   
                                </div>
                                <div class="row">
                                    <div class="col-sm-12">
                                    <center>
                                        <h3 class="fw-300 display-4 fw-500 color-primary-600 keep-print-font pt-4 l-h-n m-0">
                                            Pay Slip 
                                        </h3>
                                        </center>
                                        <br>
                                            <table class="table table-stripped">
                                                <thead>
                                                    <tr>
                                                        <th>Basic Salary</th>
                                                        <th>Commission</th>
                                                        <th>Tax</th>
                                                        <th>Gross Income</th>
                                                        <th>Net Income</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td><?php echo $pay_slip_details[0]['basic_salary'] ?></td>
                                                        <td><?php echo $pay_slip_details[0]['reward'] ?></td>
                                                        <td><?php echo $pay_slip_details[0]['tax'] ?></td>
                                                        <td><?php echo $gross = floatval($pay_slip_details[0]['basic_salary'])+floatval($pay_slip_details[0]['reward']) ?></td>
                                                        <td><?php echo floatval($gross)-floatval($pay_slip_details[0]['tax']) ?></td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php else: ?>
                        <div class="container">
                            <div data-size="A4">
                                <div class="row">
                                </div>
                                <div class="row">
                                    <div class="col-sm-3"></div>
                                    <div class="col-sm-6">
                                    <center>
                                        <h3 class="fw-300 display-4 fw-500 color-primary-600 keep-print-font pt-4 l-h-n m-0">
                                            Pay Slip
                                        </h3>
                                    </center>
                                        <center>
                                            <h3 class="fw-100 keep-print-font pt-4 l-h-n m-0">Record Not Found!</h3>
                                            
                                            
                                        </center>
                                    </div>
                                    <div class="col-sm-3"></div>
                                </div>
                                <div class="row">
                                    <div class="col-sm-12">
                                        <h4 class="py-5 text-primary">
                                        </h4>
                                        <p class="mt-2 text-muted mb-0">
                                            
                                        </p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    <?php endif ?>
                    <center><button id="print" class="btn btn-primary d-print-none">Print</button></center>
                    
                        <?php endif ?>
                    </main>
                    <!-- END Page Content -->
                    <!-- this overlay is activated only when mobile menu is triggered -->
<div class="page-content-overlay" data-action="toggle" data-class="mobile-nav-on"></div>
<!-- BEGIN Page Footer -->
<?php include 'inc/footer_inc.php' ?>
<!-- END Page Footer -->
<!-- BEGIN Shortcuts -->
<!-- modal shortcut -->
<?php //include 'inc/header_menu.php'; ?>
 <!-- END Shortcuts -->
                </div>
            </div>
        </div>
        
<!-- END Quick Menu -->
<!-- BEGIN Page Settings -->
 <!-- END Page Settings -->
<?php include 'inc/script_inc.php' ?>
        <script src="assets/js/datagrid/datatables/datatables.bundle.js"></script>
        <script src="assets/js/formplugins/bootstrap-datepicker/bootstrap-datepicker.js"></script>
        <script>
            var controls = {
            leftArrow: '<i class="fal fa-angle-left" style="font-size: 1.25rem"></i>',
            rightArrow: '<i class="fal fa-angle-right" style="font-size: 1.25rem"></i>'
            }

            var runDatePicker = function()
            {
                // range picker
                $('#datepicker-5').datepicker(
                {
                    todayHighlight: true,
                    clearBtn:true,
                    templates: controls
                });
            }
            $.fn.digits = function(){ 
                return this.each(function(){ 
                    $(this).text( $(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") ); 
                })
            }
            $(document).ready(function()
            {
                // Event Lot
                var events = $("#app-eventlog");
                runDatePicker();

                $('#print').click(function(){
                    window.print();
                })
                
                $('#search').on('click',function(){
                    start = $('#start').val();
                    end = $('#end').val();
                    window.location.replace("income_report_summary.php?summary=&&start="+start+"&&end="+end);
                });
                
            });
            
        </script>
<!-- Modal Large -->
    </body>

</html>
