Test fixes
Some checks failed
Image optimization / general_image_workflow (push) Has been cancelled
CI / general_module_workflow_php (push) Has been cancelled
CI / general_module_workflow_js (push) Has been cancelled

This commit is contained in:
Dennis Eichhorn 2024-05-16 02:14:54 +00:00
parent 100bc08226
commit a248fc159d
17 changed files with 134 additions and 22 deletions

View File

@ -68,6 +68,20 @@
"en": "Postage",
"de": "Porto"
}
},
{
"name": "stationary",
"l11n": {
"en": "Stationary",
"de": "Büromaterial"
}
},
{
"name": "it",
"l11n": {
"en": "IT",
"de": "IT"
}
},
{
"name": "other",

View File

@ -497,7 +497,7 @@ final class ApiController extends Controller
$this->apiExpenseElementCreate($internalRequest, $internalResponse, $data);
$elements[] = $internalResponse->getDataArray($internalRequest->uri->__toString())['response'];
$elements[] = $internalResponse->getDataArray($internalRequest->uri->__toString())['response'] ?? null;
}
$this->createStandardCreateResponse($request, $response, $elements);
@ -705,7 +705,13 @@ final class ApiController extends Controller
$this->app->moduleManager->get('Billing', 'ApiPurchase')->apiSupplierBillUpload($internalRequest, $internalResponse, $data);
$bills = $internalResponse->getDataArray($internalRequest->uri->__toString())['response'];
$bills = $internalResponse->getDataArray($internalRequest->uri->__toString())['response'] ?? [];
if (empty($bills)) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidAddResponse($request, $response, $bills);
return;
}
$elementObj = ExpenseElementMapper::get()
->where('id', $element)

View File

@ -126,7 +126,7 @@ final class BackendController extends Controller
->executeGetArray();
$view->data['expense-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
return $view;
}

View File

