Files
kulakpos_web/Modules/Business/resources/views/sales/pdf.blade.php
eko54r 05fd3230b8
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 5m14s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 17s
Build, Push and Deploy / deploy-staging (push) Successful in 41s
Build, Push and Deploy / deploy-production (push) Has been skipped
update marketing
2026-05-14 11:55:22 +07:00

640 lines
24 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@extends('layouts.business.pdf.pdf_layout')
@section('pdf_title')
<style>
body {
font-family: notosansarmenian, sans-serif;
font-size: 12px;
color: #000;
}
.invoice-container {
width: 100%;
padding: 10px;
direction: {{ app()->getLocale() == 'ar' ? 'rtl' : 'ltr' }};
text-align: {{ app()->getLocale() == 'ar' ? 'right' : 'left' }};
}
.border-none {
border: 1px solid transparent
}
.top-table {
width: 100%;
border-collapse: collapse;
}
.logo-cell img {
height: 45px;
}
.company-name {
font-size: 20px;
font-weight: bold;
}
.right-info {
text-align: right;
font-size: 12px;
line-height: 1.6;
}
.invoice-badge {
margin: 10px auto 15px auto;
text-align: center;
}
.invoice-badge span {
display: inline-block;
padding: 6px 25px;
background: #c5161d;
color: #fff;
border-radius: 20px;
font-weight: bold;
letter-spacing: 1px;
}
.info-table {
width: 100%;
margin-bottom: 10px;
}
.info-table td {
vertical-align: top;
padding: 2px 4px;
}
.item-table {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
}
.item-table th,
.item-table td {
border: 1px solid #000;
padding: 6px;
font-size: 12px;
}
.item-table th {
background: #f5f5f5;
font-weight: bold;
}
.text-right {
text-align: right;
}
.text-center {
text-align: center;
}
.summary-table {
width: 100%;
margin-top: 10px;
}
.summary-table td {
padding: 4px;
font-size: 12px;
}
.summary-right {
width: 40%;
float: right;
}
.return-title {
margin-top: 15px;
font-weight: bold;
}
.footer-table {
width: 100%;
margin-top: 25px;
}
.signature {
width: 40%;
text-align: end;
}
.signature-2 {
text-align: right
}
.signature hr {
margin-bottom: 3px;
}
.warranty-box {
border: 1px solid #000;
padding: 6px;
margin-top: 15px;
font-size: 11px;
}
</style>
@endsection
@section('pdf_title')
<div style="text-align:center; margin-bottom: 10px;">
@include('business::print.header')
<h4 class="mt-2" style="text-align:center;">{{ __('Sales Invoice') }}</h4>
<div class="invoice-badge">
<span>{{ __('Invoice') }}</span>
</div>
</div>
@push('css')
@include('business::pdf.fonts-css')
<style>
body {
font-family: notosansarmenian, sans-serif;
font-size: 12px;
}
:root {
--clr-primary: var(--dynamic-primary, #c52127);
--secondary-color: var(--dynamic-secondary, #0071bc);
--sidebar-color: var(--dynamic-sidebar, #201415);
--accent-color: var(--dynamic-accent, #fef0f1);
--clr-white: #fff;
--clr-white2: #f9f9f9;
--clr-white3: #f3f7ff;
--clr-black: #01040d;
--clr-black2: #171717;
--clr-black3: #344054;
--clr-gray: #525252;
--clr-gray1: #737373;
--clr-gray2: #d4d4d4;
--clr-gray3: #f5f5f5;
--clr-gray4: #f4f5f7;
--clr-gray5: #a3a3a3;
--clr-violet: rgba(130, 49, 211, 1);
--clr-violet-light: rgba(130, 49, 211, 0.12);
--clr-green: #01b81a;
--clr-green-light: rgba(1, 184, 26, 0.12);
--clr-orange: #ff6565;
--clr-orange-light: rgba(255, 116, 62, 0.12);
--clr-red: #ef4444;
--ff: "Inter", sans-serif;
}
.header-table {
width: 100%;
margin-bottom: 10px;
}
.header-table td {
vertical-align: top;
padding: 2px 5px;
}
.invoice-table,
.return-table,
.summary-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 10px;
}
.invoice-table th,
.invoice-table td,
.return-table th,
.return-table td,
.summary-table td {
border: 1px solid #000;
padding: 4px;
}
.invoice-table th,
.return-table th {
background-color: #f2f2f2;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
.signature {
width: 45%;
display: inline-block;
text-align: center;
margin-top: 30px;
}
.signature hr {
margin: 30px 0 5px;
border: none;
border-top: 1px solid #000;
}
.warranty {
border: 1px solid #000;
padding: 5px;
font-size: 11px;
margin-top: 10px;
}
.invoice-badge{
background-color: #c52127 !important;
}
</style>
@endpush
@endsection
@section('pdf_content')
@php
$subtotal = 0;
foreach ($sale->details as $detail) {
$subtotal += ($detail->price - $detail->discount) * $detail->quantities;
}
$total_return_amount = 0;
foreach ($sale_returns as $return) {
foreach ($return->details as $detail) {
$total_return_amount += $detail->return_amount;
}
}
@endphp
<div class="invoice-container" dir="{{ app()->getLocale() == 'ar' ? 'rtl' : 'ltr' }}">
{{-- Header --}}
<table class="header-table">
<tr>
<td style="width:60%;">
@php
$defaultLogo = public_path('assets/images/default.svg');
$customLogo = public_path(
get_business_option('business-settings')['a4_invoice_logo'] ?? 'assets/images/default.svg',
);
$logoPath = file_exists($customLogo) ? $customLogo : $defaultLogo;
$logoData = base64_encode(file_get_contents($logoPath));
$logoType = pathinfo($logoPath, PATHINFO_EXTENSION);
$src = 'data:image/' . $logoType . ';base64,' . $logoData;
@endphp
@if ((get_business_option('business-settings')['show_a4_invoice_logo'] ?? 0) == 1)
<img style="
width: auto;
height: 54px;
display: block;" src="{{ $src }}">
@endif
</td>
<td style="width:40%; text-align:right;">
@if (($sale->business->meta['show_address'] ?? 0) == 1)
<div>{{ __('Address') }} : {{ $sale->branch?->address ?? ($sale->business?->address ?? '') }}</div>
@endif
@if (($sale->business->meta['show_phone_number'] ?? 0) == 1)
<div>{{ __('Mobile') }} : {{ $sale->branch?->phone ?? ($sale->business?->phoneNumber ?? '') }}</div>
@endif
@if (($sale->business->meta['show_email'] ?? 0) == 1)
<div>{{ __('Email') }} : {{ $sale->branch?->email ?? ($sale->business?->email ?? '') }}</div>
@endif
<div>
@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
</div>
</td>
</tr>
</table>
{{-- INVOICE BADGE --}}
<h3 class="invoice-badge"
style="
font-size: 20px;
font-weight: 600;
color: white;
padding: 5px 12px;
border-radius: 30px;
margin: 0;
width: 100px;
display: flex;
align-items: center;
justify-content: center;
margin: auto;
border: 1px solid black;
text-align: center;">
{{ __('INVOICE') }}
</h3>
{{-- Customer & Invoice Info --}}
<table class="header-table">
<tr>
<td style="width:50%; text-align:{{ app()->getLocale() == 'ar' ? 'right' : 'left' }};">
<div>{{ __('Customer') }} : {{ $sale->party->name ?? __('Guest') }}</div>
<div>{{ __('Address') }} : {{ $sale->party->address ?? '' }}</div>
<div>{{ __('Phone') }} : {{ $sale->party->phone ?? __('Guest') }}</div>
<div>{{ __('Remarks') }} : {{ $sale->meta['note'] ?? 'N/A' }}</div>
</td>
<td style="width:50%; text-align:{{ app()->getLocale() == 'ar' ? 'left' : 'right' }};">
<div>{{ __('Invoice No') }} : {{ $sale->invoiceNumber ?? '' }}</div>
<div>{{ __('Date') }} : {{ formatted_date($sale->saleDate ?? '') }}</div>
<div>{{ __('Time') }} : {{ formatted_time($sale->saleDate ?? '') }}</div>
<div>{{ __('Sales By') }} :
{{ $sale->user->role != 'staff' ? __('Admin') : $sale->user->name }}
</div>
</td>
</tr>
</table>
{{-- Sale Items --}}
<table class="invoice-table">
<thead>
<tr>
<th>{{ __('SL') }}</th>
<th>{{ __('Item') }}</th>
<th>{{ __('Quantity') }}</th>
@if ($hasWarranty)
<th>{{ __('Warranty') }}</th>
@endif
@if ($hasGuarantee)
<th>{{ __('Guarantee') }}</th>
@endif
<th>{{ __('Unit Price') }}</th>
<th>{{ __('Discount') }}</th>
<th>{{ __('Total Price') }}</th>
</tr>
</thead>
<tbody>
@foreach ($sale->details as $detail)
@php
$price = $detail->price ?? 0;
$discount = $detail->discount ?? 0;
$qty = $detail->quantities ?? 0;
$productTotal = ($price - $discount) * $qty;
$info = $detail->warranty_guarantee_info ?? [];
@endphp
<tr>
<td class="text-center">{{ $loop->iteration }}</td>
<td class="text-center">
{{ $detail->product->productName ?? '' }}
{{ !empty($detail->stock?->batch_no) ? ' (' . $detail->stock->batch_no . ')' : '' }}
</td>
<td class="text-center">{{ $qty }}</td>
@if ($hasWarranty)
<td class="text-center">{{ $info['warranty_duration'] ?? '' }}
{{ $info['warranty_unit'] ?? '' }}</td>
@endif
@if ($hasGuarantee)
<td class="text-center">{{ $info['guarantee_duration'] ?? '' }}
{{ $info['guarantee_unit'] ?? '' }}</td>
@endif
<td class="text-center">{{ currency_format($price, currency: business_currency()) }}</td>
<td class="text-center">{{ currency_format($discount, currency: business_currency()) }}</td>
<td class="text-center">{{ currency_format($productTotal, currency: business_currency()) }}</td>
</tr>
@endforeach
</tbody>
</table>
<table class="table-summery" width="100%" style="margin-top:15px;">
<tr>
<!-- LEFT SIDE -->
<td width="60%" valign="top">
<table width="100%">
<tbody>
<tr>
<td>{{ amountInWords($subtotal) }}</td>
</tr>
<tr>
<td style="padding-bottom:8px;">
@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>
<tr>
<td style="padding-top:5px; font-weight:bold;">
{{ __('Paid by') }} :
{{ $transactionTypes ??
($due_collect->payment_type_id ? $due_collect->payment_type->name ?? '' : $due_collect->paymentType ?? '') }}
</td>
</tr>
</tbody>
</table>
{{-- BANK DETAILS --}}
@if (($bank_detail->show_in_invoice ?? 0) == 1)
<table width="" style="margin-top:10px; border:1px solid #ccc;" cellspacing="0"
cellpadding="5">
<tr>
<td colspan="2" style="font-weight:bold; background:#f5f5f5;">
{{ __('Bank Details') }}
</td>
</tr>
<tr>
<td width="40%">{{ __('Name') }}</td>
<td width="60%">: {{ $bank_detail->name }}</td>
</tr>
<tr>
<td>{{ __('Account No') }}</td>
<td>: {{ $bank_detail->meta['account_number'] ?? '' }}</td>
</tr>
<tr>
<td>{{ __('UPI ID') }}</td>
<td>: {{ $bank_detail->meta['upi_id'] ?? '' }}</td>
</tr>
<tr>
<td>{{ __('Holders Name') }}</td>
<td>: {{ $bank_detail->meta['account_holder'] ?? '' }}</td>
</tr>
</table>
@endif
</td>
<!-- RIGHT SIDE -->
<td width="40%" valign="top" align="right">
<table width="100%">
<tbody>
<tr>
<td align="right">{{ __('Subtotal') }}</td>
<td align="right">:</td>
<td align="right">{{ currency_format($subtotal, currency: business_currency()) }}</td>
</tr>
<tr>
<td align="right">{{ __('Vat') }}</td>
<td align="right">:</td>
<td align="right">{{ currency_format($sale->vat_amount, currency: business_currency()) }}
</td>
</tr>
<tr>
<td align="right">{{ __('Shipping Charge') }} </td>
<td align="right">:</td>
<td align="right">
{{ currency_format($sale->shipping_charge, currency: business_currency()) }}</td>
</tr>
<tr>
<td align="right">{{ __('Discount') }} </td>
<td align="right">:</td>
<td align="right">
{{ currency_format($sale->discountAmount + $total_discount, currency: business_currency()) }}
</td>
</tr>
<tr>
<td align="right">{{ __('Total Amount') }} </td>
<td align="right">:</td>
<td align="right">
{{ currency_format(
$subtotal +
$sale->vat_amount -
($sale->discountAmount + $total_discount) +
$sale->shipping_charge +
$sale->rounding_amount,
currency: business_currency(),
) }}
</td>
</tr>
<tr>
<td align="right">{{ __('Rounding (+/-)') }} </td>
<td align="right">:</td>
<td align="right">
{{ currency_format(abs($sale->rounding_amount), currency: business_currency()) }}</td>
</tr>
<tr>
<td align="right">{{ __('Total Payable') }} </td>
<td align="right">:</td>
<td align="right">{{ currency_format($sale->totalAmount, currency: business_currency()) }}
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
{{-- Sale Returns --}}
@if (!$sale_returns->isEmpty())
<table style="margin-top: 14px" class="return-table">
<thead>
<tr>
<th>{{ __('SL') }}</th>
<th>{{ __('Date') }}</th>
<th>{{ __('Returned Item') }}</th>
<th>{{ __('Quantity') }}</th>
<th>{{ __('Total Amount') }}</th>
</tr>
</thead>
<tbody>
@php
$total_return_amount = 0;
$row_counter = 0;
@endphp
@foreach ($sale_returns as $return)
@foreach ($return->details as $detail)
@php
$total_return_amount += $detail->return_amount ?? 0;
$row_counter++;
@endphp
<tr>
<td class="text-center">{{ $row_counter }}</td>
<td class="text-center">{{ formatted_date($return->return_date) }}</td>
<td class="text-center">
{{ $detail->saleDetail->product->productName ?? '' }}
{{ $detail->saleDetail?->stock?->batch_no ? '(' . $detail->saleDetail?->stock?->batch_no . ')' : '' }}
</td>
<td class="text-center">{{ $detail->return_qty }}</td>
<td class="text-center">
{{ currency_format($detail->return_amount, currency: business_currency()) }}</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
<table width="100%" style="margin-top:15px;">
<tr>
<td>{{ amountInWords($total_return_amount) }}</td>
</tr>
<tr>
<!-- LEFT SIDE -->
<td width="60%" valign="top">
{{ __('Paid by') }} :
{{ $returnTransactionType ?? ($sale->paymentType ?? '') }}
</td>
<!-- RIGHT SIDE -->
<td width="40%" valign="top" align="right">
<table width="100%">
<tbody>
<tr>
<td align="right">{{ __('Total Return Amount') }}</td>
<td align="right">:</td>
<td align="right">
{{ currency_format($total_return_amount, currency: business_currency()) }}</td>
</tr>
<tr>
<td align="right">{{ __('Payable Amount') }}</td>
<td align="right">:</td>
<td align="right">{{ currency_format($sale->totalAmount, currency: business_currency()) }}
</td>
</tr>
<tr>
<td align="right">{{ __('Paid Amount') }} </td>
<td align="right">:</td>
<td align="right">{{ currency_format($sale->paidAmount, currency: business_currency()) }}
</td>
</tr>
<tr>
<td align="right">{{ __('Due') }} </td>
<td align="right">:</td>
<td align="right">{{ currency_format($sale->dueAmount, currency: business_currency()) }}
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
@endif
{{-- Payment Info & Signature --}}
{{-- SIGNATURE --}}
<table class="footer-table">
<tr>
<td class="signature">
<div class="" style="border-top: 1px solid black">
{{ __('Customer Signature') }}
</div>
</td>
<td></td>
<td class="signature-2">
<div style="border-top: 1px solid black;">
{{ __('Authorized Signature') }}
</div>
</td>
</tr>
</table>
{{-- Warranty Box --}}
@if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1)
<div class="warranty">
@if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1)
<strong>{{ get_business_option('business-settings')['warranty_void_label'] ?? '' }} - </strong>
@endif
{{ get_business_option('business-settings')['warranty_void'] ?? '' }}
</div>
@endif
</div>
@endsection