update perbaikan pos, return, dan report profit nlost
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 4m17s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 15s
Build, Push and Deploy / deploy-staging (push) Successful in 41s
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-05-14 22:19:01 +07:00
parent 1dfc06635d
commit 2fabdf8fc9
48 changed files with 1700 additions and 3030 deletions

View File

@@ -1,46 +1,33 @@
@php
$isBusinessRoute = request()->routeIs('business.purchases.*');
$business_id = $purchase->business_id;
$vat_amount = $purchase->vat_amount;
@endphp
<div class="invoice-container">
<div class="invoice-content p-4 position-relative">
<div class="row d-print-none py-2 d-flex align-items-start justify-content-between border-bottom print-container">
<div class="col-md-3 d-flex align-items-center p-2">
<div class="col-md-6 d-flex align-items-center p-2">
<span class="Money-Receipt">{{ __('Purchase Invoice') }}</span>
</div>
@if($isBusinessRoute)
<div class="col-md-9 d-flex justify-content-start justify-content-md-end align-items-end">
<div class="d-flex gap-2 flex-wrap ">
<a href="javascript:void(0)" class="pdf-btn print-btn share-btn" data-bs-toggle="modal" data-bs-target="#shareModalDues">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.8303 3.75H6.96224C4.50701 3.75 3.27939 3.75 2.51665 4.48223C1.75391 5.21447 1.75391 6.39298 1.75391 8.75V12.0833C1.75391 14.4403 1.75391 15.6188 2.51665 16.3511C3.27939 17.0833 4.50701 17.0833 6.96224 17.0833H10.4678C12.923 17.0833 14.1506 17.0833 14.9133 16.3511C15.4075 15.8767 15.5815 15.2149 15.6428 14.1667" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
<path d="M13.4723 5.83073V3.20869C13.4723 3.04597 13.6097 2.91406 13.7792 2.91406C13.8605 2.91406 13.9386 2.9451 13.9962 3.00035L17.9396 6.7861C18.1362 6.97475 18.2465 7.23061 18.2465 7.4974C18.2465 7.76418 18.1362 8.02005 17.9396 8.20869L13.9962 11.9944C13.9386 12.0497 13.8605 12.0807 13.7792 12.0807C13.6097 12.0807 13.4723 11.9488 13.4723 11.7861V9.16406H10.9298C7.39583 9.16406 6.09375 12.0807 6.09375 12.0807V9.9974C6.09375 7.69621 8.03696 5.83073 10.434 5.83073H13.4723Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
</svg>
{{__('Share')}}
</a>
<form action="{{ route('business.purchases.mail', ['purchase_id' => $purchase->id]) }}" method="POST" class="ajaxform_instant_reload">
<div class="col-md-6 d-flex justify-content-end align-items-end">
<div class="d-flex gap-2 ">
<form action="{{ route('business.purchases.mail', ['purchase_id' => $purchase->id]) }}" method="POST"
class="ajaxform_instant_reload">
@csrf
<button type="submit" class="btn custom-print-btn submit-btn"><img class="w-10 h-10" src="{{ asset('assets/img/email.svg') }}"><span class="pl-1">{{__('Email')}}</span> </button>
<button type="submit" class="btn custom-print-btn"><img class="w-10 h-10"
src="{{ asset('assets/img/email.svg') }}"><span class="pl-1">{{__('Email')}}</span> </button>
</form>
<a target="_blank" href="{{ route('business.purchases.pdf', ['purchase_id' => $purchase->id]) }}" class="pdf-btn print-btn">
<a target="blank" href="{{ route('business.purchases.pdf', ['purchase_id' => $purchase->id]) }}"
class="pdf-btn print-btn">
<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>
{{__('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>
@endif
</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">
@if ((get_business_option('business-settings', $business_id)['show_a4_invoice_logo'] ?? 0) == 1 )
<img class="invoice-logo" src="{{ Storage::url(get_business_option('business-settings', $business_id)['a4_invoice_logo'] ?? 'assets/images/default.svg') ?? '' }}">
@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'] ?? 'assets/images/default.svg') ?? '' }}">
@endif
</div>
@@ -109,9 +96,8 @@
</div>
</div>
{{-- PURCHASE + RETURN --}}
@if (!$purchase_returns->isEmpty())
{{-- purchases portion --}}
{{-- purchases --}}
<div class="custom-invoice-table">
<table class="table table-striped">
<thead>
@@ -121,48 +107,34 @@
<th class="head-black text-center">{{ __('Quantity') }}</th>
@usercan('purchases.price')
<th class="head-black text-end">{{ __('Unit Price') }}</th>
<th class="head-black text-end">{{ __('Price (exc.)') }}</th>
@endusercan
<th class="head-black text-end">{{ __('Total Price') }}</th>
</tr>
</thead>
@php
$subtotal = 0;
$total_product_vat = 0;
@endphp
<tbody class="in-table-body-container">
@foreach ($purchase->details as $detail)
@php
$productTotal = ($detail->productPurchasePrice ?? 0) * ($detail->quantities ?? 0);
$exclusive_price = ($detail->price_without_tax && $detail->price_without_tax > 0) ? $detail->price_without_tax : ($detail->productPurchasePrice ?? 0);
$qty = $detail->quantities ?? 0;
$product_vat = $productTotal - ($exclusive_price * $qty ?? 1);
$total_product_vat += $product_vat;
$subtotal += $exclusive_price * ($qty ?? 1);
$subtotal += $productTotal;
@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 . ')' : '') }}
@if(moduleCheck('SerialCodeAddon') && ($detail->product->has_serial ?? 0) == 1)
<p>{{__('Serial')}}:{{ is_array($detail->serial_numbers) ? implode(', ', $detail->serial_numbers) : $detail->serial_numbers }}
</p>
@endif
</div>
</td>
<td class="text-center">{{ $detail->quantities ?? '' }}</td>
@usercan('purchases.price')
<td class="text-end">
{{ currency_format($detail->productPurchasePrice ?? 0, currency: business_currency($business_id)) }}
</td>
<td class="text-end">
{{ currency_format($exclusive_price ?? 0, currency: business_currency($business_id)) }}
{{ currency_format($detail->productPurchasePrice ?? 0, currency: business_currency()) }}
</td>
@endusercan
<td class="text-end">
{{ currency_format($productTotal, currency: business_currency($business_id)) }}</td>
{{ currency_format($productTotal, currency: business_currency()) }}</td>
</tr>
@endforeach
</tbody>
@@ -187,21 +159,20 @@
<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($business_id)) }}
<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', $business_id)['vat_name'] ?? 'Vat' }}</td>
<td class="text-end">: </td>
<td class="text-end">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($vat_amount + $total_product_vat, currency: business_currency($business_id)) }}
</td>
{{ currency_format($purchase->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($purchase->shipping_charge, currency: business_currency($business_id)) }}
{{ currency_format($purchase->shipping_charge, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom border-bottom-dis">
@@ -212,14 +183,14 @@
</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($purchase->discountAmount + $total_discount, currency: business_currency($business_id)) }}
{{ currency_format($purchase->discountAmount + $total_discount, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end total-amound">{{ __('Total Amount') }}</td>
<td class="text-end total-amound">:</td>
<td class="text-end total-amound">
{{ currency_format($subtotal + $total_product_vat + $vat_amount - ($purchase->discountAmount + $total_discount) + $purchase->shipping_charge, currency: business_currency($business_id)) }}
{{ currency_format($subtotal + $purchase->vat_amount - ($purchase->discountAmount + $total_discount) + $purchase->shipping_charge, currency: business_currency()) }}
</td>
</tr>
</tbody>
@@ -227,7 +198,7 @@
</div>
</div>
{{-- purchase Return portion --}}
{{-- purchase Return --}}
<div class="custom-invoice-table">
<table class="table table-striped">
<thead>
@@ -248,19 +219,16 @@
@endphp
<tr class="in-table-body">
<td class="text-center">{{ $loop->iteration }}</td>
<td class="text-start">{{ formatted_datetime($return->return_date) }}</td>
<td class="text-start">{{ formatted_date($return->return_date) }}</td>
<td class="text-start">
<div class="invoice-item">
{{ $detail->purchaseDetail->product->productName ?? '' }}
{{ $detail->purchaseDetail?->stock?->batch_no ? '(' . $detail->purchaseDetail?->stock?->batch_no . ')' : '' }}
@if(moduleCheck('SerialCodeAddon') && ($detail->purchaseDetail->product->has_serial ?? 0) == 1)
<p>{{__('Serial')}}: {{ is_array($detail->serial_numbers) ? implode(', ', $detail->serial_numbers) : $detail->serial_numbers }}</p>
@endif
</div>
</td>
<td class="text-center">{{ $detail->return_qty ?? 0 }}</td>
<td class="text-end">
{{ currency_format($detail->return_amount ?? 0, currency: business_currency($business_id)) }}
{{ currency_format($detail->return_amount ?? 0, currency: business_currency()) }}
</td>
</tr>
@endforeach
@@ -269,7 +237,7 @@
</table>
</div>
<div class="d-flex align-items-start justify-content-between position-relative bottom-info-container">
<h2 class="word-amount">{{ amountInWords($total_return_amount, business_id: $business_id) }}</h2>
<h2 class="word-amount">{{ amountInWords($total_return_amount) }}</h2>
<div>
<table class="table">
<tbody>
@@ -281,10 +249,10 @@
{{ $returnTransactionType ?? $purchase->paymentType ?? '' }}
</td>
</tr>
@if ((get_business_option('business-settings', $business_id)['show_note'] ?? 0) == 1)
@if ((get_business_option('business-settings')['show_note'] ?? 0) == 1)
<tr class="in-table-row">
<td class="text-start">
{{ get_business_option('business-settings', $business_id)['note'] ?? '' }}
{{ get_business_option('business-settings')['note'] ?? '' }}
</td>
</tr>
@endif
@@ -293,7 +261,7 @@
@if ($bank_detail->show_in_invoice ?? 0 == 1)
<div class="bank-details-container">
<div class="bank-details-title">
{{__('Bank Details')}}
Bank Details
</div>
<div class="back-details-content">
<table class="table mb-2">
@@ -333,33 +301,32 @@
<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($business_id)) }}</td>
{{ currency_format($total_return_amount, currency: business_currency()) }}</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end total-amound">{{ __('Payable Amount') }}</td>
<td class="text-end total-amound">:</td>
<td class="text-end total-amound">
{{ currency_format($purchase->totalAmount, currency: business_currency($business_id)) }}</td>
{{ currency_format($purchase->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($purchase->paidAmount, currency: business_currency($business_id)) }}</td>
{{ currency_format($purchase->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($purchase->dueAmount, currency: business_currency($business_id)) }}</td>
{{ currency_format($purchase->dueAmount, currency: business_currency()) }}</td>
</tr>
</tbody>
</table>
</div>
</div>
{{-- ONLY PURCHASE --}}
@else
{{-- purchases --}}
<div class="custom-invoice-table">
<table class="table table-striped">
<thead>
@@ -369,54 +336,39 @@
<th class="head-black text-center">{{ __('Quantity') }}</th>
@usercan('purchases.price')
<th class="head-black text-end">{{ __('Unit Price') }}</th>
<th class="head-black text-end">{{ __('Price (exc.)') }}</th>
@endusercan
<th class="head-black text-end">{{ __('Total Price') }}</th>
</tr>
</thead>
@php
$subtotal = 0;
$total_product_vat = 0;
@endphp
@php $subtotal = 0; @endphp
<tbody class="in-table-body-container">
@foreach ($purchase->details as $detail)
@php
$productTotal = ($detail->productPurchasePrice ?? 0) * ($detail->quantities ?? 0);
$exclusive_price = ($detail->price_without_tax && $detail->price_without_tax > 0) ? $detail->price_without_tax : ($detail->productPurchasePrice ?? 0);
$qty = $detail->quantities ?? 0;
$product_vat = $productTotal - ($exclusive_price * $qty ?? 1);
$total_product_vat += $product_vat;
$subtotal += $exclusive_price * ($qty ?? 1);
$subtotal += $productTotal;
@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 . ')' : '') }}
@if(moduleCheck('SerialCodeAddon') && ($detail->product->has_serial ?? 0) == 1)
<p>{{__('Serial')}}: {{ is_array($detail->serial_numbers) ? implode(', ', $detail->serial_numbers) : $detail->serial_numbers }}</p>
@endif
</div>
</td>
<td class="text-center">{{ $detail->quantities ?? '' }}</td>
@usercan('purchases.price')
<td class="text-end">
{{ currency_format($detail->productPurchasePrice ?? 0, currency: business_currency($business_id)) }}
</td>
<td class="text-end">
{{ currency_format($exclusive_price ?? 0, currency: business_currency($business_id)) }}
{{ currency_format($detail->productPurchasePrice ?? 0, currency: business_currency()) }}
</td>
@endusercan
<td class="text-end">
{{ currency_format($productTotal, currency: business_currency($business_id)) }}</td>
{{ 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">
<h2 class="word-amount">{{ amountInWords($purchase->totalAmount, business_id: $business_id) }}</h2>
<h2 class="word-amount">{{ amountInWords($subtotal) }}</h2>
<div>
<table class="table">
<tbody>
@@ -428,10 +380,10 @@
{{ $transactionTypes ?? ($purchase->payment_type_id ? ($purchase->payment_type->name ?? '') : ($purchase->paymentType ?? '')) }}
</td>
</tr>
@if ((get_business_option('business-settings', $business_id)['show_note'] ?? 0) == 1)
@if ((get_business_option('business-settings')['show_note'] ?? 0) == 1)
<tr class="in-table-row">
<td class="text-start">
{{ get_business_option('business-settings', $business_id)['note'] ?? '' }}
{{ get_business_option('business-settings')['note'] ?? '' }}
</td>
</tr>
@endif
@@ -480,21 +432,21 @@
<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($business_id)) }}
<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', $business_id)['vat_name'] ?? 'Vat' }}</td>
<td class="text-end">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($vat_amount + $total_product_vat, currency: business_currency($business_id)) }}
{{ currency_format($purchase->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($purchase->shipping_charge, currency: business_currency($business_id)) }}
{{ currency_format($purchase->shipping_charge, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom border-bottom-dis" >
@@ -505,20 +457,20 @@
</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($purchase->discountAmount, currency: business_currency($business_id)) }}
{{ currency_format($purchase->discountAmount, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end total-amound">{{ __('Total Amount') }}</td>
<td class="text-end total-amound">:</td>
<td class="text-end total-amound">
{{ currency_format($purchase->totalAmount, currency: business_currency($business_id)) }}</td>
{{ currency_format($purchase->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($purchase->paidAmount + $purchase->change_amount, currency: business_currency($business_id)) }}
{{ currency_format($purchase->paidAmount + $purchase->change_amount, currency: business_currency()) }}
</td>
</tr>
@if($purchase->change_amount > 0)
@@ -526,7 +478,7 @@
<td class="text-end">{{ __('Change Amount') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($purchase->change_amount, currency: business_currency($business_id)) }}
{{ currency_format($purchase->change_amount, currency: business_currency()) }}
</td>
</tr>
@else
@@ -534,7 +486,7 @@
<td class="text-end">{{ __('Due') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($purchase->dueAmount, currency: business_currency($business_id)) }}
{{ currency_format($purchase->dueAmount, currency: business_currency()) }}
</td>
</tr>
@endif
@@ -556,26 +508,15 @@
</div>
</div>
</div>
@if ((get_business_option('business-settings', $business_id)['show_warranty'] ?? 0) == 1)
@if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1)
<div class="warranty-container-2">
<p>
@if ((get_business_option('business-settings', $business_id)['show_warranty'] ?? 0) == 1)
<span>{{ get_business_option('business-settings', $business_id)['warranty_void_label'] ?? '' }} - </span>
@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', $business_id)['warranty_void'] ?? '' }}
{{ get_business_option('business-settings')['warranty_void'] ?? '' }}
</p>
</div>
@endif
<h4 class="tax-powered pt-3 pb-0">{{ get_option('general')['admin_footer_text'] ?? '' }}: {{ get_option('general')['admin_footer_link_text'] ?? '' }}</h4>
</div>
</div>
@php
$shareUrl = $purchase->unique_id ? route('purchase.invoice.unique', $purchase->unique_id) : ($purchase->party?->phone ? route('purchase.invoice', ['purchase_id' => $purchase->id, 'phone' => $purchase->party?->phone]) : '');
$facebook = $shareUrl ? 'https://www.facebook.com/sharer/sharer.php?u=' . urlencode($shareUrl) : '';
$twitter = $shareUrl ? 'https://twitter.com/intent/tweet?url=' . urlencode($shareUrl) : '';
$whatsapp = $shareUrl ? 'https://wa.me/?text=' . urlencode($shareUrl) : '';
@endphp
@include('business::component.share-modal', ['copy' => $shareUrl, 'facebook' => $facebook, 'twitter' => $twitter, 'whatsapp' => $whatsapp])