Look: Modif esthétique mineure
This commit is contained in:
parent
6c7eaa2d47
commit
de9fe85246
@ -22,7 +22,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \file htdocs/compta/facture.php
|
/**
|
||||||
|
\file htdocs/compta/facture.php
|
||||||
\ingroup facture
|
\ingroup facture
|
||||||
\brief Page de création d'une facture
|
\brief Page de création d'une facture
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
@ -36,23 +37,14 @@ $user->getrights('banque');
|
|||||||
if (!$user->rights->facture->lire)
|
if (!$user->rights->facture->lire)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$langs->load("main"); // BUG De chargement de traduction ne pas modifier cette ligne
|
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
|
||||||
require_once "../facture.class.php";
|
require_once "../facture.class.php";
|
||||||
require_once "../paiement.class.php";
|
require_once "../paiement.class.php";
|
||||||
if ($conf->projet->enabled) {
|
if ($conf->projet->enabled) require_once "../project.class.php";
|
||||||
require_once "../project.class.php";
|
if ($conf->propal->enabled) require_once "../propal.class.php";
|
||||||
}
|
if ($conf->contrat->enabled) require_once "../contrat/contrat.class.php";
|
||||||
if ($conf->propal->enabled) {
|
if ($conf->commande->enabled) require_once "../commande/commande.class.php";
|
||||||
require_once "../propal.class.php";
|
|
||||||
}
|
|
||||||
if ($conf->contrat->enabled) {
|
|
||||||
require_once "../contrat/contrat.class.php";
|
|
||||||
}
|
|
||||||
if ($conf->commande->enabled) {
|
|
||||||
require_once "../commande/commande.class.php";
|
|
||||||
}
|
|
||||||
require_once "../lib/CMailFile.class.php";
|
require_once "../lib/CMailFile.class.php";
|
||||||
|
|
||||||
|
|
||||||
@ -1710,20 +1702,20 @@ else
|
|||||||
{
|
{
|
||||||
if ($objp->fk_statut == 0)
|
if ($objp->fk_statut == 0)
|
||||||
{
|
{
|
||||||
print '<td align="center">brouillon</td>';
|
print '<td align="center">'.$langs->trans("BillShortStatusDraft").'</td>';
|
||||||
}
|
}
|
||||||
elseif ($objp->fk_statut == 3)
|
elseif ($objp->fk_statut == 3)
|
||||||
{
|
{
|
||||||
print '<td align="center">abandonnée</td>';
|
print '<td align="center">'.$langs->trans("BillShortStatusCanceled").'</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td align="center"><a class="'.$class.'" href="facture.php?filtre=paye:0,fk_statut:1">'.($objp->am?"commencé":"impayée").'</a></td>';
|
print '<td align="center"><a class="'.$class.'" href="facture.php?filtre=paye:0,fk_statut:1">'.($objp->am?$langs->trans("BillShortStatusStarted"):$langs->trans("BillShortStatusNotPayed")).'</a></td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td align="center">payée</td>';
|
print '<td align="center">'.$langs->trans("BillShortStatusPayed").'</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -44,87 +44,97 @@ $page=isset($_GET["page"])?$_GET["page"]:$_POST["page"];
|
|||||||
|
|
||||||
if ($_POST["action"] == 'add_paiement')
|
if ($_POST["action"] == 'add_paiement')
|
||||||
{
|
{
|
||||||
if ($_POST["paiementid"] > 0)
|
if ($_POST["paiementid"] > 0)
|
||||||
{
|
{
|
||||||
|
$datepaye = $db->idate(mktime(12, 0 , 0,
|
||||||
$datepaye = $db->idate(mktime(12, 0 , 0,
|
$_POST["remonth"],
|
||||||
$_POST["remonth"],
|
$_POST["reday"],
|
||||||
$_POST["reday"],
|
$_POST["reyear"]));
|
||||||
$_POST["reyear"]));
|
|
||||||
|
|
||||||
$paiement_id = 0;
|
$paiement_id = 0;
|
||||||
$amounts = array();
|
$amounts = array();
|
||||||
foreach ($_POST as $key => $value)
|
foreach ($_POST as $key => $value)
|
||||||
{
|
{
|
||||||
if (substr($key,0,7) == 'amount_')
|
if (substr($key,0,7) == 'amount_')
|
||||||
{
|
{
|
||||||
$other_facid = substr($key,7);
|
$other_facid = substr($key,7);
|
||||||
|
|
||||||
$amounts[$other_facid] = $_POST[$key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO Mettre toute la chaine dans une même transaction
|
|
||||||
|
|
||||||
// Creation de la ligne paiement
|
$amounts[$other_facid] = $_POST[$key];
|
||||||
$paiement = new Paiement($db);
|
}
|
||||||
$paiement->datepaye = $datepaye;
|
}
|
||||||
$paiement->amounts = $amounts; // Tableau de montant
|
|
||||||
$paiement->paiementid = $_POST["paiementid"];
|
|
||||||
$paiement->num_paiement = $_POST["num_paiement"];
|
|
||||||
$paiement->note = $_POST["comment"];
|
|
||||||
$paiement_id = $paiement->create($user);
|
|
||||||
|
|
||||||
if ($paiement_id > 0)
|
// TODO Mettre toute la chaine dans une même transaction
|
||||||
{
|
$db->begin();
|
||||||
// On determine le montant total du paiement
|
|
||||||
$total=0;
|
// Creation de la ligne paiement
|
||||||
foreach ($paiement->amounts as $key => $value)
|
$paiement = new Paiement($db);
|
||||||
{
|
$paiement->datepaye = $datepaye;
|
||||||
$facid = $key;
|
$paiement->amounts = $amounts; // Tableau de montant
|
||||||
$value = trim($value);
|
$paiement->paiementid = $_POST["paiementid"];
|
||||||
$amount = round(ereg_replace(",",".",$value), 2);
|
$paiement->num_paiement = $_POST["num_paiement"];
|
||||||
if (is_numeric($amount))
|
$paiement->note = $_POST["comment"];
|
||||||
{
|
|
||||||
$total += $amount;
|
$paiement_id = $paiement->create($user);
|
||||||
}
|
if ($paiement_id > 0)
|
||||||
}
|
{
|
||||||
|
// On determine le montant total du paiement
|
||||||
// Insertion dans llx_bank
|
$total=0;
|
||||||
$label = "Règlement facture";
|
foreach ($paiement->amounts as $key => $value)
|
||||||
$acc = new Account($db, $_POST["accountid"]);
|
{
|
||||||
//paiementid contient "CHQ ou VIR par exemple"
|
$facid = $key;
|
||||||
$bank_line_id = $acc->addline($paiement->datepaye, $paiement->paiementid, $label, $total, $paiement->num_paiement, '', $user);
|
$value = trim($value);
|
||||||
|
$amount = round(ereg_replace(",",".",$value), 2);
|
||||||
// Mise a jour fk_bank dans llx_paiement. On connait ainsi le paiement qui a généré l'écriture bancaire
|
if (is_numeric($amount))
|
||||||
if ($bank_line_id)
|
{
|
||||||
{
|
$total += $amount;
|
||||||
$paiement->update_fk_bank($bank_line_id);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mise a jour liens (pour chaque facture concernées par le paiement)
|
// Insertion dans llx_bank
|
||||||
foreach ($paiement->amounts as $key => $value)
|
$label = "Règlement facture";
|
||||||
{
|
$acc = new Account($db, $_POST["accountid"]);
|
||||||
$facid = $key;
|
//paiementid contient "CHQ ou VIR par exemple"
|
||||||
$fac = new Facture($db);
|
$bank_line_id = $acc->addline($paiement->datepaye, $paiement->paiementid, $label, $total, $paiement->num_paiement, '', $user);
|
||||||
$fac->fetch($facid);
|
|
||||||
$fac->fetch_client();
|
// Mise a jour fk_bank dans llx_paiement. On connait ainsi le paiement qui a généré l'écriture bancaire
|
||||||
$acc->add_url_line($bank_line_id, $paiement_id, DOL_URL_ROOT.'/compta/paiement/fiche.php?id=', "(paiement)");
|
if ($bank_line_id > 0)
|
||||||
$acc->add_url_line($bank_line_id, $fac->client->id, DOL_URL_ROOT.'/compta/fiche.php?socid=', $fac->client->nom);
|
{
|
||||||
}
|
$paiement->update_fk_bank($bank_line_id);
|
||||||
|
|
||||||
$loc = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$paiement_id;
|
// Mise a jour liens (pour chaque facture concernées par le paiement)
|
||||||
Header("Location: $loc");
|
foreach ($paiement->amounts as $key => $value)
|
||||||
}
|
{
|
||||||
else
|
$facid = $key;
|
||||||
{
|
$fac = new Facture($db);
|
||||||
// Il y a eu erreur
|
$fac->fetch($facid);
|
||||||
$fiche_erreur_message = "Echec de la création du paiement";
|
$fac->fetch_client();
|
||||||
}
|
$acc->add_url_line($bank_line_id, $paiement_id, DOL_URL_ROOT.'/compta/paiement/fiche.php?id=', "(paiement)");
|
||||||
|
$acc->add_url_line($bank_line_id, $fac->client->id, DOL_URL_ROOT.'/compta/fiche.php?socid=', $fac->client->nom);
|
||||||
|
}
|
||||||
|
|
||||||
|
$loc = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$paiement_id;
|
||||||
|
|
||||||
|
$db->commit();
|
||||||
|
|
||||||
|
Header("Location: $loc");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Il y a eu erreur
|
||||||
|
$db->rollback();
|
||||||
|
$fiche_erreur_message = $langs->trans("ErrorUnknown");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Il y a eu erreur
|
||||||
|
$db->rollback();
|
||||||
|
$fiche_erreur_message = $langs->trans("ErrorUnknown");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$fiche_erreur_message = "Vous devez sélectionner un mode de paiement";
|
$fiche_erreur_message = '<div class="error">Vous devez sélectionner un mode de paiement</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,8 +155,13 @@ llxHeader();
|
|||||||
|
|
||||||
$html=new Form($db);
|
$html=new Form($db);
|
||||||
|
|
||||||
|
if ($fiche_erreur_message)
|
||||||
|
{
|
||||||
|
print '<tr><td colspan="3" align="center">'.$fiche_erreur_message.'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($_GET["action"] == 'create')
|
|
||||||
|
if ($_GET["action"] == 'create' || $_POST["action"] == 'add_paiement')
|
||||||
{
|
{
|
||||||
$facture = new Facture($db);
|
$facture = new Facture($db);
|
||||||
$facture->fetch($facid);
|
$facture->fetch($facid);
|
||||||
@ -165,18 +180,18 @@ if ($_GET["action"] == 'create')
|
|||||||
|
|
||||||
$total = $obj->total;
|
$total = $obj->total;
|
||||||
|
|
||||||
print_titre("Emettre un paiement");
|
print_titre($langs->trans("DoPayment"));
|
||||||
|
|
||||||
print '<form action="paiement.php?action=create&facid='.$facid.'" method="post">';
|
print '<form action="paiement.php" method="post">';
|
||||||
print '<input type="hidden" name="action" value="add_paiement">';
|
print '<input type="hidden" name="action" value="add_paiement">';
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
|
||||||
print "<tr><td>".$langs->trans("Company")." :</td><td colspan=\"2\">$obj->nom</td></tr>\n";
|
|
||||||
|
|
||||||
print "<input type=\"hidden\" name=\"facid\" value=\"$facid\">";
|
print "<input type=\"hidden\" name=\"facid\" value=\"$facid\">";
|
||||||
print "<input type=\"hidden\" name=\"facnumber\" value=\"$obj->facnumber\">";
|
print "<input type=\"hidden\" name=\"facnumber\" value=\"$obj->facnumber\">";
|
||||||
print "<input type=\"hidden\" name=\"socid\" value=\"$obj->idp\">";
|
print "<input type=\"hidden\" name=\"socid\" value=\"$obj->idp\">";
|
||||||
print "<input type=\"hidden\" name=\"societe\" value=\"$obj->nom\">";
|
print "<input type=\"hidden\" name=\"societe\" value=\"$obj->nom\">";
|
||||||
|
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
print "<tr><td>".$langs->trans("Company")." :</td><td colspan=\"2\">$obj->nom</td></tr>\n";
|
||||||
|
|
||||||
print "<tr><td>".$langs->trans("Date")." :</td><td>";
|
print "<tr><td>".$langs->trans("Date")." :</td><td>";
|
||||||
$html->select_date();
|
$html->select_date();
|
||||||
@ -254,7 +269,7 @@ if ($_GET["action"] == 'create')
|
|||||||
print '<tr><td colspan="3">';
|
print '<tr><td colspan="3">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>Facture</td><td align="center">'.$langs->trans("Date").'</td>';
|
print '<td>'.$langs->trans("Bill").'</td><td align="center">'.$langs->trans("Date").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("Received").'</td>';
|
print '<td align="right">'.$langs->trans("Received").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("RemainderToPay").'</td>';
|
print '<td align="right">'.$langs->trans("RemainderToPay").'</td>';
|
||||||
@ -272,7 +287,7 @@ if ($_GET["action"] == 'create')
|
|||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
print '<td><a href="facture.php?facid='.$objp->facid.'">' . $objp->facnumber;
|
print '<td><a href="facture.php?facid='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->facnumber;
|
||||||
print "</a></td>\n";
|
print "</a></td>\n";
|
||||||
|
|
||||||
if ($objp->df > 0 )
|
if ($objp->df > 0 )
|
||||||
@ -323,11 +338,6 @@ if ($_GET["action"] == 'create')
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($fiche_erreur_message)
|
|
||||||
{
|
|
||||||
print '<tr><td colspan="3" align="center">'.$fiche_erreur_message.'</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr><td colspan="3" align="center"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>';
|
print '<tr><td colspan="3" align="center"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>';
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
@ -339,20 +349,15 @@ if ($_GET["action"] == 'create')
|
|||||||
/**
|
/**
|
||||||
* \brief Affichage de la liste des paiement
|
* \brief Affichage de la liste des paiement
|
||||||
*/
|
*/
|
||||||
if (! $_GET["action"])
|
if (! $_GET["action"] && ! $_POST["action"])
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($page == -1)
|
if ($page == -1) $page = 0 ;
|
||||||
$page = 0 ;
|
|
||||||
|
|
||||||
$limit = $conf->liste_limit;
|
$limit = $conf->liste_limit;
|
||||||
$offset = $limit * $page ;
|
$offset = $limit * $page ;
|
||||||
|
|
||||||
if ($sortorder == "")
|
if (! $sortorder) $sortorder="DESC";
|
||||||
$sortorder="DESC";
|
if (! $sortfield) $sortfield="p.datep";
|
||||||
|
|
||||||
if ($sortfield == "")
|
|
||||||
$sortfield="p.datep";
|
|
||||||
|
|
||||||
$sql = "SELECT ".$db->pdate("p.datep")." as dp, p.amount, f.amount as fa_amount, f.facnumber";
|
$sql = "SELECT ".$db->pdate("p.datep")." as dp, p.amount, f.amount as fa_amount, f.facnumber";
|
||||||
$sql .=", f.rowid as facid, c.libelle as paiement_type, p.num_paiement";
|
$sql .=", f.rowid as facid, c.libelle as paiement_type, p.num_paiement";
|
||||||
@ -374,7 +379,7 @@ if (! $_GET["action"])
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
$var=True;
|
$var=True;
|
||||||
|
|
||||||
print_barre_liste("Paiements", $page, "paiement.php","",$sortfield,$sortorder,'',$num);
|
print_barre_liste($langs->trans("Payments"), $page, "paiement.php","",$sortfield,$sortorder,'',$num);
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|||||||
@ -21,7 +21,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \file htdocs/compta/paiement/fiche.php
|
/**
|
||||||
|
\file htdocs/compta/paiement/fiche.php
|
||||||
\ingroup facture
|
\ingroup facture
|
||||||
\brief Onglet paiement d'un paiement
|
\brief Onglet paiement d'un paiement
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
@ -156,10 +157,10 @@ if ($db->query($sql))
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill").'</a>';
|
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill").' ';
|
||||||
print ' <a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">' . $objp->facnumber;
|
print $objp->facnumber;
|
||||||
print "</a></td>\n";
|
print "</a></td>\n";
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$objp->idp.'">' . $objp->nom.'</a></td>';
|
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$objp->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$objp->nom.'</a></td>';
|
||||||
print '<td align="right">'.price($objp->amount).'</td>';
|
print '<td align="right">'.price($objp->amount).'</td>';
|
||||||
$fac=new Facture($db);
|
$fac=new Facture($db);
|
||||||
print '<td align="center">'.$fac->LibStatut($objp->paye,$objp->fk_statut).'</td>';
|
print '<td align="center">'.$fac->LibStatut($objp->paye,$objp->fk_statut).'</td>';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -21,7 +21,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file htdocs/compta/paiement/info.php
|
/**
|
||||||
|
\file htdocs/compta/paiement/info.php
|
||||||
\ingroup facture
|
\ingroup facture
|
||||||
\brief Onglet info d'un paiement
|
\brief Onglet info d'un paiement
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
@ -51,10 +52,12 @@ $paiement->fetch($_GET["id"], $user);
|
|||||||
$paiement->info($_GET["id"]);
|
$paiement->info($_GET["id"]);
|
||||||
|
|
||||||
print '<table width="100%"><tr><td>';
|
print '<table width="100%"><tr><td>';
|
||||||
|
print '<br>';
|
||||||
dolibarr_print_object_info($paiement);
|
dolibarr_print_object_info($paiement);
|
||||||
|
print '<br>';
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
llxFooter('$Date$ - $Revision$');
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user