bug fixes / dbmapper fixes

This commit is contained in:
Dennis Eichhorn 2021-12-19 20:20:39 +01:00
parent fa7e92a8b5
commit 4c10113699
2 changed files with 17 additions and 10 deletions

View File

@ -14,10 +14,8 @@ declare(strict_types=1);
namespace Modules\ClientManagement\Controller;
use Modules\Billing\Models\BillTypeL11n;
use Modules\Billing\Models\SalesBillMapper;
use Modules\ClientManagement\Models\ClientMapper;
use Modules\Media\Models\Media;
use phpOMS\Asset\AssetType;
use phpOMS\Contract\RenderableInterface;
use phpOMS\DataStorage\Database\Query\OrderType;
@ -120,8 +118,8 @@ final class BackendController extends Controller
->with('profile/account')
->with('contactElements')
->with('mainAddress')
->with('files')->limit(5, 'files')->sort('files', OrderType::DESC)
->with('notes')->limit(5, 'files')->sort('notes', OrderType::DESC)
->with('files')->limit(5, 'files')->sort('files/id', OrderType::DESC)
->with('notes')->limit(5, 'files')->sort('notes/id', OrderType::DESC)
->where('id', (int) $request->getData('id'))
->execute();
@ -129,10 +127,19 @@ final class BackendController extends Controller
// stats
if ($this->app->moduleManager->isActive('Billing')) {
$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::getAll()->with('client')->where('client', $client->getId())->sort('id', OrderType::DESC)->limit(5)->execute();
$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::getAll()
->with('type')
->with('type/l11n')
->with('client')
->where('client', $client->getId())
->where('type/l11n/language', $response->getLanguage())
->sort('id', OrderType::DESC)
->limit(5)
->execute();
$monthlySalesCosts = SalesBillMapper::getClientMonthlySalesCosts($client->getId(), (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'));
$items = SalesBillMapper::getClientItem($client->getId(), (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'));
} else {

View File

@ -8,7 +8,7 @@
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https: //orange-management.org
* @link https://orange-management.org
*/
declare(strict_types=1);
@ -21,7 +21,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
*
* @package Modules\ClientManagement\Models
* @license OMS License 1.0
* @link https: //orange-management.org
* @link https://orange-management.org
* @since 1.0.0
*/
final class ClientAttributeValueMapper extends DataMapperFactory