begin to add movements to clean entry and output

This commit is contained in:
JBthePenguin 2021-08-31 16:51:45 +02:00
parent ff037ff75b
commit 4bb7e7d3b9
13 changed files with 138 additions and 21 deletions

10
src/lib/Movement.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace Garradin\Plugin\Materiels;
use Garradin\DB;
use Garradin\Plugin\Materiels\Equipment;
class Movement
{
}

View File

@ -39,7 +39,7 @@ CREATE TABLE IF NOT EXISTS plugin_materiels_movement (
kind varchar(20) NOT NULL,
equipment_number integer NOT NULL,
equipment_id integer NOT NULL,
mvt_date date NOT NULL,
mvt_date date NOT NULL,
additional_comment varchar(255),
FOREIGN KEY ( equipment_id ) REFERENCES plugin_materiels_equipment( id ) ON DELETE RESTRICT ON UPDATE CASCADE
);

View File

@ -4,8 +4,10 @@
<ul>
<li class="{if $current_nav == 'index'}current{/if}"><a href="{plugin_url}">Inventaire</a></li>
<li class="{if $current_nav == 'categories'}current{/if}"><a href="{plugin_url file="categories/index.php"}">Catégories</a></li>
<li class="{if $current_nav == 'entrees'}current{/if}"><a href="{plugin_url file="entrees/index.php"}">Entrées</a></li>
<li class="{if $current_nav == 'sorties'}current{/if}"><a href="{plugin_url file="sorties/index.php"}">Sorties</a></li>
<li class="{if $current_nav == 'entrees_old'}current{/if}"><a href="{plugin_url file="entrees/index.php"}">Entrées (old)</a></li>
<li class="{if $current_nav == 'sorties_old'}current{/if}"><a href="{plugin_url file="sorties/index.php"}">Sorties (old)</a></li>
<li class="{if $current_nav == 'entrees'}current{/if}"><a href="{plugin_url file="mouvements/entrees/index.php"}">Entrées</a></li>
<li class="{if $current_nav == 'sorties'}current{/if}"><a href="{plugin_url file="mouvements/sorties/index.php"}">Sorties</a></li>
</ul>
</nav>
<!-- -->

View File

