<?php $__env->startSection('title', 'Manage CashBook'); ?>
<?php $__env->startSection('body'); ?>
    <!--app-content open-->


    <!-- PAGE-HEADER -->
    <div class="page-header">
        <div>
            <h1 class="page-title">Daily Profit Loss Report</h1>
        </div>
        <div class="ms-auto pageheader-btn">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="<?php echo e(route('cashBook')); ?>">Profit</a></li>
                <li class="breadcrumb-item active" aria-current="page">Profit Report</li>
            </ol>
        </div>
    </div>
    <!-- PAGE-HEADER END -->

    <!-- Row -->
    <div class="row row-sm">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header border-bottom">
                    <?php if(isset($selectedMonth)): ?>
                        <h4>Report for: <?php echo e(\Carbon\Carbon::parse($selectedMonth . '-01')->format('F Y')); ?></h4>
                        <button id="openModalBtn" class="btn btn-primary ms-auto" data-toggle="modal" data-target="#module">Select Date</button>
                    <?php endif; ?>

                </div>
                <div class="card-body">
                    <div class="">

                    </div>
                    <div class="table-responsive export-table">
                        <table id="file-datatable" class="table table-bordered text-nowrap key-buttons border-bottom  w-100">
                            <thead>
                            <tr>
                                <th class="border-bottom-0">SL No</th>
                                <th class="border-bottom-0">Date</th>
                                <th class="border-bottom-0">Income</th>
                                <th class="border-bottom-0">Expenses</th>
                                <th class="border-bottom-0">Profit</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php $__currentLoopData = $monthlyCashBookSummary; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cashBook): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                        <td><?php echo e($loop->iteration); ?></td>
                                        <?php if(isset($cashBook->date)): ?>
                                        <td><?php echo e(\Carbon\Carbon::parse($cashBook->date)->format('d-M-Y') ?? " "); ?></td>
                                        <?php else: ?>
                                        <td><?php echo e(\Carbon\Carbon::parse($cashBook->month . '-01')->format('M-Y')); ?></td>
                                       <?php endif; ?>

                                        <td><?php echo e(number_format($cashBook->total_dr, 0)); ?></td>
                                        <td><?php echo e(number_format($cashBook->total_cr, 0)); ?></td>
                                        <td><?php echo e(number_format($cashBook->total_dr - $cashBook->total_cr, 0)); ?></td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- End Row -->
    <!-- CONTAINER CLOSED -->


    <div class="modal fade" id="module" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel">Input Bank Detail</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">

                    <form class="form-horizontal" action="<?php echo e(route('report.month')); ?>" method="POST" enctype="multipart/form-data">
                        <?php echo csrf_field(); ?>
                        <div class="row">
                            <div class="col-md-12 col-xl-12">
                                <div class="form-group">
                                    <label for="place-top-left" class="form-label">Start Date</label>
                                    <input type="month" class="form-control" name="month" maxlength="25" id="place-top-left">
                                </div>
                            </div>
                            <div class="col-md-12 col-xl-3">
                                <div class="form-group">
                                    <button class="btn btn-primary " type="submit">Find Report</button>
                                </div>
                            </div>
                        </div>
                    </form>

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

<?php $__env->stopSection(); ?>



<?php echo $__env->make($master, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\primary\resources\views/admin/report/index.blade.php ENDPATH**/ ?>