improve billing

This commit is contained in:
Dennis Eichhorn 2021-02-20 21:19:43 +01:00
parent 3bf4821761
commit 5121bd3276
2 changed files with 7 additions and 7 deletions

View File

@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Modules\ClientManagement\Controller;
use Modules\Billing\Models\BillMapper;
use Modules\Billing\Models\SalesBillMapper;
use Modules\Billing\Models\BillTypeL11n;
use Modules\ClientManagement\Models\ClientMapper;
use phpOMS\Asset\AssetType;
@ -108,11 +108,11 @@ final class BackendController extends Controller
// stats
if ($this->app->moduleManager->isActive('Billing')) {
$ytd = BillMapper::getSalesByClientId($client->getId(), new SmartDateTime('Y-01-01'), new SmartDateTime('now'));
$mtd = BillMapper::getSalesByClientId($client->getId(), new SmartDateTime('Y-m-01'), new SmartDateTime('now'));
$lastOrder = BillMapper::getLastOrderDateByClientId($client->getId());
$newestInvoices = BillMapper::withConditional('language', $response->getLanguage(), [BillTypeL11n::class])::getNewestClientInvoices($client->getId(), 5);
$monthlySalesCosts = BillMapper::getClientMonthlySalesCosts($client->getId(), (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'));
$ytd = SalesBillMapper::getSalesByClientId($client->getId(), new SmartDateTime('Y-01-01'), new SmartDateTime('now'));
$mtd = SalesBillMapper::getSalesByClientId($client->getId(), new SmartDateTime('Y-m-01'), new SmartDateTime('now'));
$lastOrder = SalesBillMapper::getLastOrderDateByClientId($client->getId());
$newestInvoices = SalesBillMapper::withConditional('language', $response->getLanguage(), [BillTypeL11n::class])::getNewestClientInvoices($client->getId(), 5);
$monthlySalesCosts = SalesBillMapper::getClientMonthlySalesCosts($client->getId(), (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'));
} else {
$ytd = new Money();
$mtd = new Money();

View File

@ -208,7 +208,7 @@ echo $this->getData('nav')->render();
<td><?= $this->getHtml('Date'); ?>
<tbody>
<?php foreach ($newestInvoices as $invoice) :
$url = UriFactory::build('{/prefix}sales/invoice?{?}&id=' . $invoice->getId());
$url = UriFactory::build('{/prefix}sales/bill?{?}&id=' . $invoice->getId());
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $invoice->getNumber(); ?></a>