@extends('layout.app')
@section('title', 'Edit Sale Voucher')
@push('header_script')
@endpush
@section('content')
{!! Form::open([
'route' => ['sale-voucher.update', $saleVoucher->id],
'onsubmit' => 'BtnSubmit.disabled = true',
'class' => 'needs-validation',
'method' => 'post',
'autocomplete' => 'off',
'files' => true,
]) !!}
@method('PUT')
{{-- ========================================
SECTION 1: VOUCHER DETAILS
======================================== --}}
{{-- ========================================
PARTY DETAILS CARD
======================================== --}}
-
-
-
-
-
-
-
{{-- ========================================
INFORMATION PANEL CARD
======================================== --}}
{!! Form::select(
'party_account_ledger_id',
['' => '--Select--'] + $partyLedger,
old('party_account_ledger_id', $saleVoucher->party_account_ledger_id),
['class' => 'form-control select2', 'id' => 'party_account_ledger_id', 'required'],
) !!}
Balance:
{{ $errors->first('party_account_ledger_id') }}
@if ($saleVoucher->doc)
@endif
{{ $errors->first('doc') }}
{{-- ========================================
SECTION 3: SELECTED ITEM DETAILS
======================================== --}}
| Name of Item *
|
Qty * |
Unit * |
Rate/Unit * |
Amount * |
Tax Rate (%) |
Tax Amount |
Total Amount * |
|
@php $rowIndex = 10; @endphp
@forelse($saleVoucher->voucherDetails as $detail)
@php
$rowIndex++;
$ri = $rowIndex;
@endphp
|
{!! Form::select(
'product_id[]',
['' => '--Select--'] + $product,
old('product_id.' . $loop->index, $detail->product_id),
[
'class' => 'form-control select2',
'id' => 'product_id_' . $ri,
'required',
],
) !!}
|
|
|
|
|
@php
$isGstApplicable = ($detail->product && $detail->product->gst_applicable == 'yes') ? true : false;
$selectAttributes = [
'class' => 'form-control select2 taxGroupIds',
'id' => 'tax_group_id_' . $ri,
'required'
];
if (!$isGstApplicable) {
$selectAttributes['disabled'] = 'disabled';
}
@endphp
{!! Form::select(
'tax_group_id[]',
['' => '--Select--'] + $taxGroup,
old('tax_group_id.' . $loop->index, $detail->tax_group_id),
$selectAttributes
) !!}
|
|
|
@if (!$loop->first)
@endif
|
@empty
|
{!! Form::select('product_id[]', ['' => '--Select--'] + $product, old('product_id.0'), [
'class' => 'form-control select2',
'id' => 'product_id_11',
'required',
]) !!}
|
|
|
|
|
{!! Form::select('tax_group_id[]', ['' => '--Select--'] + $taxGroup, old('tax_group_id.0'), [
'class' => 'form-control select2 taxGroupIds',
'id' => 'tax_group_id_11',
'required',
]) !!}
|
|
|
|
@endforelse
| Total Amount |
|
|
|
|
|
{{-- ══════ CALCULATION SECTION ══════ --}}
{{-- OTHER CHARGES BEFORE GST --}}
{{-- GST BREAKUP --}}
{{-- OTHER CHARGES AFTER GST --}}
{{-- GROSS TOTAL --}}
{{-- ROUND OFF --}}
{{-- NET TOTAL --}}
{{-- PAID AMOUNT --}}
{{-- REMAINING BALANCE --}}
{{-- REMARK --}}
{{ $errors->first('remark') }}
{!! Form::close() !!}
@include('common.modal.common_party')
@include('common.modal.product')
@endsection
@push('footer_script')
{{-- ══════ PRE-LOAD EXISTING OTHER CHARGES (BEFORE GST) ══════ --}}
@php
$existingOtherCharges = $saleVoucher->otherCharges ?? collect();
$existingAfterGst = $saleVoucher->afterGstCharges ?? collect();
$existingPayments = $saleVoucher->payments ?? collect();
@endphp
@php
$productHasGst = !empty($detail->product->tax_group_id);
@endphp
{{-- Party modal --}}
{{-- - product modal ---------- --}}
@endpush