Rechnungen
- Artikelsuche - optional weg - Einheit weg - Einzelpreis wird nicht geholt - einzelpreis andere preistypen irgendwie anzeigen - ust weg - -1 menge erlauben - kleiner Speicher bug - mit Rechnungsadresse LS geht nicht übernehmen - pdf herunterladen Status ändern - per Mail verschicken ohne eingetragene Mail geht ned
This commit is contained in:
@@ -108,7 +108,9 @@ class ManualInvoiceController extends TTCrud
|
||||
"{{ leistungszeitraumHtml }}" => ($invoice->leistungszeitraum ?? '') ? "<tr><td>Leistungszeitraum:</td><td>" . htmlspecialchars($invoice->leistungszeitraum) . "</td></tr>" : "",
|
||||
"{{ externeReferenzHtml }}" => ($invoice->externe_referenz ?? '') ? "<tr><td>Externe Referenz:</td><td>" . htmlspecialchars($invoice->externe_referenz) . "</td></tr>" : "",
|
||||
"{{ vatHtml }}" => ($invoice->uid ?? '') ? "<tr><td>Ihre UID:</td><td>" . $invoice->uid . "</td></tr>" : "",
|
||||
"{{ qrCodeSrc }}" => $this->generateSepaQRCode($invoice->invoice_number ?? "VORSCHAU", round($invoice->total_gross ?? 0, 2))
|
||||
"{{ qrCodeHtml }}" => ($invoice->total_gross ?? 0) >= 0
|
||||
? '<td style="vertical-align: top; padding-right: 10px;"><img alt="QR-Code" src="' . $this->generateSepaQRCode($invoice->invoice_number ?? "VORSCHAU", round($invoice->total_gross ?? 0, 2)) . '" style="display: block; height: 100%; max-height: 3.5cm; width: auto;"></td>'
|
||||
: ''
|
||||
];
|
||||
|
||||
$headerHtml = str_replace(array_keys($replacements), array_values($replacements), file_get_contents(BASEDIR . "/Layout/default/ManualInvoice/PDF_HEADER.html"));
|
||||
@@ -349,10 +351,17 @@ class ManualInvoiceController extends TTCrud
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
|
||||
// Log download in journal
|
||||
// Update status to 'gesendet' (same as email)
|
||||
if ($invoice->status === 'erstellt') {
|
||||
$invoice->status = 'gesendet';
|
||||
$invoice->save();
|
||||
}
|
||||
|
||||
// Log download in journal with status change
|
||||
ManualInvoiceJournalModel::create([
|
||||
'manualinvoiceId' => $id,
|
||||
'text' => 'Rechnung heruntergeladen',
|
||||
'statusChange' => 'gesendet',
|
||||
'createBy' => $me->id,
|
||||
'create' => time()
|
||||
]);
|
||||
@@ -467,13 +476,20 @@ class ManualInvoiceController extends TTCrud
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
|
||||
// Fields that exist in ManualInvoicepositionModel
|
||||
$allowedFields = ['billing_id', 'contract_id', 'matchcode', 'product_id', 'product_name', 'product_info',
|
||||
'amount', 'unit', 'price', 'discount', 'price_total', 'price_gross', 'vatrate',
|
||||
'fibu_cost_account', 'fibu_cost_account_legacy', 'fibu_taxcode', 'options'];
|
||||
|
||||
foreach ($this->tempPositions as $position) {
|
||||
// Skip empty positions
|
||||
if (empty($position['product_name']) || ($position['amount'] ?? 0) == 0) continue;
|
||||
|
||||
// Map _group to position_group
|
||||
$groupName = $position['_group'] ?? null;
|
||||
unset($position['_group']);
|
||||
|
||||
// Filter to only allowed fields
|
||||
$filteredPosition = array_intersect_key($position, array_flip($allowedFields));
|
||||
|
||||
ManualInvoicepositionModel::create(array_merge([
|
||||
'manualinvoice_id' => $invoiceId,
|
||||
@@ -484,7 +500,7 @@ class ManualInvoiceController extends TTCrud
|
||||
'edit_by' => $me->id,
|
||||
'create' => time(),
|
||||
'edit' => time()
|
||||
], $position));
|
||||
], $filteredPosition));
|
||||
}
|
||||
$this->tempPositions = [];
|
||||
}
|
||||
@@ -810,6 +826,15 @@ class ManualInvoiceController extends TTCrud
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse prices from cheapestSellPrice JSON
|
||||
$prices = [];
|
||||
if (!empty($article->cheapestSellPrice)) {
|
||||
$pricesData = json_decode($article->cheapestSellPrice, true);
|
||||
if (is_array($pricesData)) {
|
||||
$prices = $pricesData;
|
||||
}
|
||||
}
|
||||
|
||||
self::returnJson([
|
||||
'success' => true,
|
||||
'article' => [
|
||||
@@ -817,8 +842,10 @@ class ManualInvoiceController extends TTCrud
|
||||
'title' => $article->title,
|
||||
'articleNumber' => $article->articleNumber,
|
||||
'description' => $article->description,
|
||||
'revenueAccount' => $article->revenueAccount
|
||||
'revenueAccount' => $article->revenueAccount,
|
||||
'unit' => $article->unit
|
||||
],
|
||||
'prices' => $prices,
|
||||
'vatgroup_id' => $vatgroupId,
|
||||
'fibu_cost_account' => $vatrate->account,
|
||||
'fibu_cost_account_legacy' => $vatrate->legacy_account,
|
||||
|
||||
Reference in New Issue
Block a user