

<?php $__env->startSection('title'); ?>
Vendors Vouchers 
<?php $__env->stopSection(); ?>

<?php $__env->startSection('breadcrumb'); ?>
<ol class="breadcrumb pull-right">
        <li><a href="<?php echo e(route('home')); ?>"><i class="fa fa-dashboard"></i> Home</a></li>

        <li class="active">Vendor Vouchers</li>
      </ol>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('content'); ?>


            <div class="container-fluid">


                <!-- /row -->
                <div class="row" >
                    <div class="col-sm-12">

                        <div class="white-box">
                            <h3 class="box-title">Vendor</h3>
                            
                            <!-- Nav tabs -->
                            <ul class="nav customtab nav-tabs" role="tablist">

                                <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"><span class="visible-xs"><i class="ti-home"></i></span><span class="hidden-xs">List</span></a></li>
                                
                                 <li role="presentation" class=""><a href="#vendor_certificate" aria-controls="profile" role="tab" data-toggle="tab" aria-expanded="false"><span class="visible-xs"><i class="ti-user"></i></span> <span class="hidden-xs">Vendor Certificate</span></a></li>
                                
                                <li role="presentation" class=""><a href="#profile1" aria-controls="profile" role="tab" data-toggle="tab" aria-expanded="false"><span class="visible-xs"><i class="ti-user"></i></span> <span class="hidden-xs">Bills</span></a></li>

                                 <li role="presentation" class=""><a href="#home1" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"><span class="visible-xs"><i class="ti-home"></i></span><span class="hidden-xs">Pending Procurement Bills </span></a></li> 

                                 <li role="presentation" class=""><a href="#home2" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"><span class="visible-xs"><i class="ti-home"></i></span><span class="hidden-xs">Pending Procurement Advance Bills </span></a></li> 

                                <li role="presentation" class=""><a href="#profile2" aria-controls="profile" role="tab" data-toggle="tab" aria-expanded="false"><span class="visible-xs"><i class="ti-user"></i></span> <span class="hidden-xs">Vouchers</span></a></li>

                               
                                
                            </ul>
                            <!-- Tab panes -->
                            <div class="tab-content">

                                <div role="tabpanel" class="tab-pane fade active in" id="home">
                                    <div class="table-responsive">

                                        <a href="<?php echo e(route('control-account.addView',['id'=>\App\ControlAccount::VENDOR])); ?>" target="_blank"  class="btn btn-default pull-right" style="background-color: #0282CA; color: white;"> Add New </a>
                                        &nbsp;&nbsp;<a href="#" style="margin-right: 1rem;" class="btn btn-info pull-right" onclick="return showCertificateModal(this)"> Add Certificate </a>
                                        
                                        <br>
                                        <br>
                                        <div class="clearfix"></div>
                                <table id="myTable8" class="table table-striped">
                                    <thead>
                                        <tr>
                                            <th>#</th>
                                           
                                            <th>Name</th>
                                            <th>Description</th>
                                            <th>balance</th>
                                            
                                           
                                            <th style="width: 185px!important;">Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $count =1; $vendorArray = array();?>
                                        

                                        <?php $__currentLoopData = $list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $l): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        
                                        <?php
                                        $vendorArray[] = array('vendor_id' => $l->id , 'vendor_name' => $l->name);
                                        ?>
                                        <tr >
                                            <td><?php echo e($count++); ?></td>
                                           <td>
                                                <?php echo e($l->name); ?>

                                        
                                           
                                        </td> 
                                          
                                            <td><?php echo e($l->description); ?></td>
                                              <td>
                                                  <?php if($balance[$l->id] < 0 ): ?>
                                              (<?php echo e(number_format(abs($balance[$l->id]))); ?>)
                                              <?php elseif($balance[$l->id] > 0 ): ?>
                                              <?php echo e(number_format($balance[$l->id])); ?>

                                              <?php else: ?>
                                              -
                                              <?php endif; ?>
                                            </td>
                                            

                                            <td class="text-nowrap">
                                                
                                                <a href="<?php echo e(route('control-account.detail',['id'=>$l->id])); ?>" target="_blank"  class="btn btn-default"> View </a>
                                                

                                                <a href="<?php echo e(route('control-account.editView',['id'=>$l->id])); ?>" target="_blank"  class="btn btn-default"> Edit</a>

                                                
           
                                            </td>

                                        </tr>

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

                                    </tbody>
                                </table>
                                
                            </div>
                                    <div class="clearfix"></div>
                                </div>
                                
                                
                                
                                
                                <div role="tabpanel" class="tab-pane fade active in" id="vendor_certificate">
                                    <div class="table-responsive">

            
                                        <div class="clearfix"></div>
                                <table id="myTable8" class="table table-striped">
                                    <thead>
                                        <tr>
                                            <th>#</th>
                                            <th>Vendor</th>
                                            <th>Date From</th>
                                            <th>Date To</th>
                                            <th>Tax Amount</th>
                                            <th>Total Amount</th>
                                            <th style="width: 185px!important;">Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $count =1; ?>
                                        

                                        <?php $__currentLoopData = $vendorCertificates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $vendor_certificate): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        
                                    
                                        <tr >
                                            <td><?php echo e($count++); ?></td>
                                            <td><?php echo e(!empty($vendor_certificate->control_account)? $vendor_certificate->control_account->name:''); ?></td> 
                                            <td><?php echo e($vendor_certificate->date_from); ?></td> 
                                            <td><?php echo e($vendor_certificate->date_to); ?></td>
                                            <td><?php echo e(number_format($vendor_certificate->total_tax_amount,2)); ?></td>
                                            <td><?php echo e(number_format($vendor_certificate->total_amount , 2)); ?></td>
                                            <td class="text-nowrap">
    
                                                <a href="<?php echo e(route('get-certificate-detail',['id'=>$vendor_certificate->id])); ?>" target="_blank"  class="btn btn-default"> View </a>
           
                                            </td>

                                        </tr>

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

                                    </tbody>
                                </table>
                                
                            </div>
                                    <div class="clearfix"></div>
                                </div>


                                <div role="tabpanel" class="tab-pane fade " id="home1">
                                    <div class="table-responsive">
                                <table id="myTable" style="margin-top: 5rem;" class="table table-striped table-bordered dataTable color-table primary-table" role="grid" aria-describedby="myTable_info">
                                <thead>
                                <tr role="row">

                                <th style="color:black;" class="sorting_asc" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Name: activate to sort column descending" style="width: 100px;">Po#</th>


                                <th style="color:black;" class="sorting_asc" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Name: activate to sort column descending" style="width: 100px;">Vendor</th>

                                
                                <th style="color:black;" class="sorting_asc" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Name: activate to sort column descending" style="width: 100px;">Bill Amount</th>


                                <th style="color:black;" class="sorting_asc" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Name: activate to sort column descending" style="width: 200px;text-align: center;">Date</th>


                                <th style="color:black;" class="sorting_asc" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Name: activate to sort column descending" style="width: 100px;">Action</th>

                                </tr>

                                </thead>
                                <tbody>
                                <?php $__currentLoopData = $total_receipts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php $__currentLoopData = $pr->receipts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $list): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($list->receipt_type == 1): ?>

                                <?php
                                $vendor = \App\PurchaseRequestVendor::find($list->vendor_id);
                                ?>
                                <tr role="row" class="odd">

                                <td>
                                    <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'list-purchase-order')): ?>
                                    <a href="<?php echo e(url('purchase-orders/detail?vendor='.Crypt::encryptString($vendor->id).'&purchase_request='.Crypt::encryptString($list->purchase_request_id).'')); ?>"  target="_blank" >PO-<?php echo e(ucfirst($list->purchase_order_id)); ?></a> 
                                    <?php else: ?>

                                    PO-<?php echo e(ucfirst($list->purchase_order_id)); ?>

                                    <?php endif; ?>
                                </td>

                                <td>
                                    <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'view-vendor')): ?>
                                    <a href="<?php echo e(route('vendor.view' ,[$vendor->id])); ?>"><?php echo e(ucfirst($vendor->name)); ?></a>
                                    <?php else: ?>
                                    <?php echo e(ucfirst($vendor->name)); ?>

                                    <?php endif; ?> </td>
                                
                                <td><?php echo e(number_format($list->remaining_amount)); ?></td>


                                <td style="line-height: 30px;font-size: 15px;text-align: center;">
                                    <b>Created At :</b><br> <?php echo e(date('d-F-Y' , strtotime($list->receipt_date))); ?>

                                   
                                </td>

                                <td>

                                    
                                
                                <a href="<?php echo e(url('purchase-order-receipts/detail?vendor='.Crypt::encryptString($vendor->id).'&purchase_order='.Crypt::encryptString($list->purchase_order_id).'&receipt_id='.Crypt::encryptString($list->id).'&purchase_request='.Crypt::encryptString($list->purchase_request_id).'')); ?>" class="btn btn-success btn-sm" target="_blank">View</a> 

                                    <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'create-voucher')): ?>
                                <a onclick="$('#voucher-form').submit()" href="#"><button  class="btn btn-default btn-outline"  type="button"> <span><i class="fa fa-money"></i> Make Voucher</span> </button></a>
                                <?php endif; ?>

        

                                <form id="voucher-form" method="post" action="<?php echo e(route('create-voucher')); ?>">
                                <?php echo e(csrf_field()); ?>

                                <input type="hidden" name="type" value="<?php echo e(\App\GeneralJournalEntry::procurment_receipt); ?>">
                                <input type="hidden" name="id" value="<?php echo e($list->id); ?>">
                                <input type="hidden" name="control" value="<?php echo e(\App\ControlAccount::VENDOR); ?>">

                                </form>
                                
                            </td>

                            </tr>

                            <?php endif; ?>

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

                            </div>
                            <div class="clearfix"></div>
                            </div>



                            <div role="tabpanel" class="tab-pane fade " id="home2">
                            <div class="table-responsive">
                            <table id="myTable" style="margin-top: 5rem;" class="table table-striped table-bordered dataTable color-table primary-table" role="grid" aria-describedby="myTable_info">
                            <thead>
                            <tr role="row">

                            <th style="color:black;" class="sorting_asc" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Name: activate to sort column descending" style="width: 100px;">Po#</th>


                            <th style="color:black;" class="sorting_asc" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Name: activate to sort column descending" style="width: 100px;">Vendor</th>


                            <th style="color:black;" class="sorting_asc" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Name: activate to sort column descending" style="width: 100px;">Bill Amount</th>


                            <th style="color:black;" class="sorting_asc" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Name: activate to sort column descending" style="width: 200px;text-align: center;">Date</th>


                            <th style="color:black;" class="sorting_asc" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Name: activate to sort column descending" style="width: 100px;">Action</th>

                            </tr>

                            </thead>
                            <tbody>
                            <?php $__currentLoopData = $total_receipts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php $__currentLoopData = $pr->receipts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $list): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php if($list->receipt_type == 2): ?>

                            <?php
                            $vendor = \App\PurchaseRequestVendor::find($list->vendor_id);
                            ?>
                            <tr role="row" class="odd">

                            <td>
                            <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'list-purchase-order')): ?>
                            <a href="<?php echo e(url('purchase-orders/detail?vendor='.Crypt::encryptString($vendor->id).'&purchase_request='.Crypt::encryptString($list->purchase_request_id).'')); ?>"  target="_blank" >PO-<?php echo e(ucfirst($list->purchase_order_id)); ?></a> 
                            <?php else: ?>

                            PO-<?php echo e(ucfirst($list->purchase_order_id)); ?>

                            <?php endif; ?>
                            </td>

                            <td>
                            <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'view-vendor')): ?>
                            <a href="<?php echo e(route('vendor.view' ,[$vendor->id])); ?>"><?php echo e(ucfirst($vendor->name)); ?></a>
                            <?php else: ?>
                            <?php echo e(ucfirst($vendor->name)); ?>

                            <?php endif; ?> </td>

                            <td><?php echo e(number_format($list->remaining_amount)); ?></td>


                            <td style="line-height: 30px;font-size: 15px;text-align: center;">
                            <b>Created At :</b><br> <?php echo e(date('d-F-Y' , strtotime($list->receipt_date))); ?>


                            </td>

                            <td>


                            <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'create-voucher')): ?>
                            <a onclick="$('#voucher-form').submit()" href="#"><button  class="btn btn-default btn-outline"  type="button"> <span><i class="fa fa-money"></i> Make Voucher</span> </button></a>
                            <?php endif; ?>



