Gestion des factures récurrentes

This commit is contained in:
Rodolphe Quiedeville 2003-10-12 14:41:22 +00:00
parent b881e05ef5
commit 5f028dc5a4

View File

@ -55,6 +55,17 @@ if ($HTTP_POST_VARS["action"] == 'add')
$facture->number = $HTTP_POST_VARS["facnumber"]; $facture->number = $HTTP_POST_VARS["facnumber"];
$facture->date = $datefacture; $facture->date = $datefacture;
$facture->note = $HTTP_POST_VARS["note"]; $facture->note = $HTTP_POST_VARS["note"];
if ($HTTP_POST_VARS["fac_rec"] > 0)
{
/*
* Facture récurrente
*/
$facture->fac_rec = $HTTP_POST_VARS["fac_rec"];
$facid = $facture->create($user);
}
else
{
$facture->projetid = $HTTP_POST_VARS["projetid"]; $facture->projetid = $HTTP_POST_VARS["projetid"];
$facture->cond_reglement = $HTTP_POST_VARS["condid"]; $facture->cond_reglement = $HTTP_POST_VARS["condid"];
$facture->amount = $HTTP_POST_VARS["amount"]; $facture->amount = $HTTP_POST_VARS["amount"];
@ -104,6 +115,7 @@ if ($HTTP_POST_VARS["action"] == 'add')
print $db->error(); print $db->error();
} }
} }
}
$action = ''; $action = '';
} }
@ -338,10 +350,10 @@ if ($action == 'create')
print '<input type="hidden" name="socid" value="'.$obj->idp.'">' ."\n"; print '<input type="hidden" name="socid" value="'.$obj->idp.'">' ."\n";
print '<input type="hidden" name="remise_percent" value="0">'; print '<input type="hidden" name="remise_percent" value="0">';
print '<table cellspacing="0" cellpadding="3" border="1" width="100%">'; print '<table class="border" cellspacing="0" cellpadding="3" width="100%">';
print "<tr><td>Client :</td><td>$obj->nom</td>"; print '<tr><td>Client :</td><td>'.$obj->nom.'</td>';
print "<td>Commentaire</td></tr>"; print '<td class="border">Commentaire</td></tr>';
print "<tr><td>Auteur :</td><td>".$user->fullname."</td>"; print "<tr><td>Auteur :</td><td>".$user->fullname."</td>";
@ -427,7 +439,7 @@ if ($action == 'create')
print $db->error(); print $db->error();
} }
print '<table border="0" cellspacing="0">'; print '<table class="noborder" cellspacing="0">';
print '<tr><td>Produit</td><td>Quan.</td><td>Remise</td></tr>'; print '<tr><td>Produit</td><td>Quan.</td><td>Remise</td></tr>';
for ($i = 1 ; $i < 5 ; $i++) for ($i = 1 ; $i < 5 ; $i++)
{ {
@ -439,7 +451,41 @@ if ($action == 'create')
print '</table>'; print '</table>';
print '</td></tr>'; print '</td></tr>';
} }
/*
* Factures récurrentes
*
*/
if ($propalid == 0)
{
$sql = "SELECT r.rowid, r.titre, r.amount FROM llx_facture_rec as r";
$sql .= " WHERE r.fk_soc = $socidp";
if ( $db->query($sql) )
{
$num = $db->num_rows();
$i = 0;
if ($num > 0)
{
print '<tr><td colspan="3">Factures récurrentes : <select name="fac_rec">';
print '<option value="0" selected></option>';
while ($i < $num)
{
$objp = $db->fetch_object( $i);
print "<option value=\"$objp->rowid\">$objp->titre : $objp->amount</option>\n";
$i++;
}
print '</select></td></tr>';
}
$db->free();
}
else
{
print "$sql";
}
}
/*
*
*/
print '<tr><td colspan="3" align="center"><input type="submit" value="Créer"></td></tr>'; print '<tr><td colspan="3" align="center"><input type="submit" value="Créer"></td></tr>';
print "</form>\n"; print "</form>\n";
print "</table>\n"; print "</table>\n";
@ -678,7 +724,7 @@ else
$objp = $db->fetch_object( $i); $objp = $db->fetch_object( $i);
$var=!$var; $var=!$var;
print "<TR $bc[$var]>"; print "<TR $bc[$var]>";
if ($objp->fk_product) if ($objp->fk_product > 0)
{ {
print '<td><a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.stripslashes(nl2br($objp->description)).'</a></td>'; print '<td><a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.stripslashes(nl2br($objp->description)).'</a></td>';
} }