Ajout divers champs pour facture/devis

This commit is contained in:
Jean-Christophe Engel 2025-03-23 18:27:47 +01:00
parent 950a6b8b2c
commit aff20099aa
7 changed files with 93 additions and 28 deletions

View file

@ -89,6 +89,7 @@ $form->runIf(f('save') && !$form->hasErrors(),
'reglee' => f('reglee') == 1?1:0,
'archivee' => f('archivee') == 1?1:0,
'moyen_paiement' => f('moyen_paiement'),
'nom_contact' => f('nom_contact'),
'toto' => 0
];
$data['type_facture'] = f('type');
@ -113,8 +114,12 @@ $form->runIf(f('save') && !$form->hasErrors(),
unset($data['toto']);
if (! isset($data['contenu'])) {
throw new UserException("Aucune désignation ni aucun prix saisi !!");
}
}
}
if (f('type') == FACT) {
$data['numero_commande'] = f('numero_commande');
$data['reference_acheteur'] = f('reference_acheteur');
}
}
elseif ( f('type') == CERFA )
{
$data['moyen_paiement'] = f('moyen_paiement_cerfa');
@ -276,6 +281,9 @@ else
$doc['date_emission'] = f('date_emission') ?: $f->date_emission;
$doc['date_echeance'] = f('date_echeance')?: $f->date_echeance; // Smarty m'a saoulé pour utiliser form_field|date_fr:---
$doc['nom_contact'] = $f->nom_contact;
$doc['numero_commande'] = $f->numero_commande;
$doc['reference_acheteur'] = $f->reference_acheteur;
/* modif DD -- CERFA -------------------------------------- */
if ( $f->type_facture == CERFA ) {
$doc['total'] = $f->total;

View file

@ -128,12 +128,17 @@ if ($f->type_facture != CERFA)
$receveur =
$txtdest.'<br>'.
'<b>'.$nom_client.'</b><br>'.
(($t = $f->nom_contact)?"Contact : $t<br>":'').
$c->adresse."<br>".
$c->code_postal.' '.$c->ville."<br>".
(($t = $c->siret)?"SIREN/SIRET : " . implode(' ', str_split($t, 3)) . "<br>":'').
(($t = $c->email)?"Email : $t<br>":'').
(($t = $c->telephone)?"Tel : $t<br>":'');
if ($f->type_facture == FACT) {
$receveur .=
(($t = $f->numero_commande)?"Commande N° : $t<br>":'').
(($t = $f->reference_acheteur)?"Référence : $t<br>":'');
}
$total = Utils::money_format($f->total, ',', ' ');
// Devis et facture
@ -203,11 +208,11 @@ EOF;
</footer>
EOF;
if ($f->type_facture == DEVIS) {
echo <<<EOF
if ($f->type_facture == DEVIS) {
echo <<<EOF
<p><b>Bon pour accord, date et signature<b></p>
EOF;
}
}
$content = ob_get_clean();