Invoice: BMD Export button now use filter
This commit is contained in:
@@ -26,7 +26,7 @@ $pagination_entity_name = "Rechnungen";
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="col-8">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
@@ -62,10 +62,14 @@ $pagination_entity_name = "Rechnungen";
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
<div class="col">
|
||||
<div class="col-6">
|
||||
<button type="submit" class="btn btn-primary">Filter anwenden</button>
|
||||
<a class="btn btn-secondary" href="<?=self::getUrl("Invoice")?>?resetFilter=1">Filter zurücksetzen</a>
|
||||
</div>
|
||||
<div class="col-6 justify-content-end text-right">
|
||||
<button type="submit" name="export_type" value="bmd-credit" class="btn btn-outline-danger"><i class="far fa-fw fa-file-export"></i> Provisionsexport für BMD</button>
|
||||
<button type="submit" name="export_type" value="bmd-invoice" class="btn btn-outline-primary ml-2"><i class="far fa-fw fa-file-export"></i> Rechnungsexport für BMD</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -76,11 +80,11 @@ $pagination_entity_name = "Rechnungen";
|
||||
|
||||
|
||||
|
||||
<div class="col-6">
|
||||
<div class="col-4">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="col-8">
|
||||
<h4>Rechnungsversand</h4>
|
||||
<form method="post" action="<?=self::getUrl("Invoice","sendInvoices")?>">
|
||||
<div class="row">
|
||||
@@ -115,11 +119,6 @@ $pagination_entity_name = "Rechnungen";
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h4 class="header-title">Rechnungen</h4>
|
||||
<div class="float-right">
|
||||
<a href="<?=self::getUrl("Invoice", "exportBmd", ["type" => "credit"])?>" class="btn btn-outline-danger"><i class="far fa-fw fa-file-export"></i> Provisionsexport für BMD</a>
|
||||
<a href="<?=self::getUrl("Invoice", "exportBmd")?>" class="btn btn-outline-primary ml-2"><i class="far fa-fw fa-file-export"></i> Rechnungsexport für BMD</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ class InvoiceController extends mfBaseController {
|
||||
if(!$this->me->can("Billing")) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
if($this->request->export_type == "bmd-invoice" || $this->request->export_type == "bmd-credit") {
|
||||
return $this->exportBmdAction();
|
||||
}
|
||||
|
||||
$this->layout()->setTemplate("Invoice/Index");
|
||||
|
||||
if ($this->request->resetFilter) {
|
||||
@@ -593,7 +597,7 @@ class InvoiceController extends mfBaseController {
|
||||
|
||||
//var_dump($this->request->type);exit;
|
||||
$type = "normal";
|
||||
if($this->request->type == "credit") {
|
||||
if($this->request->export_type == "bmd-credit") {
|
||||
$type = "credit";
|
||||
}
|
||||
|
||||
@@ -606,9 +610,20 @@ class InvoiceController extends mfBaseController {
|
||||
}
|
||||
$csv_out = "";
|
||||
|
||||
$filter = [
|
||||
"bmd_export_date" => null,
|
||||
];
|
||||
$filter = [];
|
||||
if (is_array($this->request->filter)) {
|
||||
$filter = $this->request->filter;
|
||||
$_SESSION[MFAPPNAME . '-Invoice-filter'] = $filter;
|
||||
} else {
|
||||
if (array_key_exists(MFAPPNAME . '-Invoice-filter', $_SESSION) && count($_SESSION[MFAPPNAME . '-Invoice-filter'])) {
|
||||
$filter = $_SESSION[MFAPPNAME . '-Invoice-filter'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->layout->set("filter", $filter);
|
||||
$filter = $this->getPreparedFilter($filter);
|
||||
|
||||
$filter["bmd_export_date"] = null;
|
||||
|
||||
if($type == "credit") {
|
||||
$filter["vatgroup_id"] = TT_VATGROUP_CREDIT;
|
||||
@@ -616,7 +631,7 @@ class InvoiceController extends mfBaseController {
|
||||
$filter["!vatgroup_id"] = TT_VATGROUP_CREDIT;
|
||||
}
|
||||
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if(!InvoiceModel::search($filter)) {
|
||||
$this->layout()->setFlash("Keine neuen Rechnungen seit letztem BMD-Export vorhanden.");
|
||||
$this->redirect("Invoice");
|
||||
|
||||
Reference in New Issue
Block a user