PreorderBilling

This commit is contained in:
Frank Schubert
2025-03-31 13:50:49 +02:00
parent 21655c5ff4
commit 17405c8c5d
17 changed files with 704 additions and 43 deletions

View File

@@ -0,0 +1,22 @@
<?php
/**
* @var Invoice $invoice
*/
$this->setReturnValue([
'subject' => "Ihre ".(($invoice->total < 0) ? "Gutschrift" : "Rechnung" )." ".$invoice->invoice_number,
'from_email' => "no-reply@rmlinfrastruktur.at",
'from_email_name' => "Verrechnung | RML Infrastruktur GmbH"
]);
?>
Sehr geehrte Damen und Herren,
im Anhang übersenden wir Ihnen unsere Abrechnung <?=(new DateTime($invoice->invoice_date))->modify("-1 month")?>
Im Anhang erhalten Sie Ihre aktuelle <?=($invoice->total < 0) ? "Gutschrift" : "Rechnung"?>.
Beste Grüße,
RML Infrastruktur GmbH
Wirtschaftspark A | 8940 Liezen
+43 664 128 10 40
rechnung@rmlinfrastruktur.at | www.rmlinfrastruktur.at
www.facebook.com/rmlinfrastruktur

View File

@@ -55,7 +55,7 @@ $pagination_entity_name = "Billingrecords";
</select>
</div>
<div class="col-1">
<label class="form-label" for="filter_fibu_account_number">Fibu Kontonummer</label>
<label class="form-label" for="filter_fibu_account_number">Kundennummer</label>
<input type="text" class="form-control" name="filter[fibu_account_number]" id="filter_fibu_account_number" value="<?=(array_key_exists("fibu_account_number", $filter)) ? $filter['fibu_account_number'] : ""?>"/>
</div>
@@ -156,7 +156,7 @@ $pagination_entity_name = "Billingrecords";
<th>Preis</th>
<th>Preis Setup</th>
<th>Zustellung</th>
<th></th>
<th>Erstellt</th>
</tr>
<?php foreach($billings as $billing): ?>
<tr>
@@ -186,7 +186,10 @@ $pagination_entity_name = "Billingrecords";
<td class="<?=($billing->price < 0) ? "text-danger" : ""?>">€ <?=number_format($billing->price,2,",",".")?></td>
<td class="<?=($billing->price_setup < 0) ? "text-danger" : ""?>">€ <?=number_format($billing->price_setup,2,",",".")?></td>
<td><?=($billing->billing_delivery == "email") ? "Email" : "Papier"?></td>
<td></td>
<td>
<?=$billing->creator->name?><br />
<?=date("d.m.Y H:i", $billing->create)?>
</td>
</tr>
<?php endforeach; ?>
</table>

View File

