Corrections sur gestion avoirs
This commit is contained in:
parent
079ffc15ec
commit
cc2217a8a4
@ -1744,6 +1744,21 @@ else
|
||||
$facreplaced->fetch($fac->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("CorrectInvoice",$facreplaced->getNomUrl(1)).')';
|
||||
}
|
||||
$facidavoir=$fac->getIdAvoirInvoice();
|
||||
if (sizeof($facidavoir) > 0)
|
||||
{
|
||||
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
|
||||
$i=0;
|
||||
foreach($facidavoir as $id)
|
||||
{
|
||||
if ($i==0) print ' ';
|
||||
else print ',';
|
||||
$facavoir=new Facture($db);
|
||||
$facavoir->fetch($id);
|
||||
print $facavoir->getNomUrl(1);
|
||||
}
|
||||
print ')';
|
||||
}
|
||||
$facidnext=$fac->getIdReplacingInvoice();
|
||||
if ($facidnext > 0)
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -87,6 +87,8 @@ if (isset($_GET["action"]) && $_GET["action"] == 'del_bookmark')
|
||||
*
|
||||
*/
|
||||
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
llxHeader("",$langs->trans("AccountancyTreasuryArea"));
|
||||
|
||||
print_fiche_titre($langs->trans("AccountancyTreasuryArea"));
|
||||
@ -147,7 +149,11 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td nowrap><a href="facture.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->facnumber.'</a></td>';
|
||||
print '<tr '.$bc[$var].'><td nowrap>';
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->id=$obj->idp;
|
||||
print $facturestatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,16).'</a></td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '</tr>';
|
||||
@ -391,7 +397,10 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td nowrap><a href="facture.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->facnumber.'</a>';
|
||||
print '<td nowrap>';
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
print $facturestatic->getNomUrl(1,'');
|
||||
if ($obj->datelimite < (time() - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCustomer"),"company").' '.dolibarr_trunc($obj->nom,44).'</a></td>';
|
||||
@ -465,7 +474,11 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[$var].'><td><a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->facnumber.'</a></td>';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
$facstatic->ref=$obj->facnumber;
|
||||
$facstatic->id=$obj->rowid;
|
||||
print $facstatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowSupplier"),"company").' '.dolibarr_trunc($obj->nom,44).'</a></td>';
|
||||
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
|
||||
@ -1752,6 +1752,35 @@ class Facture extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoie tableau des ids de facture avoir issus de la facture
|
||||
* \return array Tableau d'id de factures avoirs
|
||||
*/
|
||||
function getIdAvoirInvoice()
|
||||
{
|
||||
$idarray=array();
|
||||
|
||||
$sql = 'SELECT rowid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture';
|
||||
$sql.= ' WHERE fk_facture_source = '.$this->id;
|
||||
$sql.= ' AND type = 2';
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
// Si il y en a
|
||||
$idarray[]=$obj->rowid;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
return $idarray;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoie l'id de la facture qui la remplace
|
||||
* \return int <0 si ko, 0 si aucune facture ne remplace, id facture sinon
|
||||
@ -1761,7 +1790,7 @@ class Facture extends CommonObject
|
||||
$sql = 'SELECT rowid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture';
|
||||
$sql.= ' WHERE fk_facture_source = '.$this->id;
|
||||
$sql.= ' AND fk_statut > 0';
|
||||
$sql.= ' AND type < 2';
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -569,5 +569,26 @@ class FactureFournisseur extends Facture
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoie nom clicable (avec eventuellement le picto)
|
||||
* \param withpicto Inclut le picto dans le lien
|
||||
* \param option Sur quoi pointe le lien
|
||||
* \return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$this->id.'">';
|
||||
$lienfin='</a>';
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowInvoice"),'bill').$lienfin.' ');
|
||||
$result.=$lien.$this->ref.$lienfin;
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -22,6 +22,7 @@ ReplacedByInvoice=Replaced by invoice %s
|
||||
CorrectInvoice=Correct invoice %s
|
||||
NoReplacableInvoice=No replacable invoices
|
||||
NoInvoiceToCorrect=No invoice to correct
|
||||
InvoiceHasAvoir=Corrected by one or several invoices
|
||||
CardBill=Invoice card
|
||||
Invoice=Invoice
|
||||
Invoices=Invoices
|
||||
|
||||
@ -22,6 +22,7 @@ ReplacedByInvoice=Remplac
|
||||
CorrectInvoice=Corrige facture %s
|
||||
NoReplacableInvoice=Pas de factures remplacables
|
||||
NoInvoiceToCorrect=Pas de factures à corriger
|
||||
InvoiceHasAvoir=Corrigée par un ou plusieurs avoirs
|
||||
CardBill=Fiche facture
|
||||
Invoice=Facture
|
||||
Invoices=Factures
|
||||
|
||||
Loading…
Reference in New Issue
Block a user