ລາຍງານການຂາຍ

@if($branchName)
ໂຮງຫວຍ: {{ $branchName }}
@endif @if($lotteryNo)
ງວດທີ: {{ $lotteryNo }}
@endif @if($unitName)
ໜ່ວຍ: {{ $unitName }}
@endif
ວັນທີ່ອອກລາຍງານ: {{ now()->format('d/m/Y H:i') }}
@php // ດຶງເປີເຊັນຈາກລາຍການທຳອິດ (ສົມມຸດວ່າທຸກລາຍການມີເປີເຊັນດຽວກັນ) $firstSale = $sales->first(); $headerMachinePercentage = $firstSale ? \App\Services\SaleCalculationService::getMachinePercentage($firstSale) : 0; $headerUnitPercentage = $firstSale ? \App\Services\SaleCalculationService::getUnitPercentage($firstSale) : 0; @endphp @php $totalSales = 0; $totalMachineAmount = 0; $totalUnitAmount = 0; $totalAwards = 0; $totalTax = 0; $totalNet = 0; @endphp @foreach($sales as $index => $sale) @php $machinePercentage = \App\Services\SaleCalculationService::getMachinePercentage($sale); $unitPercentage = \App\Services\SaleCalculationService::getUnitPercentage($sale); $machineAmount = \App\Services\SaleCalculationService::getMachineAmount($sale); $unitAmount = \App\Services\SaleCalculationService::getUnitAmount($sale); $awards = \App\Services\SaleCalculationService::calculateTotalAwards($sale); $tax = \App\Services\SaleCalculationService::calculateTax($sale); $netAmount = \App\Services\SaleCalculationService::calculateNetAmount($sale); $totalSales += $sale->price; $totalMachineAmount += $machineAmount; $totalUnitAmount += $unitAmount; $totalAwards += $awards; $totalTax += $tax; $totalNet += $netAmount; @endphp @endforeach
ລຳດັບ ລະຫັດຜູ້ຂາຍ ຍອດຂາຍ ເປີເຊັນຜູ້ຂາຍ ({{ number_format($headerMachinePercentage, 0) }}%) ເປີເຊັນຫົວໜ້າໜ່ວຍ ({{ number_format($headerUnitPercentage, 0) }}%) ລາງວັນ ຍອດເງິນເຫຼືອຕົວຈິງ
{{ $index + 1 }} {{ $sale->machineCode }} {{ number_format($sale->price, 0, ',', ',') }} {{ number_format($machineAmount, 0, ',', ',') }}
{{ number_format($unitAmount, 0, ',', ',') }}
{{ number_format($awards, 0, ',', ',') }} {{ number_format($netAmount, 0, ',', ',') }}
ລວມທັງໝົດ {{ number_format($totalSales, 0, ',', ',') }} {{ number_format($totalMachineAmount, 0, ',', ',') }} {{ number_format($totalUnitAmount, 0, ',', ',') }} {{ number_format($totalAwards, 0, ',', ',') }} {{ number_format($totalNet, 0, ',', ',') }}
ຈຳນວນລາຍການທັງໝົດ: {{ count($sales) }} ລາຍການ
ຍອດຂາຍລວມ: {{ number_format($totalSales, 0, ',', ',') }} ກີບ
ຍອດເງິນຜູ້ຂາຍລວມ: {{ number_format($totalMachineAmount, 0, ',', ',') }} ກີບ
ຍອດເງິນໜ່ວຍລວມ: {{ number_format($totalUnitAmount, 0, ',', ',') }} ກີບ
ລາງວັນຜົນບວກລວມ: {{ number_format($totalAwards, 0, ',', ',') }} ກີບ
ອາກອນລວມ: {{ number_format($totalTax, 0, ',', ',') }} ກີບ
ຍອດເງິນເຫຼືອຕົວຈິງລວມ: {{ number_format($totalNet, 0, ',', ',') }} ກີບ