Some adjustments to show customer's logo.
This commit is contained in:
@@ -175,6 +175,9 @@ class ExcelController extends Controller
|
|||||||
$tax[$item->tax] = 0;
|
$tax[$item->tax] = 0;
|
||||||
$gross[$item->tax] = 0;
|
$gross[$item->tax] = 0;
|
||||||
}
|
}
|
||||||
|
if ($invoice->sum == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$net[$item->tax] += $item->amount * $item->price * $payment->paid_amount / $invoice->sum;
|
$net[$item->tax] += $item->amount * $item->price * $payment->paid_amount / $invoice->sum;
|
||||||
$tax[$item->tax] += $item->amount * $item->price * $item->tax * $payment->paid_amount / ($invoice->sum * 100);
|
$tax[$item->tax] += $item->amount * $item->price * $item->tax * $payment->paid_amount / ($invoice->sum * 100);
|
||||||
$gross[$item->tax] += $item->total * $payment->paid_amount / ($invoice->sum);
|
$gross[$item->tax] += $item->total * $payment->paid_amount / ($invoice->sum);
|
||||||
@@ -184,9 +187,9 @@ class ExcelController extends Controller
|
|||||||
$worksheet->setCellValue('B' . $row, $invoice->customer->name);
|
$worksheet->setCellValue('B' . $row, $invoice->customer->name);
|
||||||
$worksheet->setCellValue('C' . $row, $invoice->address->name);
|
$worksheet->setCellValue('C' . $row, $invoice->address->name);
|
||||||
$worksheet->getCell('D' . $row)->getStyle()->getNumberFormat()->setFormatCode($this->currencyMask);
|
$worksheet->getCell('D' . $row)->getStyle()->getNumberFormat()->setFormatCode($this->currencyMask);
|
||||||
$worksheet->setCellValue('D' . $row, ($invoice->sum - $invoice->tax) / ($invoice->sum / $payment->paid_amount));
|
$worksheet->setCellValue('D' . $row, ($invoice->sum != 0 && $payment->paid_amount != 0) ? (($invoice->sum - $invoice->tax) / ($invoice->sum / $payment->paid_amount)) : 0);
|
||||||
$worksheet->getCell('E' . $row)->getStyle()->getNumberFormat()->setFormatCode($this->currencyMask);
|
$worksheet->getCell('E' . $row)->getStyle()->getNumberFormat()->setFormatCode($this->currencyMask);
|
||||||
$worksheet->setCellValue('E' . $row, $invoice->tax / ($invoice->sum / $payment->paid_amount));
|
$worksheet->setCellValue('E' . $row, ($invoice->sum != 0 && $payment->paid_amount != 0) ? ($invoice->tax / ($invoice->sum / $payment->paid_amount)) : 0);
|
||||||
$worksheet->getCell('F' . $row)->getStyle()->getNumberFormat()->setFormatCode($this->currencyMask);
|
$worksheet->getCell('F' . $row)->getStyle()->getNumberFormat()->setFormatCode($this->currencyMask);
|
||||||
$worksheet->setCellValue('F' . $row, $payment->paid_amount);
|
$worksheet->setCellValue('F' . $row, $payment->paid_amount);
|
||||||
$worksheet->setCellValue('G' . $row, Date::PHPToExcel(\DateTime::createFromFormat('!Y-m-d', $payment->payment_date)));
|
$worksheet->setCellValue('G' . $row, Date::PHPToExcel(\DateTime::createFromFormat('!Y-m-d', $payment->payment_date)));
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ class OptionController extends Controller
|
|||||||
$option->value = $value;
|
$option->value = $value;
|
||||||
$option->save();
|
$option->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$arr = explode(';base64,', $request->company_logo);
|
||||||
|
$type = substr($arr[0], strpos($arr[0], '/') + 1);
|
||||||
|
file_put_contents(base_path('/public/storage/company_logo.'. $type), base64_decode($arr[1]));
|
||||||
|
|
||||||
return response()->json($request->all());
|
return response()->json($request->all());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use App\View\Composers\OptionLogo;
|
||||||
use App\View\Composers\TaxDropdown;
|
use App\View\Composers\TaxDropdown;
|
||||||
use Illuminate\Support\Facades\URL;
|
use Illuminate\Support\Facades\URL;
|
||||||
use Illuminate\Support\Facades\View;
|
use Illuminate\Support\Facades\View;
|
||||||
@@ -34,6 +35,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
View::composer('components.tax-dropdown', TaxDropdown::class);
|
View::composer('components.tax-dropdown', TaxDropdown::class);
|
||||||
|
View::composer('components.company-logo', OptionLogo::class);
|
||||||
Number::useLocale(config('app.locale'));
|
Number::useLocale(config('app.locale'));
|
||||||
Number::useCurrency(config('app.currency'));
|
Number::useCurrency(config('app.currency'));
|
||||||
|
|
||||||
|
|||||||
17
app/View/Composers/OptionLogo.php
Normal file
17
app/View/Composers/OptionLogo.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Composers;
|
||||||
|
|
||||||
|
use App\Models\Option;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class OptionLogo
|
||||||
|
{
|
||||||
|
public function compose(View $view): void
|
||||||
|
{
|
||||||
|
$company_logo = Option::where('name', '=', 'company_logo')->first();
|
||||||
|
|
||||||
|
$view->with(['company_logo' => $company_logo]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
1
resources/views/components/company-logo.blade.php
Normal file
1
resources/views/components/company-logo.blade.php
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<img src="{{ $company_logo->value }}" {{ $attributes }}/>
|
||||||
@@ -6,15 +6,12 @@
|
|||||||
<!-- Logo -->
|
<!-- Logo -->
|
||||||
<div class="shrink-0 flex items-center">
|
<div class="shrink-0 flex items-center">
|
||||||
<a href="{{ route('dashboard') }}">
|
<a href="{{ route('dashboard') }}">
|
||||||
<x-application-logo class="block h-9 w-auto fill-current text-gray-800 dark:text-gray-200"/>
|
<x-company-logo class="block h-9 w-auto fill-current text-gray-800 dark:text-gray-200"/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Navigation Links -->
|
<!-- Navigation Links -->
|
||||||
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
|
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
|
||||||
<x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
|
|
||||||
{{ __('dashboard.Dashboard') }}
|
|
||||||
</x-nav-link>
|
|
||||||
<x-nav-link :href="route('customer.index')"
|
<x-nav-link :href="route('customer.index')"
|
||||||
:active="\Illuminate\Support\Str::startsWith(request()->route()->getName(), 'customer.') || \Illuminate\Support\Str::startsWith(request()->route()->getName(), 'address.')">
|
:active="\Illuminate\Support\Str::startsWith(request()->route()->getName(), 'customer.') || \Illuminate\Support\Str::startsWith(request()->route()->getName(), 'address.')">
|
||||||
{{ __('customer.Customers') }}
|
{{ __('customer.Customers') }}
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
<header>
|
<header>
|
||||||
<div>
|
<div>
|
||||||
<div class="left header-left">
|
<div class="left header-left">
|
||||||
<img class="header-logo" src="{{ $options->company_logo }}" />
|
@php
|
||||||
|
$arr = explode(';base64,', $options->company_logo);
|
||||||
|
$type = substr($arr[0], strpos($arr[0], '/') + 1);
|
||||||
|
@endphp
|
||||||
|
<img class="header-logo" src="{{ base_path('/public/storage/company_logo.' . $type) }}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="right header-right text-right">
|
<div class="right header-right text-right">
|
||||||
<div>{{ $options->company_name }}</div>
|
<div>{{ $options->company_name }}</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user