Ajout reçu fiscal sur Nouveau document

This commit is contained in:
Noizette 2020-10-24 07:28:31 +02:00
parent 8adc144bfa
commit ba5096bfb2
3 changed files with 33 additions and 23 deletions

View file

@ -15,7 +15,7 @@ $tpl->assign('moyen_paiement', f('moyen_paiement') ?: 'ES');
if (f('add'))
{
$form->check('ajout_facture', [
'type' => 'required|in:facture,devis',
'type' => 'required|in:facture,devis,cerfa,cotis',
'numero_facture' => 'required|string',
'date_emission' => 'required|date',
'date_echeance' => 'required|date',
@ -48,15 +48,19 @@ if (f('add'))
'toto' => 0
];
if (f('type') == 'facture')
{
$truc['type_facture'] = 1;
}
elseif (f('type') == 'devis')
{
$truc['type_facture'] = 0;
}
if (f('type') == 'devis')
{
$truc['type_facture'] = 0;
}
elseif (f('type') == 'facture')
{
$truc['type_facture'] = 1;
}
elseif (f('type') == 'cerfa')
{
$truc['type_facture'] = 2;
}
foreach(f('designation') as $k=>$value)
{
$truc['contenu'][$k]['designation'] = $value;
@ -96,7 +100,7 @@ $tpl->assign('membre_id', f('membre') ?: -1);
$designations = [];
$prix = [];
if (($d = f('designation')) && ($p = f('prix')))
if (($d = f('designation')) && ($p = f('prix')) && implode($d))
{
foreach($d as $k=>$v)
{
@ -108,6 +112,10 @@ if (($d = f('designation')) && ($p = f('prix')))
$prix[] = $p[$k];
}
}
else {
$designations = ['Exemple'];
$prix = [1.5];
}
$tpl->assign('designations', $designations);
$tpl->assign('prix', $prix);