Added button to send copy of Invoice in PreorderBillingInvoice
This commit is contained in:
@@ -13,6 +13,10 @@ $period = "monthly";
|
||||
$netowner_config = TT_PREORDER_BILLING[$invoice->netowner_id];
|
||||
$netoperator_config = $netowner_config["netoperators"][$invoice->owner_id];
|
||||
|
||||
if($netoperator_config["billing-period"] == "quarterly") {
|
||||
$period = "quarterly";
|
||||
}
|
||||
|
||||
if($period == "monthly") {
|
||||
$fmt = new IntlDateFormatter(
|
||||
MFLOCALE_TIME,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
$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"
|
||||
'from_email_name' => "Rechnung | RML Infrastruktur GmbH"
|
||||
]);
|
||||
?>
|
||||
Sehr geehrte Damen und Herren,
|
||||
|
||||
@@ -175,6 +175,7 @@ $pagination_entity_name = "Rechnungen";
|
||||
<th>Brutto</th>
|
||||
<th>Versendet</th>
|
||||
<th>Erstellt</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach($invoices as $invoice): ?>
|
||||
<tr>
|
||||
@@ -207,6 +208,9 @@ $pagination_entity_name = "Rechnungen";
|
||||
<?=$invoice->creator->name?><br />
|
||||
<?=date("d.m.Y H:i", $invoice->create)?>
|
||||
</td>
|
||||
<td>
|
||||
<a href="#" onclick="openSendCopyModal(<?=$invoice->id?>); return false;" title="Rechungskopie versenden"><i class="fas fa-fw fa-paper-plane"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
@@ -227,6 +231,32 @@ $pagination_entity_name = "Rechnungen";
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="sendCopyModal" tabindex="-1" aria-labelledby="sendCopyModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form method="post" action="<?=self::getUrl("PreorderBillingInvoice", "sendCopy")?>">
|
||||
<input type="hidden" name="id" value="" />
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="sendCopyModalLabel">Rechungskopie versenden</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="recipient-name" class="col-form-label">Empfänger Emailadresse:</label>
|
||||
<input type="text" class="form-control email_to" name="email_to">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
|
||||
<button type="submit" class="btn btn-primary">Rechnungskopie versenden</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$("#filter_start_date_from").datepicker({
|
||||
orientation: "bottom",
|
||||
@@ -253,6 +283,12 @@ $pagination_entity_name = "Rechnungen";
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
function openSendCopyModal(id) {
|
||||
$('#sendCopyModal input[name="id"]').val(id);
|
||||
$('#sendCopyModal input[name="email_to"]').val("");
|
||||
$('#sendCopyModal').modal();
|
||||
}
|
||||
|
||||
var status_update;
|
||||
|
||||
function updateStatus() {
|
||||
|
||||
@@ -666,6 +666,31 @@ class PreorderBillingInvoiceController extends mfBaseController {
|
||||
$this->redirect("PreorderBillingInvoice");
|
||||
}
|
||||
|
||||
protected function sendCopyAction() {
|
||||
$id = $this->request->id;
|
||||
if(!is_numeric($id) || $id < 1) {
|
||||
$this->layout()->setFlash("Rechnung nicht gefunden", "error");
|
||||
$this->redirect("PreorderBillingInvoice");
|
||||
}
|
||||
|
||||
$invoice = new PreorderBillingInvoice($id);
|
||||
if(!$invoice->id) {
|
||||
$this->layout()->setFlash("Rechnung nicht gefunden", "error");
|
||||
$this->redirect("PreorderBillingInvoice");
|
||||
}
|
||||
|
||||
$email = trim($this->request->email_to);
|
||||
if(!$email) {
|
||||
$this->layout()->setFlash("Ungültige Emailadresse", "error");
|
||||
$this->redirect("PreorderBillingInvoice");
|
||||
}
|
||||
|
||||
$invoice->sendByEmail($email);
|
||||
|
||||
$this->layout()->setFlash("Rechnungskopie erfolgreich versendet", "success");
|
||||
$this->redirect("PreorderBillingInvoice");
|
||||
}
|
||||
|
||||
public function _sendEmailInvoices($limit = false) {
|
||||
$sent = 0;
|
||||
$defer = 0;
|
||||
|
||||
Reference in New Issue
Block a user