@extends('layouts.master') @section('css') @endsection @section('title') Sales @endsection @section('content') @isset($accountingVoucher) @method('put') @else @endisset @csrf @isset($accountingVoucher) Edit Sales @else Add Sales @endisset @if (auth()->user()->staff == null) Branch @foreach ($branches as $branch) branch_id == $branch->id ? 'selected' : '') : ($branch->name == 'Main Branch' ? 'selected' : '') }}> {{ $branch->name }} @endforeach @endif Voucher Number @isset($accountingVoucher) @if (str_contains($accountingVoucher->voucher_number, '-')) @php $explode = explode('-', $accountingVoucher->voucher_number); $voucherNumber = end($explode); $prefix = array_pop($explode); $prefix = implode('-', $explode); @endphp {{ $prefix }} @else @endif @else @if ($voucherType->prefix != null) {{ $voucherType->prefix }} @else @endif @endisset Voucher Type @isset($accountingVoucher) {{ $accountingVoucher->voucherType->name }} @endisset Voucher Date Cost Center Select Cost Center @foreach ($costCenters as $costCenter) cost_center_id == $costCenter->id ? 'selected' : '') : '' }}> {{ $costCenter->name }} @endforeach Remarks {{ isset($accountingVoucher) ? $accountingVoucher->remarks : '' }} Sl No Type Particulars Debit Credit @if (Auth::user()->company_profile->use_bill_wise_receipt) Against Ref @endif Action @isset($accountingVoucher) @foreach ($accountingVoucher->accountingVoucherLedgers as $key => $accountingVoucherLedger) {{ $key + 1 }} {{ $key + 1 == 1 ? 'Party Ledger' : ($key + 1 == 2 ? 'Sales Ledger' : 'Other Ledgers') }} dr_or_cr == 'Dr' ? 'selected' : '' }} {{ $key + 1 == 2 ? 'disabled' : '' }}> By dr_or_cr == 'Cr' ? 'selected' : '' }}{{ $key + 1 == 1 ? 'disabled' : '' }}> To Select Ledger Account {{ $accountingVoucherLedger->ledger->name }} dr_or_cr == 'Cr' ? 'disabled' : '' }}> dr_or_cr == 'Dr' ? 'disabled' : '' }}> @if (Auth::user()->company_profile->use_bill_wise_receipt) @php $bill_wise_receipts = \App\Models\BillWiseReceipt::where( 'accounting_voucher_id', $accountingVoucher->id, ) ->where( 'ledger_id', $accountingVoucherLedger->ledger->id, ) ->where( 'dr_or_cr', $accountingVoucherLedger->dr_or_cr, ) ->whereNotNull('against_voucher_id') ->get(); $opening_receipts = \App\Models\BillWiseReceipt::where( 'accounting_voucher_id', $accountingVoucher->id, ) ->where('Type', 'Opening Balance') ->where( 'ledger_id', $accountingVoucherLedger->ledger->id, ) ->where( 'dr_or_cr', $accountingVoucherLedger->dr_or_cr, ) ->get(); if ($opening_receipts->count() > 0) { foreach ( $opening_receipts as $key => $opening_receipt ) { echo 'Opening Balance - ' . $opening_receipt->amount . ''; } } foreach ( $bill_wise_receipts as $bill_wise_receipt ) { echo '' . $bill_wise_receipt->againstVoucher ->VoucherType->name . ' - ' . $bill_wise_receipt->againstVoucher ->voucher_number . ' - ' . $bill_wise_receipt->amount . ''; } @endphp @endif @if ($key != 0 && $key != 1) @endif @endforeach @endisset Total {{ isset($accountingVoucher) ? $accountingVoucher->accountingVoucherLedgers->where('dr_or_cr', 'Dr')->sum('amount') : 0.0 }} {{ isset($accountingVoucher) ? $accountingVoucher->accountingVoucherLedgers->where('dr_or_cr', 'Cr')->sum('amount') : 0.0 }} Add Submit @endsection @section('script') @endsection