<?php $__env->startSection('title', ($isNew?'New ':'Edit ').'Supplier Bill'); ?>
<?php $__env->startSection('crumbs', '<a href="'.route('purchase-invoices.index').'">Supplier Bills</a> · <b>'.($isNew?'New':'Edit').'</b>'); ?>
<?php $__env->startSection('content'); ?>
<div class="card"><div class="card-h"><h2><?php echo e($isNew?'New':'Edit'); ?> supplier bill</h2><div class="sp"><span class="bdg b-info"><?php echo e($docNo); ?></span></div></div>
<div class="card-b"><form method="POST" action="<?php echo e($isNew?route('purchase-invoices.store'):route('purchase-invoices.update',$record->id)); ?>" data-doc data-tax='{"apply":false}'><?php echo csrf_field(); ?> <?php if(!$isNew): ?><?php echo method_field('PUT'); ?><?php endif; ?>
<div class="frow">
<div class="fld c4"><label>Supplier *</label><select name="supplier_id" required><option value="">—</option><?php $__currentLoopData = $suppliers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($s->id); ?>" data-defcur="<?php echo e($s->default_currency); ?>" <?php echo e($record->supplier_id==$s->id?'selected':''); ?>><?php echo e($s->display_name); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></div>
<div class="fld c2"><label>Date *</label><input type="date" name="invoice_date" value="<?php echo e(old('invoice_date',$record->invoice_date?->format('Y-m-d') ?? date('Y-m-d'))); ?>" required></div>
<?php echo $__env->make('docs._fxfields', ['record' => $record, 'fx' => $fx, 'isNew' => $isNew], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<div class="fld c2"><label>Due date</label><input type="date" name="due_date" value="<?php echo e(old('due_date',$record->due_date?->format('Y-m-d'))); ?>"></div>
<div class="fld c2"><label>Supplier inv no.</label><input type="text" name="supplier_invoice_no" value="<?php echo e(old('supplier_invoice_no',$record->supplier_invoice_no)); ?>"></div>
<div class="fld c2"><label>WHT deducted</label><input type="number" step="0.01" name="withholding_tax" value="<?php echo e(old('withholding_tax',$record->withholding_tax ?? 0)); ?>"><div class="help">Goods 3% · Services 7.5%</div></div>
</div>
<?php if($record->purchase_order_id): ?><input type="hidden" name="purchase_order_id" value="<?php echo e($record->purchase_order_id); ?>"><?php endif; ?>
<?php if($record->goods_receipt_id): ?><input type="hidden" name="goods_receipt_id" value="<?php echo e($record->goods_receipt_id); ?>"><?php endif; ?>
<?php echo $__env->make('docs._lines', ['id'=>'pinLines', 'rows'=>($record->lines && count($record->lines) ? $record->lines : $prefill), 'cols'=>[
  ['f'=>'description','l'=>'Description *','t'=>'text','req'=>1],
  ['f'=>'qty','l'=>'Qty *','t'=>'number','role'=>'qty','req'=>1,'w'=>'110px'],
  ['f'=>'rate','l'=>'Rate *','t'=>'number','role'=>'rate','req'=>1,'w'=>'130px'],
  ['f'=>'amount','l'=>'Amount','t'=>'number','role'=>'amount','ro'=>1,'w'=>'140px'],
]], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<?php echo $__env->make('docs._totals', ['tax'=>null], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<div style="margin-top:12px"><button class="btn btn-pri">Save <?php echo e($isNew?'draft':'changes'); ?></button> <a class="btn btn-ghost" href="<?php echo e(route('purchase-invoices.index')); ?>">Cancel</a></div>
</form></div></div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/user/nowills-sqc-erp/resources/views/docs/purchase-invoice/form.blade.php ENDPATH**/ ?>