Some adjustments to show customer's logo.
This commit is contained in:
@@ -175,6 +175,9 @@ class ExcelController extends Controller
|
||||
$tax[$item->tax] = 0;
|
||||
$gross[$item->tax] = 0;
|
||||
}
|
||||
if ($invoice->sum == 0) {
|
||||
continue;
|
||||
}
|
||||
$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);
|
||||
$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('C' . $row, $invoice->address->name);
|
||||
$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->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->setCellValue('F' . $row, $payment->paid_amount);
|
||||
$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->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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\View\Composers\OptionLogo;
|
||||
use App\View\Composers\TaxDropdown;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\Facades\View;
|
||||
@@ -34,6 +35,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
public function boot(): void
|
||||
{
|
||||
View::composer('components.tax-dropdown', TaxDropdown::class);
|
||||
View::composer('components.company-logo', OptionLogo::class);
|
||||
Number::useLocale(config('app.locale'));
|
||||
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]);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user