facturation/www/admin/facture.php
2019-11-02 16:53:27 +00:00

57 lines
1.2 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace Garradin;
require_once __DIR__ . '/_inc.php';
$session->requireAccess('compta', Membres::DROIT_ACCES);
use Garradin\Membres;
$membres = new Membres;
qv(['id' => 'required|numeric']);
$id = (int) qg('id');
$f = $facture->get($id);
if (!$f)
{
throw new UserException("Ce document n'existe pas.");
}
$cats = new Compta\Categories;
$tpl->assign('moyens_paiement', $cats->listMoyensPaiement());
$tpl->assign('moyen_paiement', $cats->getMoyenPaiement($f->moyen_paiement));
try
{
if ($f->receveur_membre)
{
$c = $membres->get($f->receveur_id);
foreach(['ville','code_postal','adresse'] as $v)
{
if($c->$v == '')
{
$c->$v = '[A RENSEIGNER DANS LA FICHE MEMBRE]';
}
}
}
else
{
$c = $client->get($f->receveur_id);
}
$tpl->assign('facture', $f);
$tpl->assign('client', $c);
}
catch(UserException $e)
{
$form->addError("Pas de document correspondant à cet id trouvée.");
}
$tpl->assign('id', $id);
$tpl->assign('footer', $cfg->get('footer')?:'');
$tpl->assign('siret_asso', $cfg->get('siret_asso')?:'');
$tpl->display(PLUGIN_ROOT . '/templates/facture.tpl');