<?php
use App\Model\setup\PackerModel;$br = getBranch();
if ($master->packer_id) {
    $tailor = PackerModel::find($master->packer_id);
    $contact = $tailor->contact ?? '';
} else {
    $tailor = findTailor($master->tailor_id);
    $contact = $tailor->phone ?? '';
}
?>
<div class="print_this_form" style="padding-bottom: 20px">
    <div class="text-center " style="margin-bottom: 30px;margin-top: 20px"><h3><?php echo e(__('administrator.payment')); ?></h3></div>
    <table width="100%" style="margin-bottom: 20px">
        <tr style="text-align: left;">
            <td style="width: 65%;vertical-align: top!important;">
                <div><?php echo e(__('administrator.reference_number')); ?>: <?php echo e("$master->payment_invoice "); ?> (<?php echo e(__("administrator.$master->type")); ?>)</div>
                <div style="margin-top: 5px"><?php echo e(__('administrator.tailor')); ?> / <?php echo e(__('administrator.packer')); ?>: <?php echo e($tailor->name??''); ?></div>
            </td>
            <td>
                <table>
                    <tr class="font_12">
                        <td><?php echo e(__('administrator.date')); ?> </td>
                        <td style="white-space: nowrap">:
                            <b><?php echo e(myDate($master->payment_date)); ?></b>
                        </td>
                    </tr>
                    <?php if($contact): ?>
                        <tr class="font_12">
                            <td style="padding-top: 5px"><?php echo e(__('administrator.contact')); ?></td>
                            <td style="padding-top: 5px"> : <?php echo e($contact); ?></td>
                        </tr>
                    <?php endif; ?>
                </table>
            </td>
        </tr>
    </table>
    <table class="table table-bordered" width="100%">
        <thead>
        <tr>
            <th>#</th>
            <th><?php echo e(__('administrator.products')); ?></th>
            <th><?php echo e(__('administrator.qty')); ?></th>
            <th><?php echo e(__('administrator.price')); ?></th>
            <th><?php echo e(__('administrator.total')); ?></th>
        </tr>
        </thead>
        <tbody>
        <?php
        $subtotal = 0;
        $count = 1;
        $total_qty = 0;
        ?>
        <?php if($detail): ?>
            <?php $__currentLoopData = $detail; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php
                $currency = findCurrency($row->currency_id)->symbol ?? '';
                $punit = findProductUnitByCode($row->barcode, 'product');
                $product = getProductById($row->product_id);
                $unit = findUnit($product->unit_id ?? '')->unit;
                $total_qty += $row->qty;
                $size = findSize($punit->size_code)->size??'';
                $color = findColor($punit->color_code)->name??'';
                ?>
                <tr role="row">
                    <td><?php echo e($count++); ?></td>
                    <td><?php echo e("$product->product_name ( $size,$color )"); ?></td>
                    <td><?php echo e("$row->qty $unit"); ?></td>
                    <td><?php echo e($currency.number_format($row->price ,2)); ?></td>
                    <td><?php echo e($currency.number_format($row->price*$row->qty,2)); ?></td>
                </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            <?php while($count<=10): ?>
                <tr>
                    <td class="text-center"><?php echo e($count++); ?></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
            <?php endwhile; ?>
        <?php endif; ?>
        <tr>
            <td colspan="2" rowspan="2" style="text-align: left">
                <?php if($master->note): ?>
                    <span><b><?php echo e(__('administrator.note')); ?></b> : <?php echo $master->note; ?></span>
                <?php endif; ?>
            </td>
            <td class="text-right"><?php echo e(__('administrator.total')); ?></td>
            <td class="text-left"><?php echo e($total_qty); ?> ឯកតា</td>
            <td class="text-left"><?php echo e(number_format($master->payment_amount,2)); ?> $</td>
        </tr>
        <tr>
            <td colspan="2" class="text-right"><?php echo e(__('administrator.payment_method')); ?></td>
            <td class="text-left"><?php echo e(\App\Model\account\AccountChartModel::find($master->payment_method)->acc_namekh??''); ?></td>
        </tr>
        </tbody>
    </table>
</div>
<?php /**PATH /home/nsowos/public_html/shr-brand/resources/views/administrator/production-payment/show.blade.php ENDPATH**/ ?>