quand on paye une facture fournisseur on peut maintenant dire quel est le compte à débiter et si c'est le cas on le retrouvera à rapprocher dans les extraits de compte en module compta

This commit is contained in:
erics 2004-01-26 23:53:04 +00:00
parent 18c79f2937
commit f6de7c5d3b
2 changed files with 37 additions and 9 deletions

View File

@ -1,5 +1,6 @@
<?PHP <?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -37,11 +38,14 @@ if ($action == 'add') {
$paiementfourn = new PaiementFourn($db); $paiementfourn = new PaiementFourn($db);
$paiementfourn->facid = $facid; $paiementfourn->facid = $facid;
$paiementfourn->facnumber = $facnumber;
$paiementfourn->datepaye = $db->idate(mktime(12, 0 , 0, $paiementfourn->datepaye = $db->idate(mktime(12, 0 , 0,
$HTTP_POST_VARS["remonth"], $HTTP_POST_VARS["remonth"],
$HTTP_POST_VARS["reday"], $HTTP_POST_VARS["reday"],
$HTTP_POST_VARS["reyear"])); $HTTP_POST_VARS["reyear"]));
$paiementfourn->amount = $amount; $paiementfourn->amount = $amount;
$paiementfourn->accountid = $accountid;
$paiementfourn->societe = $societe;
$paiementfourn->author = $author; $paiementfourn->author = $author;
$paiementfourn->paiementid = $paiementid; $paiementfourn->paiementid = $paiementid;
$paiementfourn->num_paiement = $num_paiement; $paiementfourn->num_paiement = $num_paiement;
@ -53,7 +57,6 @@ if ($action == 'add') {
} }
$action = ''; $action = '';
} }
/* /*
@ -139,6 +142,28 @@ if ($action == 'create')
print "<td rowspan=\"4\">"; print "<td rowspan=\"4\">";
print '<textarea name="comment" wrap="soft" cols="40" rows="10"></textarea></td></tr>'; print '<textarea name="comment" wrap="soft" cols="40" rows="10"></textarea></td></tr>';
print "<tr><td>Compte à débiter :</td><td><select name=\"accountid\"><option value=\"\">-</option>\n";
$sql = "SELECT rowid, label FROM llx_bank_account ORDER BY rowid";
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows();
$i = 0;
while ($i < $num)
{
$objopt = $db->fetch_object( $i);
print '<option value="'.$objopt->rowid.'"';
if (defined("FACTURE_RIB_NUMBER") && FACTURE_RIB_NUMBER == $objopt->rowid)
{
print ' SELECTED';
}
print '>'.$objopt->label.'</option>';
$i++;
}
}
print "</select>";
print "</td></tr>\n";
print "<tr><td>Numéro :</td><td><input name=\"num_paiement\" type=\"text\"><br><em>Num du cheque ou virement</em></td></tr>\n"; print "<tr><td>Numéro :</td><td><input name=\"num_paiement\" type=\"text\"><br><em>Num du cheque ou virement</em></td></tr>\n";
print "<tr><td valign=\"top\">Reste à payer :</td><td><b>".price($total - $sumpayed)."</b> euros TTC</td></tr>\n"; print "<tr><td valign=\"top\">Reste à payer :</td><td><b>".price($total - $sumpayed)."</b> euros TTC</td></tr>\n";
print "<tr><td valign=\"top\">Montant :</td><td><input name=\"amount\" type=\"text\"></td></tr>\n"; print "<tr><td valign=\"top\">Montant :</td><td><input name=\"amount\" type=\"text\"></td></tr>\n";

View File

@ -25,12 +25,15 @@ class PaiementFourn
var $id; var $id;
var $db; var $db;
var $facid; var $facid;
var $facnumber;
var $datepaye; var $datepaye;
var $amount; var $amount;
var $accountid;
var $author; var $author;
var $paiementid; // numero du paiement dans le cas ou une facture paye +ieur fois var $paiementid; // numero du paiement dans le cas ou une facture paye +ieur fois
var $num_paiement; var $num_paiement;
var $note; var $note;
var $societe;
/* /*
* *
* *
@ -54,16 +57,16 @@ class PaiementFourn
$this->amount = ereg_replace(",",".",$this->amount); $this->amount = ereg_replace(",",".",$this->amount);
$sql = "INSERT INTO llx_paiementfourn (fk_facture_fourn, datec, datep, amount, fk_user_author, fk_paiement, num_paiement, note)"; $sql = "INSERT INTO llx_paiementfourn (fk_facture_fourn, datec, datep, amount, fk_user_author, fk_paiement, num_paiement, note)";
$sql .= " VALUES ($this->facid, now(), $this->datepaye,$this->amount, $user->id, $this->paiementid, '$this->num_paiement', '$this->note')"; $sql .= " VALUES ('$this->facid', now(), '$this->datepaye', '$this->amount', '$user->id', '$this->paiementid', '$this->num_paiement', '$this->note')";
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if (isset($result))
{ {
$label = "Facture $this->facnumber - $this->societe"; $label = "Facture $this->facnumber - $this->societe";
$sql = "INSERT INTO llx_bank (datec, dateo, amount, author, label)"; $sql = "INSERT INTO llx_bank (datec, dateo, amount, author, label, fk_account)";
$sql .= " VALUES (now(), $this->datepaye, $this->amount,'$this->author', '$this->label')"; $sql .= " VALUES (now(), '$this->datepaye', '$this->amount', '$this->author', '$label', '$this->accountid')";
//$result = $this->db->query($sql); $result = $this->db->query($sql);
} }
else else
{ {