mirror of
https://github.com/Karaka-Management/oms-InvestmentManagement.git
synced 2026-02-18 05:08:41 +00:00
update
This commit is contained in:
parent
c873e2bcaa
commit
9e16b1ccd9
|
|
@ -33,6 +33,7 @@ use Modules\Media\Models\ReferenceMapper;
|
||||||
use phpOMS\Localization\BaseStringL11n;
|
use phpOMS\Localization\BaseStringL11n;
|
||||||
use phpOMS\Localization\BaseStringL11nType;
|
use phpOMS\Localization\BaseStringL11nType;
|
||||||
use phpOMS\Localization\ISO639x1Enum;
|
use phpOMS\Localization\ISO639x1Enum;
|
||||||
|
use phpOMS\Localization\NullBaseStringL11nType;
|
||||||
use phpOMS\Message\Http\RequestStatusCode;
|
use phpOMS\Message\Http\RequestStatusCode;
|
||||||
use phpOMS\Message\NotificationLevel;
|
use phpOMS\Message\NotificationLevel;
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
|
|
@ -99,11 +100,11 @@ final class ApiController extends Controller
|
||||||
$investment->name = $request->getDataString('name') ?? '';
|
$investment->name = $request->getDataString('name') ?? '';
|
||||||
$investment->description = $request->getDataString('description') ?? '';
|
$investment->description = $request->getDataString('description') ?? '';
|
||||||
$investment->status = $request->getDataInt('status') ?? InvestmentStatus::DRAFT;
|
$investment->status = $request->getDataInt('status') ?? InvestmentStatus::DRAFT;
|
||||||
//$investment->type = new NullBaseStringL11nType((int) ($request->getDataInt('type') ?? 0));
|
|
||||||
$investment->description = $request->getDataString('description') ?? '';
|
$investment->description = $request->getDataString('description') ?? '';
|
||||||
$investment->unit = $request->getDataInt('unit') ?? $this->app->unitId;
|
$investment->unit = $request->getDataInt('unit') ?? $this->app->unitId;
|
||||||
$investment->createdBy = new NullAccount($request->header->account);
|
$investment->createdBy = new NullAccount($request->header->account);
|
||||||
$investment->performanceDate = $request->getDataDateTime('performance') ?? new \DateTime($investment->createdAt->format('Y-m-d H:i:s'));
|
$investment->performanceDate = $request->getDataDateTime('performance') ?? new \DateTime($investment->createdAt->format('Y-m-d H:i:s'));
|
||||||
|
//$investment->type = new NullBaseStringL11nType((int) ($request->getDataInt('type') ?? 0));
|
||||||
|
|
||||||
return $investment;
|
return $investment;
|
||||||
}
|
}
|
||||||
|
|
@ -390,7 +391,7 @@ final class ApiController extends Controller
|
||||||
/**
|
/**
|
||||||
* Create media directory path
|
* Create media directory path
|
||||||
*
|
*
|
||||||
* @param Investment $investment Investment
|
* @param InvestmentObject $investment Investment
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
|
|
@ -470,25 +471,26 @@ final class ApiController extends Controller
|
||||||
*/
|
*/
|
||||||
public function createInvestmentOptionFromRequest(RequestAbstract $request) : InvestmentObject
|
public function createInvestmentOptionFromRequest(RequestAbstract $request) : InvestmentObject
|
||||||
{
|
{
|
||||||
$investment = new InvestmentObject();
|
$investment = new InvestmentObject();
|
||||||
$investment->name = $request->getDataString('name') ?? '';
|
$investment->name = $request->getDataString('name') ?? '';
|
||||||
$investment->description = $request->getDataString('description') ?? '';
|
$investment->description = $request->getDataString('description') ?? '';
|
||||||
$investment->link = $request->getDataString('link') ?? '';
|
$investment->link = $request->getDataString('link') ?? '';
|
||||||
$investment->investment = (int) $request->getData('investment');
|
$investment->investment = (int) $request->getData('investment');
|
||||||
$investment->parent = $request->getDataInt('parent');
|
$investment->parent = $request->getDataInt('parent');
|
||||||
$investment->supplier = $request->getDataInt('supplier');
|
$investment->supplier = $request->getDataInt('supplier');
|
||||||
$investment->supplierName = $request->getDataString('supplierName') ?? '';
|
$investment->supplierName = $request->getDataString('supplierName') ?? '';
|
||||||
$investment->item = $request->getDataInt('item');
|
$investment->item = $request->getDataInt('item');
|
||||||
|
|
||||||
// @todo: reconsider the following lines. This seems rather complicated.
|
// @todo: reconsider the following lines. This seems rather complicated.
|
||||||
if ($request->hasData('amount')) {
|
if ($request->hasData('amount')) {
|
||||||
|
/** @var BaseStringL11nType[] $types */
|
||||||
$types = AmountTypeMapper::getAll()->execute();
|
$types = AmountTypeMapper::getAll()->execute();
|
||||||
|
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
if ($type->title = 'costs') {
|
if ($type->title = 'costs') {
|
||||||
$defaultGroup = new AmountGroup();
|
$defaultGroup = new AmountGroup();
|
||||||
$defaultGroup->name = 'Purchase Price'; // @todo: replace with api l11n
|
$defaultGroup->name = 'Purchase Price'; // @todo: replace with api l11n
|
||||||
$defaultGroup->type = $type->id;
|
$defaultGroup->type = new NullBaseStringL11nType($type->id);
|
||||||
|
|
||||||
$amount = new Amount();
|
$amount = new Amount();
|
||||||
$amount->amount = new FloatInt((int) $request->getDataInt('amount'));
|
$amount->amount = new FloatInt((int) $request->getDataInt('amount'));
|
||||||
|
|
@ -499,7 +501,7 @@ final class ApiController extends Controller
|
||||||
} elseif ($type->title === 'cashflow') {
|
} elseif ($type->title === 'cashflow') {
|
||||||
$defaultGroup = new AmountGroup();
|
$defaultGroup = new AmountGroup();
|
||||||
$defaultGroup->name = 'Cashflow'; // @todo: replace with api l11n
|
$defaultGroup->name = 'Cashflow'; // @todo: replace with api l11n
|
||||||
$defaultGroup->type = $type->id;
|
$defaultGroup->type = new NullBaseStringL11nType($type->id);
|
||||||
|
|
||||||
// @todo: calculate date based on performance date + offer conditions / 30 days
|
// @todo: calculate date based on performance date + offer conditions / 30 days
|
||||||
$amount = new Amount();
|
$amount = new Amount();
|
||||||
|
|
@ -511,7 +513,7 @@ final class ApiController extends Controller
|
||||||
} elseif ($type->title === 'depreciation') {
|
} elseif ($type->title === 'depreciation') {
|
||||||
$defaultGroup = new AmountGroup();
|
$defaultGroup = new AmountGroup();
|
||||||
$defaultGroup->name = 'Depreciation'; // @todo: replace with api l11n
|
$defaultGroup->name = 'Depreciation'; // @todo: replace with api l11n
|
||||||
$defaultGroup->type = $type->id;
|
$defaultGroup->type = new NullBaseStringL11nType($type->id);
|
||||||
|
|
||||||
// @todo: calculate automatic depreciation;
|
// @todo: calculate automatic depreciation;
|
||||||
$amount = new Amount();
|
$amount = new Amount();
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\InvestmentManagement\Models;
|
namespace Modules\InvestmentManagement\Models;
|
||||||
|
|
||||||
|
use phpOMS\Localization\BaseStringL11nType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Costs/Earnings.
|
* Costs/Earnings.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||||
* @link https://jingga.app
|
* @link https://jingga.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
* @template T of Task
|
* @template T of AmountGroup
|
||||||
* @extends DataMapperFactory<T>
|
* @extends DataMapperFactory<T>
|
||||||
*/
|
*/
|
||||||
final class AmountGroupMapper extends DataMapperFactory
|
final class AmountGroupMapper extends DataMapperFactory
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,10 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||||
* @link https://jingga.app
|
* @link https://jingga.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
* @template T of Task
|
* @template T of Amount
|
||||||
* @extends DataMapperFactory<T>
|
* @extends DataMapperFactory<T>
|
||||||
*/
|
*/
|
||||||
final class AmountGroupMapper extends DataMapperFactory
|
final class AmountMapper extends DataMapperFactory
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Columns.
|
* Columns.
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||||
* @link https://jingga.app
|
* @link https://jingga.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
* @template T of Task
|
* @template T of Investment
|
||||||
* @extends DataMapperFactory<T>
|
* @extends DataMapperFactory<T>
|
||||||
*/
|
*/
|
||||||
final class InvestmentMapper extends DataMapperFactory
|
final class InvestmentMapper extends DataMapperFactory
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||||
* @link https://jingga.app
|
* @link https://jingga.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
* @template T of Task
|
* @template T of InvestmentObject
|
||||||
* @extends DataMapperFactory<T>
|
* @extends DataMapperFactory<T>
|
||||||
*/
|
*/
|
||||||
final class InvestmentObjectMapper extends DataMapperFactory
|
final class InvestmentObjectMapper extends DataMapperFactory
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user