<?php $__env->startSection('title'); ?>
<?php echo e($Type); ?> Statement
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<style>
  .pdf-page {
    page-break-after: always;
    padding: 20px;
    background: white;
  }

  .pdf-page:last-child {
    page-break-after: auto;
  }
</style>


<div class="d-sm-flex align-items-center justify-content-between mb-4">
                        <h1 class="h3 mb-0 text-gray-800">Accounting Report</h1>
                      </div>

                    <div class="card shadow mb-4">
                        <div class="card-header py-3">
                            <h6 class="m-0 font-weight-bold text-primary"   id="formHeader"><?php echo e($Type); ?> Statement</h6>
                        </div>
                        <?php if(session('success')): ?>
                            <div class="alert alert-success" id="successMessage"  style="margin: 20px;">
                                <?php echo e(session('success')); ?>

                            </div>
                        <?php endif; ?>

                        <?php if($errors->any()): ?>

                                    <div class="form-group"  id="successMessage"  style="margin: 20px;">
                                        <div class="card bg-warning text-white shadow">
                                            <div class="card-body">

                                                <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <div style="color: red; "><?php echo e($error); ?></div>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                            </div>
                                        </div>
                                    </div>
                                    <?php endif; ?>
                            <form class="card-body" action="<?php echo e(route('fetchTransactions')); ?>" method="post"  id="accountTypeForm">
                            <?php echo csrf_field(); ?>
                            <input type="hidden" id="accountId" name="id" value="">
                            <input type="hidden" class="form-control form-control-user" id="Type" placeholder="" name="Type"  value="<?php echo e($Type); ?>" required >

                                <div class="form-group row">
                                    <div class="col-sm-4 mb-3 mb-sm-0">
                                    <select class="form-control form-control-user" id="account" name="account"  value="<?php echo e(old('account')); ?>">
                                        <option value="" disabled selected><?php echo e($Type); ?> Account</option>
                                        <option value="all">All Accounts</option>

                                        <?php $__currentLoopData = $Accounts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $Account): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                        <option value="<?php echo e($Account->AccCode.':'.$Account->AccSubCode); ?>"><?php echo e($Account->AccSubCode.'/'.$Account->AccName); ?></option>

                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                    </div>
                                    <div class="col-sm-4 mb-3 mb-sm-0">
                                        <input type="date" class="form-control form-control-user" id="from" placeholder="from" name="from" value="<?php echo e(old('date', \Carbon\Carbon::now()->format('Y-m-d'))); ?>" required>
                                    </div>
                                    <div class="col-sm-4">
                                        <input type="date" class="form-control form-control-user" id="to" placeholder="to" name="to"  value="<?php echo e(old('date', \Carbon\Carbon::now()->format('Y-m-d'))); ?>" required>
                                    </div>

                                </div>
                                  <?php if($Type == "Tenant"): ?>
                                    <div class="form-group row">
                                        <div class="col-sm-4 mb-3 mb-sm-0">
                                            <select class="form-control form-control-user" id="floor_from" name="floor_from">
                                                <option value="" disabled selected>From Floor</option>
                                                <?php $__currentLoopData = $floors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $floor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($floor->FloorNumber); ?>"><?php echo e($floor->FloorNumber); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </div>
                                        <div class="col-sm-4 mb-3 mb-sm-0">
                                            <select class="form-control form-control-user" id="floor_to" name="floor_to">
                                                <option value="" disabled selected>To Floor</option>
                                                <?php $__currentLoopData = $floors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $floor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($floor->FloorNumber); ?>"><?php echo e($floor->FloorNumber); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </div>
                                        <div class="col-sm-4">
                                            <select class="form-control form-control-user" id="account_type" name="statement_type">
                                                <option value="" disabled selected>Select Statement Type</option>
                                                <option value="1000">Rent Receivable</option>
                                                <option value="4200">Operational Costs</option>
                                                <option value="both">Both</option>
                                            </select>
                                        </div>
                                    </div>
                                    <?php endif; ?>

                                <div class="form-group row">
                                    <div class="col-sm-4 mb-3 mb-sm-0">
                                    <select class="form-control form-control-user" id="curr" name="curr"  value="<?php echo e(old('curr')); ?>"  required>
                                        <option value="" disabled selected>Select Currency</option>

                                        <?php $__currentLoopData = $currencys; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $currency): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                        <option value="<?php echo e($currency->ID); ?>"><?php echo e($currency->Name); ?></option>

                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                    </div>
                                </div>

                               <div style="display: flex;">
                               <input type="submit" style="width: 100px;height: 40px; margin-right: 10px; margin-top: 6px" value="View" class="btn btn-primary btn-user btn-block" id="submitButton"/>

                               <input style="width: 100px;"    type="reset" value="Refresh" class="btn btn-secondary btn-user btn-block"  onclick="hideMessages()"/>
                               </div>
                                <hr>
                             </form>
                             <?php
                            use Carbon\Carbon;
                            $todayLongDate = Carbon::now()->format(' F j, Y');
                            ?>

                        <?php if(!empty($trans)): ?>

                        <div class="card-body">
                            <div class="table-responsive">
                            <button id="download-pdf" style="float: right; margin: 5px;" class="btn btn-primary">Download PDF</button>

                             <div>
                                    <div class="py-4">
                                      <div class="px-14 py-6">
                                        <table class="w-full border-collapse border-spacing-0">
                                          <tbody>
                                            <tr>
                                              <td class="w-full align-top">
                                              <div style="display: flex;">
                                                    <img style="width: 100px; height: 100px;" src="<?php echo asset('img/logo.png'); ?>" class="h-12" />
                                                    <p class="whitespace-nowrap font-bold text-main text-10xl ml-4" style="margin-top: 30px; font: 30px;"><?php echo e($name); ?> Statement</p>
                                                </div>
                                              </td>
                                              <td class="align-top">
                                                <div class="text-sm">
                                                  <table class="border-collapse border-spacing-0">
                                                    <tbody>
                                                      <tr>
                                                        <td class="border-r pr-4">
                                                          <div>
                                                            <p class="whitespace-nowrap text-slate-400 text-right">Date</p>

                                                            <p class="whitespace-nowrap font-bold text-main text-right"><?php echo e($todayLongDate); ?></p>
                                                          </div>
                                                        </td>
                                                        <td class="pl-4">
                                                          <div>
                                                            <p class="whitespace-nowrap text-slate-400 text-right">Account</p>
                                                            <p class="whitespace-nowrap font-bold text-main text-right"><?php echo e($code); ?></p>
                                                          </div>
                                                        </td>
                                                      </tr>
                                                    </tbody>
                                                  </table>
                                                </div>
                                              </td>
                                            </tr>
                                          </tbody>
                                        </table>
                                      </div>
                                      <div class="bg-slate-100 px-14 py-6 text-sm">
                                        <table class="w-full border-collapse border-spacing-0">
                                          <tbody>
                                          <tr>
                                              <td class="w-1/2 align-top">
                                                <div class="text-sm text-neutral-600">
                                                <?php $__currentLoopData = $pdetails; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pdetail): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                                  <p class="font-bold"><?php echo e($pdetail->Name); ?></p>
                                                  <p><?php echo e($pdetail->Address); ?></p>
                                                  <p><?php echo e($pdetail->Email); ?></p>
                                                  <p><?php echo e($pdetail->Phone); ?></p>

                                                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                                </div>
                                              </td>
                                              <td class="w-1/2 align-top text-right">
                                                <div class="text-sm text-neutral-600">
                                                <?php $__currentLoopData = $cst; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cs): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                                  <p class="font-bold"><?php echo e($cs->Name); ?></p>
                                                  <p><?php echo e($cs->Address); ?></p>
                                                  <p><?php echo e($cs->Email); ?></p>
                                                  <p><?php echo e($cs->Contact); ?></p>
                                                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </div>
                                              </td>
                                            </tr>
                                            <tr>
                                              <td class="w-1/2 align-top">
                                                <div class="text-sm text-neutral-600">

                                                <p class="font-bold">Currency: <?php echo e($currnames); ?></p>
                                                  <p>From: <?php echo e($from); ?> To: <?php echo e($to); ?></p>

                                                </div>
                                              </td>
                                              <td class="w-1/2 align-top text-right">
                                                <div class="text-sm text-neutral-600">
                                                </div>
                                              </td>
                                            </tr>
                                          </tbody>
                                        </table>
                                      </div>
                                      <div class="px-14 py-10 text-sm text-neutral-700">
                                        <table class="w-full border-collapse border-spacing-0">
                                          <thead>
                                            <tr>
                                              <td class="border-b-2 border-main pb-3 pl-2 font-bold text-main">Date</td>
                                              <td class="border-b-2 border-main pb-3 pl-2 font-bold text-main">Description</td>
                                              <td class="border-b-2 border-main pb-3 pl-2 text-right font-bold text-main">Reference</td>
                                              <td class="border-b-2 border-main pb-3 pl-2 pr-3 text-right font-bold text-main">DR</td>
                                              <td class="border-b-2 border-main pb-3 pl-2 pr-3 text-right font-bold text-main">CR</td>
                                              <td class="border-b-2 border-main pb-3 pl-2 pr-3 text-right font-bold text-main">Balance</td>
                                            </tr>
                                          </thead>
                                          <tbody>
                                    <?php
                                        $b = $openingBalance; // Initialize $b
                                        $dr=0;
                                        $cr=0;
                                    ?>
                                    <tr>
                                    <td class="border-b py-3 pl-2"><?php echo e($from); ?></td>
                                    <td class="border-b py-3 pl-2">Opening Balance</td>
                                    <td class="border-b py-3 pl-2 text-right"></td>
                                    <?php
                                    if($b=="Supplier")
                                    {

                                    if($b<0)
                                    {
                                      $dr=$b;
                                      $cr=0;

                                    }
                                    else
                                    {
                                      $dr=0;
                                      $cr=$b;

                                    }
                                    }
                                    else
                                    {

                                      if($b<0)
                                    {

                                      $dr=0;
                                      $cr=$b*(-1);
                                    }
                                    else
                                    {
                                      $dr=$b;
                                      $cr=0;
                                    }
                                    }

                                    ?>
                                    <td class="border-b py-3 pl-2 pr-3 text-right"><?php echo e(number_format($dr, 2)); ?></td>
                                    <td class="border-b py-3 pl-2 pr-3 text-right"><?php echo e(number_format($cr, 2)); ?></td>

                                    <td class="border-b py-3 pl-2 pr-3 text-right">
                                        <?php if($b < 0): ?>
                                            (<?php echo e(number_format(abs($b), 2)); ?>)
                                        <?php else: ?>
                                            <?php echo e(number_format($b, 2)); ?>

                                        <?php endif; ?>
                                    </td>

                                    </tr>

                            <?php $__currentLoopData = $trans; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tran): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                              <tr>
                                <td class="border-b py-3 pl-2"><?php echo e($tran->EntryDate); ?></td>
                                <td class="border-b py-3 pl-2"><?php echo e($tran->MNarration); ?></td>
                                <?php
                                if($Type=="Supplier")
                                {

                                  $b = $b+ ($tran->DR-$tran->CR);
                                  }
                                  else
                                  {
                                    $b = $b+ ($tran->CR-$tran->DR);
                                  }
                                  ?>

                                <td class="border-b py-3 pl-2 text-right"><?php echo e($tran->Batch); ?></td>
                                <?php
                                if($Type=="Supplier")
                                {
                                $dr=$tran->DR;
                                $cr=$tran->CR;
                                }
                                else
                                {

                                  $dr=$tran->CR;
                                  $cr=$tran->DR;
                                }

                                ?>
                                <td class="border-b py-3 pl-2 pr-3 text-right"><?php echo e(number_format($dr, 2)); ?></td>
                                <td class="border-b py-3 pl-2 pr-3 text-right"><?php echo e(number_format($cr, 2)); ?></td>
                                <td class="border-b py-3 pl-2 pr-3 text-right">
                                    <?php if($b < 0): ?>
                                        (<?php echo e(number_format(abs($b), 2)); ?>)
                                    <?php else: ?>
                                        <?php echo e(number_format($b, 2)); ?>

                                    <?php endif; ?>
                                </td>

                              </tr>
                              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                              <tr>
                                <td colspan="9">
                                  <table class="w-full border-collapse border-spacing-0">
                                    <tbody>
                                      <tr>
                                        <td class="w-full"></td>
                                        <td>
                                          <table class="w-full border-collapse border-spacing-0">
                                            <tbody>
                                              <tr>
                                                <td class="bg-main p-3">
                                                  <div class="whitespace-nowrap font-bold text-white">Balance:</div>
                                                </td>
                                                <td class="bg-main p-3 text-right">
                                                  <div class="whitespace-nowrap font-bold text-white"> <?php if($b < 0): ?>
                                                    (<?php echo e(number_format(abs($b), 2)); ?>)
                                                <?php else: ?>
                                                    <?php echo e(number_format($b, 2)); ?>

                                                <?php endif; ?></div>
                                                </td>
                                              </tr>
                                            </tbody>
                                          </table>
                                        </td>
                                      </tr>
                                    </tbody>
                                  </table>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <?php endif; ?>
                <?php if(!empty($allTransactions)): ?>
                <div class="col-12">
                <button id="download-pdf" style="float: right; margin: 5px;" class="btn btn-primary">Download PDF</button>

                <div class="card-body">
                <div class="table-responsive">
                <div>
                <div id="pdf-content">
                <div class="py-4">
                                      <?php $__currentLoopData = $allTransactions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $obj): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                      <div class="px-14 py-10 text-sm text-neutral-700">
                                         <div class="px-14 py-6">
                                        <table class="w-full border-collapse border-spacing-0">
                                          <tbody>
                                            <tr>
                                              <td class="w-full align-top">
                                              <div style="display: flex;">
                                                    <img style="width: 100px; height: 100px;" src="<?php echo asset('img/logo.png'); ?>" class="h-12" />
                                                    <p class="whitespace-nowrap font-bold text-main text-10xl ml-4" style="margin-top: 30px; font: 30px;"><?php echo e($Type); ?> Statement</p>
                                                </div>
                                              </td>
                                              <td class="align-top">
                                                <div class="text-sm">
                                                  <table class="border-collapse border-spacing-0">
                                                    <tbody>
                                                      <tr>
                                                        <td class="border-r pr-4">
                                                          <div>
                                                            <p class="whitespace-nowrap text-slate-400 text-right">Date</p>

                                                            <p class="whitespace-nowrap font-bold text-main text-right"><?php echo e($todayLongDate); ?></p>
                                                          </div>
                                                        </td>
                                                        <td class="pl-4">
                                                          <div>
                                                            <p class="whitespace-nowrap text-slate-400 text-right">Account</p>
                                                            <p class="whitespace-nowrap font-bold text-main text-right"> <?php echo e($obj["code"]); ?></p>
                                                          </div>
                                                        </td>
                                                      </tr>
                                                    </tbody>
                                                  </table>
                                                </div>
                                              </td>
                                            </tr>
                                          </tbody>
                                        </table>
                                      </div>
                                      <div class="bg-slate-100 px-14 py-6 text-sm">
                                        <table class="w-full border-collapse border-spacing-0">
                                          <tbody>
                                          <tr>
                                              <td class="w-1/2 align-top">
                                                <div class="text-sm text-neutral-600">
                                                <?php $__currentLoopData = $pdetails; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pdetail): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                  <p class="font-bold"><?php echo e($pdetail->Name); ?></p>
                                                  <p><?php echo e($pdetail->Address); ?></p>
                                                  <p><?php echo e($pdetail->Email); ?></p>
                                                  <p><?php echo e($pdetail->Phone); ?></p>
                                                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </div>
                                              </td>
                                              <td class="w-1/2 align-top text-right">
                                                <div class="text-sm text-neutral-600">
                                                <p class="whitespace-nowrap font-bold text-main text-right"> <?php echo e($obj["name"]); ?></p>
                                                 <p class="whitespace-nowrap font-bold text-main text-right"><?php echo e($obj["address"]); ?></p>
                                                 <p class="whitespace-nowrap font-bold text-main text-right"><?php echo e($obj["email"]); ?></p>
                                                 <p class="whitespace-nowrap font-bold text-main text-right"><?php echo e($obj["contact"]); ?></p>
                                                </div>
                                              </td>
                                            </tr>
                                            <tr>
                                              <td class="w-1/2 align-top">
                                                <div class="text-sm text-neutral-600">

                                                <p class="font-bold">Currency: <?php echo e($currnames); ?></p>
                                                  <p>From: <?php echo e($from); ?> To: <?php echo e($to); ?></p>

                                                </div>
                                              </td>
                                              <td class="w-1/2 align-top text-right">
                                                <div class="text-sm text-neutral-600">
                                                <p  class="font-bold">Floor: <?php echo e($obj["floor"]); ?>  | Rooms: <?php echo e($obj["rooms"]); ?></p>
                                                <p  class="font-bold">Space: <?php echo e($obj["space"]); ?>sqm</p>
                                                </div>
                                              </td>
                                            </tr>
                                          </tbody>
                                        </table>
                                      </div>
                                      <div class="px-14 py-10 text-sm text-neutral-700">
                                        <table class="w-full border-collapse border-spacing-0">
                                          <thead>
                                            <tr>
                                              <td class="border-b-2 border-main pb-3 pl-2 font-bold text-main">Date</td>
                                              <td class="border-b-2 border-main pb-3 pl-2 font-bold text-main">Description</td>
                                              <td class="border-b-2 border-main pb-3 pl-2 text-right font-bold text-main">Reference</td>
                                              <td class="border-b-2 border-main pb-3 pl-2 pr-3 text-right font-bold text-main">DR</td>
                                              <td class="border-b-2 border-main pb-3 pl-2 pr-3 text-right font-bold text-main">CR</td>
                                              <td class="border-b-2 border-main pb-3 pl-2 pr-3 text-right font-bold text-main">Balance</td>
                                            </tr>
                                          </thead>
                                          <tbody>
                                    <?php
                                        $b = $openingBalance; // Initialize $b
                                        $dr=0;
                                        $cr=0;
                                    ?>
                                    <tr>
                                    <td class="border-b py-3 pl-2"><?php echo e($from); ?></td>
                                    <td class="border-b py-3 pl-2">Opening Balance</td>
                                    <td class="border-b py-3 pl-2 text-right"></td>
                                    <?php
                                    if($b=="Supplier")
                                    {

                                    if($b<0)
                                    {
                                      $dr=$b;
                                      $cr=0;

                                    }
                                    else
                                    {
                                      $dr=0;
                                      $cr=$b;

                                    }


                                    }
                                    else
                                    {

                                      if($b<0)
                                    {

                                      $dr=0;
                                      $cr=$b*(-1);
                                    }
                                    else
                                    {
                                      $dr=$b;
                                      $cr=0;


                                    }
                                    }

                                    ?>
                                    <td class="border-b py-3 pl-2 pr-3 text-right"><?php echo e(number_format($dr, 2)); ?></td>
                                    <td class="border-b py-3 pl-2 pr-3 text-right"><?php echo e(number_format($cr, 2)); ?></td>

                                    <td class="border-b py-3 pl-2 pr-3 text-right">
                                        <?php if($b < 0): ?>
                                            (<?php echo e(number_format(abs($b), 2)); ?>)
                                        <?php else: ?>
                                            <?php echo e(number_format($b, 2)); ?>

                                        <?php endif; ?>
                                    </td>

                                    </tr>

                            <?php $__currentLoopData = $obj["transactions"]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tran): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                              <tr>
                                <td class="border-b py-3 pl-2"><?php echo e($tran->EntryDate); ?></td>
                                <td class="border-b py-3 pl-2"><?php echo e($tran->MNarration); ?></td>
                                <?php
                                if($Type=="Supplier")
                                {

                                  $b = $b+ ($tran->DR-$tran->CR);
                                  }
                                  else
                                  {
                                    $b = $b+ ($tran->CR-$tran->DR);
                                  }
                                  ?>

                                <td class="border-b py-3 pl-2 text-right"><?php echo e($tran->Batch); ?></td>
                                <?php
                                if($Type=="Supplier")
                                {
                                $dr=$tran->DR;
                                $cr=$tran->CR;
                                }
                                else
                                {

                                  $dr=$tran->CR;
                                  $cr=$tran->DR;
                                }

                                ?>
                                <td class="border-b py-3 pl-2 pr-3 text-right"><?php echo e(number_format($dr, 2)); ?></td>
                                <td class="border-b py-3 pl-2 pr-3 text-right"><?php echo e(number_format($cr, 2)); ?></td>
                                <td class="border-b py-3 pl-2 pr-3 text-right">
                                    <?php if($b < 0): ?>
                                        (<?php echo e(number_format(abs($b), 2)); ?>)
                                    <?php else: ?>
                                        <?php echo e(number_format($b, 2)); ?>

                                    <?php endif; ?>
                                </td>
                              </tr>
                              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                              <tr>
                                <td colspan="9">
                                  <table class="w-full border-collapse border-spacing-0">
                                    <tbody>
                                      <tr>
                                        <td class="w-full"></td>
                                        <td>
                                          <table class="w-full border-collapse border-spacing-0">
                                            <tbody>
                                              <tr>
                                                <td class="bg-main p-3">
                                                  <div class="whitespace-nowrap font-bold text-white">Balance:</div>
                                                </td>
                                                <td class="bg-main p-3 text-right">
                                                  <div class="whitespace-nowrap font-bold text-white"> <?php if($b < 0): ?>
                                                    (<?php echo e(number_format(abs($b), 2)); ?>)
                                                <?php else: ?>
                                                    <?php echo e(number_format($b, 2)); ?>

                                                <?php endif; ?></div>
                                                </td>
                                              </tr>
                                            </tbody>
                                          </table>
                                        </td>
                                      </tr>
                                    </tbody>
                                  </table>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                          </div>
                        </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                      </div>

                      </div>

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

                    </div>
                    <?php endif; ?>

                    </div>
                    <script>
    document.addEventListener("DOMContentLoaded", function () {
        let type = document.getElementById("Type").value;
        if (type === "Supplier" || type==="Customer") {
            document.getElementById("floor_from").closest('.col-sm-4').style.display = "none";
            document.getElementById("floor_to").closest('.col-sm-4').style.display = "none";
            document.getElementById("account_type").closest('.col-sm-4').style.display = "none";
        }
    });
</script>

<script>
    document.getElementById('download-pdf').addEventListener('click', function () {
      var element = document.querySelector('.py-4'); // Select the section to prin
      var opt = {
          margin:       -0.3,
          filename:     '<?php echo e($Type); ?>Statement.pdf',
          image:        { type: 'jpeg', quality: 0.98 },
          html2canvas:  { scale: 2 },
          jsPDF:        { unit: 'in', format: 'A4', orientation: 'portrait' }
      };
      // Generate the PDF with the footer included
      html2pdf().from(element).set(opt).save();
    });

</script>
<script>
document.getElementById('download-pdf').addEventListener('click', function () {
    const element = document.getElementById('pdf-content');
    setTimeout(() => {
        const opt = {
            margin:       0.5,
            filename:     '<?php echo e($Type); ?>_Statement.pdf',
            image:        { type: 'jpeg', quality: 0.98 },
            html2canvas:  { scale: 2 },
            jsPDF:        { unit: 'in', format: 'a4', orientation: 'portrait' }
        };
        html2pdf().from(element).set(opt).save();
    }, 500); // wait for DOM paint
});

</script>



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

<?php echo $__env->make('layouts.nav', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\pinetops\re.pro\resources\views//Statements.blade.php ENDPATH**/ ?>