@@ -60,11 +60,11 @@ $pagination_entity_name = "Rechnungen";
</select>
</div>
<div class="col-1">
<label class="form-label" for="filter_start_date_from">Periode von</label>
<label class="form-label" for="filter_start_date_from">Rech.nummer von</label>
<input type="text" class="form-control" name="filter[start_date_from]" id="filter_start_date_from" value="<?=(array_key_exists("start_date_from", $filter)) ? $filter['start_date_from'] : ""?>"/>
</div>
<div class="col-1">
<label class="form-label" for="filter_start_date_to">Periode bis</label>
<label class="form-label" for="filter_start_date_to">Rech.nummer bis</label>
<input type="text" class="form-control" name="filter[start_date_to]" id="filter_start_date_to" value="<?=(array_key_exists("start_date_to", $filter)) ? $filter['start_date_to'] : ""?>"/>
</div>
@@ -91,6 +91,52 @@ $pagination_entity_name = "Rechnungen";
<div class="card">
<div class="card-body mb-3">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-6 border-left">
<h4>Rechungsemails versenden</h4>
<form method="post" action="<?=self::getUrl("PreorderBillingInvoice", "createJob")?>">
<input type="hidden" name="task" value="send-preorder-invoice-email" />
<div class="row">
<div class="col-4">
<label class="form-label" for="from_date">Job Startdatum:</label>
<input type="text" class="form-control datepicker" name="from_date" value="" />
</div>
</div>
<button type="submit" class="btn btn-primary mt-1"><i class="fas fa-fw fa-circle-plus"></i> Versandjob erstellen</button>
<?php if(is_array($email_jobs) && count($email_jobs)): ?>
<h5>Aktuelle Email Jobs</h5>
<table class="table table-sm table-striped">
<tr>
<th>Start ab</th>
<th>Gestartet</th>
<th>Beendet</th>
<th>Status</th>
</tr>
<?php foreach($email_jobs as $job): ?>
<tr id="job-<?=$job->id?>">
<td><?=$job->from_date?></td>
<td><?=$job->started?></td>
<td class="finished"><?=$job->finished?></td>
<td>
<strong class="status text-monospace <?=(($job->status == "finished") ? "text-success" : ($job->status == "timeout" ? "text-danger" : "text-info"))?>"><?=($job->status) ? $job->status : "neu"?></strong><br />
<span class="status-text"><?=$job->getResult("sent") ? $job->getResult("sent")." Emails versendet" : ""?></span>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
</form>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<h4 class="header-title">Rechnungen</h4>
@@ -113,7 +159,8 @@ $pagination_entity_name = "Rechnungen";
<th>Netto</th>
<th>Ust.</th>
<th>Brutto</th>
<th></th>
<th>Zustellung</th>
<th>Erstellt</th>
</tr>
<?php foreach($invoices as $invoice): ?>
<tr>
@@ -141,7 +188,11 @@ $pagination_entity_name = "Rechnungen";
<td>€ <?=number_format($invoice->total, 2, ",", ".")?></td>
<td>€ <?=number_format($invoice->total_gross - $invoice->total, 2, ",", ".")?></td>
<td>€ <?=number_format($invoice->total_gross, 2, ",", ".")?></td>
<td></td>
<td class="text-monospace text-success"><?=($invoice->date_delivered) ? "<i class='far fa-envelope-circle-check'></i> ".date("d.m.Y H:i", $invoice->date_delivered) : ""?></td>
<td>
<?=$invoice->creator->name?><br />
<?=date("d.m.Y H:i", $invoice->create)?>
</td>
</tr>
<?php endforeach; ?>
</table>
@@ -179,5 +230,76 @@ $pagination_entity_name = "Rechnungen";
todayBtn: 'linked',
autoclose: true
});
$('.datepicker').datepicker({
orientation: "bottom",
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
var status_update;
function updateStatus() {
$.post(
"<?=self::getUrl("PreorderBillingInvoice", "api")?>",
{
do: "getActiveJobs",
type: "send-preorder-invoice-email"
},
function(success) {
if(success.status != "OK") return;
jobs = success.result.jobs;
jobs.forEach((job) => {
let status = JSON.parse(job.result);
if(!status) return;
let status_text = "";
let count = 0;
if(job.task == "send-preorder-invoice-email") {
status_text = status.sent + " Emails versendet";
count = status.sent;
}
let old_count = 0;
let m = $("#job-" + job.id + " .status-text").text().match(/^(\d+)/);
if(m) {
old_count = m[1];
}
if(old_count != count) {
$("#job-" + job.id + " .status-text").fadeOut();
$("#job-" + job.id + " .status-text").promise().done(() => {$("#job-" + job.id + " .status-text").text(status_text).fadeIn()});
}
$("#job-" + job.id + " .status").text(job.status ? job.status : "neu");
if(job.status == "timeout") {
$("#job-" + job.id + " .status").removeClass("text-info text-success").addClass("text-danger");
} else if(job.status == "finished") {
$("#job-" + job.id + " .status").removeClass("text-info text-danger").addClass("text-success");
} else {
$("#job-" + job.id + " .status").removeClass("text-danger text-success").addClass("text-info");
}
if(job.finished) {
$("#job-" + job.id + " .finished").text(job.finished);
} else {
$("#job-" + job.id + " .finished").text("");
}
});
status_update = setTimeout(updateStatus, 2000);
},
"json"
);
}
$(document).ready(() => {
<?php if(is_array($email_jobs) && count($email_jobs)): ?>
status_update = setTimeout(updateStatus, 1000);
<?php endif; ?>
});
</script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -76,7 +76,7 @@ $this->setReturnValue(['filename' => $invoice->invoice_number . ".pdf"]);
}
tr.position td:first-child {
vertical-align: middle !important;
/*vertical-align: middle !important;*/
padding-left: 4pt;
}
@@ -119,9 +119,14 @@ $this->setReturnValue(['filename' => $invoice->invoice_number . ".pdf"]);
?>
<tr class="position <?=($i%2 == 0) ? "even" : "uneven" ?>">
<td style="text-align: left"><?=$i+1?></td>
<td style="text-align: left; vertical-align: top;"><?=$i+1?></td>
<td style="text-align: left"><?=$p->article_number?></td>
<td style="text-align: left"><?=$p->article_name?></td>
<td style="text-align: left">
<?=$p->article_name?>
<?php if($p->article_info): ?>
<div style="padding-left: 2pt; font-style: italic;"><?=$p->article_info?></div>
<?php endif; ?>
</td>
<td style="text-align: right"><?=$amount?></td>
<td style="text-align: left"><?=$p->unit?></td>
<td style="text-align: right"><?=$price?> €</td>
@@ -165,7 +170,7 @@ $this->setReturnValue(['filename' => $invoice->invoice_number . ".pdf"]);
<th style="width: 20%; text-align: left">Zahlungskondition:</th>
<td style="text-align: left;">Zahlbar sofort nach Erhalt der Rechnung ohne Abzug</td>
<td rowspan="3">
<img alt="QR-Code" src="<?=$qrcode?>" style="text-align:right;height: 3cm;">
<img alt="QR-Code" src="<?=$qrcode?>" style="text-align:right;height: 3.1cm;">
</td>
</tr><tr>
<th style="text-align: left; vertical-align: top;">Bankverbindung:</th>
@@ -174,10 +179,10 @@ $this->setReturnValue(['filename' => $invoice->invoice_number . ".pdf"]);
IBAN: AT85 1200 0100 3986 5885 &nbsp; BIC: BKAUATWWXXX
</td>
</tr><tr>
<td style="width: 20%; text-align: left; vertical-align: top; padding-top: 16px;"></td>
<th style="width: 20%; text-align: left; vertical-align: top; padding-top: 16px;">Kontakt:</th>
<td style="text-align: left; vertical-align: top; padding-top: 16px;">
<strong>+43 664 128 10 43</strong><br />
<strong>office@rml-infrastruktur.at</strong>
+43 664 128 1040<br />
rechnung@rmlinfrastruktur.at
</td>
</tr>
</table>

View File

@@ -379,6 +379,22 @@
</div>
</div>
<div class="card">
<div class="card-body">
<h4>Verrechnungsdaten</h4>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="">Netzinhaber FIBU Kostenstelle</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="netowner_fibu_cost_code" value="<?=$campaign->netowner_fibu_cost_code?>" />
</div>
</div>
</div>
</div>
<h4>Emailbenachrichtigungen</h4>
<?php if(isset($campaign) && $campaign): ?>
<div class="card">