New: Add navigation arrows in supplier invoices

This commit is contained in:
Laurent Destailleur 2009-07-19 15:39:25 +00:00
parent d28ce530e8
commit 3bcd18feb6
5 changed files with 171 additions and 135 deletions

View File

@ -2267,7 +2267,7 @@ else
}
print '</td></tr>';
// Discount
// Discounts
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
else print $langs->trans("CompanyHasNoRelativeDiscount");
@ -2343,14 +2343,17 @@ else
print '</td>';
// Payments
/*
* List of payments
*/
$nbrows=8;
if ($conf->global->FAC_USE_CUSTOMER_ORDER_REF) $nbrows++;
if ($conf->projet->enabled) $nbrows++;
print '<td rowspan="'.$nbrows.'" colspan="2" valign="top">';
print '<table class="noborder" width="100%">';
print '<table class="nobordernopadding" width="100%">';
// List of payments already done
print '<tr class="liste_titre">';
@ -2362,10 +2365,6 @@ else
$var=true;
/*
* List of payments
*/
// Payments already done (from deposits)
/*
$depositamount=0;

View File

@ -179,7 +179,7 @@ if ($id > 0)
// Reference du facture
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $facture->ref;
print $html->showrefnav($facture,'facid','',1,'rowid','ref',$morehtmlref);
print "</td></tr>";
// Ref supplier

View File

@ -20,11 +20,11 @@
*/
/**
\file htdocs/fourn/facture/document.php
\ingroup facture, fournisseur
\brief Page de gestion des documents attachees a une facture fournisseur
\version $Id$
*/
* \file htdocs/fourn/facture/document.php
* \ingroup facture, fournisseur
* \brief Page de gestion des documents attachees a une facture fournisseur
* \version $Id$
*/
require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.facture.class.php');
@ -66,42 +66,42 @@ if ($_POST['sendit'] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
$facture = new FactureFournisseur($db);
if ($facture->fetch($facid))
{
$upload_dir = $conf->fournisseur->dir_output.'/facture/'.get_exdir($facture->id,2).$facture->id;
{
$upload_dir = $conf->fournisseur->dir_output.'/facture/'.get_exdir($facture->id,2).$facture->id;
if (! is_dir($upload_dir)) create_exdir($upload_dir);
if (! is_dir($upload_dir)) create_exdir($upload_dir);
if (is_dir($upload_dir))
{
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . '/' . $_FILES['userfile']['name'],0) > 0)
{
$mesg = '<div class="ok">'.$langs->trans('FileTransferComplete').'</div>';
//print_r($_FILES);
}
else
{
// Echec transfert (fichier depassant la limite ?)
$mesg = '<div class="error">'.$langs->trans('ErrorFileNotUploaded').'</div>';
// print_r($_FILES);
}
}
}
if (is_dir($upload_dir))
{
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . '/' . $_FILES['userfile']['name'],0) > 0)
{
$mesg = '<div class="ok">'.$langs->trans('FileTransferComplete').'</div>';
//print_r($_FILES);
}
else
{
// Echec transfert (fichier depassant la limite ?)
$mesg = '<div class="error">'.$langs->trans('ErrorFileNotUploaded').'</div>';
// print_r($_FILES);
}
}
}
}
// Delete
if ($action=='delete')
{
$facid=$_GET["id"];
$facid=$_GET["id"];
$facture = new FactureFournisseur($db);
$facture = new FactureFournisseur($db);
if ($facture->fetch($facid))
{
$upload_dir = $conf->fournisseur->dir_output.'/facture/'.get_exdir($facture->id,2).$facture->id;
{
$upload_dir = $conf->fournisseur->dir_output.'/facture/'.get_exdir($facture->id,2).$facture->id;
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans('FileWasRemoved').'</div>';
}
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans('FileWasRemoved').'</div>';
}
}
@ -109,14 +109,16 @@ if ($action=='delete')
* Affichage
*/
$html = new Form($db);
llxHeader();
if ($facid > 0)
{
$facture = new FactureFournisseur($db);
if ($facture->fetch($facid))
{
$facture->fetch_fournisseur();
{
$facture->fetch_fournisseur();
$upload_dir = $conf->fournisseur->dir_output.'/facture/'.get_exdir($facture->id,2).$facture->id;
@ -133,31 +135,33 @@ if ($facid > 0)
}
print '<table class="border"width="100%">';
print '<table class="border"width="100%">';
// Ref
print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">'.$facture->ref.'</td>';
print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
print $html->showrefnav($facture,'facid','',1,'rowid','ref',$morehtmlref);
print '</td>';
print "</tr>\n";
// Ref supplier
print '<tr><td nowrap="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$facture->ref_supplier.'</td>';
print "</tr>\n";
// Societe
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$facture->fournisseur->getNomUrl(1).'</td></tr>';
// Societe
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$facture->fournisseur->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans('NbOfAttachedFiles').'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans('NbOfAttachedFiles').'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalSizeOfAttachedFiles').'</td><td colspan="3">'.$totalsize.' '.$langs->trans('bytes').'</td></tr>';
print '<tr><td>'.$langs->trans('TotalSizeOfAttachedFiles').'</td><td colspan="3">'.$totalsize.' '.$langs->trans('bytes').'</td></tr>';
print '</table>';
print '</div>';
print '</table>';
print '</div>';
if ($mesg) { print $mesg.'<br>'; }
if ($mesg) { print $mesg.'<br>'; }
// Affiche formulaire upload
$formfile=new FormFile($db);
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$facture->id,'',0,0,$user->rights->fournisseur->facture->creer);

View File

@ -645,8 +645,6 @@ else
if ($ret == 'html') print '<br>';
}
print '<table width="100%" class="notopnoleftnoright">';
print '<tr><td width="50%" valign="top" class="notopnoleft">';
/*
* Facture
@ -654,84 +652,70 @@ else
print '<table class="border" width="100%">';
// Ref
print '<tr><td nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
print '<tr><td nowrap="nowrap" width="20%">'.$langs->trans("Ref").'</td><td colspan="4">';
print $html->showrefnav($fac,'facid','',1,'rowid','ref',$morehtmlref);
print '</td>';
print "</tr>\n";
// Ref supplier
print '<tr><td nowrap="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$fac->ref_supplier.'</td>';
print '<tr><td nowrap="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="4">'.$fac->ref_supplier.'</td>';
print "</tr>\n";
// Societe
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">'.$societe->getNomUrl(1).'</td>';
print '<td align="right"><a href="index.php?socid='.$fac->socid.'">'.$langs->trans('OtherBills').'</a></td>';
print '</tr>';
// Third party
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="4">'.$societe->getNomUrl(1).' (<a href="index.php?socid='.$fac->socid.'">'.$langs->trans('OtherBills').'</a>)</td></tr>';
// Type
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="4">';
print $fac->getLibType();
if ($fac->type == 1)
{
$facreplaced=new FactureFournisseur($db);
$facreplaced->fetch($fac->fk_facture_source);
print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
}
if ($fac->type == 2)
{
$facusing=new FactureFournisseur($db);
$facusing->fetch($fac->fk_facture_source);
print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')';
}
$facidavoir=$fac->getListIdAvoirFromInvoice();
if (sizeof($facidavoir) > 0)
{
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
$i=0;
foreach($facidavoir as $id)
{
if ($i==0) print ' ';
else print ',';
$facavoir=new FactureFournisseur($db);
$facavoir->fetch($id);
print $facavoir->getNomUrl(1);
}
print ')';
}
if ($facidnext > 0)
{
$facthatreplace=new FactureFournisseur($db);
$facthatreplace->fetch($facidnext);
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
}
print '</td></tr>';
// Label
print '<tr><td>'.$langs->trans('Label').'</td><td colspan="3">';
print $fac->libelle;
print '</td>';
print '</tr>';
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3" nowrap="nowrap">';
print dol_print_date($fac->datep,'daytext').'</td></tr>';
print '<tr>';
print '<td>'.$langs->trans('DateEcheance').'</td><td colspan="3">';
print dol_print_date($fac->date_echeance,'daytext');
if (($fac->paye == 0) && ($fac->statut > 0) && $fac->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning");
print '</td></tr>';
// Status
$alreadypayed=$fac->getSommePaiement();
print '<tr><td>'.$langs->trans('Status').'</td><td colspan="3">'.$fac->getLibStatut(4,$alreadypayed).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountHT').'</td><td><b>'.price($fac->total_ht).'</b></td><td colspan="2" align="left">'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($fac->total_tva).'</td><td colspan="2" align="left">'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td>'.price($fac->total_ttc).'</td><td colspan="2" align="left">'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
// Project
if ($conf->projet->enabled)
{
$langs->load('projects');
print '<tr>';
print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Project');
print '</td>';
if ($_GET['action'] != 'classer')
{
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classer&amp;facid='.$fac->id.'">';
print img_edit($langs->trans('SetProject'),1);
print '</a></td>';
}
print '</tr></table>';
print '</td><td colspan="3">';
if ($_GET['action'] == 'classer')
{
$html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socid,$fac->fk_project,'projetid');
}
else
{
$html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socid,$fac->fk_project,'none');
}
print '</td>';
print '</tr>';
}
print '</table>';
print '</td><td valign="top" class="notopnoleftnoright">';
print '<table width="100%" class="noborder">';
/*
* List of payments
*/
print '<tr><td colspan="2">';
$nbrows=7;
if ($conf->projet->enabled) $nbrows++;
print '<td rowspan="'.$nbrows.'" valign="top">';
$sql = 'SELECT '.$db->pdate('datep').' as dp, pf.amount,';
$sql .= ' c.libelle as paiement_type, p.num_paiement, p.rowid';
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p';
@ -745,7 +729,7 @@ else
{
$num = $db->num_rows($result);
$i = 0; $totalpaye = 0;
print '<table class="noborder" width="100%">';
print '<table class="nobordernopadding" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Payments').'</td>';
print '<td>'.$langs->trans('Type').'</td>';
@ -796,12 +780,59 @@ else
{
dol_print_error($db);
}
print '</td>';
print '</tr>';
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3" nowrap="nowrap">';
print dol_print_date($fac->datep,'daytext').'</td></tr>';
print '<tr>';
print '<td>'.$langs->trans('DateEcheance').'</td><td colspan="3">';
print dol_print_date($fac->date_echeance,'daytext');
if (($fac->paye == 0) && ($fac->statut > 0) && $fac->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning");
print '</td></tr>';
print '</table>';
// Status
$alreadypayed=$fac->getSommePaiement();
print '<tr><td>'.$langs->trans('Status').'</td><td colspan="3">'.$fac->getLibStatut(4,$alreadypayed).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountHT').'</td><td><b>'.price($fac->total_ht).'</b></td><td colspan="2" align="left">'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($fac->total_tva).'</td><td colspan="2" align="left">'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td>'.price($fac->total_ttc).'</td><td colspan="2" align="left">'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
// Project
if ($conf->projet->enabled)
{
$langs->load('projects');
print '<tr>';
print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Project');
print '</td>';
if ($_GET['action'] != 'classer')
{
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classer&amp;facid='.$fac->id.'">';
print img_edit($langs->trans('SetProject'),1);
print '</a></td>';
}
print '</tr></table>';
print '</td><td colspan="3">';
if ($_GET['action'] == 'classer')
{
$html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socid,$fac->fk_project,'projetid');
}
else
{
$html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socid,$fac->fk_project,'none');
}
print '</td>';
print '</tr>';
}
print '</td></tr>';
print '</table>';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -19,11 +19,11 @@
*/
/**
\file htdocs/fourn/facture/note.php
\ingroup facture
\brief Fiche de notes sur une facture fournisseur
\version $Id$
*/
* \file htdocs/fourn/facture/note.php
* \ingroup facture
* \brief Fiche de notes sur une facture fournisseur
* \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/fourn.lib.php');
@ -49,7 +49,7 @@ $fac->fetch($_GET["facid"]);
if ($_POST["action"] == 'update_public' && $user->rights->facture->creer)
{
$db->begin();
$res=$fac->update_note_public($_POST["note_public"],$user);
if ($res < 0)
{
@ -65,7 +65,7 @@ if ($_POST["action"] == 'update_public' && $user->rights->facture->creer)
if ($_POST["action"] == 'update' && $user->rights->fournisseur->facture->creer)
{
$db->begin();
$res=$fac->update_note($_POST["note"],$user);
if ($res < 0)
{
@ -80,14 +80,14 @@ if ($_POST["action"] == 'update' && $user->rights->fournisseur->facture->creer)
/******************************************************************************/
/* Affichage fiche */
/******************************************************************************/
llxHeader();
/*
* View
*/
$html = new Form($db);
llxHeader();
if ($_GET["facid"])
{
$fac->fetch_fournisseur();
@ -100,7 +100,9 @@ if ($_GET["facid"])
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">'.$fac->ref.'</td>';
print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
print $html->showrefnav($fac,'facid','',1,'rowid','ref',$morehtmlref);
print '</td>';
print "</tr>\n";
// Ref supplier
@ -148,7 +150,7 @@ if ($_GET["facid"])
}
print "</td></tr>";
}
print "</table>";