@extends('layouts.master') @section('css') @endsection @section('title') Delivery Note @endsection @section('content') @php use App\Http\Controllers\Admin\ExtraController; @endphp
{{ $accountingVoucher->voucherType->name }}
{{ $accountingVoucher->voucher_number }}
{{ \Carbon\Carbon::parse($accountingVoucher->voucher_date)->format('d M Y') }}
{{ $accountingVoucher->creditLedger?->name }}
{{ $accountingVoucher->debitLedger?->name }}
Interstate(IGST)
@elseIntrastate
@endif{{ $accountingVoucher->priceSlab->name ?? '--' }}
{{ $accountingVoucher->stockLocation->name ?? '--' }}
{{ $accountingVoucher->remarks ?? '--' }}
{{ $accountingVoucher->costCenter->name ?? '--' }}
{{ $accountingVoucher->customer->name ?? '--' }}
{{ $accountingVoucher->customer->mobile ?? '--' }}
{{ $accountingVoucher->CustomerSource->name ?? '--' }}
| Item | MRP | Qty | Unit | Price | Price (Inc GST) | Gross Value | Dis % | Taxable Value | CGST | SGST | IGST | CESS | Total | Profit Margin | Profit Margin On Landing Cost |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ $item->stockItem->name }} @if ($item->variant_id != null)
({{ $item->variant->name }}) @endif |
{{ $item->stockItem->mrp }} | {{ $item->quantity }} | {{ $item->unit->symbol }} | {{ $item->price }} | {{ $item->price_inc_tax }} | {{ $item->gross_value }} | {{ $item->disc_percentage }} | @php $totalTaxableValue += $item->taxable_value; @endphp {{ $item->taxable_value }} | {{ $item->cgst }} | {{ $item->sgst }} | {{ $item->igst }} | {{ $item->cess }} | {{ $item->total }} | @if (Auth::user()->can('view profit margin')) @php $extraController = new ExtraController(); $avgPrice = $extraController->getAvg( $item->stock_item_id, $accountingVoucher->voucher_date, ); if ($avgPrice == 0) { continue; } $price = $avgPrice * $item->quantity; if ($price == 0) { continue; } $profit = (($item->taxable_value - $price) / $price) * 100; //profit percentage $profitAmount = round($item->taxable_value - $price, 2); $avgProfit = round($profit, 2); $totalProfit += $profitAmount; $totalProfits[] = $avgProfit; @endphp {{ $profitAmount }} ({{ $avgProfit . '%' }}) @else --- @endif | @if (Auth::user()->can('view profit margin')) @php $costPurchases = App\Models\AccountingVoucher::select('cost_allocation_id') ->where(['business_key' => Auth::user()->business_key]) ->where('status', 1) ->where('cost_allocation_id', '!=', null) ->pluck('cost_allocation_id') ->toArray(); $vouchers = App\Models\AccountingVoucher::where([ 'business_key' => Auth::user()->business_key, ]) ->whereIn('id', $costPurchases) ->whereHas('items', function ($query) use ($item) { $query->where('stock_item_id', $item->stock_item_id); }) ->get(); $itemCosts = []; foreach ($vouchers as $key => $voucher) { $taxable_value = $voucher->items()->sum('taxable_value'); $expense = App\Models\AccountingVoucherLedger::whereHas( 'accountingVoucher', function ($query) use ($voucher) { $query->where('cost_allocation_id', $voucher->id); }, ) ->where('is_cost_allocated', 1) ->sum('amount'); $percentage = ($expense / $taxable_value) * 100; $itemPrice = $voucher ->items() ->where('stock_item_id', $item->stock_item_id) ->sum('taxable_value'); $itemQuantity = $voucher ->items() ->where('stock_item_id', $item->stock_item_id) ->sum('quantity'); $itemPrice = $itemPrice / $itemQuantity; $itemCosts[] = ($itemPrice * $percentage) / 100; } $avgCost = count($itemCosts) != 0 ? array_sum($itemCosts) / count($itemCosts) : 0; $landingCost = round($avgCost + $avgPrice, 2); $netCost = $item->quantity * $landingCost; if ($netCost == 0) { continue; } $PMOnLandingCost = $item->taxable_value - $netCost; $perc = round(($PMOnLandingCost / $netCost) * 100, 2); $totalPercentages[] = $perc; $totalPMOnLandingCost += $PMOnLandingCost; @endphp {{ $PMOnLandingCost }} ({{ $perc . '%' }}) @else --- @endif |
| Total | {{ round($totalTaxableValue, 2) }} | {{ $accountingVoucherItems->sum('cgst') }} | {{ $accountingVoucherItems->sum('sgst') }} | {{ $accountingVoucherItems->sum('total') }} | {{ round($totalProfit, 2) }} ({{ count($totalProfits) > 0 ? round(array_sum($totalProfits) / count($totalProfits), 2) : 0 }}%) | {{ round($totalPMOnLandingCost, 2) }} ({{ count($totalPercentages) > 0 ? round(array_sum($totalPercentages) / count($totalPercentages), 2) : 0 }}%) | |||||||||
| Account Name | Amount |
|---|---|
| {{ $accountingVoucherDetail->ledger->name }} | {{ $accountingVoucherDetail->amount }} {{ $accountingVoucherDetail->dr_or_cr }} |