mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
First work on a new module for expense report matching dolibarr
standard to replace current one.
This commit is contained in:
parent
bd4b401281
commit
448655ea45
|
|
@ -1656,6 +1656,10 @@ abstract class CommonObject
|
|||
$fieldtva='tva';
|
||||
$fieldup='pu_ht';
|
||||
}
|
||||
if ($this->element == 'expensereport')
|
||||
{
|
||||
$fieldup='value_unit';
|
||||
}
|
||||
|
||||
$sql = 'SELECT rowid, qty, '.$fieldup.' as up, remise_percent, total_ht, '.$fieldtva.' as total_tva, total_ttc, '.$fieldlocaltax1.' as total_localtax1, '.$fieldlocaltax2.' as total_localtax2,';
|
||||
$sql.= ' tva_tx as vatrate, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, info_bits, product_type';
|
||||
|
|
@ -1770,6 +1774,7 @@ abstract class CommonObject
|
|||
if ($this->element == 'facture' || $this->element == 'facturerec') $fieldht='total';
|
||||
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva='total_tva';
|
||||
if ($this->element == 'propal') $fieldttc='total';
|
||||
if ($this->element == 'expensereport') $fieldtva='total_tva';
|
||||
|
||||
if (empty($nodatabaseupdate))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4172,13 +4172,14 @@ function print_date_range($date_start,$date_end,$format = '',$outputlangs='')
|
|||
/**
|
||||
* Format output for start and end date
|
||||
*
|
||||
* @param timestamp $date_start Start date
|
||||
* @param timestamp $date_end End date
|
||||
* @param string $format Output format
|
||||
* @param Translate $outputlangs Output language
|
||||
* @return string String
|
||||
* @param timestamp $date_start Start date
|
||||
* @param timestamp $date_end End date
|
||||
* @param string $format Output format
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param string $withparenthesis 1=Add parenthesis, 0=non parenthesis
|
||||
* @return string String
|
||||
*/
|
||||
function get_date_range($date_start,$date_end,$format = '',$outputlangs='')
|
||||
function get_date_range($date_start,$date_end,$format = '',$outputlangs='', $withparenthesis=1)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
|
@ -4188,15 +4189,15 @@ function get_date_range($date_start,$date_end,$format = '',$outputlangs='')
|
|||
|
||||
if ($date_start && $date_end)
|
||||
{
|
||||
$out.= ' ('.$outputlangs->trans('DateFromTo',dol_print_date($date_start, $format, false, $outputlangs),dol_print_date($date_end, $format, false, $outputlangs)).')';
|
||||
$out.= ($withparenthesis?' (':'').$outputlangs->trans('DateFromTo',dol_print_date($date_start, $format, false, $outputlangs),dol_print_date($date_end, $format, false, $outputlangs)).($withparenthesis?')':'');
|
||||
}
|
||||
if ($date_start && ! $date_end)
|
||||
{
|
||||
$out.= ' ('.$outputlangs->trans('DateFrom',dol_print_date($date_start, $format, false, $outputlangs)).')';
|
||||
$out.= ($withparenthesis?' (':'').$outputlangs->trans('DateFrom',dol_print_date($date_start, $format, false, $outputlangs)).($withparenthesis?')':'');
|
||||
}
|
||||
if (! $date_start && $date_end)
|
||||
{
|
||||
$out.= ' ('.$outputlangs->trans('DateUntil',dol_print_date($date_end, $format, false, $outputlangs)).')';
|
||||
$out.= ($withparenthesis?' (':'').$outputlangs->trans('DateUntil',dol_print_date($date_end, $format, false, $outputlangs)).($withparenthesis?')':'');
|
||||
}
|
||||
|
||||
return $out;
|
||||
|
|
|
|||
93
htdocs/core/modules/expensereport/modules_deplacement.php
Executable file
93
htdocs/core/modules/expensereport/modules_deplacement.php
Executable file
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Parent class for trips and expenses templates
|
||||
*/
|
||||
class ModeleExpenseReport extends CommonDocGenerator
|
||||
{
|
||||
var $error='';
|
||||
|
||||
|
||||
/**
|
||||
* Return list of active generation modules
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $maxfilenamelength Max length of value to show
|
||||
* @return array List of templates
|
||||
*/
|
||||
static function liste_modeles($db,$maxfilenamelength=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$type='expensereport';
|
||||
$liste=array();
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$liste=getListOfModels($db,$type,$maxfilenamelength);
|
||||
|
||||
return $liste;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function expensereport_pdf_create($db, $id, $message, $modele, $outputlangs)
|
||||
{
|
||||
global $conf,$langs;
|
||||
$langs->load("trips");
|
||||
|
||||
// Increase limit for PDF build
|
||||
$err=error_reporting();
|
||||
error_reporting(0);
|
||||
@set_time_limit(120);
|
||||
error_reporting($err);
|
||||
|
||||
$dir = dol_buildpath('/expensereport/core/modules/expensereport/');
|
||||
|
||||
// Positionne modele sur le nom du modele a utiliser
|
||||
if (! strlen($modele))
|
||||
{
|
||||
if ($conf->global->DEPLACEMENT_ADDON_PDF)
|
||||
{
|
||||
$modele = $conf->global->DEPLACEMENT_ADDON_PDF;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_DEPLACEMENT_ADDON_PDF_NotDefined");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Charge le modele
|
||||
$file = "pdf_".$modele.".modules.php";
|
||||
if (file_exists($dir.$file))
|
||||
{
|
||||
$classname = "pdf_".$modele;
|
||||
require_once($dir.$file);
|
||||
|
||||
$obj = new $classname($db);
|
||||
$obj->message = $message;
|
||||
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
if ($obj->write_file($id, $outputlangs) > 0)
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
dol_print_error($db,"expensereport_pdf_create Error: ".$obj->error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
759
htdocs/core/modules/expensereport/pdf_teclib.modules.php
Executable file
759
htdocs/core/modules/expensereport/pdf_teclib.modules.php
Executable file
|
|
@ -0,0 +1,759 @@
|
|||
<?php
|
||||
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/expensereport/core/modules/expensereport/pdf_.modules.php
|
||||
* \ingroup facture
|
||||
* \brief File of class to generate invoices from crab model
|
||||
* \author Laurent Destailleur
|
||||
*/
|
||||
|
||||
dol_include_once("/expensereport/core/modules/expensereport/modules_expensereport.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Classe permettant de generer les factures au modele Crabe
|
||||
*/
|
||||
class pdf_ extends ModeleExpenseReport
|
||||
{
|
||||
var $emetteur; // Objet societe qui emet
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("trips");
|
||||
$langs->load("project");
|
||||
$langs->load("expensereport@expensereport");
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "";
|
||||
$this->description = $langs->trans('PDFDescription');
|
||||
|
||||
// Dimension page pour format A4
|
||||
$this->type = 'pdf';
|
||||
$formatarray=pdf_getFormat();
|
||||
$this->page_largeur = $formatarray['width'];
|
||||
$this->page_hauteur = $formatarray['height'];
|
||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
|
||||
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
|
||||
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
|
||||
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
|
||||
|
||||
$this->option_logo = 1; // Affiche logo
|
||||
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
|
||||
$this->option_modereg = 1; // Affiche mode reglement
|
||||
$this->option_condreg = 1; // Affiche conditions reglement
|
||||
$this->option_codeproduitservice = 1; // Affiche code produit-service
|
||||
$this->option_multilang = 1; // Dispo en plusieurs langues
|
||||
$this->option_escompte = 1; // Affiche si il y a eu escompte
|
||||
$this->option_credit_note = 1; // Support credit notes
|
||||
$this->option_freetext = 1; // Support add of a personalised text
|
||||
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
|
||||
|
||||
$this->franchise=!$mysoc->tva_assuj;
|
||||
|
||||
// Get source company
|
||||
$this->emetteur=$mysoc;
|
||||
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
|
||||
|
||||
// Defini position des colonnes
|
||||
// Defini position des colonnes
|
||||
$this->posxpiece=$this->marge_gauche+1;
|
||||
$this->posxdesc=20;
|
||||
$this->posxdate=85;
|
||||
$this->posxtype=105;
|
||||
$this->posxprojet=125;
|
||||
$this->posxtva=145;
|
||||
$this->posxup=158;
|
||||
$this->posxqty=170;
|
||||
$this->postotalttc=176;
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
$this->posxdate-=20;
|
||||
$this->posxtype-=20;
|
||||
$this->posxprojet-=20;
|
||||
$this->posxtva-=20;
|
||||
$this->posxup-=20;
|
||||
$this->posxqty-=20;
|
||||
$this->postotalttc-=20;
|
||||
}
|
||||
|
||||
$this->tva=array();
|
||||
$this->localtax1=array();
|
||||
$this->localtax2=array();
|
||||
$this->atleastoneratenotnull=0;
|
||||
$this->atleastonediscount=0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to build pdf onto disk
|
||||
*
|
||||
* @param Object $object Object to generate
|
||||
* @param Translate $outputlangs Lang output object
|
||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
*/
|
||||
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
|
||||
{
|
||||
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
|
||||
// Hack to use expensereport dir
|
||||
$rootfordata = DOL_DATA_ROOT;
|
||||
$rootforuser = DOL_DATA_ROOT;
|
||||
// If multicompany module is enabled, we redefine the root of data
|
||||
//if (! empty($this->multicompany->enabled) && ! empty($this->entity) && $this->entity > 1)
|
||||
//{
|
||||
// $rootfordata.='/'.$this->entity;
|
||||
//}
|
||||
$conf->expensereport->dir_output = $rootfordata.'/expensereport';
|
||||
$conf->expensereport_->dir_output = $rootfordata.'/expensereport';
|
||||
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("dict");
|
||||
$outputlangs->load("trips");
|
||||
$outputlangs->load("project");
|
||||
$outputlangs->load("expensereport@expensereport");
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
if ($conf->expensereport_->dir_output)
|
||||
{
|
||||
// Definition de l'objet $object (pour compatibilite ascendante)
|
||||
if (! is_object($object))
|
||||
{
|
||||
$id = $object;
|
||||
$object = new ExpenseReport($db);
|
||||
$ret=$object->fetch($id,$user);
|
||||
}
|
||||
|
||||
$objectref = dol_sanitizeFileName($object->ref_number);
|
||||
$dir = $conf->expensereport_->dir_output . "/" . $objectref;
|
||||
$file = $dir . "/" . $objectref . ".pdf";
|
||||
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
if (dol_mkdir($dir) < 0)
|
||||
{
|
||||
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($object->lignes) && ! isset($object->lines)) $object->lines=$object->lignes;
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
$nblignes = count($object->lines);
|
||||
|
||||
// Create pdf instance
|
||||
$pdf=pdf_getInstance($this->format);
|
||||
|
||||
if (class_exists('TCPDF'))
|
||||
{
|
||||
$pdf->setPrintHeader(false);
|
||||
$pdf->setPrintFooter(false);
|
||||
}
|
||||
$pdf->SetFont(pdf_getPDFFont($outputlangs));
|
||||
// Set path to the background PDF File
|
||||
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
|
||||
{
|
||||
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
|
||||
$tplidx = $pdf->importPage(1);
|
||||
}
|
||||
|
||||
$pdf->Open();
|
||||
$pagenb=0;
|
||||
$pdf->SetDrawColor(128,128,128);
|
||||
|
||||
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref_number));
|
||||
$pdf->SetSubject($outputlangs->transnoentities("Trips"));
|
||||
$pdf->SetCreator("");
|
||||
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
|
||||
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref_number)." ".$outputlangs->transnoentities("Trips"));
|
||||
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
|
||||
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
$pdf->SetAutoPageBreak(1,0);
|
||||
|
||||
// Positionne $this->atleastonediscount si on a au moins une remise
|
||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||
{
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
$pagenb++;
|
||||
$this->_pagehead($pdf, $object, 1, $outputlangs);
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->MultiCell(0, 3, ''); // Set interline to 3
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
$tab_top = 95;
|
||||
$tab_top_newpage = 95;
|
||||
$tab_height = 110;
|
||||
$tab_height_newpage = 110;
|
||||
|
||||
// Affiche notes
|
||||
if (! empty($object->note))
|
||||
{
|
||||
$tab_top = 93;
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note), 0, 1);
|
||||
$nexY = $pdf->GetY();
|
||||
$height_note=$nexY-$tab_top;
|
||||
|
||||
// Rect prend une longueur en 3eme param
|
||||
$pdf->SetDrawColor(192,192,192);
|
||||
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
|
||||
|
||||
$tab_height = $tab_height - $height_note;
|
||||
$tab_top = $nexY+6;
|
||||
}
|
||||
else
|
||||
{
|
||||
$height_note=0;
|
||||
}
|
||||
|
||||
$iniY = $tab_top + 7;
|
||||
$curY = $tab_top + 7;
|
||||
$nexY = $tab_top + 7;
|
||||
|
||||
// Loop on each lines
|
||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||
{
|
||||
$curY = $nexY;
|
||||
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
$piece_comptable = $i +1;
|
||||
|
||||
// Piece comptable
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-1, 3, $this->posxpiece-1, $curY, $piece_comptable, 0, 1);
|
||||
|
||||
// Comments
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY ($this->posxcomment, $curY);
|
||||
$pdf->writeHTMLCell($this->posxdate-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $object->lignes[$i]->comments, 0, 1);
|
||||
|
||||
//nexY
|
||||
$nexY = $pdf->GetY();
|
||||
|
||||
// Date
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY ($this->posxdate, $curY);
|
||||
$pdf->MultiCell($this->posxtype-$this->posxdate-1, 3,dol_print_date($object->lignes[$i]->date,"day",false,$outpulangs), 0, 'C');
|
||||
|
||||
// Type
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY ($this->posxtype, $curY);
|
||||
$pdf->MultiCell($this->posxprojet-$this->posxtype-1, 3,$outputlangs->transnoentities($object->lignes[$i]->type_fees_code), 0, 'C');
|
||||
|
||||
// Projet
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY ($this->posxprojet, $curY);
|
||||
$pdf->MultiCell($this->posxtva-$this->posxprojet-1, 3,$object->lignes[$i]->projet_ref, 0, 'C');
|
||||
|
||||
// TVA
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY ($this->posxtva, $curY);
|
||||
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3,vatrate($object->lignes[$i]->tva_taux,true), 0, 'R');
|
||||
|
||||
// UP
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY ($this->posxup, $curY);
|
||||
$pdf->MultiCell($this->posxqty-$this->posxup-1, 3,price($object->lignes[$i]->value_unit), 0, 'R');
|
||||
|
||||
// QTY
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY ($this->posxqty, $curY);
|
||||
$pdf->MultiCell($this->postotalttc-$this->posxqty, 3,$object->lignes[$i]->qty, 0, 'C');
|
||||
|
||||
// TotalTTC
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY ($this->postotalttc-2, $curY);
|
||||
$pdf->MultiCell(26, 3,price($object->lignes[$i]->total_ttc), 0, 'R');
|
||||
|
||||
$nexY+=5;
|
||||
|
||||
// Cherche nombre de lignes a venir pour savoir si place suffisante
|
||||
if ($i < ($nblignes - 1)) // If it's not last line
|
||||
{
|
||||
//on recupere la description du produit suivant
|
||||
$follow_descproduitservice = $object->lines[$i+1]->desc;
|
||||
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
|
||||
$nblineFollowDesc = dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4;
|
||||
// Et si on affiche dates de validite, on ajoute encore une ligne
|
||||
if ($object->lines[$i]->date_start && $object->lines[$i]->date_end)
|
||||
{
|
||||
$nblineFollowDesc += 4;
|
||||
}
|
||||
}
|
||||
else // If it's last line
|
||||
{
|
||||
$nblineFollowDesc = 0;
|
||||
}
|
||||
|
||||
// Test if a new page is required
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
$tab_top_in_current_page=$tab_top;
|
||||
$tab_height_in_current_page=$tab_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
$tab_top_in_current_page=$tab_top_newpage;
|
||||
$tab_height_in_current_page=$tab_height_newpage;
|
||||
}
|
||||
if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblignes - 1))
|
||||
{
|
||||
if ($pagenb == 1):
|
||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
|
||||
$nexY=$tab_top + $tab_height + 1;
|
||||
else:
|
||||
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
|
||||
$nexY=$tab_top_newpage + $tab_height_newpage + 1;
|
||||
endif;
|
||||
|
||||
$this->_pagefoot($pdf,$object,$outputlangs);
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
$pagenb++;
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->MultiCell(0, 3, ''); // Set interline to 3
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
$nexY = $tab_top_newpage + 7;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Show square
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
|
||||
$bottomlasttab=$tab_top + $tab_height + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
|
||||
$bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
|
||||
}
|
||||
|
||||
// Affiche zone totaux
|
||||
$posy=$bottomlasttab+5;//$nexY+95;
|
||||
$pdf->SetXY(120, $posy);
|
||||
$pdf->MultiCell(50, 5, $outputlangs->transnoentities("TotalHT"), 1, 'L');
|
||||
$pdf->SetXY (170, $posy);
|
||||
$pdf->MultiCell(30, 5, price($object->total_ht), 1, 'R');
|
||||
$pdf->SetFillColor(248,248,248);
|
||||
|
||||
$posy+=5;
|
||||
$pdf->SetXY (120, $posy);
|
||||
$pdf->SetFont('','B', 10);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(50, 5, $outputlangs->transnoentities("TotalTTC"), 1,'L');
|
||||
$pdf->SetXY (170, $posy);
|
||||
$pdf->MultiCell(30, 5, price($object->total_ttc),1, 'R');
|
||||
|
||||
// Pied de page
|
||||
$this->_pagefoot($pdf,$object,$outputlangs);
|
||||
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
|
||||
|
||||
$pdf->Close();
|
||||
|
||||
$pdf->Output($file,'F');
|
||||
|
||||
// Add pdfgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('pdfgeneration'));
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||
global $action;
|
||||
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
return 1; // Pas d'erreur
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","DEPLACEMENT_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF &$pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @return void
|
||||
*/
|
||||
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
|
||||
{
|
||||
global $conf,$langs,$hookmanager;
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("trips");
|
||||
$outputlangs->load("companies");
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
/*
|
||||
// ajout du fondu vert en bas de page à droite
|
||||
$image_fondue = $conf->mycompany->dir_output.'/fondu_vert_.jpg';
|
||||
$pdf->Image($image_fondue,20,107,200,190);
|
||||
|
||||
pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
|
||||
*/
|
||||
|
||||
// Filligrane brouillon
|
||||
if($object->fk_c_expensereport_statuts==1)
|
||||
{
|
||||
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',"' - PREVIEW ONLY");
|
||||
}
|
||||
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->SetFont('','B', $default_font_size + 3);
|
||||
|
||||
$posy=$this->marge_haute;
|
||||
$posx=$this->page_largeur-$this->marge_droite-100;
|
||||
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
|
||||
// Logo
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
{
|
||||
$height=pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->SetTextColor(200,0,0);
|
||||
$pdf->SetFont('','B', $default_font_size -2);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$text=$this->emetteur->name;
|
||||
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
|
||||
}
|
||||
|
||||
$pdf->SetFont('','B', $default_font_size + 6);
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(255,255,255);
|
||||
$pdf->SetFillColor(193,219,62);
|
||||
$ref_text = explode($conf->global->NDF_EXPLODE_CHAR,$object->ref_number);
|
||||
$ref_text = substr($ref_text[1],3,$conf->global->NDF_NUM_CAR_REF);
|
||||
$pdf->MultiCell(110,6,"Note de frais ".$ref_text, 0, 'L', 1);
|
||||
|
||||
$pdf->SetFont('','', $default_font_size -1);
|
||||
|
||||
// Réf complète
|
||||
$posy+=8;
|
||||
$pdf->SetXY(100,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Ref")." : " . $object->ref_number, '', 'L');
|
||||
|
||||
// Date début période
|
||||
$posy+=5;
|
||||
$pdf->SetXY(100,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateStart")." : " . ($object->date_debut>0?$object->date_debut:dol_print_date($object->date_debut,"day",false,$outpulangs)), '', 'L');
|
||||
|
||||
// Date fin période
|
||||
$posy+=5;
|
||||
$pdf->SetXY(100,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEnd")." : " . ($object->date_fin>0?dol_print_date($object->date_fin,"day",false,$outpulangs):''), '', 'L');
|
||||
|
||||
// Statut NDF
|
||||
$posy+=7;
|
||||
$pdf->SetXY(100,$posy);
|
||||
$pdf->SetFont('','B',20);
|
||||
$pdf->SetTextColor(111,81,124);
|
||||
if(preg_match("#Pay#",$object->libelle_statut) && !preg_match("#A P#",$object->libelle_statut)):
|
||||
$pdf->MultiCell(100, 3,$outputlangs->convToOutputCharset("Payée"), '', 'L');
|
||||
elseif(preg_match("#Annul#",$object->libelle_statut)):
|
||||
$pdf->MultiCell(100, 3,$outputlangs->convToOutputCharset("Annulée"), '', 'L');
|
||||
elseif(preg_match("#Refus#",$object->libelle_statut)):
|
||||
$pdf->MultiCell(100, 3,$outputlangs->convToOutputCharset("Refusée"), '', 'L');
|
||||
else:
|
||||
$pdf->MultiCell(100, 3,$object->libelle_statut, '', 'L');
|
||||
endif;
|
||||
|
||||
// Sender properties
|
||||
$carac_emetteur = '';
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->address);
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->zip).' '.$outputlangs->convToOutputCharset($this->emetteur->town);
|
||||
$carac_emetteur .= "\n";
|
||||
// Tel
|
||||
if ($this->emetteur->phone) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone")." : ".$outputlangs->convToOutputCharset($this->emetteur->phone);
|
||||
// Fax
|
||||
if ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? ($this->emetteur->tel ? " - " : "\n") : '' ).$outputlangs->transnoentities("Fax")." : ".$outputlangs->convToOutputCharset($this->emetteur->fax);
|
||||
// EMail
|
||||
if ($this->emetteur->email) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Email")." : ".$outputlangs->convToOutputCharset($this->emetteur->email);
|
||||
// Web
|
||||
if ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web")." : ".$outputlangs->convToOutputCharset($this->emetteur->url);
|
||||
|
||||
// Show sender
|
||||
$posy=50;
|
||||
$posx=$this->marge_gauche;
|
||||
$hautcadre=40;
|
||||
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=118;
|
||||
|
||||
// Show sender frame
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
$pdf->SetXY($posx,$posy-5);
|
||||
$pdf->MultiCell(66,5, $outputlangs->transnoentities("TripSociete")." :",'','L');
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetFillColor(224,224,224);
|
||||
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
|
||||
// Show sender name
|
||||
$pdf->SetXY($posx+2,$posy+3);
|
||||
$pdf->SetFont('','B', $default_font_size);
|
||||
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
|
||||
|
||||
// Show sender information
|
||||
$pdf->SetXY($posx+2,$posy+8);
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
|
||||
|
||||
// Show recipient
|
||||
$posy=50;
|
||||
$posx=100;
|
||||
|
||||
// Show recipient frame
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('','B',8);
|
||||
$pdf->SetXY($posx,$posy-5);
|
||||
$pdf->MultiCell(80,5, $outputlangs->transnoentities("TripNDF")." :", 0, 'L');
|
||||
$pdf->rect($posx, $posy, 100, $hautcadre);
|
||||
|
||||
// Informations for trip (dates and users workflow)
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_author); $posy+=3;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->SetFont('','',10);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("AUTHOR")." : ".$outputlangs->convToOutputCharset($userfee->firstname)." ".$outputlangs->convToOutputCharset($userfee->lastname),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_SAVE")." : ".dol_print_date($object->date_create,"day",false,$outpulangs),0,'L');
|
||||
|
||||
if($object->fk_c_expensereport_statuts<3):
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_validator); $posy+=6;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("VALIDATOR")." : ".$outputlangs->convToOutputCharset($userfee->firstname)." ".$outputlangs->convToOutputCharset($userfee->lastname),0,'L');
|
||||
elseif($object->fk_c_expensereport_statuts==99):
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_refuse); $posy+=6;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("REFUSEUR")." : ".$outputlangs->convToOutputCharset($userfee->firstname)." ".$outputlangs->convToOutputCharset($userfee->lastname),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("MOTIF_REFUS")." : ".$outputlangs->convToOutputCharset($object->detail_refuse),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_REFUS")." : ".dol_print_date($object->date_refuse,"day",false,$outpulangs),0,'L');
|
||||
elseif($object->fk_c_expensereport_statuts==4):
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_cancel); $posy+=6;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("CANCEL_USER")." : ".$outputlangs->convToOutputCharset($userfee->firstname)." ".$outputlangs->convToOutputCharset($userfee->lastname),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("MOTIF_CANCEL")." : ".$outputlangs->convToOutputCharset($object->detail_cancel),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_CANCEL")." : ".dol_print_date($object->date_cancel,"day",false,$outpulangs),0,'L');
|
||||
else:
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_validator); $posy+=6;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("VALIDOR")." : ".$outputlangs->convToOutputCharset($userfee->firstname)." ".$outputlangs->convToOutputCharset($userfee->lastname),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_VALIDE")." : ".dol_print_date($object->date_valide,"day",false,$outpulangs),0,'L');
|
||||
endif;
|
||||
|
||||
if($object->fk_c_expensereport_statuts==6):
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_paid); $posy+=6;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("AUTHORPAIEMENT")." : ".$outputlangs->convToOutputCharset($userfee->firstname)." ".$outputlangs->convToOutputCharset($userfee->lastname),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_PAIEMENT")." : ".dol_print_date($object->date_paiement,"day",false,$outpulangs),0,'L');
|
||||
endif;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche la grille des lignes de factures
|
||||
*
|
||||
* @param $pdf Objet PDF
|
||||
* @param $tab_top Tab top
|
||||
* @param $tab_height Tab height
|
||||
* @param $nexY next y
|
||||
* @param $outputlangs Output langs
|
||||
* @return void
|
||||
*/
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
// Amount in (at tab_top - 1)
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
|
||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 4), $tab_top -4);
|
||||
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
||||
|
||||
$pdf->SetDrawColor(128,128,128);
|
||||
|
||||
// Rect prend une longueur en 3eme param
|
||||
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
|
||||
// line prend une position y en 3eme param
|
||||
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
|
||||
|
||||
$pdf->SetFont('','',8);
|
||||
|
||||
//Piece comptable
|
||||
$pdf->SetXY ($this->posxpiece-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxpiece-$this->posxpiece-1,1,$outputlangs->transnoentities("Piece"),'','L');
|
||||
|
||||
//Comments
|
||||
$pdf->line($this->posxdesc-1, $tab_top, $this->posxdesc-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY ($this->posxdesc-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxdate-$this->posxdesc-1,1,$outputlangs->transnoentities("Description"),'','L');
|
||||
|
||||
//Date
|
||||
$pdf->line($this->posxdate-1, $tab_top, $this->posxdate-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY ($this->posxdate-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxtype-$this->posxdate-1,2, $outputlangs->transnoentities("Date"),'','C');
|
||||
|
||||
//Type
|
||||
$pdf->line($this->posxtype-1, $tab_top, $this->posxtype-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY ($this->posxtype-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxprojet-$this->posxtype-1,2, $outputlangs->transnoentities("Type"),'','C');
|
||||
|
||||
// Projet
|
||||
$pdf->line($this->posxprojet-1, $tab_top, $this->posxprojet-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY ($this->posxprojet-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxtva-$this->posxprojet-1,2, $outputlangs->transnoentities("Project"),'','C');
|
||||
|
||||
//TVA
|
||||
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY ($this->posxtva-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C');
|
||||
|
||||
//PU
|
||||
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY ($this->posxup-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PU"),'','C');
|
||||
|
||||
//QTY
|
||||
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY ($this->posxqty-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->postotalttc-$this->posxqty,2, $outputlangs->transnoentities("Q"),'','R');
|
||||
|
||||
//TOTALTTC
|
||||
$pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height);
|
||||
$pdf->SetXY ($this->postotalttc-4, $tab_top+1);
|
||||
$pdf->MultiCell(28,2, $outputlangs->transnoentities("TotalTTC"),'','R');
|
||||
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF &$pdf PDF
|
||||
* @param Object $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
* @return int Return height of bottom margin including footer text
|
||||
*/
|
||||
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
|
||||
{
|
||||
return pdf_pagefoot($pdf,$outputlangs,'DEPLACEMENT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ class modDeplacement extends DolibarrModules
|
|||
$this->description = "Gestion des notes de frais et deplacements"; // Si traduction Module75Desc non trouvee
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'dolibarr';
|
||||
$this->version = 'dolibarr_deprecated';
|
||||
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
$this->special = 0;
|
||||
|
|
|
|||
347
htdocs/core/modules/modExpenseReport.class.php
Executable file
347
htdocs/core/modules/modExpenseReport.class.php
Executable file
|
|
@ -0,0 +1,347 @@
|
|||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup Indicateurs
|
||||
* \brief Module indicateurs
|
||||
* Such a file must be copied into htdocs/includes/module directory.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/indicateurs/core/modules/modExpenseReport.class.php
|
||||
* \ingroup indicateur
|
||||
* \brief Description and activation file for module ExpenseReport
|
||||
*/
|
||||
include_once(DOL_DOCUMENT_ROOT ."/core/modules/DolibarrModules.class.php");
|
||||
|
||||
|
||||
/**
|
||||
* Description and activation class for module ExpenseReport
|
||||
*/
|
||||
class modExpenseReport extends DolibarrModules
|
||||
{
|
||||
/**
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
* @param Database $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
// Id for module (must be unique).
|
||||
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
|
||||
$this->numero = 770;
|
||||
// Key text used to identify module (for permissions, menus, etc...)
|
||||
$this->rights_class = 'deplacement';
|
||||
|
||||
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
|
||||
// It is used to group modules in module setup page
|
||||
$this->family = "hr";
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->description = "Manage and claim expense reports (transportation, meal, ...)";
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'dolibarr';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
|
||||
$this->special = 0;
|
||||
// Name of image file used for this module.
|
||||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||
$this->picto='trip';
|
||||
|
||||
// Defined if the directory /mymodule/inc/triggers/ contains triggers or not
|
||||
$this->triggers = 0;
|
||||
|
||||
// Data directories to create when module is enabled.
|
||||
// Example: this->dirs = array("/mymodule/temp");
|
||||
$this->dirs = array();
|
||||
$r=0;
|
||||
|
||||
// Relative path to module style sheet if exists. Example: '/mymodule/css/mycss.css'.
|
||||
//$this->style_sheet = '/mymodule/mymodule.css.php';
|
||||
|
||||
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
|
||||
$this->config_page_url = array();
|
||||
|
||||
// Dependencies
|
||||
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
|
||||
// $this->conflictwith = array("modDeplacement");
|
||||
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||
$this->phpmin = array(4,3); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module
|
||||
$this->langfiles = array("companies","trips","deplacement@deplacement");
|
||||
|
||||
// Constants
|
||||
// Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',0),
|
||||
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) );
|
||||
// 2=>array('MAIN_MODULE_MYMODULE_NEEDSMARTY','chaine',1,'Constant to say module need smarty',0)
|
||||
$this->const = array(); // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 0 or 'allentities')
|
||||
|
||||
// Array to add new pages in new tabs
|
||||
$this->tabs = array();
|
||||
// where entity can be
|
||||
// 'thirdparty' to add a tab in third party view
|
||||
// 'intervention' to add a tab in intervention view
|
||||
// 'order_supplier' to add a tab in supplier order view
|
||||
// 'invoice_supplier' to add a tab in supplier invoice view
|
||||
// 'invoice' to add a tab in customer invoice view
|
||||
// 'order' to add a tab in customer order view
|
||||
// 'product' to add a tab in product view
|
||||
// 'stock' to add a tab in stock view
|
||||
// 'propal' to add a tab in propal view
|
||||
// 'member' to add a tab in fundation member view
|
||||
// 'contract' to add a tab in contract view
|
||||
// 'user' to add a tab in user view
|
||||
// 'group' to add a tab in group view
|
||||
// 'contact' to add a tab in contact view
|
||||
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array(); // List of boxes
|
||||
$r=0;
|
||||
|
||||
// Add here list of php file(s) stored in includes/boxes that contains class to show a box.
|
||||
// Example:
|
||||
//$this->boxes[$r][1] = "myboxa.php";
|
||||
//$r++;
|
||||
//$this->boxes[$r][1] = "myboxb.php";
|
||||
//$r++;
|
||||
|
||||
|
||||
// Permissions
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
$this->rights_class = 'expensereport';
|
||||
|
||||
$this->rights[1][0] = 771;
|
||||
$this->rights[1][1] = 'Read expense reports (own and his subordinates)';
|
||||
$this->rights[1][2] = 'r';
|
||||
$this->rights[1][3] = 1;
|
||||
$this->rights[1][4] = 'lire';
|
||||
|
||||
$this->rights[3][0] = 772;
|
||||
$this->rights[3][1] = 'Create/modify expense reports';
|
||||
$this->rights[3][2] = 'w';
|
||||
$this->rights[3][3] = 0;
|
||||
$this->rights[3][4] = 'creer';
|
||||
|
||||
$this->rights[4][0] = 773;
|
||||
$this->rights[4][1] = 'Delete expense reports';
|
||||
$this->rights[4][2] = 'd';
|
||||
$this->rights[4][3] = 0;
|
||||
$this->rights[4][4] = 'supprimer';
|
||||
|
||||
$this->rights[2][0] = 774;
|
||||
$this->rights[2][1] = 'Read all expense reports';
|
||||
$this->rights[2][2] = 'r';
|
||||
$this->rights[2][3] = 1;
|
||||
$this->rights[2][4] = 'readall';
|
||||
|
||||
$this->rights[6][0] = 775;
|
||||
$this->rights[6][1] = 'Approve expense reports';
|
||||
$this->rights[6][2] = 'w';
|
||||
$this->rights[6][3] = 0;
|
||||
$this->rights[6][4] = 'to_validate';
|
||||
|
||||
$this->rights[7][0] = 776;
|
||||
$this->rights[7][1] = 'Pay expense reports';
|
||||
$this->rights[7][2] = 'w';
|
||||
$this->rights[7][3] = 0;
|
||||
$this->rights[7][4] = 'to_paid';
|
||||
|
||||
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
|
||||
{
|
||||
$this->rights[8][0] = 777;
|
||||
$this->rights[8][1] = 'Synchroniser les NDF avec un compte courant';
|
||||
$this->rights[8][2] = 'w';
|
||||
$this->rights[8][3] = 0;
|
||||
$this->rights[8][4] = 'synchro';
|
||||
|
||||
$this->rights[9][0] = 778;
|
||||
$this->rights[9][1] = 'Exporter les NDF au format CSV';
|
||||
$this->rights[9][2] = 'r';
|
||||
$this->rights[9][3] = 0;
|
||||
$this->rights[9][4] = 'export_csv';
|
||||
}
|
||||
|
||||
$this->rights[5][0] = 779;
|
||||
$this->rights[5][1] = 'Export expense reports';
|
||||
$this->rights[5][2] = 'r';
|
||||
$this->rights[5][3] = 0;
|
||||
$this->rights[5][4] = 'export';
|
||||
|
||||
// Exports
|
||||
$r=0;
|
||||
|
||||
$r++;
|
||||
$this->export_code[$r]='trips_'.$r;
|
||||
$this->export_label[$r]='ListTripsAndExpenses';
|
||||
$this->export_permission[$r]=array(array("expensereport","export"));
|
||||
$this->export_fields_array[$r]=array('d.rowid'=>"TripId",'d.type'=>"Type",'d.km'=>"FeesKilometersOrAmout",'d.note'=>'NotePrivate','d.note_public'=>'NotePublic','s.nom'=>'ThirdParty','u.lastname'=>'Lastname','u.firstname'=>'Firstname','d.dated'=>"Date");
|
||||
$this->export_entities_array[$r]=array('d.rowid'=>"Trip",'d.type'=>"Trip",'d.km'=>"Trip",'d.note'=>'Trip','d.note_public'=>'Trip','s.nom'=>'company','u.lastname'=>'user','u.firstname'=>'user','d.dated'=>"Date");
|
||||
$this->export_alias_array[$r]=array('d.rowid'=>"idtrip",'d.type'=>"type",'d.km'=>"km",'d.note'=>'note','d.note_public'=>'note_public','s.nom'=>'companyname','u.lastname'=>'name','u.firstname'=>'firstname','d.dated'=>'date');
|
||||
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u';
|
||||
$this->export_sql_end[$r] .=', '.MAIN_DB_PREFIX.'expensereport as d';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON d.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .=' WHERE d.fk_user = u.rowid';
|
||||
$this->export_sql_end[$r] .=' AND d.entity = '.$conf->entity;
|
||||
|
||||
|
||||
|
||||
// Main menu entries
|
||||
$this->menu = array(); // List of menus to add
|
||||
$r=0;
|
||||
|
||||
// Example to declare a Left Menu entry: fk_mainmenu=home,fk_leftmenu=modulesadmintools
|
||||
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=accountancy', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'TripsAndExpenses',
|
||||
'mainmenu'=>'accountancy',
|
||||
'leftmenu'=>'expensereport',
|
||||
'url'=>'/expensereport/index.php',
|
||||
'langs'=>'trips', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>100,
|
||||
'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
$r++;
|
||||
|
||||
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=accountancy,fk_leftmenu=expensereport', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'New',
|
||||
'mainmenu'=>'accountancy',
|
||||
'leftmenu'=>'expensereport_detail',
|
||||
'url'=>'/expensereport/card.php?action=create',
|
||||
'langs'=>'trips', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>100,
|
||||
'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
$r++;
|
||||
|
||||
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=accountancy,fk_leftmenu=expensereport', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'List',
|
||||
'mainmenu'=>'accountancy',
|
||||
'leftmenu'=>'expensereport_detail',
|
||||
'url'=>'/expensereport/list.php',
|
||||
'langs'=>'trips', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>100,
|
||||
'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
$r++;
|
||||
|
||||
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=accountancy,fk_leftmenu=expensereport', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'Statistics',
|
||||
'mainmenu'=>'accountancy',
|
||||
'leftmenu'=>'expensereport_detail',
|
||||
'url'=>'/expensereport/stats/index.php',
|
||||
'langs'=>'trips', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>100,
|
||||
'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
$r++;
|
||||
|
||||
|
||||
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=accountancy,fk_leftmenu=expensereport', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'ExportTripCSV',
|
||||
'mainmenu'=>'accountancy',
|
||||
'leftmenu'=>'expensereport_detail',
|
||||
'url'=>'/expensereport/export_csv.php',
|
||||
'langs'=>'expensereport', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>100,
|
||||
'enabled'=>'$conf->global->DEPLACEMENT_TO_CLEAN', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
$r++;
|
||||
|
||||
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=accountancy,fk_leftmenu=expensereport', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'Synchro_Compta',
|
||||
'mainmenu'=>'accountancy',
|
||||
'leftmenu'=>'expensereport_detail',
|
||||
'url'=>'/expensereport/synchro_compta.php',
|
||||
'langs'=>'expensereport', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>100,
|
||||
'enabled'=>'$conf->global->DEPLACEMENT_TO_CLEAN', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
$r++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories.
|
||||
*
|
||||
* @param string $options Options
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function init($options='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->remove($options);
|
||||
|
||||
$result=$this->_load_tables('/deplacement/sql/');
|
||||
|
||||
$sql = array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'teclib' AND entity = ".$conf->entity,
|
||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('teclib','deplacement',".$conf->entity.")"
|
||||
);
|
||||
|
||||
return $this->_init($sql,$options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
* Data directories are not deleted.
|
||||
*
|
||||
* @param string Options
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function remove($options='')
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
return $this->_remove($sql,$options);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
88
htdocs/expensereport/ajax/ajaxprojet.php
Executable file
88
htdocs/expensereport/ajax/ajaxprojet.php
Executable file
|
|
@ -0,0 +1,88 @@
|
|||
<?php
|
||||
/* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010 Cyrille de Lambert <info@auguria.net>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/expensereport/ajax/ajaxprojet.php
|
||||
* \brief File to return Ajax response on third parties request
|
||||
*/
|
||||
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
|
||||
|
||||
$res=0;
|
||||
require '../../main.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
// Ajout directives pour resoudre bug IE
|
||||
//header('Cache-Control: Public, must-revalidate');
|
||||
//header('Pragma: public');
|
||||
|
||||
//top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header.
|
||||
top_httphead();
|
||||
|
||||
//print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
||||
|
||||
dol_syslog(join(',',$_GET));
|
||||
|
||||
|
||||
// Generation liste des projets
|
||||
if (GETPOST('fk_projet') != '')
|
||||
{
|
||||
$return_arr = array();
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.title, s.nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
|
||||
if (! empty($_GET["fk_projet"])) $sql.= " WHERE p.ref LIKE '%".$db->escape($_GET["fk_projet"])."%' OR p.title LIKE '%".$db->escape($_GET["fk_projet"])."%' OR s.nom LIKE '%".$db->escape($_GET["fk_projet"])."%'"; // Add other filters
|
||||
$sql.= " ORDER BY p.ref ASC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($row = $db->fetch_array($resql))
|
||||
{
|
||||
$label=$row['ref'].' - '.$row['title'];
|
||||
$row_array['label'] = $label;
|
||||
$row_array['value'] = $label;
|
||||
$row_array['key'] = $row['rowid'];
|
||||
|
||||
array_push($return_arr,$row_array);
|
||||
}
|
||||
|
||||
echo json_encode($return_arr);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('nom'=>'Error','label'=>'Error','key'=>'Error','value'=>'Error'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('nom'=>'ErrorBadParameter','label'=>'ErrorBadParameter','key'=>'ErrorBadParameter','value'=>'ErrorBadParameter'));
|
||||
}
|
||||
1776
htdocs/expensereport/card.php
Executable file
1776
htdocs/expensereport/card.php
Executable file
File diff suppressed because it is too large
Load Diff
1496
htdocs/expensereport/class/expensereport.class.php
Executable file
1496
htdocs/expensereport/class/expensereport.class.php
Executable file
File diff suppressed because it is too large
Load Diff
163
htdocs/expensereport/class/expensereportstats.class.php
Normal file
163
htdocs/expensereport/class/expensereportstats.class.php
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (c) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/expensereport/class/expensereportstats.class.php
|
||||
* \ingroup factures
|
||||
* \brief Fichier de la classe de gestion des stats des expensereport et notes de frais
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php';
|
||||
dol_include_once('/expensereport/class/expensereport.class.php');
|
||||
|
||||
/**
|
||||
* Classe permettant la gestion des stats des expensereports et notes de frais
|
||||
*/
|
||||
class ExpenseReportStats extends Stats
|
||||
{
|
||||
public $table_element;
|
||||
|
||||
var $socid;
|
||||
var $userid;
|
||||
|
||||
var $from;
|
||||
var $field;
|
||||
var $where;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $socid Id third party
|
||||
* @param int $userid Id user for filter
|
||||
* @return void
|
||||
*/
|
||||
function __construct($db, $socid=0, $userid=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
$this->socid = $socid;
|
||||
$this->userid = $userid;
|
||||
|
||||
$object=new ExpenseReport($this->db);
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element;
|
||||
$this->field='total_ht';
|
||||
|
||||
$this->where = " fk_c_expensereport_statuts > 0 and date_valide > '2000-01-01'";
|
||||
//$this->where.= " AND entity = ".$conf->entity;
|
||||
if ($this->socid)
|
||||
{
|
||||
$this->where.=" AND fk_soc = ".$this->socid;
|
||||
}
|
||||
if ($this->userid > 0) $this->where.=' AND fk_user_author = '.$this->userid;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renvoie le nombre de facture par annee
|
||||
*
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getNbByYear()
|
||||
{
|
||||
$sql = "SELECT YEAR(date_valide) as dm, count(*)";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql.= " GROUP BY dm DESC";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
|
||||
return $this->_getNbByYear($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renvoie le nombre de facture par mois pour une annee donnee
|
||||
*
|
||||
* @param string $year Year to scan
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getNbByMonth($year)
|
||||
{
|
||||
$sql = "SELECT MONTH(date_valide) as dm, count(*)";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql.= " WHERE YEAR(date_valide) = ".$year;
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm','DESC');
|
||||
|
||||
$res=$this->_getNbByMonth($year, $sql);
|
||||
//var_dump($res);print '<br>';
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renvoie le montant de facture par mois pour une annee donnee
|
||||
*
|
||||
* @param int $year Year to scan
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getAmountByMonth($year)
|
||||
{
|
||||
$sql = "SELECT date_format(date_valide,'%m') as dm, sum(".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql.= " WHERE date_format(date_valide,'%Y') = '".$year."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm','DESC');
|
||||
|
||||
$res=$this->_getAmountByMonth($year, $sql);
|
||||
//var_dump($res);print '<br>';
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return average amount
|
||||
*
|
||||
* @param int $year Year to scan
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getAverageByMonth($year)
|
||||
{
|
||||
$sql = "SELECT date_format(date_valide,'%m') as dm, avg(".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql.= " WHERE date_format(date_valide,'%Y') = '".$year."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm','DESC');
|
||||
|
||||
return $this->_getAverageByMonth($year, $sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return nb, total and average
|
||||
*
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getAllByYear()
|
||||
{
|
||||
$sql = "SELECT date_format(date_valide,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY year";
|
||||
$sql.= $this->db->order('year','DESC');
|
||||
|
||||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
}
|
||||
|
||||
131
htdocs/expensereport/document.php
Normal file
131
htdocs/expensereport/document.php
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/expensereport/document.php
|
||||
* \ingroup expensereport
|
||||
* \brief Page of linked files onto trip and expenses
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
|
||||
$langs->load("other");
|
||||
$langs->load("trips");
|
||||
$langs->load("companies");
|
||||
$langs->load("interventions");
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'expensereport', $id, '');
|
||||
|
||||
|
||||
// Get parameters
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
|
||||
$object = new ExpenseReport($db);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
$upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
$modulepart='trip';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader("","",$langs->trans("TripCard"));
|
||||
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head=trip_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'documents', $langs->trans("TripCard"), 0, 'trip');
|
||||
|
||||
|
||||
// Construit liste des fichiers
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$totalsize=0;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>';
|
||||
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
|
||||
print '</td></tr>';
|
||||
|
||||
// Societe
|
||||
//print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
$modulepart = 'expensereport';
|
||||
$permission = $user->rights->expensereport->creer;
|
||||
$param = '&id=' . $object->id;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ErrorUnknown");
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
199
htdocs/expensereport/export_csv.php
Executable file
199
htdocs/expensereport/export_csv.php
Executable file
|
|
@ -0,0 +1,199 @@
|
|||
<?php
|
||||
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/expensereport/index.php
|
||||
* \brief Page list of expenses
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||
dol_include_once("/expensereport/class/expensereport.class.php");
|
||||
|
||||
$langs->load("users");
|
||||
$langs->load("trips");
|
||||
|
||||
if(!$user->rights->expensereport->export_csv) {
|
||||
accessforbidden();
|
||||
exit();
|
||||
}
|
||||
|
||||
// Security check
|
||||
$socid = $_GET["socid"]?$_GET["socid"]:'';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'expensereport','','');
|
||||
|
||||
$req = "SELECT * FROM ".MAIN_DB_PREFIX."rights_def WHERE id = '178'";
|
||||
$result = $db->query($req);
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
if($num < 1) {
|
||||
|
||||
$insert = "INSERT INTO ".MAIN_DB_PREFIX."rights_def (";
|
||||
$insert.= "`id` ,";
|
||||
$insert.= "`libelle` ,";
|
||||
$insert.= "`module` ,";
|
||||
$insert.= "`entity` ,";
|
||||
$insert.= "`perms` ,";
|
||||
$insert.= "`subperms` ,";
|
||||
$insert.= "`type` ,";
|
||||
$insert.= "`bydefault`";
|
||||
$insert.= ")";
|
||||
$insert.= "VALUES (";
|
||||
$insert.= "'178', 'Exporter les notes de frais au format CSV', 'expensereport', '1', 'export_csv', NULL , 'r', '0'";
|
||||
$insert.= ")";
|
||||
|
||||
$req = $db->query($insert);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
print_fiche_titre($langs->trans("ExportTripCSV"));
|
||||
|
||||
print '<div class="tabBar">';
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="action" value="export"/>';
|
||||
print '<p>Choisir le mois à exporter : ';
|
||||
|
||||
$year = date('Y', time());
|
||||
$month = date('m', time());
|
||||
|
||||
print '<select name="mois">';
|
||||
|
||||
for($i=1;$i<13;$i++) {
|
||||
$mois = str_pad($i, 2, "0", STR_PAD_LEFT);
|
||||
if($month == $mois) {
|
||||
print '<option value="'.$mois.'" selected="selected">'.$mois.'</option>';
|
||||
} else {
|
||||
print '<option value="'.$mois.'">'.$mois.'</option>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</select> ';
|
||||
|
||||
print '<select name="annee">';
|
||||
|
||||
for($i=2009;$i<$year+1;$i++) {
|
||||
if($year == $i) {
|
||||
print '<option value="'.$i.'" selected="selected">'.$i.'</option>';
|
||||
} else {
|
||||
print '<option value="'.$i.'">'.$i.'</option>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</select> ';
|
||||
|
||||
print '<input type="submit" class="button" value="Exporter" />';
|
||||
print '</p>';
|
||||
print '</form>'."\n";
|
||||
|
||||
// Si c'est une action
|
||||
if (isset($_POST['action']))
|
||||
{
|
||||
if($_POST['action'] == 'export')
|
||||
{
|
||||
$select_date = $_POST['annee'].'-'.$_POST['mois'];
|
||||
|
||||
//var_dump($conf->expensereport->dir_output.'/export/');
|
||||
if (!file_exists($conf->expensereport->dir_output.'/export/'))
|
||||
{
|
||||
dol_mkdir($conf->expensereport->dir_output.'/export/');
|
||||
}
|
||||
|
||||
$dir = $conf->expensereport->dir_output.'/export/expensereport-'.$select_date.'.csv';
|
||||
$outputlangs = $langs;
|
||||
$outputlangs->charset_output = 'UTF-8';
|
||||
|
||||
$sql = "SELECT d.rowid, d.ref_number, d.date_paiement, d.total_ht, d.total_tva, d.total_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d";
|
||||
$sql.= " WHERE date_paiement LIKE '".$select_date."%'";
|
||||
$sql.= " ORDER BY d.rowid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
$num = $db->num_rows($result);
|
||||
if ($num)
|
||||
{
|
||||
$open = fopen($dir,"w+");
|
||||
|
||||
$ligne = "ID, Référence, ----, Date paiement, Montant HT, TVA, Montant TTC\n";
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$ligne.= "----, ----, ----, ----, ----, ----, ----\n";
|
||||
$objet = $db->fetch_object($result);
|
||||
$objet->total_ht = number_format($objet->total_ht,2);
|
||||
$objet->total_tva = number_format($objet->total_tva,2);
|
||||
$objet->total_ttc = number_format($objet->total_ttc,2);
|
||||
$objet->ref_number = trim($objet->ref_number);
|
||||
$ligne.= "{$objet->rowid}, {$objet->ref_number}, ----, {$objet->date_paiement}, {$objet->total_ht}, {$objet->total_tva}, {$objet->total_ttc}\n";
|
||||
|
||||
$ligne.= "--->, Ligne, Type, Description, ----, ----, ----\n";
|
||||
|
||||
|
||||
$sql2 = "SELECT de.rowid, t.label as libelle, de.comments, de.total_ht, de.total_tva, de.total_ttc";
|
||||
$sql2.= " FROM ".MAIN_DB_PREFIX."expensereport_det as de,";
|
||||
$sql2.= " ".MAIN_DB_PREFIX."c_type_fees as t";
|
||||
$sql2.= " WHERE de.fk_c_type_fees = t.id";
|
||||
$sql2.= " AND de.fk_expensereport = '".$objet->rowid."'";
|
||||
$sql2.= " ORDER BY de.date";
|
||||
|
||||
$result2 = $db->query($sql2);
|
||||
$num2 = $db->num_rows($result2);
|
||||
|
||||
if($num2) {
|
||||
for ($a = 0; $a < $num2; $a++)
|
||||
{
|
||||
$objet2 = $db->fetch_object($result2);
|
||||
$objet2->total_ht = number_format($objet2->total_ht,2);
|
||||
$objet2->total_tva = number_format($objet2->total_tva,2);
|
||||
$objet2->total_ttc = number_format($objet2->total_ttc,2);
|
||||
$objet2->comments = str_replace(',',';',$objet2->comments);
|
||||
$objet2->comments = str_replace("\r\n",' ',$objet2->comments);
|
||||
$objet2->comments = str_replace("\n",' ',$objet2->comments);
|
||||
|
||||
$ligne.= "--->, {$objet2->rowid}, {$objet2->libelle}, {$objet2->comments}, {$objet2->total_ht}, {$objet2->total_tva}, {$objet2->total_ttc}\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$ligne = $outputlangs->convToOutputCharset($ligne);
|
||||
|
||||
fwrite($open,$ligne);
|
||||
fclose($open);
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart=expensereport&file=export%2Fexpensereport-'.$select_date.'.csv" target="_blank">Télécharger le fichier expensereport-'.$select_date.'.csv</a>';
|
||||
|
||||
} else {
|
||||
|
||||
print '<b>'.$langs->trans('NoTripsToExportCSV').'</b>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
208
htdocs/expensereport/index.php
Normal file
208
htdocs/expensereport/index.php
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/expensereport/index.php
|
||||
* \brief Page list of expenses
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
dol_include_once("/expensereport/class/expensereport.class.php");
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("users");
|
||||
$langs->load("trips");
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'expensereport','','');
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="d.date_create";
|
||||
$limit = $conf->liste_limit;
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$tripandexpense_static=new ExpenseReport($db);
|
||||
|
||||
$childids = $user->getAllChildIds();
|
||||
$childids[]=$user->id;
|
||||
|
||||
//$help_url='EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones';
|
||||
$help_url='';
|
||||
llxHeader('',$langs->trans("ListOfFees"),$help_url);
|
||||
|
||||
|
||||
$label=$somme=$nb=array();
|
||||
|
||||
$totalnb=$totalsum=0;
|
||||
$sql = "SELECT tf.code, tf.label, count(de.rowid) as nb, sum(de.total_ht) as km";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."expensereport_det as de, ".MAIN_DB_PREFIX."c_type_fees as tf";
|
||||
$sql.= " WHERE de.fk_expensereport = d.rowid AND de.fk_c_type_fees = tf.id";
|
||||
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) $sql.=' AND d.fk_user_author IN ('.join(',',$childids).')';
|
||||
$sql.= " GROUP BY tf.code, tf.label";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$somme[$objp->code] = $objp->km;
|
||||
$nb[$objp->code] = $objp->nb;
|
||||
$label[$objp->code] = $objp->label;
|
||||
$totalnb += $objp->nb;
|
||||
$totalsum += $objp->km;
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("ExpensesArea"));
|
||||
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("Statistics").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
//$listoftype=$tripandexpense_static->listOfTypes();
|
||||
$listoftype=$label;
|
||||
foreach ($listoftype as $code => $label)
|
||||
{
|
||||
$dataseries[]=array('label'=>$label,'data'=>(isset($somme[$code])?(int) $somme[$code]:0));
|
||||
}
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print '<tr '.$bc[0].'><td align="center" colspan="4">';
|
||||
$data=array('series'=>$dataseries);
|
||||
dol_print_graph('stats',320,180,$data,1,'pie',0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right" colspan="3">'.price($totalsum,1,$langs,0,0,0,$conf->currency).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
// Right area
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
$max=10;
|
||||
|
||||
$langs->load("boxes");
|
||||
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.rowid, d.date_debut as dated, d.date_fin as datef, d.date_create as dm, d.total_ht, d.total_ttc, d.fk_c_expensereport_statuts as fk_status";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."user as u";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE u.rowid = d.fk_user_author";
|
||||
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) $sql.=' AND d.fk_user_author IN ('.join(',',$childids).')';
|
||||
//$sql.= " AND d.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_user_author = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND d.fk_user_author = ".$socid;
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var=false;
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses",min($max,$num)).'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
if ($num)
|
||||
{
|
||||
$total_ttc = $totalam = $total = 0;
|
||||
|
||||
$expensereportstatic=new ExpenseReport($db);
|
||||
$userstatic=new User($db);
|
||||
while ($i < $num && $i < $max)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$expensereportstatic->ref=$obj->rowid;
|
||||
$expensereportstatic->id=$obj->rowid;
|
||||
$userstatic->id=$obj->uid;
|
||||
$userstatic->lastname=$obj->lastname;
|
||||
$userstatic->firstname=$obj->firstname;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$expensereportstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.$userstatic->getNomUrl(1).'</td>';
|
||||
print '<td align="right">'.$obj->total_ht.'</td>';
|
||||
print '<td align="right">'.$obj->total_ttc.'</td>';
|
||||
print '<td align="right">'.dol_print_date($db->jdate($obj->dm),'day').'</td>';
|
||||
print '<td align="right">';
|
||||
//print $obj->libelle;
|
||||
print $expensereportstatic->LibStatut($obj->fk_status,3);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$var=!$var;
|
||||
$i++;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td colspan="2">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print '</table><br>';
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
print '</div></div></div>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
63
htdocs/expensereport/info.php
Normal file
63
htdocs/expensereport/info.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/expensereport/info.php
|
||||
* \ingroup trip
|
||||
* \brief Page to show a trip information
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/trip.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/expensereport/class/expensereport.class.php';
|
||||
|
||||
$langs->load("trips");
|
||||
|
||||
// Security check
|
||||
$id = GETPOST('id','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'expensereport', $id, '');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($id)
|
||||
{
|
||||
$object = new ExpenseReport($db);
|
||||
$object->fetch($id);
|
||||
$object->info($id);
|
||||
|
||||
$head = trip_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("TripCard"), 0, 'trip');
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dol_print_object_info($object);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
316
htdocs/expensereport/list.php
Executable file
316
htdocs/expensereport/list.php
Executable file
|
|
@ -0,0 +1,316 @@
|
|||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/expensereport/index.php
|
||||
* \brief Page liste des expensereports
|
||||
*/
|
||||
|
||||
require "../main.inc.php";
|
||||
dol_include_once("/expensereport/class/expensereport.class.php");
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("users");
|
||||
$langs->load("trips");
|
||||
|
||||
// Security check
|
||||
$socid = $_GET["socid"]?$_GET["socid"]:'';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'expensereport','','');
|
||||
|
||||
$search_ref=GETPOST('search_ref');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$html = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$expensereporttmp=new ExpenseReport($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$max_year = 5;
|
||||
$min_year = 5;
|
||||
|
||||
$sortorder = $_GET["sortorder"];
|
||||
$sortfield = $_GET["sortfield"];
|
||||
$page = $_GET["page"];
|
||||
|
||||
$search_ref = $_GET['search_ref'];
|
||||
|
||||
$month_start = $_GET['month_start'];
|
||||
$year_start = $_GET['year_start'];
|
||||
$month_end = $_GET['month_end'];
|
||||
$year_end = $_GET['year_end'];
|
||||
|
||||
$search_user = $_GET['search_user'];
|
||||
|
||||
$search_state = $_GET['search_state'];
|
||||
|
||||
|
||||
if (!$sortorder) $sortorder="DESC";
|
||||
if (!$sortfield) $sortfield="d.date_debut";
|
||||
|
||||
if ($page == -1) {
|
||||
$page = 0 ;
|
||||
}
|
||||
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$sql = "SELECT d.rowid, d.ref_number, d.total_ht, d.total_tva, d.total_ttc, d.fk_c_expensereport_statuts,";
|
||||
$sql.= " d.date_debut, d.date_fin,";
|
||||
$sql.= " u.rowid as id_user, u.firstname, u.lastname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport d\n";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user u ON d.fk_user_author = u.rowid\n";
|
||||
|
||||
// WHERE
|
||||
if(!empty($search_ref)){
|
||||
$sql.= " WHERE d.ref_number LIKE '%".$db->escape($search_ref)."%'\n";
|
||||
}else{
|
||||
$sql.= " WHERE 1 = 1\n";
|
||||
}
|
||||
|
||||
// DATE START
|
||||
if ($month_start > 0) {
|
||||
if ($year_start > 0) {
|
||||
if($month_end > 0) {
|
||||
if($year_end > 0) {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y-%m') >= '$year_start-$month_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%Y-%m') <= '$year_end-$month_end'";
|
||||
} else {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y-%m') >= '$year_start-$month_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%m') <= '$month_end'";
|
||||
}
|
||||
} else {
|
||||
if($year_end > 0) {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y-%m') >= '$year_start-$month_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%Y') <= '$year_end'";
|
||||
} else {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y-%m') >= '$year_start-$month_start'";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sql.= " AND date_format(d.date_debut, '%m') >= '$month_start'";
|
||||
}
|
||||
} else {
|
||||
if ($year_start > 0) {
|
||||
if($month_end > 0) {
|
||||
if($year_end > 0) {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y') >= '$year_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%Y-%m') <= '$year_end-$month_end'";
|
||||
} else {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y') >= '$year_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%m') <= '$month_end'";
|
||||
}
|
||||
} else {
|
||||
if($year_end > 0) {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y') >= '$year_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%Y') <= '$year_end'";
|
||||
} else {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y') >= '$year_start'";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if($month_end > 0) {
|
||||
if($year_end > 0) {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y') >= '$year_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%Y-%m') <= '$year_end-$month_end'";
|
||||
} else {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y') >= '$year_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%m') <= '$month_end'";
|
||||
}
|
||||
} else {
|
||||
if($year_end > 0) {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y') >= '$year_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%Y') <= '$year_end'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($search_user) && $search_user != -1) {
|
||||
$sql.= " AND d.fk_user_author = '$search_user'\n";
|
||||
}
|
||||
|
||||
if(!empty($search_state)) {
|
||||
$sql.= " AND d.fk_c_expensereport_statuts = '$search_state'\n";
|
||||
}
|
||||
|
||||
// RESTRICT RIGHTS
|
||||
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)){
|
||||
$sql.= " AND d.fk_user_author = '{$user->id}'\n";
|
||||
}
|
||||
|
||||
// ORDER
|
||||
$sql.= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit + 1 ,$offset);
|
||||
|
||||
if($_GET['debug']=='ok'){
|
||||
var_dump("<pre>",$sql,"</pre>"); exit();
|
||||
}
|
||||
|
||||
//print $sql;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$i = 0;
|
||||
print_barre_liste($langs->trans("ListTripsAndExpenses"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"d.date_debut","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"d.date_fin","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.lastname","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("TotalHT"),$_SERVER["PHP_SELF"],"d.total_ht","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("TotalVAT"),$_SERVER["PHP_SELF"],"d.total_tva","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("TotalTTC"),$_SERVER["PHP_SELF"],"d.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Statut"),$_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre();
|
||||
print "</tr>\n";
|
||||
|
||||
// FILTRES
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" size="15" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||
|
||||
// Date start
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month_start" value="'.$month_start.'">';
|
||||
$formother->select_year($year_start,'year_start',1, $min_year, $max_year);
|
||||
print '</td>';
|
||||
|
||||
// Date end
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month_end" value="'.$month_end.'">';
|
||||
$formother->select_year($year_end,'year_end',1, $min_year, $max_year);
|
||||
print '</td>';
|
||||
|
||||
// User
|
||||
if ($user->rights->expensereport->readall || $user->rights->expensereport->lire_tous){
|
||||
print '<td class="liste_titre" align="left">';
|
||||
$html->select_users($search_user,"search_user",1,"",0,'');
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print "</td>";
|
||||
|
||||
// Status
|
||||
print '<td class="liste_titre" align="right">';
|
||||
select_expensereport_statut($search_state,'search_state');
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right" width="20px">';
|
||||
print ' <input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans('Search').'">';
|
||||
print "</td>";
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$var=true;
|
||||
|
||||
$total_total_ht = 0;
|
||||
$total_total_ttc = 0;
|
||||
$total_total_tva = 0;
|
||||
|
||||
if($num>0)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td><a href="card.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowTrip"),"trip").' '.$objp->ref_number.'</a></td>';
|
||||
print '<td align="center">'.($objp->date_debut > 0 ? dol_print_date($objp->date_debut, 'day') : '').'</td>';
|
||||
print '<td align="center">'.($objp->date_fin > 0 ? dol_print_date($objp->date_fin, 'day') : '').'</td>';
|
||||
print '<td align="left"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$objp->id_user.'">'.img_object($langs->trans("ShowUser"),"user").' '.dolGetFirstLastname($objp->firstname, $objp->lastname).'</a></td>';
|
||||
/*print '<td align="right">'.price($objp->total_tva, '', $langs, 0, 'MT', 0, $conf->currency).'</td>';
|
||||
print '<td align="right">'.price($objp->total_ht, '', $langs, 0, 'MT', 0, $conf->currency).'</td>';
|
||||
print '<td align="right">'.price($objp->total_ttc, '', $langs, 0, 'MT', 0, $conf->currency).'</td>';
|
||||
*/
|
||||
print '<td align="right">'.price($objp->total_ht).'</td>';
|
||||
print '<td align="right">'.price($objp->total_tva).'</td>';
|
||||
print '<td align="right">'.price($objp->total_ttc).'</td>';
|
||||
|
||||
$expensereporttmp->status=$objp->statut;
|
||||
print '<td align="right" colspan="2">'.$expensereporttmp->getLibStatut(5).'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$total_total_ht = $total_total_ht + $objp->total_ht;
|
||||
$total_total_tva = $total_total_tva + $objp->total_tva;
|
||||
$total_total_ttc = $total_total_ttc + $objp->total_ttc;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="4">'.$langs->trans("Total").'</td>';
|
||||
/*
|
||||
print '<td style="text-align:right;">'.price($total_total_tva, '', $langs, 0, 'MT', 0, $conf->currency).'</td>';
|
||||
print '<td style="text-align:right;">'.price($total_total_ht, '', $langs, 0, 'MT', 0, $conf->currency).'</td>';
|
||||
print '<td style="text-align:right;">'.price($total_total_ttc, '', $langs, 0, 'MT', 0, $conf->currency).'</td>';
|
||||
*/
|
||||
print '<td style="text-align:right;">'.$total_total_ht.'</td>';
|
||||
print '<td style="text-align:right;">'.$total_total_tva.'</td>';
|
||||
print '<td style="text-align:right;">'.$total_total_ttc.'</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="9">'.$langs->trans("NoRecordFound").'</td>';
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print "</form>";
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<a href="'.dol_buildpath('/expensereport/card.php',1).'?action=create" class="butAction">Ajouter une note de frais</a>';
|
||||
print '</div>';
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
297
htdocs/expensereport/stats/index.php
Executable file
297
htdocs/expensereport/stats/index.php
Executable file
|
|
@ -0,0 +1,297 @@
|
|||
<?php
|
||||
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/expensereport/stats/index.php
|
||||
* \ingroup expensereport
|
||||
* \brief Page for statistics of module trips and expenses
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereportstats.class.php';
|
||||
|
||||
$langs->load("trips");
|
||||
|
||||
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
|
||||
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
|
||||
|
||||
$userid=GETPOST('userid','int');
|
||||
$socid=GETPOST('socid','int'); if ($socid < 0) $socid=0;
|
||||
$id = GETPOST('id','int');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'expensereport', $id,'');
|
||||
|
||||
$nowyear=strftime("%Y", dol_now());
|
||||
$year = GETPOST('year')>0?GETPOST('year'):$nowyear;
|
||||
//$startyear=$year-2;
|
||||
$startyear=$year-1;
|
||||
$endyear=$year;
|
||||
|
||||
$mode=GETPOST("mode")?GETPOST("mode"):'customer';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$title=$langs->trans("TripsAndExpensesStatistics");
|
||||
$dir=$conf->expensereport->dir_temp;
|
||||
|
||||
print_fiche_titre($title, $mesg);
|
||||
|
||||
dol_mkdir($dir);
|
||||
|
||||
$stats = new ExpenseReportStats($db, $socid, $userid);
|
||||
|
||||
|
||||
// Build graphic number of object
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
//print "$endyear, $startyear";
|
||||
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
|
||||
//var_dump($data);
|
||||
|
||||
$filenamenb = $dir."/tripsexpensesnbinyear-".$year.".png";
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesnbinyear-'.$year.'.png';
|
||||
|
||||
$px1 = new DolGraph();
|
||||
$mesg = $px1->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px1->SetData($data);
|
||||
$px1->SetPrecisionY(0);
|
||||
$i=$startyear;$legend=array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
$legend[]=$i;
|
||||
$i++;
|
||||
}
|
||||
$px1->SetLegend($legend);
|
||||
$px1->SetMaxValue($px1->GetCeilMaxValue());
|
||||
$px1->SetWidth($WIDTH);
|
||||
$px1->SetHeight($HEIGHT);
|
||||
$px1->SetYLabel($langs->trans("Number"));
|
||||
$px1->SetShading(3);
|
||||
$px1->SetHorizTickIncrement(1);
|
||||
$px1->SetPrecisionY(0);
|
||||
$px1->mode='depth';
|
||||
$px1->SetTitle($langs->trans("NumberByMonth"));
|
||||
|
||||
$px1->draw($filenamenb,$fileurlnb);
|
||||
}
|
||||
|
||||
// Build graphic amount of object
|
||||
$data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear);
|
||||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
$filenameamount = $dir."/tripsexpensesamountinyear-".$year.".png";
|
||||
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesamountinyear-'.$year.'.png';
|
||||
|
||||
$px2 = new DolGraph();
|
||||
$mesg = $px2->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px2->SetData($data);
|
||||
$i=$startyear;$legend=array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
$legend[]=$i;
|
||||
$i++;
|
||||
}
|
||||
$px2->SetLegend($legend);
|
||||
$px2->SetMaxValue($px2->GetCeilMaxValue());
|
||||
$px2->SetMinValue(min(0,$px2->GetFloorMinValue()));
|
||||
$px2->SetWidth($WIDTH);
|
||||
$px2->SetHeight($HEIGHT);
|
||||
$px2->SetYLabel($langs->trans("Amount"));
|
||||
$px2->SetShading(3);
|
||||
$px2->SetHorizTickIncrement(1);
|
||||
$px2->SetPrecisionY(0);
|
||||
$px2->mode='depth';
|
||||
$px2->SetTitle($langs->trans("AmountTotal"));
|
||||
|
||||
$px2->draw($filenameamount,$fileurlamount);
|
||||
}
|
||||
|
||||
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
{
|
||||
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename_avg = $dir.'/ordersaverage-'.$year.'.png';
|
||||
if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png';
|
||||
if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png';
|
||||
}
|
||||
|
||||
$px3 = new DolGraph();
|
||||
$mesg = $px3->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px3->SetData($data);
|
||||
$i = $startyear;$legend=array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
$legend[]=$i;
|
||||
$i++;
|
||||
}
|
||||
$px3->SetLegend($legend);
|
||||
$px3->SetYLabel($langs->trans("AmountAverage"));
|
||||
$px3->SetMaxValue($px3->GetCeilMaxValue());
|
||||
$px3->SetMinValue($px3->GetFloorMinValue());
|
||||
$px3->SetWidth($WIDTH);
|
||||
$px3->SetHeight($HEIGHT);
|
||||
$px3->SetShading(3);
|
||||
$px3->SetHorizTickIncrement(1);
|
||||
$px3->SetPrecisionY(0);
|
||||
$px3->mode='depth';
|
||||
$px3->SetTitle($langs->trans("AmountAverage"));
|
||||
|
||||
$px3->draw($filename_avg,$fileurl_avg);
|
||||
}
|
||||
|
||||
|
||||
// Show array
|
||||
$data = $stats->getAllByYear();
|
||||
$arrayyears=array();
|
||||
foreach($data as $val) {
|
||||
$arrayyears[$val['year']]=$val['year'];
|
||||
}
|
||||
if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear;
|
||||
|
||||
|
||||
$h=0;
|
||||
$head = array();
|
||||
$head[$h][0] = DOL_URL_ROOT . '/compta/expensereport/stats/index.php';
|
||||
$head[$h][1] = $langs->trans("ByMonthYear");
|
||||
$head[$h][2] = 'byyear';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'trip_stats');
|
||||
|
||||
dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
|
||||
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
// Show filter box
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
/*
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
$filter='';
|
||||
print $form->select_company($socid,'socid',$filter,1,1);
|
||||
print '</td></tr>';
|
||||
*/
|
||||
// User
|
||||
print '<tr><td>'.$langs->trans("User").'</td><td>';
|
||||
print $form->select_dolusers($userid,'userid',1);
|
||||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
||||
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year',$arrayyears,$year,0);
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br><br>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr height="24">';
|
||||
print '<td align="center">'.$langs->trans("Year").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Number").'</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$oldyear=0;
|
||||
foreach ($data as $val)
|
||||
{
|
||||
$year = $val['year'];
|
||||
while ($year && $oldyear > $year+1)
|
||||
{ // If we have empty year
|
||||
$oldyear--;
|
||||
print '<tr height="24">';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&mode='.$mode.'">'.$oldyear.'</a></td>';
|
||||
print '<td align="right">0</td>';
|
||||
print '<td align="right">0</td>';
|
||||
print '<td align="right">0</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '<tr height="24">';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&mode='.$mode.'">'.$year.'</a></td>';
|
||||
print '<td align="right">'.$val['nb'].'</td>';
|
||||
print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>';
|
||||
print '<td align="right">'.price(price2num($val['avg'],'MT'),1).'</td>';
|
||||
print '</tr>';
|
||||
$oldyear=$year;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
// Show graphs
|
||||
print '<table class="border" width="100%"><tr valign="top"><td align="center">';
|
||||
if ($mesg) { print $mesg; }
|
||||
else {
|
||||
print $px1->show();
|
||||
print "<br>\n";
|
||||
print $px2->show();
|
||||
print "<br>\n";
|
||||
print $px3->show();
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
196
htdocs/expensereport/synchro_compta.php
Executable file
196
htdocs/expensereport/synchro_compta.php
Executable file
|
|
@ -0,0 +1,196 @@
|
|||
<?php
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once(DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php');
|
||||
dol_include_once("/expensereport/class/expensereport.class.php");
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("users");
|
||||
$langs->load("trips");
|
||||
$langs->load("banks");
|
||||
|
||||
$idAccount=isset($_GET["account"])?$_GET["account"]:$_POST["account"];
|
||||
|
||||
if ($_GET["action"] == 'confirm_ndf_to_account' && $_GET["confirm"] == "yes"):
|
||||
|
||||
$idTrip = $_GET['idTrip'];
|
||||
|
||||
$expensereport = new ExpenseReport($db);
|
||||
$expensereport->fetch($idTrip,$user);
|
||||
|
||||
$datePaiement = explode("-",$expensereport->date_paiement);
|
||||
|
||||
$dateop = dol_mktime(12,0,0,$datePaiement[1],$datePaiement[2],$datePaiement[0]);
|
||||
$operation = $expensereport->code_paiement;
|
||||
$label = "Règlement ".$expensereport->ref_number;
|
||||
$amount = - price2num($expensereport->total_ttc);
|
||||
$num_chq = '';
|
||||
$cat1 = '';
|
||||
|
||||
$user = new User($db);
|
||||
$user->fetch($expensereport->fk_user_paid);
|
||||
|
||||
$acct=new Account($db,$idAccount);
|
||||
$insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user);
|
||||
|
||||
if ($insertid > 0):
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."expensereport d";
|
||||
$sql.= " SET integration_compta = 1, fk_bank_account = $idAccount";
|
||||
$sql.= " WHERE rowid = $idTrip";
|
||||
$resql=$db->query($sql);
|
||||
if($result):
|
||||
Header("Location: synchro_compta.php?account=".$idAccount);
|
||||
exit;
|
||||
else:
|
||||
dol_print_error($db);
|
||||
endif;
|
||||
else:
|
||||
dol_print_error($db,$acct->error);
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ($_GET["action"] == 'confirm_account_to_ndf' && $_GET["confirm"] == "yes"):
|
||||
|
||||
$idTrip = $_GET['idTrip'];
|
||||
|
||||
$expensereport = new ExpenseReport($db);
|
||||
$expensereport->fetch($idTrip,$user);
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " WHERE label LIKE '%".$expensereport->ref_number."%'";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql > 0):
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."expensereport d";
|
||||
$sql.= " SET integration_compta = 0, fk_bank_account = 0";
|
||||
$sql.= " WHERE rowid = $idTrip";
|
||||
$resql=$db->query($sql);
|
||||
if($result):
|
||||
Header("Location: synchro_compta.php?account=".$idAccount);
|
||||
exit;
|
||||
else:
|
||||
dol_print_error($db);
|
||||
endif;
|
||||
else:
|
||||
dol_print_error($db);
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
$submit = isset($_POST['submit'])?true:false;
|
||||
$idAccount=isset($_GET["account"])?$_GET["account"]:$_POST["account"];
|
||||
|
||||
print_fiche_titre($langs->trans("TripSynch"));
|
||||
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
|
||||
if ($_GET["action"] == 'ndfTOaccount'):
|
||||
$idTrip = $_GET['idTrip'];
|
||||
$ret=$html->form_confirm("synchro_compta.php?idTrip=".$idTrip."&account=".$idAccount,$langs->trans("ndfToAccount"),$langs->trans("ConfirmNdfToAccount"),"confirm_ndf_to_account","","",1);
|
||||
if ($ret == 'html') print '<br />';
|
||||
endif;
|
||||
|
||||
if ($_GET["action"] == 'accountTOndf'):
|
||||
$idTrip = $_GET['idTrip'];
|
||||
$ret=$html->form_confirm("synchro_compta.php?idTrip=".$idTrip."&account=".$idAccount,$langs->trans("AccountToNdf"),$langs->trans("ConfirmAccountToNdf"),"confirm_account_to_ndf","","",1);
|
||||
if ($ret == 'html') print '<br />';
|
||||
endif;
|
||||
|
||||
if(empty($submit) && empty($idAccount)):
|
||||
|
||||
print "<form name='add' method=\"post\" action=\"synchro_compta.php\">";
|
||||
print 'Choix du compte ';
|
||||
print $html->select_comptes($_POST['account'],'account',0,'',1);
|
||||
print ' <input type="submit" name="submit" class="button" value="'.$langs->trans("ViewAccountSynch").'">';
|
||||
print "</form>";
|
||||
|
||||
else:
|
||||
|
||||
print "<form name='add' method=\"post\" action=\"synchro_compta.php\">";
|
||||
print 'Choix du compte ';
|
||||
print $html->select_comptes($idAccount,'account',0,'',1);
|
||||
print ' <input type="submit" class="button" value="'.$langs->trans("ViewAccountSynch").'">';
|
||||
print "</form>";
|
||||
|
||||
$sql = "SELECT d.fk_bank_account, d.ref_number, d.rowid, d.date_valide, d.fk_user_author, d.total_ttc, d.integration_compta, d.fk_c_expensereport_statuts";
|
||||
$sql.= " ,CONCAT(u.firstname,' ',u.lastname) as declarant_NDF";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport d";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user u ON d.fk_user_author = u.rowid";
|
||||
$sql.= " WHERE d.fk_c_expensereport_statuts = 6";
|
||||
$sql.= " ORDER BY d.date_valide DESC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql):
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
if($num>0):
|
||||
|
||||
$account=new Account($db);
|
||||
$account->fetch($idAccount);
|
||||
|
||||
print '<br>';
|
||||
|
||||
print "<table class='noborder' width='80%'>";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td>'.$langs->trans("DateValidation").'</td>';
|
||||
print '<td>'.$langs->trans("USER_AUTHOR").'</td>';
|
||||
print '<td align="center">'.$langs->trans("TotalTTC").'</td>';
|
||||
print '<td align="center">Actions</td>';
|
||||
print '<td>Compte</td>';
|
||||
print '<td align="center">Int.</td>';
|
||||
print '</tr>';
|
||||
|
||||
while($i<$num):
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>'.$objp->ref_number.'</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($objp->date_valide),'day').'</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$objp->fk_user_author.'">'.img_object($langs->trans("ShowUser"),"user").' '.$objp->declarant_NDF.'</a></td>';
|
||||
print '<td align="center">'.$objp->total_ttc.' '.$langs->trans("EURO").'</td>';
|
||||
|
||||
if($objp->integration_compta):
|
||||
print '<td align="center"><a href="synchro_compta.php?action=accountTOndf&idTrip='.$objp->rowid.'&account='.$idAccount.'"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1leftarrow.png" style="border:0px;" alt="Compte vers NDF" title="Compte vers NDF"/></a></td>';
|
||||
else:
|
||||
print '<td align="center"><a href="synchro_compta.php?action=ndfTOaccount&idTrip='.$objp->rowid.'&account='.$idAccount.'"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1rightarrow.png" style="border:0px;" alt="NDF vers Compte" title="NDF vers Compte"/></a></td>';
|
||||
endif;
|
||||
|
||||
print '<td>'.$account->label.'</td>';
|
||||
|
||||
if($objp->integration_compta):
|
||||
print '<td align="center"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/tick.png" style="border:0px;" alt="Intégration OK" /></td>';
|
||||
else:
|
||||
print '<td align="center"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/off.png" style="border:0px;" alt="Intégration Non OK" /></td>';
|
||||
endif;
|
||||
|
||||
print "</tr>";
|
||||
$i++;
|
||||
endwhile;
|
||||
|
||||
print "</table>";
|
||||
|
||||
else:
|
||||
print '<div class="error">'.$langs->trans("AucuneTripToSynch").'</div>';
|
||||
endif;
|
||||
|
||||
$db->free($resql);
|
||||
else:
|
||||
dol_print_error($db);
|
||||
endif;
|
||||
|
||||
endif;
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
|
@ -111,3 +111,77 @@ ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN sellby date DEFAULT NUL
|
|||
ALTER TABLE llx_stock_mouvement ADD COLUMN batch varchar(30) DEFAULT NULL;
|
||||
ALTER TABLE llx_stock_mouvement ADD COLUMN eatby date DEFAULT NULL;
|
||||
ALTER TABLE llx_stock_mouvement ADD COLUMN sellby date DEFAULT NULL;
|
||||
|
||||
|
||||
|
||||
|
||||
CREATE TABLE llx_expensereport (
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
ref_number varchar(50) NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
ref_number_int integer DEFAULT NULL,
|
||||
ref_ext integer,
|
||||
total_ht double(24,8) DEFAULT 0,
|
||||
total_tva double(24,8) DEFAULT 0,
|
||||
localtax1 double(24,8) DEFAULT 0, -- amount total localtax1
|
||||
localtax2 double(24,8) DEFAULT 0, -- amount total localtax2
|
||||
total_ttc double(24,8) DEFAULT 0,
|
||||
date_debut date NOT NULL,
|
||||
date_fin date NOT NULL,
|
||||
date_paiement datetime,
|
||||
date_valide datetime,
|
||||
date_create datetime NOT NULL,
|
||||
fk_user_author integer NOT NULL,
|
||||
fk_user_modif integer DEFAULT NULL,
|
||||
fk_user_validator integer DEFAULT NULL,
|
||||
fk_c_expensereport_statuts integer NOT NULL, -- 1=brouillon, 2=validé (attente approb), 4=annulé, 5=approuvé, 6=payed, 99=refusé
|
||||
fk_c_paiement integer DEFAULT NULL,
|
||||
note text,
|
||||
note_private text,
|
||||
fk_user_valid integer DEFAULT NULL,
|
||||
fk_user_paid integer DEFAULT NULL,
|
||||
detail_refuse varchar(255) DEFAULT NULL,
|
||||
date_cancel datetime,
|
||||
date_refuse datetime,
|
||||
detail_cancel varchar(255) DEFAULT NULL,
|
||||
fk_user_cancel integer DEFAULT NULL,
|
||||
fk_user_refuse integer DEFAULT NULL,
|
||||
integration_compta integer DEFAULT NULL,
|
||||
fk_bank_account integer DEFAULT NULL,
|
||||
model_pdf varchar(50) DEFAULT NULL
|
||||
) ENGINE=innodb;
|
||||
|
||||
|
||||
|
||||
|
||||
CREATE TABLE llx_expensereport_det
|
||||
(
|
||||
rowid integer PRIMARY KEY NOT NULL,
|
||||
fk_expensereport integer NOT NULL,
|
||||
fk_c_type_fees integer NOT NULL,
|
||||
fk_projet integer NOT NULL,
|
||||
fk_c_tva integer NOT NULL,
|
||||
comments text NOT NULL,
|
||||
product_type integer DEFAULT -1,
|
||||
qty real NOT NULL,
|
||||
value_unit real NOT NULL,
|
||||
remise_percent real,
|
||||
tva_tx double(6,3), -- Vat rat
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
total_ht double(24,8) DEFAULT 0 NOT NULL,
|
||||
total_tva double(24,8) DEFAULT 0 NOT NULL,
|
||||
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line
|
||||
total_localtax2 double(24,8) DEFAULT 0, -- total LocalTax2 for total quantity of line
|
||||
total_ttc double(24,8) DEFAULT 0 NOT NULL,
|
||||
date date NOT NULL,
|
||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||
special_code integer DEFAULT 0, -- code pour les lignes speciales
|
||||
rang integer DEFAULT 0, -- position of line
|
||||
import_key varchar(14)
|
||||
) ENGINE=innodb;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
54
htdocs/install/mysql/tables/llx_expensereport.sql
Executable file
54
htdocs/install/mysql/tables/llx_expensereport.sql
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
-- ============================================================================
|
||||
-- Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- 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
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- ============================================================================
|
||||
|
||||
CREATE TABLE llx_expensereport (
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
ref_number varchar(50) NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
ref_number_int integer DEFAULT NULL,
|
||||
ref_ext integer,
|
||||
total_ht double(24,8) DEFAULT 0,
|
||||
total_tva double(24,8) DEFAULT 0,
|
||||
localtax1 double(24,8) DEFAULT 0, -- amount total localtax1
|
||||
localtax2 double(24,8) DEFAULT 0, -- amount total localtax2
|
||||
total_ttc double(24,8) DEFAULT 0,
|
||||
date_debut date NOT NULL,
|
||||
date_fin date NOT NULL,
|
||||
date_paiement datetime,
|
||||
date_valide datetime,
|
||||
date_create datetime NOT NULL,
|
||||
fk_user_author integer NOT NULL,
|
||||
fk_user_modif integer DEFAULT NULL,
|
||||
fk_user_validator integer DEFAULT NULL,
|
||||
fk_c_expensereport_statuts integer NOT NULL, -- 1=brouillon, 2=validé (attente approb), 4=annulé, 5=approuvé, 6=payed, 99=refusé
|
||||
fk_c_paiement integer DEFAULT NULL,
|
||||
note text,
|
||||
note_private text,
|
||||
fk_user_valid integer DEFAULT NULL,
|
||||
fk_user_paid integer DEFAULT NULL,
|
||||
detail_refuse varchar(255) DEFAULT NULL,
|
||||
date_cancel datetime,
|
||||
date_refuse datetime,
|
||||
detail_cancel varchar(255) DEFAULT NULL,
|
||||
fk_user_cancel integer DEFAULT NULL,
|
||||
fk_user_refuse integer DEFAULT NULL,
|
||||
integration_compta integer DEFAULT NULL,
|
||||
fk_bank_account integer DEFAULT NULL,
|
||||
model_pdf varchar(50) DEFAULT NULL
|
||||
) ENGINE=innodb;
|
||||
|
||||
46
htdocs/install/mysql/tables/llx_expensereport_det.sql
Normal file
46
htdocs/install/mysql/tables/llx_expensereport_det.sql
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
-- ============================================================================
|
||||
-- Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- 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
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- ============================================================================
|
||||
|
||||
CREATE TABLE llx_expensereport_det
|
||||
(
|
||||
rowid integer PRIMARY KEY NOT NULL,
|
||||
fk_expensereport integer NOT NULL,
|
||||
fk_c_type_fees integer NOT NULL,
|
||||
fk_projet integer NOT NULL,
|
||||
fk_c_tva integer NOT NULL,
|
||||
comments text NOT NULL,
|
||||
product_type integer DEFAULT -1,
|
||||
qty real NOT NULL,
|
||||
value_unit real NOT NULL,
|
||||
remise_percent real,
|
||||
tva_tx double(6,3), -- Vat rat
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
total_ht double(24,8) DEFAULT 0 NOT NULL,
|
||||
total_tva double(24,8) DEFAULT 0 NOT NULL,
|
||||
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line
|
||||
total_localtax2 double(24,8) DEFAULT 0, -- total LocalTax2 for total quantity of line
|
||||
total_ttc double(24,8) DEFAULT 0 NOT NULL,
|
||||
date date NOT NULL,
|
||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||
special_code integer DEFAULT 0, -- code pour les lignes speciales
|
||||
rang integer DEFAULT 0, -- position of line
|
||||
import_key varchar(14)
|
||||
) ENGINE=innodb;
|
||||
|
|
@ -30,7 +30,7 @@ create table llx_facturedet
|
|||
fk_product integer NULL, -- Doit pouvoir etre nul pour ligne detail sans produits
|
||||
label varchar(255) DEFAULT NULL,
|
||||
description text,
|
||||
tva_tx double(6,3), -- Taux tva produit/service (exemple 19.6)
|
||||
tva_tx double(6,3), -- Vat rate (example 20%)
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
|
|
@ -43,8 +43,8 @@ create table llx_facturedet
|
|||
price double(24,8), -- Deprecated (Do not use)
|
||||
total_ht double(24,8), -- Total HT de la ligne toute quantite et incluant remise ligne et globale
|
||||
total_tva double(24,8), -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
|
||||
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line
|
||||
total_localtax2 double(24,8) DEFAULT 0, -- total LocalTax2 for total quantity of line
|
||||
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line
|
||||
total_localtax2 double(24,8) DEFAULT 0, -- total LocalTax2 for total quantity of line
|
||||
total_ttc double(24,8), -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
|
||||
product_type integer DEFAULT 0,
|
||||
date_start datetime DEFAULT NULL, -- date debut si service
|
||||
|
|
@ -55,8 +55,8 @@ create table llx_facturedet
|
|||
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
|
||||
|
||||
fk_code_ventilation integer DEFAULT 0 NOT NULL,
|
||||
special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales
|
||||
rang integer DEFAULT 0, -- ordre d'affichage
|
||||
special_code integer DEFAULT 0, -- code pour les lignes speciales
|
||||
rang integer DEFAULT 0, -- position of line
|
||||
import_key varchar(14),
|
||||
|
||||
situation_percent real, -- % progression of lines invoicing
|
||||
|
|
|
|||
|
|
@ -493,10 +493,14 @@ Module600Name=Notifications
|
|||
Module600Desc=Send EMail notifications on some Dolibarr business events to third-party contacts (setup defined on each thirdparty)
|
||||
Module700Name=Donations
|
||||
Module700Desc=Donation management
|
||||
Module770Name=Expense Report
|
||||
Module770Desc=Management and claim expense reports (transportation, meal, ...)
|
||||
Module1200Name=Mantis
|
||||
Module1200Desc=Mantis integration
|
||||
Module1400Name=Accounting
|
||||
Module1400Desc=Accounting management (double parties)
|
||||
Module1520Name=Document Generation
|
||||
Module1520Desc=Mass mail document generation
|
||||
Module1780Name=Categories
|
||||
Module1780Desc=Category management (products, suppliers and customers)
|
||||
Module2000Name=WYSIWYG editor
|
||||
|
|
@ -711,6 +715,13 @@ Permission538=Export services
|
|||
Permission701=Read donations
|
||||
Permission702=Create/modify donations
|
||||
Permission703=Delete donations
|
||||
Permission771=Read expense reports (own and his subordinates)
|
||||
Permission772=Create/modify expense reports
|
||||
Permission773=Delete expense reports
|
||||
Permission774=Read all expense reports (even for user not subordinates)
|
||||
Permission775=Approve expense reports
|
||||
Permission776=Pay expense reports
|
||||
Permission779=Export expense reports
|
||||
Permission1001=Read stocks
|
||||
Permission1002=Create/modify warehouses
|
||||
Permission1003=Delete warehouses
|
||||
|
|
|
|||
|
|
@ -1,22 +1,127 @@
|
|||
# Dolibarr language file - Source file is en_US - trips
|
||||
Trip=Trip
|
||||
Trips=Trips
|
||||
TripsAndExpenses=Trips and expenses
|
||||
TripsAndExpensesStatistics=Trips and expenses statistics
|
||||
TripCard=Trip card
|
||||
AddTrip=Create trip
|
||||
ListOfTrips=List of trips
|
||||
Trip=Expense report
|
||||
Trips=Expense reports
|
||||
TripsAndExpenses=Expenses reports
|
||||
TripsAndExpensesStatistics=Expense reports statistics
|
||||
TripCard=Expense report card
|
||||
AddTrip=Create expense report
|
||||
ListOfTrips=List of expense report
|
||||
ListOfFees=List of fees
|
||||
NewTrip=New trip
|
||||
NewTrip=New expense report
|
||||
CompanyVisited=Company/foundation visited
|
||||
Kilometers=Kilometers
|
||||
FeesKilometersOrAmout=Amount or kilometers
|
||||
DeleteTrip=Delete trip
|
||||
ConfirmDeleteTrip=Are you sure you want to delete this trip ?
|
||||
DeleteTrip=Delete expense report
|
||||
ConfirmDeleteTrip=Are you sure you want to delete this expense report ?
|
||||
ListTripsAndExpenses=List of expense reports
|
||||
ExpensesArea=Expense reports area
|
||||
SearchATripAndExpense=Search an expense report
|
||||
ClassifyRefunded=Classify 'Refunded'
|
||||
|
||||
TripId=Id expense report
|
||||
AnyOtherInThisListCanValidate=Person to inform for validation.
|
||||
TripSociete=Information company
|
||||
TripSalarie=Informations user
|
||||
TripNDF=Informations expense report
|
||||
|
||||
DeleteLine=Delete a ligne of the expense report
|
||||
ConfirmDeleteLine=Are you sure you want to delete this line ?
|
||||
|
||||
TF_OTHER=Other
|
||||
TF_LUNCH=Lunch
|
||||
TF_TRIP=Trip
|
||||
ListTripsAndExpenses=List of trips and expenses
|
||||
ExpensesArea=Trips and expenses area
|
||||
SearchATripAndExpense=Search a trip and expense
|
||||
ClassifyRefunded=Classify 'Refunded'
|
||||
TF_METRO=Metro
|
||||
TF_TRAIN=Train
|
||||
TF_BUS=Bus
|
||||
TF_PEAGE=Toll
|
||||
TF_ESSENCE=Fuel
|
||||
TF_HOTEL=Hostel
|
||||
TF_TAXI=Taxi
|
||||
|
||||
ErrorDoubleDeclaration=ERREUR : Vous avez déclaré au moins une note de frais dans le même intervalle.
|
||||
ListTripsAndExpenses=Liste des notes de frais
|
||||
AucuneNDF=Il n'y a aucune note de frais déclarée correspondante à votre recherche!
|
||||
AucuneLigne=Il n'y a aucune ligne de déclarée dans cette note de frais!
|
||||
AddLine=Ajouter une ligne
|
||||
AddLineMini=Ajouter
|
||||
TotalHT=Montant HT
|
||||
TotalTTC=Montant TTC
|
||||
TotalTVA=Total TVA
|
||||
|
||||
Date_DEBUT=Date de début période
|
||||
Date_FIN=Date de fin période
|
||||
ModePaiement=Mode de paiement
|
||||
Note=Note
|
||||
Project=Projet
|
||||
|
||||
VALIDATOR=Utilisateur informé pour validation
|
||||
VALIDOR=Validée par
|
||||
AUTHOR=Enregistrée par
|
||||
AUTHORPAIEMENT=Payée par
|
||||
REFUSEUR=Refusée par
|
||||
CANCEL_USER=Annulée par
|
||||
|
||||
MOTIF_REFUS=Motif de refus
|
||||
MOTIF_CANCEL=Motif d'annulation
|
||||
|
||||
DATE_REFUS=Date du refus
|
||||
DATE_CANCEL=Date annulation
|
||||
DATE_VALIDE=Date de validation
|
||||
DATE_PAIEMENT=Date de paiement
|
||||
DATE_SAVE=Date d'enregistrement
|
||||
|
||||
REFUSE=Refuse
|
||||
TO_PAID=Pay
|
||||
BROUILLONNER=Reopen
|
||||
SendToValid=Sent to approve
|
||||
ModifyInfoGen=Edit
|
||||
|
||||
NOT_VALIDATOR=Vous n'êtes pas la personne habilitée à valider cette note de frais!
|
||||
NOT_AUTHOR=Vous n'êtes pas l'auteur de cette note de frais, impossible de réaliser l'opération voulue!
|
||||
NOT_VALIDOR=Vous n'êtes pas le valideur de cette note de frais, vous ne pouvez donc pas réaliser cette opération!
|
||||
NotUserRightToView=Vous n'avez pas le droit d'afficher cette note de frais.
|
||||
|
||||
RefuseTrip=Refuser une note de frais
|
||||
ConfirmRefuseTrip=Êtes vous sûr de vouloir refuser cette note de frais ?
|
||||
|
||||
ValideTrip=Valider une note de frais
|
||||
ConfirmValideTrip=Êtes vous sûr de vouloir valider cette note de frais ?
|
||||
|
||||
PaidTrip=Payer une note de frais
|
||||
ConfirmPaidTrip=Êtes vous sûr de vouloir payer cette note de frais ?
|
||||
|
||||
CancelTrip=Annuler une note de frais
|
||||
ConfirmCancelTrip=Êtes vous sûr de vouloir annuler cette note de frais ?
|
||||
|
||||
BrouillonnerTrip=Remettre une note de frais en brouillon
|
||||
ConfirmBrouillonnerTrip=Êtes vous sûr de vouloir remettre cette note de frais en brouillon ?
|
||||
|
||||
SaveTrip=Enregistrement de votre note de frais
|
||||
ConfirmSaveTrip=Êtes vous sûr de vouloir enregistrer cette note de frais? (elle sera transmise par mail pour validation)
|
||||
|
||||
INFOS_DATES=Infos Workflow
|
||||
INFOS_NDF=Infos générales note de frais
|
||||
|
||||
StatsTrip=Statistiques
|
||||
Synchro_Compta=NDF <-> Compte
|
||||
|
||||
TripSynch=Synchronisation : Notes de frais <-> Compte courant
|
||||
TripToSynch=Notes de frais à intégrer dans la compta
|
||||
AucuneTripToSynch=Aucune note de frais n'est en statut "Payée".
|
||||
ViewAccountSynch=Voir le compte
|
||||
|
||||
ConfirmNdfToAccount=Êtes-vous sûr de vouloir intégrer cette note de frais dans le compte courant?
|
||||
ndfToAccount=Note de frais - Intégration
|
||||
|
||||
ConfirmAccountToNdf=Êtes-vous sûr de vouloir retirer cette note de frais du compte courant?
|
||||
AccountToNdf=Note de frais - Retrait
|
||||
|
||||
LINE_NOT_ADDED=Ligne non ajoutée :
|
||||
NO_PROJECT=Aucun projet sélectionné.
|
||||
NO_DATE=Aucune date sélectionnée.
|
||||
NO_PRICE=Aucun prix indiqué.
|
||||
|
||||
TripForValid=à Valider
|
||||
TripForPaid=à Payer
|
||||
TripPaid=Payée
|
||||
|
||||
NoTripsToExportCSV=No expense report to export for this period.
|
||||
|
|
|
|||
137
htdocs/langs/fr_FR/expensereport.lang
Executable file
137
htdocs/langs/fr_FR/expensereport.lang
Executable file
|
|
@ -0,0 +1,137 @@
|
|||
# Dolibarr language file - fr_FR - trips
|
||||
CHARSET=UTF-8
|
||||
Trip=Note de frais
|
||||
Trips=Notes de frais
|
||||
TripsAndExpenses=Notes de frais
|
||||
TripId=Id note de frais
|
||||
TripCard=Fiche note de frais
|
||||
AddTrip=Ajouter note de frais
|
||||
ListOfTrips=Liste des notes de frais
|
||||
ListOfFees=Liste des notes de frais
|
||||
NewTrip=Nouvelle note de frais
|
||||
CancelAddTrip=Annuler
|
||||
ExportTripCSV=Exporter en CSV
|
||||
AnyOtherInThisListCanValidate=Toute personne dans la liste pourra valider. Le choix détermine qui sera informé.
|
||||
TripSociete=Informations société
|
||||
TripSalarie=Informations salarié
|
||||
TripNDF=Informations note de frais
|
||||
|
||||
DeleteTrip=Supprimer note de frais
|
||||
ConfirmDeleteTrip=Êtes vous sûr de vouloir supprimer cette note de frais ?
|
||||
|
||||
DeleteLine=Supprimer une ligne de la note de frais
|
||||
ConfirmDeleteLine=Êtes vous sûr de vouloir supprimer cette ligne ?
|
||||
|
||||
TF_OTHER=Autre
|
||||
TF_LUNCH=Repas
|
||||
TF_METRO=Métro
|
||||
TF_TRAIN=Train
|
||||
TF_RATP=Ratp
|
||||
TF_BUS=Bus
|
||||
TF_PEAGE=Péage
|
||||
TF_ESSENCE=Essence
|
||||
TF_SNCF=SNCF (Autre)
|
||||
TF_HOTEL=Hôtel
|
||||
TF_TRANSPORT=SNCF (Train)
|
||||
TF_TAXI=Taxi
|
||||
|
||||
ErrorDoubleDeclaration=ERREUR : Vous avez déclaré au moins une note de frais dans le même intervalle.
|
||||
ListTripsAndExpenses=Liste des notes de frais
|
||||
AucuneNDF=Il n'y a aucune note de frais déclarée correspondante à votre recherche!
|
||||
AucuneLigne=Il n'y a aucune ligne de déclarée dans cette note de frais!
|
||||
AddLine=Ajouter une ligne
|
||||
AddLineMini=Ajouter
|
||||
TotalHT=Montant HT
|
||||
TotalTTC=Montant TTC
|
||||
TotalTVA=Total TVA
|
||||
|
||||
Date_DEBUT=Date de début période
|
||||
Date_FIN=Date de fin période
|
||||
ModePaiement=Mode de paiement
|
||||
Note=Note
|
||||
Project=Projet
|
||||
|
||||
VALIDATOR=Utilisateur informé pour validation
|
||||
VALIDOR=Validée par
|
||||
AUTHOR=Enregistrée par
|
||||
AUTHORPAIEMENT=Payée par
|
||||
REFUSEUR=Refusée par
|
||||
CANCEL_USER=Annulée par
|
||||
|
||||
MOTIF_REFUS=Motif de refus
|
||||
MOTIF_CANCEL=Motif d'annulation
|
||||
|
||||
DATE_REFUS=Date du refus
|
||||
DATE_CANCEL=Date annulation
|
||||
DATE_VALIDE=Date de validation
|
||||
DATE_PAIEMENT=Date de paiement
|
||||
DATE_SAVE=Date d'enregistrement
|
||||
|
||||
VALIDATE=Valider
|
||||
REFUSE=Refuser
|
||||
CANCEL=Annuler
|
||||
TO_PAID=Payer
|
||||
BROUILLONNER=Remettre en brouillon
|
||||
SendToValid=Envoyer en validation
|
||||
ModifyInfoGen=Modifier les infos générales
|
||||
|
||||
Module20130304Name=Notes de frais
|
||||
Module20130304Desc=Gestion des notes de frais et déplacement (par ')
|
||||
|
||||
NOT_VALIDATOR=Vous n'êtes pas la personne habilitée à valider cette note de frais!
|
||||
NOT_AUTHOR=Vous n'êtes pas l'auteur de cette note de frais, impossible de réaliser l'opération voulue!
|
||||
NOT_VALIDOR=Vous n'êtes pas le valideur de cette note de frais, vous ne pouvez donc pas réaliser cette opération!
|
||||
NotUserRightToView=Vous n'avez pas le droit d'afficher cette note de frais.
|
||||
|
||||
RefuseTrip=Refuser une note de frais
|
||||
ConfirmRefuseTrip=Êtes vous sûr de vouloir refuser cette note de frais ?
|
||||
|
||||
ValideTrip=Valider une note de frais
|
||||
ConfirmValideTrip=Êtes vous sûr de vouloir valider cette note de frais ?
|
||||
|
||||
PaidTrip=Payer une note de frais
|
||||
ConfirmPaidTrip=Êtes vous sûr de vouloir payer cette note de frais ?
|
||||
|
||||
CancelTrip=Annuler une note de frais
|
||||
ConfirmCancelTrip=Êtes vous sûr de vouloir annuler cette note de frais ?
|
||||
|
||||
BrouillonnerTrip=Remettre une note de frais en brouillon
|
||||
ConfirmBrouillonnerTrip=Êtes vous sûr de vouloir remettre cette note de frais en brouillon ?
|
||||
|
||||
SaveTrip=Enregistrement de votre note de frais
|
||||
ConfirmSaveTrip=Êtes vous sûr de vouloir enregistrer cette note de frais? (elle sera transmise par mail pour validation)
|
||||
|
||||
INFOS_DATES=Infos Workflow
|
||||
INFOS_NDF=Infos générales note de frais
|
||||
|
||||
EURO=€
|
||||
PriceUNITAIRE=Prix U. (TTC)
|
||||
|
||||
StatsTrip=Statistiques
|
||||
Synchro_Compta=NDF <-> Compte
|
||||
|
||||
TripSynch=Synchronisation : Notes de frais <-> Compte courant
|
||||
TripToSynch=Notes de frais à intégrer dans la compta
|
||||
AucuneTripToSynch=Aucune note de frais n'est en statut "Payée".
|
||||
ViewAccountSynch=Voir le compte
|
||||
|
||||
ConfirmNdfToAccount=Êtes-vous sûr de vouloir intégrer cette note de frais dans le compte courant?
|
||||
ndfToAccount=Note de frais - Intégration
|
||||
|
||||
ConfirmAccountToNdf=Êtes-vous sûr de vouloir retirer cette note de frais du compte courant?
|
||||
AccountToNdf=Note de frais - Retrait
|
||||
|
||||
USER_AUTHOR=Auteur
|
||||
PU=P.U.
|
||||
Q=Q
|
||||
|
||||
LINE_NOT_ADDED=Ligne non ajoutée :
|
||||
NO_PROJECT=Aucun projet sélectionné.
|
||||
NO_DATE=Aucune date sélectionnée.
|
||||
NO_PRICE=Aucun prix indiqué.
|
||||
|
||||
TripForValid=à Valider
|
||||
TripForPaid=à Payer
|
||||
TripPaid=Payée
|
||||
|
||||
NoTripsToExportCSV=Il n'y a pas de notes de frais à exporter pour cette période.
|
||||
Loading…
Reference in New Issue
Block a user