<form id="voucher-form" method="post" action="<?php echo e(route('create-voucher')); ?>">
    <?php echo e(csrf_field()); ?>

<input type="hidden" name="type" value="<?php echo e(\App\GeneralJournalEntry::procurment_receipt); ?>">
<input type="hidden" name="id" value="<?php echo e($list->id); ?>">
<input type="hidden" name="control" value="<?php echo e(\App\ControlAccount::VENDOR); ?>">

                            </form>

                            </td>

                            </tr>

                            <?php endif; ?>

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

                            </div>
                            <div class="clearfix"></div>
                            </div>


                                <div role="tabpanel" class="tab-pane fade " id="profile1">
                                    <div class="pull-right">
                                    <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'create-voucher')): ?>
                                <a href="<?php echo e(route('add-bill-form')); ?>" class="btn  btn-primary">
                                    <i class="fa fa-plus-square"></i>&nbsp; Add New
                                </a>

                                <a href="#" class="btn  btn-default" onclick="checkSelectedCheckbox()" style="background-color: #ff6361!important; color: white;">
                                    <i class="fa fa-plus-square"></i>&nbsp; Make Payment Voucher
                                </a>
                                <?php endif; ?>
                            </div>
                            <div id="status" style="text-align: center;color:green;display: none"></div>
                            <div class="clearfix"></div><br>
                                   <div class="table-responsive">
                                <table id="myTable1" class="table table-striped">
                                    <thead>
                                        <tr>
                                            <th>#</th>
                                            <th></th>
                                            <th>Number</th>
                                            <th>Type</th>
                                            <th>Account Head</th>

                                            <th>Vendor</th>
                                            <th>Amount</th>




                                            <th>Bill Date</th>
                                            <th>Due Date</th>
                                            <th>Status</th>
                                            <th>Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $count =1;?>
                                        <?php $__currentLoopData = $allExpenses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $expense): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td><?php echo e($count++); ?></td>
                                            <td><input type="checkbox" name="check_list" value="<?php echo e($expense->id); ?>"></td>
                                            <td>BILL-000<?php echo e($expense->id); ?></td>
                                            <td> <?php echo e($expense->expense_type == \App\Expense::CONSTRUCTION ? 'Construction' : 'Service'); ?> </td>
                                            <td><b><?php if($expense->category): ?><?php echo e($expense->category->number); ?> - <?php echo e($expense->category->name); ?></b><?php endif; ?></td>
                                             <td><?php if($expense->vendor): ?><?php echo e($expense->vendor->name); ?><?php endif; ?></td>

                                              <td><?php echo e(number_format($expense->amount)); ?></td>
                                               <td><?php echo e(date('d-m-Y', strtotime($expense->billed_at))); ?></td>
                                               <td><?php echo e(date('d-m-Y', strtotime($expense->due_at))); ?></td>
                                               <?php if($expense->status == 1): ?>
                                            <td><span class="label label-success">PAID</span></td>
                                            <?php elseif($expense->status == 2): ?>
                                            <td><span class="label label-primary">PARTIALY</span></td>
                                            <?php else: ?>
                                            <td><span class="label label-danger">UNPAID</span></td>
                                            <?php endif; ?>
                                            <td class="text-nowrap">
                                                <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'view-expense')): ?>
                                                <a href="<?php echo e(route('pending-bills.detail',['id'=>$expense->id])); ?>" class="btn btn-default">View</a>

                                                <?php endif; ?>

                                                

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

                                    </tbody>
                                </table>
                                
                            </div>
                                    <div class="clearfix"></div>
                                </div>

                                <div role="tabpanel" class="tab-pane fade" id="profile2">
                                   <div class="table-responsive">
                                <table id="myTable3" class="table table-striped table-bordered">
                                    <thead>
                                        <tr>
                                            <th>Type</th>
                                            <th>Checked</th>
                                            <th>Posted</th>
                                            <th>Date</th>
                                            <th>Entry No.</th>
                                            <th>ADJ</th>
                                            <th>Account</th>
                                            <th>Memo</th>
                                            <!-- <th>Class</th> -->
                                            <th>Debit/Credit (+/-)</th>
                                            <th>Action</th>
                    
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $__currentLoopData = $allEntries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $entry): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr ondblclick="showEntry('<?php echo e($entry->entry_no); ?>')">

                                            <?php if($entry->voucher_type == \App\GeneralJournalEntry::CRV): ?>
                                            <td>CRV-<?php echo e($entry->voucher_no); ?></td>
                                            <?php elseif($entry->voucher_type == \App\GeneralJournalEntry::BRV): ?>
                                            <td>BRV-<?php echo e($entry->voucher_no); ?></td>
                                            <?php elseif($entry->voucher_type == \App\GeneralJournalEntry::CPV): ?>
                                            <td>CPV-<?php echo e($entry->voucher_no); ?></td>
                                            <?php elseif($entry->voucher_type == \App\GeneralJournalEntry::BPV): ?>
                                            <td>BPV-<?php echo e($entry->voucher_no); ?></td>
                                            <?php elseif($entry->voucher_type == \App\GeneralJournalEntry::JV): ?>
                                            <td>JV-<?php echo e($entry->voucher_no); ?></td>
                                            <?php else: ?>
                                            <td></td>
                                            <?php endif; ?>

                                            <td><?php if($entry->is_check): ?>
                                                <i class="fa fa-check" style="color:green"></i>
                                            <?php else: ?>
                                            <i class="fa fa-close" style="color: red;"></i>

                                        <?php endif; ?>

                                        <td><?php if($entry->is_post): ?>
                                                <i class="fa fa-check" style="color:green"></i>
                                            <?php else: ?>
                                            <i class="fa fa-close" style="color: red;"></i>

                                        <?php endif; ?>
                                        </td>
                                    
                                            <td><?php echo e(date('d/m/Y', strtotime($entry->date))); ?></td>
                                            <td><?php echo e($entry->entry_no); ?></td>
                                            <td>
                                                <?php if($entry->adjusting_entry): ?>
                                                <i class="fa fa-check"></i>
                                                <?php endif; ?>
                                            </td>
                                            <td><?php echo e($entry->account ? $entry->account->name : ''); ?></td>
                                            <td><?php echo e($entry->memo); ?></td>
                                            <!-- <td><?php echo e($entry->class ? $entry->class->name : ''); ?></td> -->
                                            <td><?php echo e(number_format($totalAmount[$entry->entry_no])); ?></td>
                                            <td >
                                                <!-- <span onclick="showEntry('<?php echo e($entry->entry_no); ?>')" style="cursor: pointer;" class="btn btn-sm btn-primary"> Show</span> -->

                                                <a href="<?php echo e(route('voucher-detail',['id'=>$entry->entry_no])); ?>" class="btn btn-default">View</a>

                                            <?php if(!$entry->is_approved): ?>

                                            <br><br>
                                            <span onclick="approveEntryModal('<?php echo e($entry->entry_no); ?>')" style="cursor: pointer;" class="btn btn-default btn-sm"> Approve</span>


                                            <?php endif; ?>

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

                                    </tbody>
                                </table>
                                
                            </div>
                                    <div class="clearfix"></div>
                                </div>


                                
                                
                                
                            </div>
                        </div>


                    </div>
                </div>

                <form id="voucher-form" method="post" action="<?php echo e(route('create-voucher')); ?>">
            <?php echo e(csrf_field()); ?>

        <input type="hidden" name="type" value="<?php echo e(\App\GeneralJournalEntry::massPayment); ?>">
        <input type="hidden" name="id" id="id" value="">

        </form>

                <!-- /.row -->
              </div>
            <!-- /.container-fluid -->
            
            
            
            <!-- Modal -->
            <div class="modal fade" id="certificateModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
            <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">
            <div class="modal-header">
            <h5 class="modal-title" id="exampleModalLabel">Add Certificate</h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
            </button>
            </div>
            <form method="post" action="<?php echo e(route('certificate-detail.add')); ?>" onsubmit="return validateData(this)">
                <?php echo e(csrf_field()); ?>

            <div class="modal-body">
                <div class="row">
                    <div class="col-md-4">
                        <label>Vendor <span class="text-danger">*</span></label>
                      <select class="form-control chosen-select" name="vendor_id" id="vendor_id" onchange="return getCertificate(this)">
                          <option value="0">None</option>
                          <?php $__currentLoopData = $vendorArray; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $vendor_list): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                          <option value="<?php echo e($vendor_list['vendor_id']); ?>">
                              <?php echo e($vendor_list['vendor_name']); ?>

                          </option>
                          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                      </select>
                    </div>
                    
                    
                    <div class="col-md-4">
                        <label>Cnic</label>
                      <input type="text" readonly class="form-control" name="cnic" id="cnic">
                    </div>
                    
                    
                     <div class="col-md-4">
                        <label>National Tax Number</label>
                      <input type="text" readonly class="form-control" name="national_tax_number" id="national_tax_number">
                    </div>
                    
                    
                    
                    <div class="col-md-4" style="margin-top: 2rem;">
                        <label>From <span class="text-danger">*</span></label>
                      <input type="date"  class="form-control" value="<?php echo e(date('Y-m-d')); ?>" name="date_from" id="date_from" >
                    </div>
                    
                    
                     <div class="col-md-4" style="margin-top: 2rem;">
                        <label>To <span class="text-danger">*</span></label>
                        <input type="date"  class="form-control" value="<?php echo e(date('Y-m-d')); ?>" name="date_to"  id="date_to">
                    </div>
                    
                    
                    <div class="col-md-4" style="margin-top: 2rem;">
                        <label>On acount of value</label>
                        <input type="text"  class="form-control" name="specific_nature" id="specific_nature" >
                    </div>
                    
                    
                    <div class="col-md-4" style="margin-top: 2rem;">
                        <label>Total Tax Amount <span class="text-danger">*</span></label>
                      <input type="number"  class="form-control" name="total_tax_amount" id="total_tax_amount" >
                    </div>
                    
                    
                     <div class="col-md-4" style="margin-top: 2rem;">
                        <label>Total Amount <span class="text-danger">*</span></label>
                        <input type="number"  class="form-control" name="total_amount" id="total_amount" >
                    </div>
                    
                    
                    
                </div>
            </div>
            <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
            <button type="submit" class="btn btn-primary">Save</button>
            
             </form>
            </div>
            </div>
            </div>
            </div>



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