@ -1,5 +0,0 @@
# Structure
## ER
![ER](Modules/BusinessExpenses/Docs/Dev/img/er.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

5
Docs/Help/en/SUMMARY.md Normal file
View File

@ -0,0 +1,5 @@
# User Content
* [Expense]({%}&page=Help/expense)
* [Expense Element Type]({%}&page=Help/expense_element_type)
* [Expense Type]({%}&page=Help/expense_type)

21
Docs/Help/en/expense.md Normal file
View File

@ -0,0 +1,21 @@
# Expense
## Overview
In the overview you can see for which person the expense report is, which period it covers and additional general information if provided.
![Expense Overview](Modules/BusinessExpenses/Docs/Help/img/expenses_overview.png)
## Expenses
In the expenses tab you can create and see individual expenses for this expense report.
> Every expense should have it's own separate expense element.
The list shows all days of the expense period, even if no expenses are recorded for a certain day. However, these days are greyed out. Expenses that are outside of the expense period are highlighted in red.
![Expense Overview](Modules/BusinessExpenses/Docs/Help/img/expenses_element_invalid_date.png)
After clicking on the respective expense line you will be able to see the detailed information of that expense.
![Expense Overview](Modules/BusinessExpenses/Docs/Help/img/expenses_element_overview.png)

View File

@ -0,0 +1,17 @@
# Expense Element Type
The expense element type describes the type of expenses. The module provides the following default types:
* Fuel
* Parking
* Entertainment
* Breakfast
* Lunch
* Dinner
* Hotel
* Travelling
* Present
* Postage
* Stationary
* IT
* Other

View File

@ -0,0 +1,10 @@
# Expense Type
The expense type describes the type of expense report. The module provides the following default types:
* Sales (e.g. meeting with customer)
* Supplier (e.g. meeting with supplier)
* Education (e.g. employee training)
* Event
* Affiliate (e.g. shareholder/owner related)
* Other

View File

@ -0,0 +1,21 @@
# Introduction
The **Business Expenses** module lets you create and manage business expenses.
## Target Group
The target group for this module is anyone who has to create and manage business expenses (e.g. travelling sales men).
# Setup
This module doesn't have any additional setup requirements. However, for some automated invoice recognition please make sure you have `tesseract-ocr` installed.
# Features
## Expense Types
Multiple expense types to indicate the type of the expense report.
## Expense Element Types
Multiple expense element types to indicate the type of the expense, such as hotel, dinner, travelling, ...

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

12
Docs/img.json Normal file
View File

@ -0,0 +1,12 @@
[
[
"/businessexpenses/expense/view?id=1",
"//*[@id=\"content\"]/div[2]/div[2]/div[1]/div[2]/div/section",
"/BusinessExpenses/Docs/Help/img/expenses_overview.png"
],
[
"/businessexpenses/expense/element/view?id=1",
"//*[@id=\"content\"]/div[2]/div[2]/div[1]/div/div/section",
"/BusinessExpenses/Docs/Help/img/expenses_element_overview.png"
]
]

View File

@ -21,22 +21,22 @@ return ['BusinessExpenses' => [
'CreatedAt' => 'Erstellt',
'Description' => 'Beschreibung',
'End' => 'Ende',
'Element' => 'Element',
'Element' => 'Element',
'Expenses' => 'Kosten',
'From' => 'Von',
'Gross' => 'Brutto',
'Back' => 'Zurück',
'Back' => 'Zurück',
'Files' => 'Dateien',
'Net' => 'Netto',
'Notes' => 'Notizen',
'Paid' => 'Bezahlt',
'Report' => 'Bericht',
'Total' => 'Gesamt',
'Total' => 'Gesamt',
'Start' => 'Start',
'Status' => 'Status',
'Overview' => 'Übersicht',
'Clocking' => 'Zeiterfassung',
'Type' => 'Typ',
'Costs' => 'Kosten',
'Costs' => 'Kosten',
'Upload' => 'Hochladen',
]];

View File

@ -21,22 +21,22 @@ return ['BusinessExpenses' => [
'CreatedAt' => 'Created At',
'Description' => 'Description',
'End' => 'End',
'Element' => 'Element',
'Element' => 'Element',
'Expenses' => 'Expenses',
'From' => 'From',
'Gross' => 'Gross',
'Files' => 'Files',
'Back' => 'Back',
'Back' => 'Back',
'Net' => 'Net',
'Notes' => 'Notes',
'Paid' => 'Paid',
'Report' => 'Report',
'Total' => 'Total',
'Total' => 'Total',
'Start' => 'Start',
'Status' => 'Status',
'Overview' => 'Overview',
'Clocking' => 'Clocking',
'Type' => 'Type',
'Costs' => 'Costs',
'Costs' => 'Costs',
'Upload' => 'Upload',
]];

View File

@ -17,8 +17,8 @@ use Modules\BusinessExpenses\Models\NullExpense;
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Views\View $this */
$element = $this->data['element'] ?? new NullExpense();
$isNew = $element->id === 0;
$element = $this->data['element'] ?? new NullExpense();
$isNew = $element->id === 0;
echo $this->data['nav']->render(); ?>
<div class="tabview tab-2">

View File

@ -26,7 +26,7 @@ $sessions = $this->data['sessions'] ?? [];
$isNew = $expense->id === 0;
echo $this->data['nav']->render(); ?>
<div class="tabview tab-2">
<div id="iExpenseView" class="tabview tab-2 url-rewrite">
<?php if (!$isNew) : ?>
<div class="box">
<ul class="tab-links">
@ -54,6 +54,7 @@ echo $this->data['nav']->render(); ?>
</section>
</div>
<!--
<div class="col-xs-12 col-lg-6">
<section class="portlet hl-3">
<div class="portlet-body">
@ -66,6 +67,7 @@ echo $this->data['nav']->render(); ?>
</div>
</section>
</div>
-->
</div>
<div class="row">
@ -123,8 +125,8 @@ echo $this->data['nav']->render(); ?>
<?php
$costs = [
'total' => new FloatInt(),
'week' => new FloatInt(),
'day' => new FloatInt(),
'week' => new FloatInt(),
'day' => new FloatInt(),
];
$elements = $expense->elements;
@ -190,6 +192,15 @@ echo $this->data['nav']->render(); ?>
<td colspan="3" class="empty">
<?php endif; ?>
<?php endwhile; ?>
<?php while (($element = \next($elements)) !== false) :
$url = UriFactory::build('{/base}/businessexpenses/expense/element/view?{?}&id=' . $element->id);
?>
<tr data-href="<?= $url; ?>" class="hl-1">
<td><a href="<?= $url; ?>"><?= $element->start->format('Y-m-d H:i'); ?></a>
<td><a href="<?= $url; ?>"><?= $element->end?->format('Y-m-d H:i'); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($element->type->l11n); ?></a>
<td><a href="<?= $url; ?>"><?= $this->getCurrency($element->gross, symbol: ''); ?></a>
<?php endwhile; ?>
<tr class="hl-3">
<td colspan="3"><?= $this->getHtml('Total'); ?>
<td><?= $costs['total']->getAmount(); ?>

View File

@ -12,7 +12,7 @@
},
"creator": {
"name": "Jingga",
"website": "jingga.app"
"website": "https://jingga.app"
},
"directory": "BusinessExpenses",
"dependencies": {