Fehler in Abrechnungsende behoben
This commit is contained in:
@@ -14,7 +14,7 @@ class ChangeCostUnitDetailsCommand {
|
||||
|
||||
$this->request->costUnit->distance_allowance = $this->request->distanceAllowance->getAmount();
|
||||
$this->request->costUnit->mail_on_new = $this->request->mailOnNew;
|
||||
$this->request->costUnit->billing_deadline = $this->request->billingDeadline;
|
||||
$this->request->costUnit->billing_deadline = $this->request->billingDeadline?->format('Y-m-d');
|
||||
|
||||
$response->success = $this->request->costUnit->save();
|
||||
return $response;
|
||||
|
||||
@@ -17,7 +17,7 @@ class CreateCostUnitCommand {
|
||||
'name' => $this->request->name,
|
||||
'tenant' => currentTenant()->slug,
|
||||
'type' => $this->request->type,
|
||||
'billing_deadline' => $this->request->billingDeadline,
|
||||
'billing_deadline' => $this->request->billingDeadline?->format('Y-m-d'),
|
||||
'distance_allowance' => $this->request->distanceAllowance->getAmount(),
|
||||
'mail_on_new' => $this->request->mailOnNew,
|
||||
'allow_new' => true,
|
||||
|
||||
@@ -37,7 +37,10 @@ class EditController extends CommonController{
|
||||
|
||||
$saveParams = $request->get('formData');
|
||||
$distanceAllowance = Amount::fromString($saveParams['distanceAllowance']);
|
||||
$billingDeadline = isset($saveParams['billingDeadline']) ? \DateTime::createFromFormat('Y-m-d', $saveParams['billingDeadline']) : null;
|
||||
$rawBillingDeadline = $saveParams['billingDeadline'] ?? null;
|
||||
$billingDeadline = !empty($rawBillingDeadline)
|
||||
? (\DateTime::createFromFormat('!Y-m-d', $rawBillingDeadline) ?: null)
|
||||
: null;
|
||||
|
||||
$request = new ChangeCostUnitDetailsRequest($costUnit, $distanceAllowance, $saveParams['mailOnNew'], $billingDeadline);
|
||||
$command = new ChangeCostUnitDetailsCommand($request);
|
||||
|
||||
@@ -26,6 +26,18 @@ class SaveInvoiceController extends CommonController
|
||||
]);
|
||||
}
|
||||
|
||||
// Sicherheitsnetz hinter der Oberfläche: Wer gereist ist, steht im Zahlungsgrund auf Beleg und EüR und
|
||||
// ist bei Fahrtkosten Pflicht. Geprüft wird hier und nicht im Command, weil auch Abrechnungskorrekturen
|
||||
// durch den Command laufen -- sie bringen ihren Zahlungsgrund mit, aber keine Personen. Und vor dem
|
||||
// Upload, damit eine abgelehnte Einreichung keinen verwaisten Beleg hinterlässt.
|
||||
if ($invoiceType === InvoiceType::INVOICE_TYPE_TRAVELLING
|
||||
&& Validator::make($request->all(), ['travellers' => 'required|string'])->fails()) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Bitte gib an, welche Personen gereist sind.'
|
||||
]);
|
||||
}
|
||||
|
||||
$uploadedFile = null;
|
||||
if (null !== $request->file('receipt')) {
|
||||
$maxFileSize = env('MAX_INVOICE_FILE_SIZE', 16);
|
||||
|
||||
@@ -41,10 +41,11 @@ const travelReasonComplete = computed(() =>
|
||||
/**
|
||||
* Wer gereist ist, steht später als Zahlungsgrund in der Belegliste, auf der EüR und auf dem Beleg. Wer
|
||||
* den Beleg einreicht, war meist selbst dabei -- deshalb der eigene Name als Vorschlag. Ohne Login
|
||||
* bleibt das Feld leer, und es hält den Ablauf auch dann nicht auf: Ein Name ist eine Hilfe, keine
|
||||
* Bedingung.
|
||||
* bleibt das Feld leer; weiter geht es erst, wenn jemand eingetragen ist -- wie beim Reisegrund.
|
||||
*/
|
||||
const travellers = ref(data.userName || '');
|
||||
|
||||
const travellersComplete = computed(() => travellers.value.trim() !== '');
|
||||
const have_receipt = ref('')
|
||||
const amount = ref(0.00);
|
||||
const invoiceType = ref(null);
|
||||
@@ -121,7 +122,7 @@ function handleFileChange(event) {
|
||||
/>
|
||||
</fieldset><br /><br />
|
||||
|
||||
<fieldset v-if="travelReasonComplete">
|
||||
<fieldset v-if="travelReasonComplete && travellersComplete">
|
||||
<legend><span style="font-weight: bolder;">Bist du mit dem ÖPNV gefahren oder besitzt du einen Beleg</span></legend>
|
||||
<input type="button" style="border-radius: 0; width: 100px;" @click="have_receipt='yes'" value="Ja" />
|
||||
<input type="button" style="border-radius: 0; width: 100px;" @click="getDistanceAllowance" value="Nein" />
|
||||
@@ -129,7 +130,8 @@ function handleFileChange(event) {
|
||||
|
||||
<br /><br />
|
||||
|
||||
<fieldset v-if="have_receipt === 'yes'">
|
||||
<!-- Auch nach "Ja"/"Nein" gilt die Pflicht: Wer die Personen wieder löscht, kann nicht einreichen. -->
|
||||
<fieldset v-if="travellersComplete && have_receipt === 'yes'">
|
||||
<legend><span style="font-weight: bolder;">Wie hoch ist der Betrag?</span></legend>
|
||||
<AmountInput v-model="amount" class="width-small" id="amount" name="amount" /> Euro
|
||||
|
||||
@@ -161,7 +163,7 @@ function handleFileChange(event) {
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<fieldset v-else-if="distanceAllowance != null">
|
||||
<fieldset v-else-if="travellersComplete && distanceAllowance != null">
|
||||
<legend><span style="font-weight: bolder;">Reiseinformationen</span></legend>
|
||||
Gesamtlänge des Reisewegs:
|
||||
<NumericInput
|
||||
|
||||
@@ -11,7 +11,7 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
/**
|
||||
* @property string $name
|
||||
* @property string $type
|
||||
* @property string $billing_deadline
|
||||
* @property string|null $billing_deadline Y-m-d, Abrechnungsschluss einschließlich des ganzen Tages
|
||||
* @property string $distance_allowance
|
||||
* @property boolean $mail_on_new
|
||||
* @property boolean $allow_new
|
||||
|
||||
@@ -49,6 +49,7 @@ class CostUnitResource {
|
||||
$data = array_merge(
|
||||
$this->costUnit->toArray(),
|
||||
[
|
||||
'billingDeadline' => $this->costUnit->billing_deadline,
|
||||
'distanceAllowanceSmall' => new Amount($this->costUnit->distance_allowance, '')->toString(),
|
||||
'distanceAllowanceFull' => new Amount($this->costUnit->distance_allowance, ' Euro')->toString(),
|
||||
'totalAmount' => new Amount($totalAmount, ' Euro')->toString(),
|
||||
|
||||
@@ -15,7 +15,6 @@ use Illuminate\Support\Facades\Mail;
|
||||
class CloseCostUnit implements CronTask {
|
||||
public function handle(): void
|
||||
{
|
||||
$now = now();
|
||||
$costUnitRepository = new CostUnitRepository();
|
||||
$now = now();
|
||||
$billingResetEnd = clone $now;
|
||||
@@ -25,7 +24,7 @@ class CloseCostUnit implements CronTask {
|
||||
$billingEnd = $costUnit['billing_deadline'];
|
||||
|
||||
if ($billingEnd === null) {
|
||||
$billingEnd = \DateTime::createFromFormat('Y-m-d H:i:s', $billingResetEnd)->format('Y-m-d H:i:s');
|
||||
$billingEnd = $billingResetEnd->format('Y-m-d');
|
||||
new ChangeCostUnitDetailsCommand(new ChangeCostUnitDetailsRequest(
|
||||
CostUnit::where('id', $costUnit['id'])->first(),
|
||||
Amount::fromString($costUnit['distance_allowance']),
|
||||
@@ -34,9 +33,9 @@ class CloseCostUnit implements CronTask {
|
||||
))->execute();
|
||||
}
|
||||
|
||||
$billingEndTime = \DateTime::createFromFormat('Y-m-d H:i:s', $billingEnd);
|
||||
$billingEndTime = \DateTime::createFromFormat('!Y-m-d', $billingEnd);
|
||||
if (false === $billingEndTime) {
|
||||
$billingEndTime = \DateTime::createFromFormat('Y-m-d', $billingEnd);
|
||||
$billingEndTime = \DateTime::createFromFormat('Y-m-d H:i:s', $billingEnd);
|
||||
}
|
||||
|
||||
if (false === $billingEndTime) {
|
||||
@@ -56,12 +55,10 @@ class CloseCostUnit implements CronTask {
|
||||
|
||||
continue;
|
||||
}
|
||||
$billingEndTime->setTime(0,0,0);
|
||||
$billingEndTime->add(new \DateInterval('P1D'));
|
||||
// Der Abrechnungsschluss gilt einschließlich des ganzen Tages: bis 23:59:59 darf eingereicht werden.
|
||||
$billingEndTime->setTime(23, 59, 59);
|
||||
|
||||
|
||||
|
||||
if ($billingEndTime < $now) {
|
||||
if ($now > $billingEndTime) {
|
||||
new ChangeCostUnitStateCommand(
|
||||
new ChangeCostUnitStateRequest(
|
||||
CostUnit::where('id', $costUnit['id'])->first(),false, false
|
||||
|
||||
Reference in New Issue
Block a user