<?php $__env->startSection('js'); ?>
<script>

function validateData(self)
{
    if($(self).find('#date_from').val() == "" || $(self).find('#date_to').val() == ""  || $(self).find('#total_tax_amount').val() == "" || $(self).find('#total_amount').val() == "" || $(self).find('#vendor_id').val() == 0)
    {
        alert('Please Select All Fields With *');
        return false;
    }
    else
    {
        return true;
    }
}

function getCertificate(self)
{
     $.ajax({
        url:"<?php echo e(route('get-certificate-details')); ?>",
        method:'GET',
        dataType:'json',
        data: {vender_id:$(self).val()},
        success:function(data)
        {
            if(data.response == 'yes')
            {
                $('#cnic').val(data.output.cnic)
                $('#national_tax_number').val(data.output.national_tax_number)
            }
            else
            {
                $('#cnic').val('')
                $('#national_tax_number').val('')
            }
        }
        })
        
        return false;
}

function showCertificateModal(self)
{
    $('#certificateModal').modal('show')
    
    return false;
}

    $(function() {
        $('#myTable').DataTable({
            'pageLength':25,
            'paging':true,
            'searching':true,
            'info':true,
            'ordering':false
        });

        $('#myTable1').DataTable({
            'pageLength':25,
            'paging':true,
            'searching':true,
            'info':true,
            'ordering':false
        });
        $('#myTable3').DataTable({
            'pageLength':25,
            'paging':true,
            'searching':true,
            'info':true,
            'ordering':false
        });

        $('#myTable8').DataTable({
            'pageLength':25,
            'paging':true,
            'searching':true,
            'info':true,
            'ordering':false
        });
    });


    function checkSelectedCheckbox()
    {
        

        var check_ids = [];
        
        $.each($("input[name='check_list']:checked"), function(){
                check_ids.push($(this).val());
            });

       
        if(check_ids.length==0)
        {
            document.getElementById('status').style.display = 'block';
            document.getElementById('status').style.color = 'red';
            document.getElementById('status').innerHTML = '<strong><h3>please select any bill!</h3></strong>';
            $('#status').delay(3000).fadeOut();
        }
        else {
          paymentVoucher(check_ids); }
           


    }

    function paymentVoucher(check_ids) {

        $('#id').val(check_ids);

        $('#voucher-form').submit();
        
    }

        
    </script>
    
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\akram-city.projecterp.net\resources\views/general-entry/vendors.blade.php ENDPATH**/ ?>