Look: Uniformisation onglet facture fournisseur
This commit is contained in:
parent
95239fcd48
commit
a27d69264b
@ -23,10 +23,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/fourn/facture/fiche.php
|
\file htdocs/fourn/facture/fiche.php
|
||||||
\ingroup facture
|
\ingroup facture
|
||||||
\brief Page des la fiche facture fournisseur
|
\brief Page des la fiche facture fournisseur
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
@ -39,9 +39,7 @@ $langs->load("bills");
|
|||||||
$langs->load("suppliers");
|
$langs->load("suppliers");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
/*
|
// Sécurité accés client
|
||||||
* Sécurité accés client
|
|
||||||
*/
|
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
@ -222,468 +220,470 @@ if ($_GET["action"] == 'add_ligne')
|
|||||||
if ($_GET["action"] == 'create' or $_GET["action"] == 'copy')
|
if ($_GET["action"] == 'create' or $_GET["action"] == 'copy')
|
||||||
{
|
{
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
print_titre($langs->trans("NewBill"));
|
print_titre($langs->trans("NewBill"));
|
||||||
|
|
||||||
if ($mesg) { print "$mesg<br>"; }
|
if ($mesg) { print "$mesg<br>"; }
|
||||||
|
|
||||||
if ($_GET["action"] == 'copy')
|
if ($_GET["action"] == 'copy')
|
||||||
{
|
{
|
||||||
$fac_ori = new FactureFournisseur($db);
|
$fac_ori = new FactureFournisseur($db);
|
||||||
$fac_ori->fetch($_GET["facid"]);
|
$fac_ori->fetch($_GET["facid"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form action="fiche.php" method="post">';
|
print '<form action="fiche.php" method="post">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
print '<tr><td>'.$langs->trans("Company").'</td>';
|
||||||
|
|
||||||
print '<td><select name="socidp">';
|
print '<td><select name="socidp">';
|
||||||
|
|
||||||
$sql = "SELECT s.nom, s.prefix_comm, s.idp";
|
$sql = "SELECT s.nom, s.prefix_comm, s.idp";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql .= " WHERE s.fournisseur = 1";
|
$sql .= " WHERE s.fournisseur = 1";
|
||||||
if ($_GET["socid"] > 0 )
|
if ($_GET["socid"] > 0 )
|
||||||
{
|
{
|
||||||
$sql .= " AND s.idp =".$_GET["socid"];
|
$sql .= " AND s.idp =".$_GET["socid"];
|
||||||
|
}
|
||||||
|
$sql .= " ORDER BY s.nom ASC";
|
||||||
|
|
||||||
|
if ( $db->query($sql) )
|
||||||
|
{
|
||||||
|
$num = $db->num_rows();
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object();
|
||||||
|
print '<option value="'.$obj->idp;
|
||||||
|
|
||||||
|
if ($_GET["socid"] == $obj->idp)
|
||||||
|
{
|
||||||
|
print '" selected>'.$obj->nom.'</option>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '">'.$obj->nom.'</option>';
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</select></td>';
|
||||||
|
print '<td>'.$langs->trans("Comments").'</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("Ref").'</td><td><input name="facnumber" type="text"></td>';
|
||||||
|
|
||||||
|
print '<td rowspan="4" valign="top"><textarea name="note" wrap="soft" cols="30" rows="6"></textarea></td></tr>';
|
||||||
|
if ($_GET["action"] == 'copy')
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("Label").'</td><td><input size="30" name="libelle" value="'.$fac_ori->libelle.'" type="text"></td></tr>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("Label").'</td><td><input size="30" name="libelle" type="text"></td></tr>';
|
||||||
|
}
|
||||||
|
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
||||||
|
$html->select_date();
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("DateEcheance").'</td><td>';
|
||||||
|
$html->select_date('','ech');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print "</table><br>";
|
||||||
|
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td> </td><td>'.$langs->trans("Label").'</td>';
|
||||||
|
print '<td align="center">'.$langs->trans("PriceUHT").'</td>';
|
||||||
|
print '<td align="center">'.$langs->trans("Qty").'</td>';
|
||||||
|
print '<td align="center">'.$langs->trans("VATRate").'</td>';
|
||||||
|
print '<td align="center">'.$langs->trans("PriceUTTC").'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
for ($i = 1 ; $i < 9 ; $i++)
|
||||||
|
{
|
||||||
|
if ($_GET["action"] == 'copy')
|
||||||
|
{
|
||||||
|
$value_label = $fac_ori->lignes[$i-1][0];
|
||||||
|
$value_pu = $fac_ori->lignes[$i-1][1];
|
||||||
|
$value_qty = $fac_ori->lignes[$i-1][3];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$value_qty = "1";
|
||||||
|
}
|
||||||
|
print '<tr><td>'.$i.'</td>';
|
||||||
|
print '<td><input size="50" name="label'.$i.'" value="'.$value_label.'" type="text"></td>';
|
||||||
|
print '<td align="center"><input type="text" size="8" name="amount'.$i.'" value="'.$value_pu.'"></td>';
|
||||||
|
print '<td align="center"><input type="text" size="3" name="qty'.$i.'" value="'.$value_qty.'"></td>';
|
||||||
|
print '<td align="center">';
|
||||||
|
$html->select_tva("tauxtva".$i);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="center"><input type="text" size="8" name="amountttc'.$i.'" value=""></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
$sql .= " ORDER BY s.nom ASC";
|
print '<p align="center"><input type="submit" value="'.$langs->trans("Save").'"></p>';
|
||||||
|
print "</form>";
|
||||||
if ( $db->query($sql) )
|
|
||||||
{
|
|
||||||
$num = $db->num_rows();
|
|
||||||
$i = 0;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object();
|
|
||||||
print '<option value="'.$obj->idp;
|
|
||||||
|
|
||||||
if ($_GET["socid"] == $obj->idp)
|
|
||||||
{
|
|
||||||
print '" selected>'.$obj->nom.'</option>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '">'.$obj->nom.'</option>';
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</select></td>';
|
|
||||||
print '<td>'.$langs->trans("Comments").'</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Ref").'</td><td><input name="facnumber" type="text"></td>';
|
|
||||||
|
|
||||||
print '<td rowspan="4" valign="top"><textarea name="note" wrap="soft" cols="30" rows="6"></textarea></td></tr>';
|
|
||||||
if ($_GET["action"] == 'copy')
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input size="30" name="libelle" value="'.$fac_ori->libelle.'" type="text"></td></tr>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input size="30" name="libelle" type="text"></td></tr>';
|
|
||||||
}
|
|
||||||
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
|
||||||
$html->select_date();
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("DateEcheance").'</td><td>';
|
|
||||||
$html->select_date('','ech');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print "</table><br>";
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td> </td><td>'.$langs->trans("Label").'</td>';
|
|
||||||
print '<td align="center">'.$langs->trans("PriceUHT").'</td>';
|
|
||||||
print '<td align="center">'.$langs->trans("Qty").'</td>';
|
|
||||||
print '<td align="center">'.$langs->trans("VATRate").'</td>';
|
|
||||||
print '<td align="center">'.$langs->trans("PriceUTTC").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
for ($i = 1 ; $i < 9 ; $i++)
|
|
||||||
{
|
|
||||||
if ($_GET["action"] == 'copy')
|
|
||||||
{
|
|
||||||
$value_label = $fac_ori->lignes[$i-1][0];
|
|
||||||
$value_pu = $fac_ori->lignes[$i-1][1];
|
|
||||||
$value_qty = $fac_ori->lignes[$i-1][3];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$value_qty = "1";
|
|
||||||
}
|
|
||||||
print '<tr><td>'.$i.'</td>';
|
|
||||||
print '<td><input size="50" name="label'.$i.'" value="'.$value_label.'" type="text"></td>';
|
|
||||||
print '<td align="center"><input type="text" size="8" name="amount'.$i.'" value="'.$value_pu.'"></td>';
|
|
||||||
print '<td align="center"><input type="text" size="3" name="qty'.$i.'" value="'.$value_qty.'"></td>';
|
|
||||||
print '<td align="center">';
|
|
||||||
$html->select_tva("tauxtva".$i);
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="center"><input type="text" size="8" name="amountttc'.$i.'" value=""></td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
print '<p align="center"><input type="submit" value="'.$langs->trans("Save").'"></p>';
|
|
||||||
print "</form>";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Fiche facture en mode visu ou edition
|
* Fiche facture en mode visu ou edition
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if ($_GET["facid"] > 0)
|
if ($_GET["facid"] > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$fac = new FactureFournisseur($db);
|
$fac = new FactureFournisseur($db);
|
||||||
$fac->fetch($_GET["facid"]);
|
$fac->fetch($_GET["facid"]);
|
||||||
|
|
||||||
$societe = new Fournisseur($db);
|
$societe = new Fournisseur($db);
|
||||||
|
|
||||||
if ( $societe->fetch($fac->socidp) )
|
if ( $societe->fetch($fac->socidp) )
|
||||||
{
|
{
|
||||||
$addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$fac->socidp;
|
$addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$fac->socidp;
|
||||||
$addons[0][1] = $societe->nom;
|
$addons[0][1] = $societe->nom;
|
||||||
}
|
}
|
||||||
llxHeader('','', $addons);
|
llxHeader('','', $addons);
|
||||||
|
|
||||||
if ($mesg) { print "<br>$mesg<br>"; }
|
if ($mesg) { print "<br>$mesg<br>"; }
|
||||||
|
|
||||||
if ($_GET["action"] == "edit")
|
if ($_GET["action"] == "edit")
|
||||||
{
|
{
|
||||||
|
|
||||||
print_titre($langs->trans("Bill").': '.$fac->ref);
|
print_titre($langs->trans("Bill").': '.$fac->ref);
|
||||||
|
|
||||||
print '<form action="fiche.php?facid='.$fac->id.'" method="post">';
|
print '<form action="fiche.php?facid='.$fac->id.'" method="post">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr><td width="20%">'.$langs->trans("Company").'</td>';
|
print '<tr><td width="20%">'.$langs->trans("Company").'</td>';
|
||||||
|
|
||||||
print '<td width="20%">'.stripslashes($fac->socnom).'</td>';
|
print '<td width="20%">'.stripslashes($fac->socnom).'</td>';
|
||||||
print '<td width="60%" valign="top">'.$langs->trans("Comments").'</tr>';
|
print '<td width="60%" valign="top">'.$langs->trans("Comments").'</tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("Ref").'</td><td valign="top">';
|
print '<tr><td valign="top">'.$langs->trans("Ref").'</td><td valign="top">';
|
||||||
print '<input name="facnumber" type="text" value="'.$fac->ref.'"></td>';
|
print '<input name="facnumber" type="text" value="'.$fac->ref.'"></td>';
|
||||||
|
|
||||||
print '<td rowspan="8" width="60%" valign="top">';
|
print '<td rowspan="8" width="60%" valign="top">';
|
||||||
print '<textarea name="note" wrap="soft" cols="60" rows="10">';
|
print '<textarea name="note" wrap="soft" cols="60" rows="10">';
|
||||||
print stripslashes($fac->note);
|
print stripslashes($fac->note);
|
||||||
print '</textarea></td></tr>';
|
print '</textarea></td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("Label").'</td><td>';
|
print '<tr><td valign="top">'.$langs->trans("Label").'</td><td>';
|
||||||
print '<input size="30" name="libelle" type="text" value="'.stripslashes($fac->libelle).'"></td></tr>';
|
print '<input size="30" name="libelle" type="text" value="'.stripslashes($fac->libelle).'"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("AmountHT").' / '.$langs->trans("AmountTTC").'</td>';
|
print '<tr><td>'.$langs->trans("AmountHT").' / '.$langs->trans("AmountTTC").'</td>';
|
||||||
print '<td>'.price($fac->total_ht).' / '.price($fac->total_ttc).'</td></tr>';
|
print '<td>'.price($fac->total_ht).' / '.price($fac->total_ttc).'</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
||||||
$html->select_date($fac->datep);
|
$html->select_date($fac->datep);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
||||||
$html->select_date($fac->date_echeance,'ech');
|
$html->select_date($fac->date_echeance,'ech');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
$authorfullname=" ";
|
$authorfullname=" ";
|
||||||
if ($fac->author)
|
if ($fac->author)
|
||||||
{
|
{
|
||||||
$author = new User($db, $fac->author);
|
$author = new User($db, $fac->author);
|
||||||
$author->fetch('');
|
$author->fetch('');
|
||||||
$authorfullname=$author->fullname;
|
$authorfullname=$author->fullname;
|
||||||
}
|
}
|
||||||
print "<tr><td>".$langs->trans("Author")."</td><td>$authorfullname</td></tr>";
|
print "<tr><td>".$langs->trans("Author")."</td><td>$authorfullname</td></tr>";
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$fac->LibStatut($fac->paye,$fac->statut)."</td></tr>";
|
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$fac->LibStatut($fac->paye,$fac->statut)."</td></tr>";
|
||||||
print "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"".$langs->trans("Save")."\"></td></tr>";
|
print "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"".$langs->trans("Save")."\"></td></tr>";
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print "</form>";
|
print "</form>";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lignes
|
* Lignes
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print "<form action=\"fiche.php?facid=$fac->id&action=add_ligne\" method=\"post\">";
|
print "<form action=\"fiche.php?facid=$fac->id&action=add_ligne\" method=\"post\">";
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Label").'</td>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Label").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("PriceUHT").'</td>';
|
print '<td align="center">'.$langs->trans("PriceUHT").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("PriceUTTC").'</td>';
|
print '<td align="center">'.$langs->trans("PriceUTTC").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("Qty").'</td>';
|
print '<td align="center">'.$langs->trans("Qty").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("TotalHT").'</td>';
|
print '<td align="center">'.$langs->trans("TotalHT").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("VATRate").'</td>';
|
print '<td align="center">'.$langs->trans("VATRate").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("VAT").'</td>';
|
print '<td align="center">'.$langs->trans("VAT").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("TotalTTC").'</td><td> </td></tr>';
|
print '<td align="right">'.$langs->trans("TotalTTC").'</td><td> </td></tr>';
|
||||||
for ($i = 0 ; $i < sizeof($fac->lignes) ; $i++)
|
for ($i = 0 ; $i < sizeof($fac->lignes) ; $i++)
|
||||||
{
|
{
|
||||||
print "<tr $bc[1]>".'<td>'.$fac->lignes[$i][0]."</td>";
|
print "<tr $bc[1]>".'<td>'.$fac->lignes[$i][0]."</td>";
|
||||||
print '<td align="center">'.price($fac->lignes[$i][1])."</td>";
|
print '<td align="center">'.price($fac->lignes[$i][1])."</td>";
|
||||||
print '<td align="center">'.price($fac->lignes[$i][1] * (1+($fac->lignes[$i][2]/100)))."</td>";
|
print '<td align="center">'.price($fac->lignes[$i][1] * (1+($fac->lignes[$i][2]/100)))."</td>";
|
||||||
print '<td align="center">'.$fac->lignes[$i][3]."</td>";
|
print '<td align="center">'.$fac->lignes[$i][3]."</td>";
|
||||||
print '<td align="center">'.price($fac->lignes[$i][4])."</td>";
|
print '<td align="center">'.price($fac->lignes[$i][4])."</td>";
|
||||||
print '<td align="center">'.$fac->lignes[$i][2]."</td>";
|
print '<td align="center">'.$fac->lignes[$i][2]."</td>";
|
||||||
print '<td align="center">'.price($fac->lignes[$i][5])."</td>";
|
print '<td align="center">'.price($fac->lignes[$i][5])."</td>";
|
||||||
print '<td align="right">'.price($fac->lignes[$i][6])."</td>";
|
print '<td align="right">'.price($fac->lignes[$i][6])."</td>";
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<a href="fiche.php?facid='.$fac->id.'&action=del_ligne&ligne_id='.$fac->lignes[$i][7].'">'.img_delete().'</a></td>';
|
print '<a href="fiche.php?facid='.$fac->id.'&action=del_ligne&ligne_id='.$fac->lignes[$i][7].'">'.img_delete().'</a></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Nouvelle ligne */
|
/* Nouvelle ligne */
|
||||||
print "<tr $bc[1]>";
|
print "<tr $bc[1]>";
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input size="30" name="label" type="text">';
|
print '<input size="30" name="label" type="text">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input size="8" name="amount" type="text">';
|
print '<input size="8" name="amount" type="text">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input size="8" name="amountttc" type="text">';
|
print '<input size="8" name="amountttc" type="text">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input size="2" name="qty" type="text" value="1">';
|
print '<input size="2" name="qty" type="text" value="1">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="center">-</td>';
|
print '<td align="center">-</td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
$html->select_tva("tauxtva");
|
$html->select_tva("tauxtva");
|
||||||
print '</td><td align="center" colspan="2">';
|
print '</td><td align="center" colspan="2">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '</td><td align="center"><input type="submit" value="'.$langs->trans("Add").'"></td></tr>';
|
print '</td><td align="center"><input type="submit" value="'.$langs->trans("Add").'"></td></tr>';
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print "</form>";
|
print "</form>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
$h=0;
|
$h=0;
|
||||||
|
|
||||||
$head[$h][0] = "fiche.php?facid=".$fac->id;
|
$head[$h][0] = "fiche.php?facid=".$fac->id;
|
||||||
$head[$h][1] = $langs->trans("SupplierBill").': '.$fac->ref;
|
$head[$h][1] = $langs->trans("SupplierBill").': '.$fac->ref;
|
||||||
$hselected = $h;
|
$hselected = $h;
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
dolibarr_fiche_head($head, $hselected);
|
dolibarr_fiche_head($head, $hselected);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Confirmation de la validation
|
* Confirmation de la validation
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] == 'valid')
|
if ($_GET["action"] == 'valid')
|
||||||
{
|
{
|
||||||
$html->form_confirm("fiche.php?facid=$fac->id",$langs->trans("ValidateBill"),$langs->trans("ConfirmValidateBill"),"confirm_valid");
|
$html->form_confirm("fiche.php?facid=$fac->id",$langs->trans("ValidateBill"),$langs->trans("ConfirmValidateBill"),"confirm_valid");
|
||||||
print '<br />';
|
print '<br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<table border=\"0\" width=\"100%\">";
|
print "<table border=\"0\" width=\"100%\">";
|
||||||
print '<tr><td width="50%" valign="top">';
|
print '<tr><td width="50%" valign="top">';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Facture
|
* Facture
|
||||||
*/
|
*/
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print "<tr><td>".$langs->trans("Company")."</td><td colspan=\"2\"><b><a href=\"../fiche.php?socid=$fac->socidp\">$fac->socnom</a></b></td>";
|
print "<tr><td>".$langs->trans("Company")."</td><td colspan=\"2\"><b><a href=\"../fiche.php?socid=$fac->socidp\">$fac->socnom</a></b></td>";
|
||||||
print "<td align=\"right\"><a href=\"index.php?socid=$fac->socidp\">".$langs->trans("OtherBills")."</a></td>\n";
|
print "<td align=\"right\"><a href=\"index.php?socid=$fac->socidp\">".$langs->trans("OtherBills")."</a></td>\n";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Date")."</td><td colspan=\"3\">";
|
print '<tr><td>'.$langs->trans("Date")."</td><td colspan=\"3\">";
|
||||||
print dolibarr_print_date($fac->datep,"%A %e %B %Y")."</td></tr>\n";
|
print dolibarr_print_date($fac->datep,"%A %d %B %Y")."</td></tr>\n";
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">';
|
||||||
print $fac->libelle;
|
print $fac->libelle;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$authorfullname=" ";
|
$authorfullname=" ";
|
||||||
if ($fac->author)
|
if ($fac->author)
|
||||||
{
|
{
|
||||||
$author = new User($db, $fac->author);
|
$author = new User($db, $fac->author);
|
||||||
$author->fetch('');
|
$author->fetch('');
|
||||||
$authorfullname=$author->fullname;
|
$authorfullname=$author->fullname;
|
||||||
}
|
}
|
||||||
print "<tr><td>".$langs->trans("Author")."</td><td colspan=\"3\">$authorfullname</td>";
|
print "<tr><td>".$langs->trans("Author")."</td><td colspan=\"3\">$authorfullname</td>";
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$fac->LibStatut($fac->paye,$fac->statut)."</td></tr>";
|
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$fac->LibStatut($fac->paye,$fac->statut)."</td></tr>";
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("TotalHT").'</td><td align="center"><b>'.price($fac->total_ht)."</b></td>";
|
print '<tr><td>'.$langs->trans("TotalHT").'</td><td align="center"><b>'.price($fac->total_ht)."</b></td>";
|
||||||
print '<td align="right">'.$langs->trans("VAT").'</td><td align="center">'.price($fac->total_tva)."</td></tr>";
|
print '<td align="right">'.$langs->trans("VAT").'</td><td align="center">'.price($fac->total_tva)."</td></tr>";
|
||||||
print '<tr><td>'.$langs->trans("TotalTTC").'</td><td colspan="3" align="center">'.price($fac->total_ttc)."</td></tr>";
|
print '<tr><td>'.$langs->trans("TotalTTC").'</td><td colspan="3" align="center">'.price($fac->total_ttc)."</td></tr>";
|
||||||
if (strlen($fac->note))
|
if (strlen($fac->note))
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("Comments").'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans("Comments").'</td><td colspan="3">';
|
||||||
print nl2br(stripslashes($fac->note));
|
print nl2br(stripslashes($fac->note));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print "</td><td valign=\"top\">";
|
print "</td><td valign=\"top\">";
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Paiements
|
* Liste des paiements
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr><td>';
|
|
||||||
|
|
||||||
$sql = "SELECT ".$db->pdate("datep")." as dp, p.amount, c.libelle as paiement_type, p.num_paiement, p.rowid";
|
print '<tr>';
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn as p, ".MAIN_DB_PREFIX."c_paiement as c ";
|
print '<td>'.$langs->trans("DateEcheance").'</td><td>';
|
||||||
$sql .= " WHERE p.fk_facture_fourn = ".$fac->id." AND p.fk_paiement = c.id";
|
print dolibarr_print_date($fac->date_echeance,"%A %d %B %Y")."</td></tr>\n";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
print '<tr><td colspan="2">'.$langs->trans("Payments").'</td></tr>';
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$num = $db->num_rows($result);
|
|
||||||
$i = 0; $total = 0;
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
$sql = "SELECT ".$db->pdate("datep")." as dp, p.amount, c.libelle as paiement_type, p.num_paiement, p.rowid";
|
||||||
print '<tr><td>'.$langs->trans("Payments").' :</td>';
|
$sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn as p, ".MAIN_DB_PREFIX."c_paiement as c ";
|
||||||
print '<td>'.$langs->trans("DateEcheance")." : ";
|
$sql .= " WHERE p.fk_facture_fourn = ".$fac->id." AND p.fk_paiement = c.id";
|
||||||
print dolibarr_print_date($fac->date_echeance,"%A %e %B %Y")."</td></tr>\n";
|
|
||||||
print "<tr class=\"liste_titre\">";
|
|
||||||
print '<td>'.$langs->trans("Date").'</td>';
|
|
||||||
print '<td>'.$langs->trans("Type").'</td>';
|
|
||||||
|
|
||||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->societe_id == 0)
|
$result = $db->query($sql);
|
||||||
{
|
if ($result)
|
||||||
$tdsup=' colspan="2"';
|
{
|
||||||
}
|
$num = $db->num_rows($result);
|
||||||
print "<td align=\"right\">".$langs->trans("AmountTTC")."</td><td$tdsup> </td>";
|
$i = 0; $total = 0;
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$var=True;
|
print '<tr><td colspan="2">';
|
||||||
while ($i < $num)
|
print '<table class="noborder" width="100%">';
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($result);
|
|
||||||
$var=!$var;
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
print "<td>".img_object($langs->trans("Payment"),"payment").' '.dolibarr_print_date($objp->dp)."</td>\n";
|
|
||||||
print "<td>$objp->paiement_type $objp->num_paiement</td>\n";
|
|
||||||
print "<td align=\"right\">".price($objp->amount)."</td><td>".$langs->trans("Currency".$conf->monnaie)."</td>\n";
|
|
||||||
|
|
||||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->societe_id == 0)
|
print "<tr class=\"liste_titre\">";
|
||||||
{
|
print '<td>'.$langs->trans("Date").'</td>';
|
||||||
print '<td align="center">';
|
print '<td>'.$langs->trans("Type").'</td>';
|
||||||
print '<a href="fiche.php?facid='.$fac->id.'&action=deletepaiement&paiement_id='.$objp->rowid.'">';
|
|
||||||
print img_delete();
|
|
||||||
print '</a></td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</tr>";
|
if ($fac->statut == 1 && $fac->paye == 0 && $user->societe_id == 0)
|
||||||
$total = $total + $objp->amount;
|
{
|
||||||
$i++;
|
$tdsup=' colspan="2"';
|
||||||
}
|
}
|
||||||
print "<tr class=\"liste_total\"><td colspan=\"2\" align=\"right\">".$langs->trans("Total")." :</td><td align=\"right\"><b>".price($total)."</b></td><td$tdsup>".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n";
|
print "<td align=\"right\">".$langs->trans("AmountTTC")."</td><td$tdsup> </td>";
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$var=True;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
$var=!$var;
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print "<td nowrap>".img_object($langs->trans("Payment"),"payment").' '.dolibarr_print_date($objp->dp)."</td>\n";
|
||||||
|
print "<td>$objp->paiement_type $objp->num_paiement</td>\n";
|
||||||
|
print "<td align=\"right\">".price($objp->amount)."</td><td>".$langs->trans("Currency".$conf->monnaie)."</td>\n";
|
||||||
|
|
||||||
|
if ($fac->statut == 1 && $fac->paye == 0 && $user->societe_id == 0)
|
||||||
|
{
|
||||||
|
print '<td align="center">';
|
||||||
|
print '<a href="fiche.php?facid='.$fac->id.'&action=deletepaiement&paiement_id='.$objp->rowid.'">';
|
||||||
|
print img_delete();
|
||||||
|
print '</a></td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</tr>";
|
||||||
|
$total = $total + $objp->amount;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
print "<tr class=\"liste_total\"><td colspan=\"2\" align=\"right\">".$langs->trans("Total")." :</td><td align=\"right\"><b>".price($total)."</b></td><td$tdsup>".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n";
|
||||||
|
|
||||||
|
|
||||||
if ($fac->statut > 0)
|
if ($fac->statut > 0)
|
||||||
{
|
{
|
||||||
$resteapayer = abs($fac->total_ttc - $total);
|
$resteapayer = abs($fac->total_ttc - $total);
|
||||||
print "<tr class=\liste_total\"><td colspan=\"2\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
|
print "<tr class=\liste_total\"><td colspan=\"2\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
|
||||||
print '<td align="right"><b>'.price($resteapayer)."</b></td><td$tdsup>".$langs->trans("Currency".$conf->monnaie)."</td>";
|
print '<td align="right"><b>'.price($resteapayer)."</b></td><td$tdsup>".$langs->trans("Currency".$conf->monnaie)."</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
$db->free();
|
$db->free();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db);
|
||||||
}
|
}
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lignes
|
* Lignes
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
print '<p><table class="noborder" width="100%">';
|
print '<p><table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Label").'</td>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Label").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("PriceUHT").'</td>';
|
print '<td align="center">'.$langs->trans("PriceUHT").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("Qty").'</td>';
|
print '<td align="center">'.$langs->trans("Qty").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("TotalHT").'</td>';
|
print '<td align="center">'.$langs->trans("TotalHT").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("VATRate").'</td>';
|
print '<td align="center">'.$langs->trans("VATRate").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("VAT").'</td>';
|
print '<td align="center">'.$langs->trans("VAT").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("TotalTTC").'</td></tr>';
|
print '<td align="right">'.$langs->trans("TotalTTC").'</td></tr>';
|
||||||
$var=1;
|
$var=1;
|
||||||
for ($i = 0 ; $i < sizeof($fac->lignes) ; $i++)
|
for ($i = 0 ; $i < sizeof($fac->lignes) ; $i++)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>".'<td>'.$fac->lignes[$i][0]."</td>";
|
print "<tr $bc[$var]>".'<td>'.$fac->lignes[$i][0]."</td>";
|
||||||
print '<td align="center">'.price($fac->lignes[$i][1])."</td>";
|
print '<td align="center">'.price($fac->lignes[$i][1])."</td>";
|
||||||
print '<td align="center">'.$fac->lignes[$i][3]."</td>";
|
print '<td align="center">'.$fac->lignes[$i][3]."</td>";
|
||||||
print '<td align="center">'.price($fac->lignes[$i][4])."</td>";
|
print '<td align="center">'.price($fac->lignes[$i][4])."</td>";
|
||||||
print '<td align="center">'.$fac->lignes[$i][2]." %</td>";
|
print '<td align="center">'.$fac->lignes[$i][2]." %</td>";
|
||||||
print '<td align="center">'.price($fac->lignes[$i][5])."</td>";
|
print '<td align="center">'.price($fac->lignes[$i][5])."</td>";
|
||||||
print '<td align="right">'.price($fac->lignes[$i][6])."</td>";
|
print '<td align="right">'.price($fac->lignes[$i][6])."</td>";
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Boutons actions
|
* Boutons actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print "<div class=\"tabsAction\">\n";
|
print "<div class=\"tabsAction\">\n";
|
||||||
|
|
||||||
if ($fac->statut == 0 && $user->societe_id == 0)
|
if ($fac->statut == 0 && $user->societe_id == 0)
|
||||||
{
|
{
|
||||||
if ($_GET["action"] == "edit")
|
if ($_GET["action"] == "edit")
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="fiche.php?facid='.$fac->id.'">'.$langs->trans("Cancel").'</a>';
|
print '<a class="butAction" href="fiche.php?facid='.$fac->id.'">'.$langs->trans("Cancel").'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="fiche.php?facid='.$fac->id.'&action=edit">'.$langs->trans('Edit').'</a>';
|
print '<a class="butAction" href="fiche.php?facid='.$fac->id.'&action=edit">'.$langs->trans('Edit').'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->societe_id == 0)
|
if ($fac->statut == 1 && $fac->paye == 0 && $user->societe_id == 0)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="paiement.php?facid='.$fac->id.'&action=create">'.$langs->trans("DoPaiement").'</a>';
|
print '<a class="butAction" href="paiement.php?facid='.$fac->id.'&action=create">'.$langs->trans("DoPaiement").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fac->statut == 1 && price($resteapayer) <= 0 && $fac->paye == 0 && $user->societe_id == 0)
|
if ($fac->statut == 1 && price($resteapayer) <= 0 && $fac->paye == 0 && $user->societe_id == 0)
|
||||||
{
|
{
|
||||||
print "<a class=\"butAction\" href=\"fiche.php?facid=$fac->id&action=payed\">".$langs->trans('ClassifyPayed')."</a>";
|
print "<a class=\"butAction\" href=\"fiche.php?facid=$fac->id&action=payed\">".$langs->trans('ClassifyPayed')."</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fac->statut == 0 && $user->rights->fournisseur->facture->valider)
|
if ($fac->statut == 0 && $user->rights->fournisseur->facture->valider)
|
||||||
{
|
{
|
||||||
if ($_GET["action"] <> "edit")
|
if ($_GET["action"] <> "edit")
|
||||||
print "<a class=\"butAction\" href=\"fiche.php?facid=$fac->id&action=valid\">".$langs->trans('Valid')."</a>";
|
print "<a class=\"butAction\" href=\"fiche.php?facid=$fac->id&action=valid\">".$langs->trans('Valid')."</a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
||||||
if ($user->rights->fournisseur->facture->creer)
|
if ($user->rights->fournisseur->facture->creer)
|
||||||
{
|
{
|
||||||
print "<a class=\"butAction\" href=\"fiche.php?facid=$fac->id&action=copy&socid=$fac->socidp\">".$langs->trans('Copy')."</a>";
|
print "<a class=\"butAction\" href=\"fiche.php?facid=$fac->id&action=copy&socid=$fac->socidp\">".$langs->trans('Copy')."</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["action"] != "edit" && $fac->statut == 0 && $user->rights->fournisseur->facture->creer)
|
if ($_GET["action"] != "edit" && $fac->statut == 0 && $user->rights->fournisseur->facture->creer)
|
||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="index.php?facid='.$fac->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
print '<a class="butActionDelete" href="index.php?facid='.$fac->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user