@ -1,6 +1,4 @@
{include file="admin/_head.tpl" title="%s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id}
{include file="%s_nav.tpl"|args:$plugin_tpl current="entrees"}
{include file="%s_nav.tpl"|args:$plugin_tpl current_nav="entrees_old"}
<form method="post" action="{$self_url}">
<fieldset>

View File

@ -1,6 +1,4 @@
{include file="admin/_head.tpl" title="%s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id}
{include file="%s_nav.tpl"|args:$plugin_tpl current="entrees"}
{include file="%s_nav.tpl"|args:$plugin_tpl current_nav="entrees_old"}
<fieldset>
<legend>Ajouter une entrée pour du </legend>

View File

@ -1,6 +1,4 @@
{include file="admin/_head.tpl" title="%s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id}
{include file="%s_nav.tpl"|args:$plugin_tpl current="entrees"}
{include file="%s_nav.tpl"|args:$plugin_tpl current_nav="entrees_old"}
{include file="%scommon/delete_form.tpl"|args:$plugin_tpl
legend="Supprimer cette entrée de matériels ?"

View File

@ -0,0 +1,37 @@
{include file="%s_nav.tpl"|args:$plugin_tpl current_nav="entrees"}
<fieldset>
<legend>Ajouter une entrée pour du </legend>
{linkbutton shape="plus" label="Matériel répertorié" href="repertorie.php"}
{linkbutton shape="plus" label="Matériel non répertorié" href="non_repertorie.php"}
{linkbutton shape="plus" label="Matériel en retour de location / prêt" href="retour.php"}
</fieldset>
{if $entries}
<table class="list">
<thead>
<th><b>Date</b></th>
<th><b>Type</b></th>
<th><b>Nombre</b></th>
<th><b>Matériel</b></th>
<th><b>Remarques</b></th>
<th></th>
</thead>
<tbody>
{foreach from=$entries item="entry"}
<tr>
<td>{$entry.entry_date|date_format:'%d/%m/%y'}</td>
<td>{$entry.kind}</td>
<td>{$entry.equipment_number}</td>
<td>{$entry.equipment}</td>
<td>{$entry.additional_comment}</td>
<td class="actions">
{linkbutton shape="delete" label="Supprimer" href="supprimer_entree.php?id=%d"|args:$entry.id}
</td>
</tr>
{/foreach}
</tbody>
</table>
{/if}
{include file="admin/_foot.tpl"}

View File

@ -0,0 +1,36 @@
{include file="%s_nav.tpl"|args:$plugin_tpl current_nav="sorties"}
<fieldset>
<legend>Ajouter une sortie pour du </legend>
{linkbutton shape="plus" label="Matériel en stock disponible" href="stock_disponible.php"}
{linkbutton shape="plus" label="Matériel emprunté" href="emprunte.php"}
</fieldset>
{if $outputs}
<table class="list">
<thead>
<th><b>Date</b></th>
<th><b>Type</b></th>
<th><b>Nombre</b></th>
<th><b>Matériel</b></th>
<th><b>Remarques</b></th>
<th></th>
</thead>
<tbody>
{foreach from=$outputs item="output"}
<tr>
<td>{$output.output_date|date_format:'%d/%m/%y'}</td>
<td>{$output.kind}</td>
<td>{$output.equipment_number}</td>
<td>{$output.equipment}</td>
<td>{$output.additional_comment}</td>
<td class="actions">
{linkbutton shape="delete" label="Supprimer" href="supprimer_sortie.php?id=%d"|args:$output.id}
</td>
</tr>
{/foreach}
</tbody>
</table>
{/if}
{include file="admin/_foot.tpl"}

View File

@ -1,6 +1,4 @@
{include file="admin/_head.tpl" title="%s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id}
{include file="%s_nav.tpl"|args:$plugin_tpl current="sorties"}
{include file="%s_nav.tpl"|args:$plugin_tpl current_nav="sorties_old"}
<form method="post" action="{$self_url}">
<fieldset>

View File

@ -1,6 +1,4 @@
{include file="admin/_head.tpl" title="%s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id}
{include file="%s_nav.tpl"|args:$plugin_tpl current="sorties"}
{include file="%s_nav.tpl"|args:$plugin_tpl current_nav="sorties_old"}
<fieldset>
<legend>Ajouter une sortie pour du </legend>

View File

@ -1,6 +1,4 @@
{include file="admin/_head.tpl" title="%s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id}
{include file="%s_nav.tpl"|args:$plugin_tpl current="sorties"}
{include file="%s_nav.tpl"|args:$plugin_tpl current_nav="sorties_old"}
{include file="%scommon/delete_form.tpl"|args:$plugin_tpl
legend="Supprimer cette sortie de matériels ?"

View File

@ -0,0 +1,22 @@
<?php
namespace Garradin;
use Garradin\Plugin\Materiels\Equipment;
use Garradin\Plugin\Materiels\Entry;
require_once __DIR__ . '/../../_inc.php';
$eqmt = new Equipment;
$entry = new Entry;
$entries = $entry->listAll();
foreach ($entries as $key => $value) {
$entry_eqmt = $eqmt->get($value->equipment_id);
$entries[$key]->equipment = $entry_eqmt->designation;
}
$tpl->assign(compact('entries'));
$tpl->display(PLUGIN_ROOT . '/templates/mouvements/entrees/index.tpl');

View File

@ -0,0 +1,22 @@
<?php
namespace Garradin;
use Garradin\Plugin\Materiels\Equipment;
use Garradin\Plugin\Materiels\Output;
require_once __DIR__ . '/../../_inc.php';
$eqmt = new Equipment;
$output = new Output;
$outputs = $output->listAll();
foreach ($outputs as $key => $value) {
$output_eqmt = $eqmt->get($value->equipment_id);
$outputs[$key]->equipment = $output_eqmt->designation;
}
$tpl->assign(compact('outputs'));
$tpl->display(PLUGIN_ROOT . '/templates/mouvements/sorties/index.tpl');