Some adjustments to show customer's logo.

This commit is contained in:
2025-02-01 13:05:29 +01:00
parent 922f3ae175
commit ba92198750
7 changed files with 36 additions and 7 deletions

View File

@@ -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)));