migrate to gtea from bistbucket

This commit is contained in:
2026-03-15 17:08:23 +07:00
commit 129ca2260c
3716 changed files with 566316 additions and 0 deletions

View File

@@ -0,0 +1,623 @@
<div class="invoice-container">
<div class="invoice-content p-4">
{{-- Print Header --}}
<div class="row py-2 d-flex align-items-start justify-content-between border-bottom print-container d-print-none">
<div class="col-md-6 d-flex align-items-center p-2">
<span class="Money-Receipt">{{ __('Sales Invoice') }}</span>
</div>
<div class="col-md-6 d-flex justify-content-end align-items-end">
<div class="d-flex gap-2">
<form action="{{ route('business.sales.mail', ['sale_id' => $sale->id]) }}" method="POST"
class="ajaxform_instant_reload ">
@csrf
<button type="submit" class="btn custom-print-btn"><img class="w-10 h-10"
src="{{ asset('assets/img/email.svg') }}"><span class="text-white pl-1">{{ __('Email') }}</span>
</button>
</form>
<a target="blank" class="pdf-btn print-btn" href="{{ route('business.sales.pdf', ['sale_id' => $sale->id]) }}">
<img class="w-10 h-10" src="{{ asset('assets/img/pdf.svg') }}">
{{ __('PDF') }}
</a>
<a class="print-btn-2 print-btn" onclick="window.print()"><img class="w-10 h-10" src="{{ asset('assets/img/print.svg') }}">{{ __('Print') }}</a>
</div>
</div>
</div>
<div class="d-flex justify-content-between align-items-center gap-3 print-logo-container">
{{-- Left Side: Logo and Content --}}
<div class="d-flex align-items-center gap-2 logo pdf-logo">
@if ((get_business_option('business-settings')['show_a4_invoice_logo'] ?? 0) == 1 )
<img class="invoice-logo" src="{{ asset(get_business_option('business-settings')['a4_invoice_logo'] ?? 'assts/images/default.svg') ?? '' }}">
@endif
</div>
{{-- Right Side: Invoice --}}
<div>
<div class="address-container">
@if (($sale->business->meta['show_address'] ?? 0) == 1)
<p> {{__('Address')}} : {{ $sale->branch?->address ?? $sale->business?->address ?? '' }}</p>
@endif
@if (($sale->business->meta['show_phone_number'] ?? 0) == 1)
<p> {{__('Mobile')}} : {{ $sale->branch?->phone ?? $sale->business?->phoneNumber ?? '' }}</p>
@endif
@if (($sale->business->meta['show_email'] ?? 0) == 1)
<p> {{__('Email')}} : {{ $sale->branch?->email ?? $sale->business?->email ?? '' }}</p>
@endif
<p>
@if (($sale->business->meta['show_vat'] ?? 0) == 1)
{{ $sale->business->vat_name }}
@endif
{{ (($sale->business->meta['show_vat'] ?? 0) == 1 && ($sale->business->meta['show_vat'] ?? 0) == 1) ? ':' : '' }}
@if (($sale->business->meta['show_vat'] ?? 0) == 1)
{{ $sale->business->vat_no ?? '' }}
@endif
</p>
</div>
</div>
</div>
<h3 class="right-invoice mb-0 align-self-center white-text">{{ __('INVOICE') }}</h3>
<div class="d-flex align-items-start justify-content-between flex-wrap">
<div>
<table class="table">
<tbody>
<tr class="in-table-row">
<td class="text-start bold-title">{{ __('Customer') }}</td>
<td class="text-start">: {{ $sale->party->name ?? 'Guest' }}</td>
</tr>
<tr class="in-table-row">
<td class="text-start bold-title">{{ __('Address') }}</td>
<td class="text-start">: {{ $sale->party->address ?? '' }}</td>
</tr>
<tr class="in-table-row ">
<td class="text-start bold-title">{{ __('Phone') }}</td>
<td class="text-start">: {{ $sale->party->phone ?? 'Guest' }}</td>
</tr>
<tr class="in-table-row ">
<td class="text-start bold-title">{{ __('Remarks') }}</td>
<td class="text-start">:
{{ $sale->meta['note'] ?? 'N/A' }}
</td>
</tr>
</tbody>
</table>
</div>
<div class="">
<table class="table">
<tbody>
<tr class="in-table-row">
<td class="text-start bold-title">{{ __('Invoice No') }}</td>
<td class="text-start"> : {{ $sale->invoiceNumber ?? '' }}</td>
</tr>
<tr class="in-table-row">
<td class="text-start bold-title">{{ __('Date') }}</td>
<td class="text-start">: {{ formatted_date($sale->saleDate ?? '') }}</td>
</tr>
<tr class="in-table-row">
<td class="text-start bold-title">{{ __('Time') }}</td>
<td class="text-start">: {{ formatted_time($sale->saleDate ?? '') }}</td>
</tr>
<tr class="in-table-row">
<td class="text-start bold-title">{{ __('Sales By') }}</td>
<td class="text-start">: {{ $sale->user->role != 'staff' ? 'Admin' : $sale->user->name }}</td>
</tr>
</tbody>
</table>
</div>
</div>
{{-- Sale Return --}}
@if (!$sale_returns->isEmpty())
{{-- Sales portion--}}
<div class="table-content custom-invoice-table">
<table class="table table-striped mb-1">
<thead>
<tr class="in-table-header">
<th class="head-red text-center white-text">{{ __('SL') }}</th>
<th class="head-red text-start white-text invoice-item">{{ __('Item') }}</th>
<th class="head-black text-center white-text">{{ __('Quantity') }}</th>
@if ($hasWarranty)
<th class="head-black text-center white-text">{{ __('Warranty') }}</th>
@endif
@if ($hasGuarantee)
<th class="head-black text-center white-text">{{ __('Guarantee') }}</th>
@endif
<th class="head-black text-end white-text">{{ __('Unit Price') }}</th>
<th class="head-black text-end white-text">{{ __('Discount') }}</th>
<th class="head-black text-end white-text">{{ __('Vat %') }}</th>
<th class="head-black text-end white-text">{{ __('Vat Value') }}</th>
<th class="head-black text-end white-text">{{ __('Total Price') }}</th>
</tr>
</thead>
@php
$subtotal = 0;
@endphp
<tbody class="in-table-body-container">
@foreach ($sale->details as $detail)
@php
$price = $detail->price ?? 0;
$discount = $detail->discount ?? 0;
$qty = $detail->quantities ?? 0;
$productTotal = ($price - $discount) * $qty;
$subtotal += $productTotal;
$info = $detail->warranty_guarantee_info ?? [];
$vat_percent = $detail->product->vat->rate ?? 0;
$vat_value = ($price * $qty) * ($vat_percent / 100);
@endphp
<tr class="in-table-body">
<td class="text-center">{{ $loop->iteration }}</td>
<td class="text-start">
<div class="invoice-item">
{{ ($detail->product->productName ?? '') . (!empty($detail->stock->batch_no) ? ' (' . $detail->stock->batch_no . ')' : '') }}
</div>
</td>
<td class="text-center">{{ $detail->quantities ?? '' }}</td>
@if ($hasWarranty)
<td class="text-center">
@if (!empty($info['warranty_duration']))
{{ $info['warranty_duration'] }} {{ ucfirst($info['warranty_unit'] ?? '') }}
@endif
</td>
@endif
@if ($hasGuarantee)
<td class="text-center">
@if (!empty($info['guarantee_duration']))
{{ $info['guarantee_duration'] }} {{ ucfirst($info['guarantee_unit'] ?? '') }}
@endif
</td>
@endif
<td class= "text-end">{{ currency_format($detail->price ?? 0, currency: business_currency()) }}</td>
<td class= "text-end">{{ currency_format($discount, currency: business_currency()) }}</td>
<td class="text-end">{{ $vat_percent }}%</td>
<td class="text-end">{{ currency_format($vat_value, currency: business_currency()) }}</td>
<td class="text-end">{{ currency_format($productTotal, currency: business_currency()) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="d-flex align-items-center justify-content-between position-relative">
<div>
<table class="table">
<tbody>
<tr class="in-table-row">
<td class="text-start"></td>
</tr>
<tr class="in-table-row">
<td class="text-start"></td>
</tr>
</tbody>
</table>
</div>
<div>
<table class="table">
<tbody>
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Subtotal') }}</td>
<td class="text-end">:</td>
<td class="text-end">{{ currency_format($subtotal, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($sale->vat_amount, currency: business_currency()) }}</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Shipping Charge') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($sale->shipping_charge, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom border-bottom-dis">
<td class="text-end">{{ __('Discount') }}
@if ($sale->discount_type == 'percent')
({{ $sale->discount_percent }}%)
@endif
</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($sale->discountAmount + $total_discount, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Total Amount') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($subtotal + $sale->vat_amount - ($sale->discountAmount + $total_discount) + $sale->shipping_charge + $sale->rounding_amount, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Rounding(+/-)') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format(abs($sale->rounding_amount), currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end total-amound white-text ">{{ __('Total Payable') }}</td>
<td class="text-end total-amound white-text ">:</td>
<td class="text-end total-amound white-text ">
{{ currency_format($subtotal + $sale->vat_amount - ($sale->discountAmount + $total_discount) + $sale->shipping_charge, currency: business_currency()) }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
{{-- Return portion--}}
<div class="custom-invoice-table">
<table class="table table-striped mb-1">
<thead>
<tr class="in-table-header">
<th class="head-red text-center white-text">{{ __('SL') }}</th>
<th class="head-red text-start white-text">{{ __('Date') }}</th>
<th class="head-black text-start white-text">{{ __('Returned Item') }}</th>
<th class="head-black text-center white-text">{{ __('Quantity') }}</th>
<th class="head-black text-end white-text">{{ __('Total Amount') }}</th>
</tr>
</thead>
@php
$total_return_amount = 0;
$row_counter = 0;
@endphp
<tbody class="in-table-body-container">
@foreach ($sale_returns as $key => $return)
@foreach ($return->details as $detail)
@php
$total_return_amount += $detail->return_amount ?? 0;
$row_counter ++;
@endphp
<tr class="in-table-body">
<td class="text-center">{{ $row_counter }}</td>
<td class="text-start">{{ formatted_date($return->return_date) }}</td>
<td class="text-start">
<div class="invoice-item">
{{ $detail->saleDetail->product->productName ?? '' }}
{{ $detail->saleDetail?->stock?->batch_no ? '(' . $detail->saleDetail?->stock?->batch_no . ')' : '' }}
</div>
</td>
<td class="text-center">{{ $detail->return_qty ?? 0 }}</td>
<td class="text-end">
{{ currency_format($detail->return_amount ?? 0, currency: business_currency()) }}
</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
</div>
<div class="d-flex align-items-start justify-content-between position-relative bottom-info-container mt-3">
<h2 class="word-amount">{{ amountInWords($total_return_amount) }}</h2>
<div>
<table class="table">
<tbody>
<tr class="in-table-row">
<td class="text-start paid-by pb-2 pt-3">{{ __('Paid by') }} :
{{ $returnTransactionType ?? $sale->paymentType ?? '' }}
</td>
</tr>
<tr class="in-table-row">
<td class="text-start paid-by">
@if ((get_business_option('business-settings')['show_note'] ?? 0 == 1))
{{ get_business_option('business-settings')['note_label'] ?? '' }} :
@endif
@if ((get_business_option('business-settings')['show_note'] ?? 0 == 1))
{{ get_business_option('business-settings')['note'] ?? '' }}
@endif
</td>
</tr>
</tbody>
</table>
@if ($bank_detail->show_in_invoice ?? 0 == 1)
<div class="bank-details-container">
<div class="bank-details-title">
Bank Details
</div>
<div class="back-details-content">
<table class="table mb-2">
<tbody>
<tr class="in-table-row">
<td class="text-start in-table-title">{{ __('Name') }} :</td>
<td class="clone-width">:</td>
<td class="text-start">{{ $bank_detail->name }}</td>
</tr>
<tr class="in-table-row">
<td class="text-start in-table-title">{{ __('Account No') }} :</td>
<td class="clone-width">:</td>
<td class="text-start">{{ $bank_detail->meta['account_number'] ?? '' }}</td>
</tr>
<tr class="in-table-row">
<td class="text-start in-table-title">{{ __('UPI ID') }}</td>
<td class="clone-width">:</td>
<td class="text-start">{{ $bank_detail->meta['upi_id'] ?? '' }}</td>
</tr>
<tr class="in-table-row">
<td class="text-start in-table-title">{{ __('Holders Name') }}</td>
<td class="clone-width">:</td>
<td class="text-start">{{ $bank_detail->meta['account_holder'] ?? '' }}</td>
</tr>
</tbody>
</table>
</div>
</div>
@endif
</div>
<div>
<table class="table">
<tbody>
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Total Return Amount') }}</td>
<td class="text-end">:</td>
<td class="text-end">{{ currency_format($total_return_amount, currency: business_currency()) }}</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end total-amound white-text">{{ __('Payable Amount') }}</td>
<td class="text-end total-amound white-text">:</td>
<td class="text-end total-amound white-text">{{ currency_format($sale->totalAmount, currency: business_currency()) }}</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Paid Amount') }}</td>
<td class="text-end">:</td>
<td class="text-end">{{ currency_format($sale->paidAmount, currency: business_currency()) }}</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Due') }}</td>
<td class="text-end">:</td>
<td class="text-end">{{ currency_format($sale->dueAmount, currency: business_currency()) }}</td>
</tr>
</tbody>
</table>
</div>
</div>
@else
{{-- Sales --}}
<div class="custom-invoice-table">
<table class="table table-striped mb-1">
<thead>
<tr class="in-table-header">
<th class="head-red text-center white-text">{{ __('SL') }}</th>
<th class="head-red text-start white-text invoice-item">{{ __('Item') }}</th>
<th class="head-black text-center white-text">{{ __('Quantity') }}</th>
@if ($hasWarranty)
<th class="head-black text-center white-text">{{ __('Warranty') }}</th>
@endif
@if ($hasGuarantee)
<th class="head-black text-center white-text">{{ __('Guarantee') }}</th>
@endif
<th class="head-black text-end white-text">{{ __('Unit Price') }}</th>
<th class="head-black text-end white-text">{{ __('Discount') }}</th>
<th class="head-black text-end white-text">{{ __('Vat %') }}</th>
<th class="head-black text-end white-text">{{ __('Vat Value') }}</th>
<th class="head-black text-end white-text">{{ __('Total Price') }}</th>
</tr>
</thead>
@php
$subtotal = 0;
@endphp
<tbody class="in-table-body-container">
@foreach ($sale->details as $detail)
@php
$price = $detail->price ?? 0;
$discount = $detail->discount ?? 0;
$qty = $detail->quantities ?? 0;
$productTotal = ($price - $discount) * $qty;
$subtotal += $productTotal;
$info = $detail->warranty_guarantee_info ?? [];
$vat_percent = $detail->product->vat->rate ?? 0;
$vat_value = ($price * $qty) * ($vat_percent / 100);
@endphp
<tr class="in-table-body">
<td class="text-center">{{ $loop->iteration }}</td>
<td class="text-start">
<div class="invoice-item">
{{ ($detail->product->productName ?? '') . (!empty($detail->stock?->batch_no) ? ' (' . $detail->stock?->batch_no . ')' : '') }}
</div>
</td>
<td class="text-center">{{ $detail->quantities ?? '' }}</td>
@if ($hasWarranty)
<td class="text-center">
@if (!empty($info['warranty_duration']))
{{ $info['warranty_duration'] }} {{ ucfirst($info['warranty_unit'] ?? '') }}
@endif
</td>
@endif
@if ($hasGuarantee)
<td class="text-center">
@if (!empty($info['guarantee_duration']))
{{ $info['guarantee_duration'] }} {{ ucfirst($info['guarantee_unit'] ?? '') }}
@endif
</td>
@endif
<td class="text-end">{{ currency_format($detail->price ?? 0, currency: business_currency()) }}</td>
<td class="text-end">{{ currency_format($discount, currency: business_currency()) }}</td>
<td class="text-end">{{ $vat_percent }}%</td>
<td class="text-end">{{ currency_format($vat_value, currency: business_currency()) }}</td>
<td class="text-end">{{ currency_format($productTotal, currency: business_currency()) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="d-flex align-items-start justify-content-between position-relative bottom-info-container mt-3">
<h2 class="word-amount">{{ amountInWords($subtotal) }}</h2>
<div>
<table class="table">
<tbody>
<tr class="in-table-row">
<td class="text-start paid-by pb-2 pt-3">{{ __('Paid by') }} :
{{ $transactionTypes ?? ($sale->payment_type_id ? ($sale->payment_type->name ?? '') : ($sale->paymentType ?? '')) }}
</td>
</tr>
<tr class="in-table-row">
<td class="text-start paid-by">
@if ((get_business_option('business-settings')['show_note'] ?? 0 == 1))
{{ get_business_option('business-settings')['note_label'] ?? '' }} :
@endif
@if ((get_business_option('business-settings')['show_note'] ?? 0 == 1))
{{ get_business_option('business-settings')['note'] ?? '' }}
@endif
</td>
</tr>
</tbody>
</table>
@if ($bank_detail->show_in_invoice ?? 0 == 1)
<div class="bank-details-container">
<div class="bank-details-title">
{{__('Bank Details')}}
</div>
<div class="back-details-content">
<table class="table mb-2">
<tbody>
<tr class="in-table-row">
<td class="text-start in-table-title">{{ __('Name') }}</td>
<td class="clone-width">:</td>
<td class="text-start">{{ $bank_detail->name }}</td>
</tr>
<tr class="in-table-row">
<td class="text-start in-table-title">{{ __('Account No') }}</td>
<td class="clone-width">:</td>
<td class="text-start">{{ $bank_detail->meta['account_number'] ?? '' }}</td>
</tr>
<tr class="in-table-row">
<td class="text-start in-table-title">{{ __('UPI ID') }}</td>
<td class="clone-width">:</td>
<td class="text-start">{{ $bank_detail->meta['upi_id'] ?? '' }}</td>
</tr>
<tr class="in-table-row">
<td class="text-start in-table-title">{{ __('Holders Name') }}</td>
<td class="clone-width">:</td>
<td class="text-start">{{ $bank_detail->meta['account_holder'] ?? '' }}</td>
</tr>
</tbody>
</table>
</div>
</div>
@endif
</div>
<div>
<table class="table">
<tbody>
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Subtotal') }}</td>
<td class="text-end">:</td>
<td class="text-end">{{ currency_format($subtotal, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($sale->vat_amount, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Shipping Charge') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($sale->shipping_charge, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom border-bottom-dis">
<td class="text-end ">{{ __('Discount') }}
@if ($sale->discount_type == 'percent')
({{ $sale->discount_percent }}%)
@endif
</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($sale->discountAmount, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Total Amount') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($sale->actual_total_amount, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Rounding(+/-)')}}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format(abs($sale->rounding_amount), currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end total-amound white-text">{{ __('Payable Amount') }}</td>
<td class="text-end total-amound white-text">:</td>
<td class="text-end total-amound white-text">
{{ currency_format($sale->totalAmount, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Receive Amount') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($sale->paidAmount + $sale->change_amount, currency: business_currency()) }}
</td>
</tr>
@if($sale->change_amount > 0)
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Change Amount') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($sale->change_amount, currency: business_currency()) }}
</td>
</tr>
@else
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Due') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($sale->dueAmount, currency: business_currency()) }}
</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
@endif
<div class="pdf-footer">
<div class="in-signature-container d-flex align-items-center justify-content-between my-3 px-2">
<div class="in-signature">
<hr class="in-hr">
<h4>{{ __('Customer Signature') }}</h4>
</div>
<div class="in-signature">
<hr class="in-hr">
<h4>{{ __('Authorized Signature') }}</h4>
</div>
</div>
</div>
@if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1)
<div class="warranty-container-2">
<p>
@if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1)
<span>{{ get_business_option('business-settings')['warranty_void_label'] ?? '' }} - </span>
@endif
{{ get_business_option('business-settings')['warranty_void'] ?? '' }}
</p>
</div>
@endif
</div>
</div>