Fix: Remove usage of pdate()

This commit is contained in:
Laurent Destailleur 2010-01-13 18:51:19 +00:00
parent 2aac1761e3
commit 62f4345e92
28 changed files with 537 additions and 534 deletions

View File

@ -586,7 +586,7 @@ class Adherent extends CommonObject
$this->db->begin(); $this->db->begin();
// Search for last subscription id and end date // Search for last subscription id and end date
$sql = "SELECT rowid, ".$this->db->pdate("datef")." as datef"; $sql = "SELECT rowid, datef";
$sql.= " FROM ".MAIN_DB_PREFIX."cotisation"; $sql.= " FROM ".MAIN_DB_PREFIX."cotisation";
$sql.= " WHERE fk_adherent='".$this->id."'"; $sql.= " WHERE fk_adherent='".$this->id."'";
$sql.= " ORDER by dateadh DESC"; // Sort by start subscription date $sql.= " ORDER by dateadh DESC"; // Sort by start subscription date
@ -596,7 +596,7 @@ class Adherent extends CommonObject
if ($resql) if ($resql)
{ {
$obj=$this->db->fetch_object($resql); $obj=$this->db->fetch_object($resql);
$datefin=$obj->datef; $datefin=$this->db->jdate($obj->datef);
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
$sql.= " datefin=".($datefin != '' ? "'".$this->db->idate($datefin)."'" : "null"); $sql.= " datefin=".($datefin != '' ? "'".$this->db->idate($datefin)."'" : "null");
@ -924,11 +924,11 @@ class Adherent extends CommonObject
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.fk_soc, d.statut, d.public, d.adresse, d.cp, d.ville, d.note,"; $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.fk_soc, d.statut, d.public, d.adresse, d.cp, d.ville, d.note,";
$sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,"; $sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,";
$sql.= " d.photo, d.fk_adherent_type, d.morphy,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy,";
$sql.= " ".$this->db->pdate("d.datec")." as datec,"; $sql.= " d.datec as datec,";
$sql.= " ".$this->db->pdate("d.tms")." as datem,"; $sql.= " d.tms as datem,";
$sql.= " ".$this->db->pdate("d.datefin")." as datefin,"; $sql.= " d.datefin as datefin,";
$sql.= " d.naiss as datenaiss,"; $sql.= " d.naiss as datenaiss,";
$sql.= " ".$this->db->pdate("d.datevalid")." as datev,"; $sql.= " d.datevalid as datev,";
$sql.= " d.pays,"; $sql.= " d.pays,";
$sql.= " p.rowid as pays_id, p.code as pays_code, p.libelle as pays_lib,"; $sql.= " p.rowid as pays_id, p.code as pays_code, p.libelle as pays_lib,";
$sql.= " t.libelle as type, t.cotisation as cotisation,"; $sql.= " t.libelle as type, t.cotisation as cotisation,";
@ -976,11 +976,11 @@ class Adherent extends CommonObject
$this->statut = $obj->statut; $this->statut = $obj->statut;
$this->public = $obj->public; $this->public = $obj->public;
$this->datec = $obj->datec; $this->datec = $this->db->jdate($obj->datec);
$this->datem = $obj->datem; $this->datem = $this->db->jdate($obj->datem);
$this->datefin = $obj->datefin; $this->datefin = $this->db->jdate($obj->datefin);
$this->datevalid = $obj->datevalid; $this->datevalid = $this->db->jdate($obj->datev);
$this->naiss = $obj->datenaiss; $this->naiss = $this->db->jdate($obj->datenaiss);
$this->note = $obj->note; $this->note = $obj->note;
$this->morphy = $obj->morphy; $this->morphy = $obj->morphy;
@ -2007,9 +2007,9 @@ class Adherent extends CommonObject
*/ */
function info($id) function info($id)
{ {
$sql = 'SELECT a.rowid, '.$this->db->pdate('a.datec').' as datec,'; $sql = 'SELECT a.rowid, a.datec as datec,';
$sql.= ' '.$this->db->pdate('a.datevalid').' as datev,'; $sql.= ' a.datevalid as datev,';
$sql.= ' '.$this->db->pdate('a.tms').' as datem,'; $sql.= ' a.tms as datem,';
$sql.= ' a.fk_user_author, a.fk_user_valid, a.fk_user_mod'; $sql.= ' a.fk_user_author, a.fk_user_valid, a.fk_user_mod';
$sql.= ' FROM '.MAIN_DB_PREFIX.'adherent as a'; $sql.= ' FROM '.MAIN_DB_PREFIX.'adherent as a';
$sql.= ' WHERE a.rowid = '.$id; $sql.= ' WHERE a.rowid = '.$id;
@ -2043,9 +2043,9 @@ class Adherent extends CommonObject
$this->user_modification = $muser; $this->user_modification = $muser;
} }
$this->date_creation = $obj->datec; $this->date_creation = $this->db->jdate($obj->datec);
$this->date_validation = $obj->datev; $this->date_validation = $this->db->jdate($obj->datev);
$this->date_modification = $obj->datem; $this->date_modification = $this->db->jdate($obj->datem);
} }
$this->db->free($result); $this->db->free($result);

View File

@ -267,8 +267,8 @@ print '<td valign="top" width="50%">';
*/ */
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe,"; $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe,";
$sql.= " c.rowid as crowid, c.cotisation,"; $sql.= " c.rowid as crowid, c.cotisation,";
$sql.= " ".$db->pdate("c.dateadh")." as dateadh,"; $sql.= " c.dateadh,";
$sql.= " ".$db->pdate("c.datef")." as datef,"; $sql.= " c.datef,";
$sql.= " c.fk_bank,"; $sql.= " c.fk_bank,";
$sql.= " b.rowid as bid,"; $sql.= " b.rowid as bid,";
$sql.= " ba.rowid as baid, ba.label, ba.bank"; $sql.= " ba.rowid as baid, ba.label, ba.bank";
@ -308,8 +308,8 @@ if ($result)
$cotisationstatic->ref=$objp->crowid; $cotisationstatic->ref=$objp->crowid;
$cotisationstatic->id=$objp->crowid; $cotisationstatic->id=$objp->crowid;
print '<td>'.$cotisationstatic->getNomUrl(1).'</td>'; print '<td>'.$cotisationstatic->getNomUrl(1).'</td>';
print '<td align="center">'.dol_print_date($objp->dateadh,'day')."</td>\n"; print '<td align="center">'.dol_print_date($this->db->jdate($objp->dateadh),'day')."</td>\n";
print '<td align="center">'.dol_print_date($objp->datef,'day')."</td>\n"; print '<td align="center">'.dol_print_date($this->db->jdate($objp->datef),'day')."</td>\n";
print '<td align="right">'.price($objp->cotisation).'</td>'; print '<td align="right">'.price($objp->cotisation).'</td>';
if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE)
{ {

View File

@ -100,10 +100,10 @@ class Cotisation extends CommonObject
*/ */
function fetch($rowid) function fetch($rowid)
{ {
$sql ="SELECT rowid, fk_adherent, ".$this->db->pdate("datec")." as datec,"; $sql ="SELECT rowid, fk_adherent, datec,";
$sql.=" tms,"; $sql.=" tms,";
$sql.=" ".$this->db->pdate("dateadh")." as dateadh,"; $sql.=" dateadh,";
$sql.=" ".$this->db->pdate("datef")." as datef,"; $sql.=" datef,";
$sql.=" cotisation, note, fk_bank"; $sql.=" cotisation, note, fk_bank";
$sql.=" FROM ".MAIN_DB_PREFIX."cotisation"; $sql.=" FROM ".MAIN_DB_PREFIX."cotisation";
$sql.=" WHERE rowid=".$rowid; $sql.=" WHERE rowid=".$rowid;
@ -120,10 +120,10 @@ class Cotisation extends CommonObject
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->fk_adherent = $obj->fk_adherent; $this->fk_adherent = $obj->fk_adherent;
$this->datec = $obj->datec; $this->datec = $this->db->jdate($obj->datec);
$this->datem = $obj->tms; $this->datem = $this->db->jdate($obj->tms);
$this->dateh = $obj->dateadh; $this->dateh = $this->db->jdate($obj->dateadh);
$this->datef = $obj->datef; $this->datef = $this->db->jdate($obj->datef);
$this->amount = $obj->cotisation; $this->amount = $obj->cotisation;
$this->note = $obj->note; $this->note = $obj->note;
$this->fk_bank = $obj->fk_bank; $this->fk_bank = $obj->fk_bank;

View File

@ -18,19 +18,19 @@
*/ */
/** /**
\file htdocs/chargesociales.class.php * \file htdocs/chargesociales.class.php
\ingroup facture * \ingroup facture
\brief Fichier de la classe des charges sociales * \brief Fichier de la classe des charges sociales
\version $Id$ * \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
/** \class ChargeSociales /** \class ChargeSociales
\brief Classe permettant la gestion des paiements des charges * \brief Classe permettant la gestion des paiements des charges
La tva collectee n'est calculee que sur les factures payees. * La tva collectee n'est calculee que sur les factures payees.
*/ */
class ChargeSociales extends CommonObject class ChargeSociales extends CommonObject
{ {
var $db; var $db;
@ -61,8 +61,8 @@ class ChargeSociales extends CommonObject
*/ */
function fetch($id) function fetch($id)
{ {
$sql = "SELECT cs.rowid,".$this->db->pdate("cs.date_ech")." as date_ech,"; $sql = "SELECT cs.rowid, cs.date_ech,";
$sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, ".$this->db->pdate("cs.periode")." as periode,"; $sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode,";
$sql.= " c.libelle"; $sql.= " c.libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= " WHERE cs.fk_type = c.id"; $sql.= " WHERE cs.fk_type = c.id";
@ -78,13 +78,13 @@ class ChargeSociales extends CommonObject
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->date_ech = $obj->date_ech; $this->date_ech = $this->db->jdate($obj->date_ech);
$this->lib = $obj->lib; $this->lib = $obj->lib;
$this->type = $obj->fk_type; $this->type = $obj->fk_type;
$this->type_libelle = $obj->libelle; $this->type_libelle = $obj->libelle;
$this->amount = $obj->amount; $this->amount = $obj->amount;
$this->paye = $obj->paye; $this->paye = $obj->paye;
$this->periode = $obj->periode; $this->periode = $this->db->jdate($obj->periode);
return 1; return 1;
} }

View File

@ -2024,7 +2024,7 @@ else
* Show object in view mode * Show object in view mode
*/ */
$now=gmmktime(); $now=dol_now();
$id = $_GET['facid']; $id = $_GET['facid'];
$ref= $_GET['ref']; $ref= $_GET['ref'];
@ -2393,6 +2393,7 @@ else
if ($fac->type != 2 && $_GET['action'] != 'editinvoicedate' && $fac->brouillon && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&amp;facid='.$fac->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>'; if ($fac->type != 2 && $_GET['action'] != 'editinvoicedate' && $fac->brouillon && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&amp;facid='.$fac->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($fac->type != 2) if ($fac->type != 2)
{ {
if ($_GET['action'] == 'editinvoicedate') if ($_GET['action'] == 'editinvoicedate')

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -19,10 +19,10 @@
*/ */
/** /**
\file htdocs/compta/resultat/index.php * \file htdocs/compta/resultat/index.php
\brief Page reporting resultat * \brief Page reporting resultat
\version $Id$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/report.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/report.lib.php");
@ -32,19 +32,19 @@ $year_start=isset($_GET["year_start"])?$_GET["year_start"]:$_POST["year_start"];
$year_current = strftime("%Y",time()); $year_current = strftime("%Y",time());
$nbofyear=4; $nbofyear=4;
if (! $year_start) { if (! $year_start) {
$year_start = $year_current - ($nbofyear-1); $year_start = $year_current - ($nbofyear-1);
$year_end = $year_current; $year_end = $year_current;
} }
else { else {
$year_end=$year_start + ($nbofyear-1); $year_end=$year_start + ($nbofyear-1);
} }
/* /*
* Securite acces client * Securite acces client
*/ */
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$socid = $user->societe_id; $socid = $user->societe_id;
} }
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
@ -59,22 +59,22 @@ $html=new Form($db);
// Affiche en-tete du rapport // Affiche en-tete du rapport
if ($modecompta=="CREANCES-DETTES") if ($modecompta=="CREANCES-DETTES")
{ {
$nom=$langs->trans("AnnualSummaryDueDebtMode"); $nom=$langs->trans("AnnualSummaryDueDebtMode");
$nom.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')'; $nom.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$period="$year_start - $year_end"; $period="$year_start - $year_end";
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":""); $periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesResultDue"); $description=$langs->trans("RulesResultDue");
$builddate=time(); $builddate=time();
$exportlink=$langs->trans("NotYetAvailable"); $exportlink=$langs->trans("NotYetAvailable");
} }
else { else {
$nom=$langs->trans("AnnualSummaryInputOutputMode"); $nom=$langs->trans("AnnualSummaryInputOutputMode");
$nom.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')'; $nom.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$period="$year_start - $year_end"; $period="$year_start - $year_end";
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":""); $periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesResultInOut"); $description=$langs->trans("RulesResultInOut");
$builddate=time(); $builddate=time();
$exportlink=$langs->trans("NotYetAvailable"); $exportlink=$langs->trans("NotYetAvailable");
} }
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
@ -84,96 +84,96 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl
*/ */
$subtotal_ht = 0; $subtotal_ht = 0;
$subtotal_ttc = 0; $subtotal_ttc = 0;
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
$sql = "SELECT sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm"; $sql = "SELECT sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."facture as f";
$sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.fk_statut in (1,2)"; $sql.= " AND f.fk_statut in (1,2)";
} else { } else {
/* /*
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin) * vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
*/ */
$sql = "SELECT sum(pf.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm"; $sql = "SELECT sum(pf.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf"; $sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf";
$sql.= ", ".MAIN_DB_PREFIX."paiement as p"; $sql.= ", ".MAIN_DB_PREFIX."paiement as p";
$sql.= " WHERE p.rowid = pf.fk_paiement"; $sql.= " WHERE p.rowid = pf.fk_paiement";
$sql.= " AND pf.fk_facture = f.rowid"; $sql.= " AND pf.fk_facture = f.rowid";
} }
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
if ($socid) $sql.= " AND f.fk_soc = $socid"; if ($socid) $sql.= " AND f.fk_soc = $socid";
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= " ORDER BY dm"; $sql.= " ORDER BY dm";
print $sql;
$result=$db->query($sql); $result=$db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$row = $db->fetch_object($result); $row = $db->fetch_object($result);
$encaiss[$row->dm] = $row->amount_ht; $encaiss[$row->dm] = $row->amount_ht;
$encaiss_ttc[$row->dm] = $row->amount_ttc; $encaiss_ttc[$row->dm] = $row->amount_ttc;
$i++; $i++;
} }
$db->free($result); $db->free($result);
} }
else { else {
dol_print_error($db); dol_print_error($db);
} }
// On ajoute les paiements clients anciennes version, non lies par paiement_facture // On ajoute les paiements clients anciennes version, non lies par paiement_facture
if ($modecompta != 'CREANCES-DETTES') { if ($modecompta != 'CREANCES-DETTES') {
$sql = "SELECT sum(p.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm"; $sql = "SELECT sum(p.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= ", ".MAIN_DB_PREFIX."paiement as p"; $sql.= ", ".MAIN_DB_PREFIX."paiement as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
$sql.= " WHERE pf.rowid IS NULL"; $sql.= " WHERE pf.rowid IS NULL";
$sql.= " AND p.fk_bank = b.rowid"; $sql.= " AND p.fk_bank = b.rowid";
$sql.= " AND b.fk_account = ba.rowid"; $sql.= " AND b.fk_account = ba.rowid";
$sql.= " AND ba.entity = ".$conf->entity; $sql.= " AND ba.entity = ".$conf->entity;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= " ORDER BY dm"; $sql.= " ORDER BY dm";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$row = $db->fetch_object($result); $row = $db->fetch_object($result);
$encaiss[$row->dm] += $row->amount_ht; $encaiss[$row->dm] += $row->amount_ht;
$encaiss_ttc[$row->dm] += $row->amount_ttc; $encaiss_ttc[$row->dm] += $row->amount_ttc;
// For DEBUG Only // For DEBUG Only
if (preg_match('/^2007/',$row->dm)) if (preg_match('/^2007/',$row->dm))
{ {
$subtotal_ht = $subtotal_ht + $row->amount_ht; $subtotal_ht = $subtotal_ht + $row->amount_ht;
$subtotal_ttc = $subtotal_ttc + $row->amount_ttc; $subtotal_ttc = $subtotal_ttc + $row->amount_ttc;
} }
$i++; $i++;
} }
} }
else { else {
dol_print_error($db); dol_print_error($db);
} }
} }
/* /*
print "<br>Facture clients: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n"; print "<br>Facture clients: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n";
for ($mois = 1 ; $mois <= 12 ; $mois++) for ($mois = 1 ; $mois <= 12 ; $mois++)
{ {
$annee = 2007; $annee = 2007;
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee)); $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee));
print 'Mois '.$mois.': '.$decaiss_ttc[$case].' '; print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
print 'Mois '.$mois.': '.$encaiss_ttc[$case].' '; print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
} }
*/ */
/* /*
* Frais, factures fournisseurs. * Frais, factures fournisseurs.
@ -181,10 +181,10 @@ for ($mois = 1 ; $mois <= 12 ; $mois++)
$subtotal_ht = 0; $subtotal_ht = 0;
$subtotal_ttc = 0; $subtotal_ttc = 0;
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
$sql = "SELECT sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm"; $sql = "SELECT sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql.= " WHERE f.fk_statut IN (1,2)"; $sql.= " WHERE f.fk_statut IN (1,2)";
} else { } else {
$sql = "SELECT sum(p.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm"; $sql = "SELECT sum(p.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p";
@ -200,171 +200,171 @@ $sql.= " GROUP BY dm";
$result=$db->query($sql); $result=$db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$row = $db->fetch_object($result); $row = $db->fetch_object($result);
$decaiss[$row->dm] = $row->amount_ht; $decaiss[$row->dm] = $row->amount_ht;
$decaiss_ttc[$row->dm] = $row->amount_ttc; $decaiss_ttc[$row->dm] = $row->amount_ttc;
// For DEBUG Only // For DEBUG Only
if (preg_match('/^2007/',$row->dm)) if (preg_match('/^2007/',$row->dm))
{ {
$subtotal_ht = $subtotal_ht + $row->amount_ht; $subtotal_ht = $subtotal_ht + $row->amount_ht;
$subtotal_ttc = $subtotal_ttc + $row->amount_ttc; $subtotal_ttc = $subtotal_ttc + $row->amount_ttc;
} }
$i++; $i++;
} }
$db->free($result); $db->free($result);
} }
else { else {
dol_print_error($db); dol_print_error($db);
} }
/* /*
print "<br>Facture fournisseurs: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n"; print "<br>Facture fournisseurs: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n";
for ($mois = 1 ; $mois <= 12 ; $mois++) for ($mois = 1 ; $mois <= 12 ; $mois++)
{ {
$annee = 2007; $annee = 2007;
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee)); $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee));
print 'Mois '.$mois.': '.$decaiss_ttc[$case].' '; print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
print 'Mois '.$mois.': '.$encaiss_ttc[$case].' '; print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
} }
*/ */
/* /*
* TVA * TVA
*/ */
$subtotal_ht = 0; $subtotal_ht = 0;
$subtotal_ttc = 0; $subtotal_ttc = 0;
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
// TVA a payer // TVA a payer
$sql = "SELECT sum(f.tva) as amount, date_format(f.datef,'%Y-%m') as dm"; $sql = "SELECT sum(f.tva) as amount, date_format(f.datef,'%Y-%m') as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " WHERE f.fk_statut IN (1,2)"; $sql.= " WHERE f.fk_statut IN (1,2)";
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
$sql.= " GROUP BY dm DESC"; $sql.= " GROUP BY dm DESC";
$result=$db->query($sql); $result=$db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$var=false; $var=false;
$i = 0; $i = 0;
if ($num) { if ($num) {
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$decaiss[$obj->dm] += $obj->amount; $decaiss[$obj->dm] += $obj->amount;
$decaiss_ttc[$obj->dm] += $obj->amount; $decaiss_ttc[$obj->dm] += $obj->amount;
$i++; $i++;
} }
} }
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
// TVA a recuperer // TVA a recuperer
$sql = "SELECT sum(f.total_tva) as amount, date_format(f.datef,'%Y-%m') as dm"; $sql = "SELECT sum(f.total_tva) as amount, date_format(f.datef,'%Y-%m') as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql.= " WHERE f.fk_statut IN (1,2)"; $sql.= " WHERE f.fk_statut IN (1,2)";
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$result=$db->query($sql); $result=$db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$var=false; $var=false;
$i = 0; $i = 0;
if ($num) { if ($num) {
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$encaiss[$obj->dm] += $obj->amount; $encaiss[$obj->dm] += $obj->amount;
$encaiss_ttc[$obj->dm] += $obj->amount; $encaiss_ttc[$obj->dm] += $obj->amount;
$i++; $i++;
} }
} }
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
} }
else { else {
// TVA reellement deja payee // TVA reellement deja payee
$sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm"; $sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; $sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
$sql.= " WHERE amount > 0"; $sql.= " WHERE amount > 0";
$sql.= " AND t.entity = ".$conf->entity; $sql.= " AND t.entity = ".$conf->entity;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$result=$db->query($sql); $result=$db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$var=false; $var=false;
$i = 0; $i = 0;
if ($num) { if ($num) {
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$decaiss[$obj->dm] += $obj->amount; $decaiss[$obj->dm] += $obj->amount;
$decaiss_ttc[$obj->dm] += $obj->amount; $decaiss_ttc[$obj->dm] += $obj->amount;
// For DEBUG Only // For DEBUG Only
if (preg_match('/^2007/',$obj->dm)) if (preg_match('/^2007/',$obj->dm))
{ {
$subtotal_ht = $subtotal_ht + $obj->amount; $subtotal_ht = $subtotal_ht + $obj->amount;
$subtotal_ttc = $subtotal_ttc + $obj->amount; $subtotal_ttc = $subtotal_ttc + $obj->amount;
}
$i++;
} }
}
$i++; } else {
} dol_print_error($db);
} }
} else { // TVA recuperee
dol_print_error($db); $sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm";
} $sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
// TVA recuperee $sql.= " WHERE amount < 0";
$sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm"; $sql.= " AND t.entity = ".$conf->entity;
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; $sql.= " GROUP BY dm";
$sql.= " WHERE amount < 0";
$sql.= " AND t.entity = ".$conf->entity; $result=$db->query($sql);
$sql.= " GROUP BY dm"; if ($result) {
$num = $db->num_rows($result);
$result=$db->query($sql); $var=false;
if ($result) { $i = 0;
$num = $db->num_rows($result); if ($num) {
$var=false; while ($i < $num) {
$i = 0; $obj = $db->fetch_object($result);
if ($num) {
while ($i < $num) { $encaiss[$obj->dm] += $obj->amount;
$obj = $db->fetch_object($result); $encaiss_ttc[$obj->dm] += $obj->amount;
// For DEBUG Only
$encaiss[$obj->dm] += $obj->amount; if (preg_match('/^2007/',$obj->dm))
$encaiss_ttc[$obj->dm] += $obj->amount; {
// For DEBUG Only $subtotal_ht = $subtotal_ht + $obj->amount;
if (preg_match('/^2007/',$obj->dm)) $subtotal_ttc = $subtotal_ttc + $obj->amount;
{ }
$subtotal_ht = $subtotal_ht + $obj->amount;
$subtotal_ttc = $subtotal_ttc + $obj->amount; $i++;
} }
}
$i++; } else {
} dol_print_error($db);
} }
} else {
dol_print_error($db);
}
} }
/* /*
print "<br>TVA: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n"; print "<br>TVA: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n";
for ($mois = 1 ; $mois <= 12 ; $mois++) for ($mois = 1 ; $mois <= 12 ; $mois++)
{ {
$annee = 2007; $annee = 2007;
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee)); $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee));
print 'Mois '.$mois.': '.$decaiss_ttc[$case].' '; print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
print 'Mois '.$mois.': '.$encaiss_ttc[$case].' '; print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
} }
*/ */
/* /*
* Charges sociales non deductibles * Charges sociales non deductibles
@ -372,26 +372,26 @@ for ($mois = 1 ; $mois <= 12 ; $mois++)
$subtotal_ht = 0; $subtotal_ht = 0;
$subtotal_ttc = 0; $subtotal_ttc = 0;
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
$sql = "SELECT c.libelle as nom, date_format(s.date_ech,'%Y-%m') as dm, sum(s.amount) as amount_ht, sum(s.amount) as amount_ttc"; $sql = "SELECT c.libelle as nom, date_format(s.date_ech,'%Y-%m') as dm, sum(s.amount) as amount_ht, sum(s.amount) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as s"; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as s";
$sql.= " WHERE s.fk_type = c.id"; $sql.= " WHERE s.fk_type = c.id";
$sql.= " AND c.deductible = 0"; $sql.= " AND c.deductible = 0";
if ($year) { if ($year) {
$sql.= " AND s.date_ech between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; $sql.= " AND s.date_ech between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'";
} }
} }
else { else {
$sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount_ht, sum(p.amount) as amount_ttc"; $sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount_ht, sum(p.amount) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as s"; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as s";
$sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p"; $sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p";
$sql.= " WHERE p.fk_charge = s.rowid"; $sql.= " WHERE p.fk_charge = s.rowid";
$sql.= " AND s.fk_type = c.id"; $sql.= " AND s.fk_type = c.id";
$sql.= " AND c.deductible = 0"; $sql.= " AND c.deductible = 0";
if ($year) { if ($year) {
$sql.= " AND p.datep between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; $sql.= " AND p.datep between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'";
} }
} }
$sql.= " AND s.entity = ".$conf->entity; $sql.= " AND s.entity = ".$conf->entity;
$sql.= " GROUP BY c.libelle, dm"; $sql.= " GROUP BY c.libelle, dm";
@ -399,39 +399,39 @@ $sql.= " GROUP BY c.libelle, dm";
$result=$db->query($sql); $result=$db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$var=false; $var=false;
$i = 0; $i = 0;
if ($num) { if ($num) {
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$decaiss[$obj->dm] += $obj->amount_ht;
$decaiss_ttc[$obj->dm] += $obj->amount_ttc;
// For DEBUG Only $decaiss[$obj->dm] += $obj->amount_ht;
if (preg_match('/^2007/',$obj->dm)) $decaiss_ttc[$obj->dm] += $obj->amount_ttc;
{
$subtotal_ht = $subtotal_ht + $obj->amount_ht; // For DEBUG Only
$subtotal_ttc = $subtotal_ttc + $obj->amount_ttc; if (preg_match('/^2007/',$obj->dm))
{
$subtotal_ht = $subtotal_ht + $obj->amount_ht;
$subtotal_ttc = $subtotal_ttc + $obj->amount_ttc;
}
$i++;
} }
}
$i++;
}
}
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
/* /*
print "<br>Charges sociales non deduc: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n"; print "<br>Charges sociales non deduc: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n";
for ($mois = 1 ; $mois <= 12 ; $mois++) for ($mois = 1 ; $mois <= 12 ; $mois++)
{ {
$annee = 2007; $annee = 2007;
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee)); $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee));
print 'Mois '.$mois.': '.$decaiss_ttc[$case].' '; print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
print 'Mois '.$mois.': '.$encaiss_ttc[$case].' '; print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
} }
*/ */
/* /*
* Charges sociales deductibles * Charges sociales deductibles
@ -440,66 +440,66 @@ $subtotal_ht = 0;
$subtotal_ttc = 0; $subtotal_ttc = 0;
if ($modecompta == 'CREANCES-DETTES') if ($modecompta == 'CREANCES-DETTES')
{ {
$sql = "SELECT c.libelle as nom, date_format(s.date_ech,'%Y-%m') as dm, sum(s.amount) as amount_ht, sum(s.amount) as amount_ttc"; $sql = "SELECT c.libelle as nom, date_format(s.date_ech,'%Y-%m') as dm, sum(s.amount) as amount_ht, sum(s.amount) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as s"; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as s";
$sql.= " WHERE s.fk_type = c.id"; $sql.= " WHERE s.fk_type = c.id";
$sql.= " AND c.deductible = 1"; $sql.= " AND c.deductible = 1";
if ($year) { if ($year) {
$sql.= " AND s.date_ech between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; $sql.= " AND s.date_ech between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'";
} }
} }
else else
{ {
$sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount_ht, sum(p.amount) as amount_ttc"; $sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount_ht, sum(p.amount) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as s"; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as s";
$sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p"; $sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p";
$sql.= " WHERE p.fk_charge = s.rowid"; $sql.= " WHERE p.fk_charge = s.rowid";
$sql.= " AND s.fk_type = c.id"; $sql.= " AND s.fk_type = c.id";
$sql.= " AND c.deductible = 1"; $sql.= " AND c.deductible = 1";
if ($year) { if ($year) {
$sql.= " AND p.datep between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; $sql.= " AND p.datep between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'";
} }
} }
$sql.= " AND s.entity = ".$conf->entity; $sql.= " AND s.entity = ".$conf->entity;
$sql.= " GROUP BY c.libelle, dm"; $sql.= " GROUP BY c.libelle, dm";
$result=$db->query($sql); $result=$db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$var=false; $var=false;
$i = 0; $i = 0;
if ($num) { if ($num) {
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$decaiss[$obj->dm] += $obj->amount_ht;
$decaiss_ttc[$obj->dm] += $obj->amount_ttc;
// For DEBUG Only $decaiss[$obj->dm] += $obj->amount_ht;
if (preg_match('/^2007/',$obj->dm)) $decaiss_ttc[$obj->dm] += $obj->amount_ttc;
{
$subtotal_ht = $subtotal_ht + $obj->amount_ht; // For DEBUG Only
$subtotal_ttc = $subtotal_ttc + $obj->amount_ttc; if (preg_match('/^2007/',$obj->dm))
{
$subtotal_ht = $subtotal_ht + $obj->amount_ht;
$subtotal_ttc = $subtotal_ttc + $obj->amount_ttc;
}
$i++;
} }
}
$i++;
}
}
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
/* /*
print "<br>Charges sociales deduc: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n"; print "<br>Charges sociales deduc: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n";
for ($mois = 1 ; $mois <= 12 ; $mois++) for ($mois = 1 ; $mois <= 12 ; $mois++)
{ {
$annee = 2007; $annee = 2007;
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee)); $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee));
print 'Mois '.$mois.': '.$decaiss_ttc[$case].' '; print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
print 'Mois '.$mois.': '.$encaiss_ttc[$case].' '; print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
} }
*/ */
/* /*
@ -513,14 +513,14 @@ print '<tr class="liste_titre"><td rowspan=2>'.$langs->trans("Month").'</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
print '<td align="center" colspan="2"><a href="clientfourn.php?year='.$annee.'">'.$annee.'</a></td>'; print '<td align="center" colspan="2"><a href="clientfourn.php?year='.$annee.'">'.$annee.'</a></td>';
} }
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
print '<td align="right">'.$langs->trans("Outcome").'</td>'; print '<td align="right">'.$langs->trans("Outcome").'</td>';
print '<td align="right">'.$langs->trans("Income").'</td>'; print '<td align="right">'.$langs->trans("Income").'</td>';
} }
print '</tr>'; print '</tr>';
@ -560,9 +560,9 @@ $nbcols=0;
print '<tr class="liste_total"><td>'.$langs->trans("TotalTTC").'</td>'; print '<tr class="liste_total"><td>'.$langs->trans("TotalTTC").'</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
$nbcols+=2; $nbcols+=2;
print '<td align="right">'.(isset($totsorties[$annee])?price($totsorties[$annee]):'&nbsp;').'</td>'; print '<td align="right">'.(isset($totsorties[$annee])?price($totsorties[$annee]):'&nbsp;').'</td>';
print '<td align="right">'.(isset($totentrees[$annee])?price($totentrees[$annee]):'&nbsp;').'</td>'; print '<td align="right">'.(isset($totentrees[$annee])?price($totentrees[$annee]):'&nbsp;').'</td>';
} }
print "</tr>\n"; print "</tr>\n";
@ -576,11 +576,11 @@ $var=!$var;
print '<tr class="liste_total"><td>'.$langs->trans("Profit").'</td>'; print '<tr class="liste_total"><td>'.$langs->trans("Profit").'</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
print '<td align="right" colspan="2"> '; print '<td align="right" colspan="2"> ';
if (isset($totentrees[$annee]) || isset($totsorties[$annee])) { if (isset($totentrees[$annee]) || isset($totsorties[$annee])) {
print price($totentrees[$annee]-$totsorties[$annee]).'</td>'; print price($totentrees[$annee]-$totsorties[$annee]).'</td>';
// print '<td>&nbsp;</td>'; // print '<td>&nbsp;</td>';
} }
} }
print "</tr>\n"; print "</tr>\n";

View File

@ -654,10 +654,10 @@ class Contact extends CommonObject
*/ */
function info($id) function info($id)
{ {
$sql = "SELECT c.rowid, ".$this->db->pdate("c.datec")." as datec, c.fk_user_creat"; $sql = "SELECT c.rowid, c.datec as datec, c.fk_user_creat,";
$sql .= ", ".$this->db->pdate("c.tms")." as tms, c.fk_user_modif"; $sql.= " c.tms as tms, c.fk_user_modif";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$sql .= " WHERE c.rowid = ".$id; $sql.= " WHERE c.rowid = ".$id;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
@ -680,9 +680,8 @@ class Contact extends CommonObject
$this->user_modification = $muser; $this->user_modification = $muser;
} }
$this->date_creation = $obj->datec; $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $obj->tms; $this->date_modification = $this->db->jdate($obj->tms);
} }
$this->db->free($resql); $this->db->free($resql);

View File

@ -1125,8 +1125,8 @@ class Contrat extends CommonObject
*/ */
function info($id) function info($id)
{ {
$sql = "SELECT c.rowid, c.ref, ".$this->db->pdate("datec")." as datec, ".$this->db->pdate("date_cloture")." as date_cloture,"; $sql = "SELECT c.rowid, c.ref, c.datec, c.date_cloture,";
$sql.= $this->db->pdate("c.tms")." as date_modification,"; $sql.= " c.tms as date_modification,";
$sql.= " fk_user_author, fk_user_cloture"; $sql.= " fk_user_author, fk_user_cloture";
$sql.= " FROM ".MAIN_DB_PREFIX."contrat as c"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c";
$sql.= " WHERE c.rowid = ".$id; $sql.= " WHERE c.rowid = ".$id;
@ -1152,9 +1152,9 @@ class Contrat extends CommonObject
$this->user_cloture = $cuser; $this->user_cloture = $cuser;
} }
$this->ref = (! $obj->ref) ? $obj->rowid : $obj->ref; $this->ref = (! $obj->ref) ? $obj->rowid : $obj->ref;
$this->date_creation = $obj->datec; $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $obj->date_modification; $this->date_modification = $this->db->jdate($obj->date_modification);
$this->date_cloture = $obj->date_cloture; $this->date_cloture = $this->db->jdate($obj->date_cloture);
} }
$this->db->free($result); $this->db->free($result);
@ -1529,17 +1529,17 @@ class ContratLigne
$sql = "SELECT"; $sql = "SELECT";
$sql.= " t.rowid,"; $sql.= " t.rowid,";
$sql.= " ".$this->db->pdate('t.tms')." as tms,"; $sql.= " t.tms,";
$sql.= " t.fk_contrat,"; $sql.= " t.fk_contrat,";
$sql.= " t.fk_product,"; $sql.= " t.fk_product,";
$sql.= " t.statut,"; $sql.= " t.statut,";
$sql.= " t.label,"; $sql.= " t.label,";
$sql.= " t.description,"; $sql.= " t.description,";
$sql.= " ".$this->db->pdate('t.date_commande')." as date_commande,"; $sql.= " t.date_commande,";
$sql.= " ".$this->db->pdate('t.date_ouverture_prevue')." as date_ouverture_prevue,"; $sql.= " t.date_ouverture_prevue as date_ouverture_prevue,";
$sql.= " ".$this->db->pdate('t.date_ouverture')." as date_ouverture,"; $sql.= " t.date_ouverture as date_ouverture,";
$sql.= " ".$this->db->pdate('t.date_fin_validite')." as date_fin_validite,"; $sql.= " t.date_fin_validite as date_fin_validite,";
$sql.= " ".$this->db->pdate('t.date_cloture')." as date_cloture,"; $sql.= " t.date_cloture as date_cloture,";
$sql.= " t.tva_tx,"; $sql.= " t.tva_tx,";
$sql.= " t.qty,"; $sql.= " t.qty,";
$sql.= " t.remise_percent,"; $sql.= " t.remise_percent,";
@ -1570,17 +1570,17 @@ class ContratLigne
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->tms = $obj->tms; $this->tms = $this->db->jdate($obj->tms);
$this->fk_contrat = $obj->fk_contrat; $this->fk_contrat = $obj->fk_contrat;
$this->fk_product = $obj->fk_product; $this->fk_product = $obj->fk_product;
$this->statut = $obj->statut; $this->statut = $obj->statut;
$this->label = $obj->label; $this->label = $obj->label;
$this->description = $obj->description; $this->description = $obj->description;
$this->date_commande = $obj->date_commande; $this->date_commande = $this->db->jdate($obj->date_commande);
$this->date_ouverture_prevue = $obj->date_ouverture_prevue; $this->date_ouverture_prevue = $this->db->jdate($obj->date_ouverture_prevue);
$this->date_ouverture = $obj->date_ouverture; $this->date_ouverture = $this->db->jdate($obj->date_ouverture);
$this->date_fin_validite = $obj->date_fin_validite; $this->date_fin_validite = $this->db->jdate($obj->date_fin_validite);
$this->date_cloture = $obj->date_cloture; $this->date_cloture = $this->db->jdate($obj->date_cloture);
$this->tva_tx = $obj->tva_tx; $this->tva_tx = $obj->tva_tx;
$this->qty = $obj->qty; $this->qty = $obj->qty;
$this->remise_percent = $obj->remise_percent; $this->remise_percent = $obj->remise_percent;

View File

@ -166,10 +166,10 @@ class Events // extends CommonObject
$sql = "SELECT"; $sql = "SELECT";
$sql.= " t.rowid,"; $sql.= " t.rowid,";
$sql.= " ".$this->db->pdate('t.tms').","; $sql.= " t.tms,";
$sql.= " t.type,"; $sql.= " t.type,";
$sql.= " t.entity,"; $sql.= " t.entity,";
$sql.= " ".$this->db->pdate('t.dateevent').","; $sql.= " t.dateevent,";
$sql.= " t.description,"; $sql.= " t.description,";
$sql.= " t.ip,"; $sql.= " t.ip,";
$sql.= " t.user_agent"; $sql.= " t.user_agent";
@ -185,10 +185,10 @@ class Events // extends CommonObject
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->tms = $obj->tms; $this->tms = $this->db->jdate($obj->tms);
$this->type = $obj->type; $this->type = $obj->type;
$this->entity = $obj->entity; $this->entity = $obj->entity;
$this->dateevent = $obj->dateevent; $this->dateevent = $this->db->jdate($obj->dateevent);
$this->description = $obj->description; $this->description = $obj->description;
$this->ip = $obj->ip; $this->ip = $obj->ip;
$this->user_agent = $obj->user_agent; $this->user_agent = $obj->user_agent;

View File

@ -426,8 +426,8 @@ class Don extends CommonObject
*/ */
function fetch($rowid) function fetch($rowid)
{ {
$sql = "SELECT d.rowid, ".$this->db->pdate("d.datec")." as datec,"; $sql = "SELECT d.rowid, d.datec,";
$sql.= " ".$this->db->pdate("d.datedon")." as datedon,"; $sql.= " d.datedon,";
$sql.= " d.prenom, d.nom, d.societe, d.amount, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.fk_don_projet,"; $sql.= " d.prenom, d.nom, d.societe, d.amount, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.fk_don_projet,";
$sql.= " p.title as projet"; $sql.= " p.title as projet";
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement as cp, ".MAIN_DB_PREFIX."don as d"; $sql.= " FROM ".MAIN_DB_PREFIX."c_paiement as cp, ".MAIN_DB_PREFIX."don as d";
@ -445,8 +445,8 @@ class Don extends CommonObject
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->datec = $obj->datec; $this->datec = $this->db->jdate($obj->datec);
$this->date = $obj->datedon; $this->date = $this->db->jdate($obj->datedon);
$this->prenom = $obj->prenom; $this->prenom = $obj->prenom;
$this->nom = $obj->nom; $this->nom = $obj->nom;
$this->societe = $obj->societe; $this->societe = $obj->societe;

View File

@ -227,7 +227,7 @@ class Expedition extends CommonObject
$sql = "SELECT e.rowid, e.fk_soc as socid, e.date_creation, e.ref, e.fk_user_author, e.fk_statut"; $sql = "SELECT e.rowid, e.fk_soc as socid, e.date_creation, e.ref, e.fk_user_author, e.fk_statut";
$sql.= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height"; $sql.= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
$sql.= ", ".$this->db->pdate("e.date_expedition")." as date_expedition, e.model_pdf, e.fk_adresse_livraison"; $sql.= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_adresse_livraison";
$sql.= ", e.fk_expedition_methode, e.tracking_number"; $sql.= ", e.fk_expedition_methode, e.tracking_number";
$sql.= ", el.fk_source as origin_id"; $sql.= ", el.fk_source as origin_id";
$sql.= ", ori.ref_client"; $sql.= ", ori.ref_client";
@ -263,7 +263,7 @@ class Expedition extends CommonObject
$this->origin_id = $obj->origin_id; $this->origin_id = $obj->origin_id;
$this->livraison_id = $obj->livraison_id; $this->livraison_id = $obj->livraison_id;
$this->user_author_id = $obj->fk_user_author; $this->user_author_id = $obj->fk_user_author;
$this->date = $obj->date_expedition; $this->date = $this->db->jdate($obj->date_expedition);
$this->adresse_livraison_id = $obj->fk_adresse_livraison; // TODO obsolete $this->adresse_livraison_id = $obj->fk_adresse_livraison; // TODO obsolete
$this->fk_delivery_address = $obj->fk_adresse_livraison; $this->fk_delivery_address = $obj->fk_adresse_livraison;
$this->modelpdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf;

View File

@ -545,11 +545,11 @@ class Facture extends CommonObject
global $conf; global $conf;
$sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.type,f.fk_soc,f.amount,f.tva,f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise'; $sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.type,f.fk_soc,f.amount,f.tva,f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise';
$sql.= ','.$this->db->pdate('f.datef').' as df'; $sql.= ', f.datef as df';
$sql.= ','.$this->db->pdate('f.date_lim_reglement').' as dlr'; $sql.= ', f.date_lim_reglement as dlr';
$sql.= ','.$this->db->pdate('f.datec').' as datec'; $sql.= ', f.datec as datec';
$sql.= ','.$this->db->pdate('f.date_valid').' as datev'; $sql.= ', f.date_valid as datev';
$sql.= ','.$this->db->pdate('f.tms').' as datem'; $sql.= ', f.tms as datem';
$sql.= ', f.note, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf'; $sql.= ', f.note, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf';
$sql.= ', f.fk_facture_source'; $sql.= ', f.fk_facture_source';
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet'; $sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet';
@ -576,9 +576,9 @@ class Facture extends CommonObject
$this->ref = $obj->facnumber; $this->ref = $obj->facnumber;
$this->ref_client = $obj->ref_client; $this->ref_client = $obj->ref_client;
$this->type = $obj->type; $this->type = $obj->type;
$this->date = $obj->df; $this->date = $this->db->jdate($obj->df);
$this->date_creation = $obj->datec; $this->date_creation = $this->db->jdate($obj->datec);
$this->date_validation = $obj->datev; $this->date_validation = $this->db->jdate($obj->datev);
$this->datem = $this->db->jdate($obj->datem); $this->datem = $this->db->jdate($obj->datem);
$this->amount = $obj->amount; $this->amount = $obj->amount;
$this->remise_percent = $obj->remise_percent; $this->remise_percent = $obj->remise_percent;
@ -592,7 +592,7 @@ class Facture extends CommonObject
$this->close_note = $obj->close_note; $this->close_note = $obj->close_note;
$this->socid = $obj->fk_soc; $this->socid = $obj->fk_soc;
$this->statut = $obj->fk_statut; $this->statut = $obj->fk_statut;
$this->date_lim_reglement = $obj->dlr; $this->date_lim_reglement = $this->db->jdate($obj->dlr);
$this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code; $this->mode_reglement_code = $obj->mode_reglement_code;
$this->mode_reglement = $obj->mode_reglement_libelle; $this->mode_reglement = $obj->mode_reglement_libelle;
@ -666,7 +666,7 @@ class Facture extends CommonObject
{ {
$sql = 'SELECT l.rowid, l.fk_product, l.description, l.product_type, l.price, l.qty, l.tva_taux, '; $sql = 'SELECT l.rowid, l.fk_product, l.description, l.product_type, l.price, l.qty, l.tva_taux, ';
$sql.= ' l.remise, l.remise_percent, l.fk_remise_except, l.subprice,'; $sql.= ' l.remise, l.remise_percent, l.fk_remise_except, l.subprice,';
$sql.= ' '.$this->db->pdate('l.date_start').' as date_start,'.$this->db->pdate('l.date_end').' as date_end,'; $sql.= ' l.date_start as date_start, l.date_end as date_end,';
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_ttc, l.fk_code_ventilation, l.fk_export_compta,'; $sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_ttc, l.fk_code_ventilation, l.fk_export_compta,';
$sql.= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as label, p.description as product_desc'; $sql.= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as label, p.description as product_desc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l';
@ -699,10 +699,10 @@ class Facture extends CommonObject
$faclig->fk_remise_except = $objp->fk_remise_except; $faclig->fk_remise_except = $objp->fk_remise_except;
$faclig->produit_id = $objp->fk_product; $faclig->produit_id = $objp->fk_product;
$faclig->fk_product = $objp->fk_product; $faclig->fk_product = $objp->fk_product;
$faclig->date_start = $objp->date_start; $faclig->date_start = $this->db->jdate($objp->date_start);
$faclig->date_end = $objp->date_end; $faclig->date_end = $this->db->jdate($objp->date_end);
$faclig->date_start = $objp->date_start; $faclig->date_start = $this->db->jdate($objp->date_start);
$faclig->date_end = $objp->date_end; $faclig->date_end = $this->db->jdate($objp->date_end);
$faclig->info_bits = $objp->info_bits; $faclig->info_bits = $objp->info_bits;
$faclig->total_ht = $objp->total_ht; $faclig->total_ht = $objp->total_ht;
$faclig->total_tva = $objp->total_tva; $faclig->total_tva = $objp->total_tva;
@ -2865,7 +2865,7 @@ class FactureLigne
{ {
$sql = 'SELECT fd.rowid, fd.fk_facture, fd.fk_product, fd.product_type, fd.description, fd.price, fd.qty, fd.tva_taux,'; $sql = 'SELECT fd.rowid, fd.fk_facture, fd.fk_product, fd.product_type, fd.description, fd.price, fd.qty, fd.tva_taux,';
$sql.= ' fd.remise, fd.remise_percent, fd.fk_remise_except, fd.subprice,'; $sql.= ' fd.remise, fd.remise_percent, fd.fk_remise_except, fd.subprice,';
$sql.= ' '.$this->db->pdate('fd.date_start').' as date_start,'.$this->db->pdate('fd.date_end').' as date_end,'; $sql.= ' fd.date_start as date_start, fd.date_end as date_end,';
$sql.= ' fd.info_bits, fd.total_ht, fd.total_tva, fd.total_ttc, fd.rang,'; $sql.= ' fd.info_bits, fd.total_ht, fd.total_tva, fd.total_ttc, fd.rang,';
$sql.= ' fd.fk_code_ventilation, fd.fk_export_compta,'; $sql.= ' fd.fk_code_ventilation, fd.fk_export_compta,';
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc'; $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc';
@ -2887,8 +2887,8 @@ class FactureLigne
$this->produit_id = $objp->fk_product; // Ne plus utiliser $this->produit_id = $objp->fk_product; // Ne plus utiliser
$this->fk_product = $objp->fk_product; $this->fk_product = $objp->fk_product;
$this->product_type = $objp->product_type; $this->product_type = $objp->product_type;
$this->date_start = $objp->date_start; $this->date_start = $this->db->jdate($objp->date_start);
$this->date_end = $objp->date_end; $this->date_end = $this->db->jdate($objp->date_end);
$this->info_bits = $objp->info_bits; $this->info_bits = $objp->info_bits;
$this->total_ht = $objp->total_ht; $this->total_ht = $objp->total_ht;
$this->total_tva = $objp->total_tva; $this->total_tva = $objp->total_tva;

View File

@ -186,9 +186,9 @@ class Fichinter extends CommonObject
function fetch($rowid,$ref='') function fetch($rowid,$ref='')
{ {
$sql = "SELECT rowid, ref, description, fk_soc, fk_statut,"; $sql = "SELECT rowid, ref, description, fk_soc, fk_statut,";
$sql.= " ".$this->db->pdate("datec")." as datec,"; $sql.= " datec,";
$sql.= " ".$this->db->pdate("date_valid")." as datev,"; $sql.= " as datev,";
$sql.= " ".$this->db->pdate("tms")." as datem,"; $sql.= " datem,";
$sql.= " duree, fk_projet, note_public, note_private, model_pdf"; $sql.= " duree, fk_projet, note_public, note_private, model_pdf";
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f"; $sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f";
if ($ref) $sql.= " WHERE f.ref='".$ref."'"; if ($ref) $sql.= " WHERE f.ref='".$ref."'";
@ -208,9 +208,9 @@ class Fichinter extends CommonObject
$this->socid = $obj->fk_soc; $this->socid = $obj->fk_soc;
$this->statut = $obj->fk_statut; $this->statut = $obj->fk_statut;
$this->duree = $obj->duree; $this->duree = $obj->duree;
$this->datec = $obj->datec; $this->datec = $this->db->jdate($obj->datec);
$this->datev = $obj->datev; $this->datev = $this->db->jdate($obj->datev);
$this->datem = $obj->datem; $this->datem = $this->db->jdate($obj->datem);
$this->projetidp = $obj->fk_projet; $this->projetidp = $obj->fk_projet;
$this->projet_id = $obj->fk_projet; $this->projet_id = $obj->fk_projet;
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
@ -449,11 +449,11 @@ class Fichinter extends CommonObject
{ {
global $conf; global $conf;
$sql = "SELECT f.rowid, "; $sql = "SELECT f.rowid,";
$sql.= $this->db->pdate("f.datec")." as datec"; $sql.= " datec,";
$sql.= ", ".$this->db->pdate("f.date_valid")." as datev"; $sql.= " f.date_valid as datev,";
$sql.= ", f.fk_user_author"; $sql.= " f.fk_user_author,";
$sql.= ", f.fk_user_valid"; $sql.= " f.fk_user_valid";
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f"; $sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f";
$sql.= " WHERE f.rowid = ".$id; $sql.= " WHERE f.rowid = ".$id;
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
@ -468,8 +468,8 @@ class Fichinter extends CommonObject
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->date_creation = $obj->datec; $this->date_creation = $this->db->jdate($obj->datec);
$this->date_validation = $obj->datev; $this->date_validation = $this->db->jdate($obj->datev);
$cuser = new User($this->db, $obj->fk_user_author); $cuser = new User($this->db, $obj->fk_user_author);
$cuser->fetch(); $cuser->fetch();
@ -818,7 +818,7 @@ class FichinterLigne
function fetch($rowid) function fetch($rowid)
{ {
$sql = 'SELECT ft.rowid, ft.fk_fichinter, ft.description, ft.duree, ft.rang,'; $sql = 'SELECT ft.rowid, ft.fk_fichinter, ft.description, ft.duree, ft.rang,';
$sql.= ' '.$this->db->pdate('ft.date').' as datei'; $sql.= ' ft.date as datei';
$sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft';
$sql.= ' WHERE ft.rowid = '.$rowid; $sql.= ' WHERE ft.rowid = '.$rowid;
@ -829,7 +829,7 @@ class FichinterLigne
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$this->rowid = $objp->rowid; $this->rowid = $objp->rowid;
$this->fk_fichinter = $objp->fk_fichinter; $this->fk_fichinter = $objp->fk_fichinter;
$this->datei = $objp->datei; $this->datei = $this->db->jdate($objp->datei);
$this->desc = $objp->description; $this->desc = $objp->description;
$this->duration = $objp->duree; $this->duration = $objp->duree;
$this->rang = $objp->rang; $this->rang = $objp->rang;

View File

@ -73,7 +73,7 @@ class PaiementFourn
*/ */
function fetch($id) function fetch($id)
{ {
$sql = 'SELECT p.rowid,'.$this->db->pdate('p.datep').' as dp, p.amount, p.statut, p.fk_bank,'; $sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank,';
$sql.= ' c.libelle as paiement_type,'; $sql.= ' c.libelle as paiement_type,';
$sql.= ' p.num_paiement, p.note, b.fk_account'; $sql.= ' p.num_paiement, p.note, b.fk_account';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiementfourn as p'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiementfourn as p';
@ -89,7 +89,7 @@ class PaiementFourn
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->date = $obj->dp; $this->date = $this->db->jdate($obj->dp);
$this->numero = $obj->num_paiement; $this->numero = $obj->num_paiement;
$this->bank_account = $obj->fk_account; $this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank; $this->bank_line = $obj->fk_bank;
@ -342,10 +342,9 @@ class PaiementFourn
*/ */
function info($id) function info($id)
{ {
$sql = 'SELECT c.rowid, '.$this->db->pdate('datec').' as datec, fk_user_author'; $sql = 'SELECT c.rowid, datec, fk_user_author, tms';
$sql .= ', '.$this->db->pdate('tms').' as tms'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as c';
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as c'; $sql.= ' WHERE c.rowid = '.$id;
$sql .= ' WHERE c.rowid = '.$id;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@ -367,8 +366,8 @@ class PaiementFourn
$muser->fetch(); $muser->fetch();
$this->user_modification = $muser; $this->user_modification = $muser;
} }
$this->date_creation = $obj->datec; $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $obj->tms; $this->date_modification = $this->db->jdate($obj->tms);
} }
$this->db->free($resql); $this->db->free($resql);
} }
@ -538,7 +537,7 @@ class PaiementFourn
$sql = "UPDATE ".MAIN_DB_PREFIX."paiementfourn"; $sql = "UPDATE ".MAIN_DB_PREFIX."paiementfourn";
$sql.= " SET datep = ".$this->db->idate($date); $sql.= " SET datep = ".$this->db->idate($date);
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
dol_syslog("PaiementFourn::update_date sql=".$sql); dol_syslog("PaiementFourn::update_date sql=".$sql);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)

View File

@ -57,7 +57,7 @@ class CommandeFournisseur extends Commande
{ {
$this->db = $DB; $this->db = $DB;
$this->products = array(); $this->products = array();
// List of language codes for status // List of language codes for status
$this->statuts[0] = 'StatusOrderDraft'; $this->statuts[0] = 'StatusOrderDraft';
$this->statuts[1] = 'StatusOrderValidated'; $this->statuts[1] = 'StatusOrderValidated';
@ -81,7 +81,7 @@ class CommandeFournisseur extends Commande
global $conf; global $conf;
$sql = "SELECT c.rowid, c.ref, c.date_creation, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva,"; $sql = "SELECT c.rowid, c.ref, c.date_creation, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva,";
$sql.= " ".$this->db->pdate("c.date_commande")." as date_commande, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_methode_commande,"; $sql.= " c.date_commande as date_commande, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_methode_commande,";
$sql.= " c.note, c.note_public, c.model_pdf,"; $sql.= " c.note, c.note_public, c.model_pdf,";
$sql.= " cm.libelle as methode_commande"; $sql.= " cm.libelle as methode_commande";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
@ -105,8 +105,8 @@ class CommandeFournisseur extends Commande
$this->total_ht = $obj->total_ht; $this->total_ht = $obj->total_ht;
$this->total_tva = $obj->tva; $this->total_tva = $obj->tva;
$this->total_ttc = $obj->total_ttc; $this->total_ttc = $obj->total_ttc;
$this->date_commande = $obj->date_commande; // date a laquelle la commande a ete transmise $this->date_commande = $this->db->jdate($obj->date_commande); // date a laquelle la commande a ete transmise
$this->date = $obj->date_creation; $this->date = $this->db->jdate($obj->date_creation);
$this->remise_percent = $obj->remise_percent; $this->remise_percent = $obj->remise_percent;
$this->methode_commande_id = $obj->fk_methode_commande; $this->methode_commande_id = $obj->fk_methode_commande;
$this->methode_commande = $obj->methode_commande; $this->methode_commande = $obj->methode_commande;

View File

@ -216,10 +216,10 @@ class FactureFournisseur extends Facture
{ {
global $conf; global $conf;
$sql = 'SELECT libelle, facnumber, amount, remise, '.$this->db->pdate(datef).'as df,'; $sql = 'SELECT libelle, facnumber, amount, remise, datef as df,';
$sql.= ' total_ht, total_tva, total_ttc, fk_user_author,'; $sql.= ' total_ht, total_tva, total_ttc, fk_user_author,';
$sql.= ' fk_statut, fk_projet as fk_project, paye, f.note, f.note_public,'; $sql.= ' fk_statut, fk_projet as fk_project, paye, f.note, f.note_public,';
$sql.= ' '.$this->db->pdate('date_lim_reglement').'as de,'; $sql.= ' date_lim_reglement as de,';
$sql.= ' s.nom as socnom, s.rowid as socid'; $sql.= ' s.nom as socnom, s.rowid as socid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f,'.MAIN_DB_PREFIX.'societe as s'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f,'.MAIN_DB_PREFIX.'societe as s';
$sql.= ' WHERE f.rowid='.$rowid.' AND f.fk_soc = s.rowid'; $sql.= ' WHERE f.rowid='.$rowid.' AND f.fk_soc = s.rowid';
@ -239,9 +239,9 @@ class FactureFournisseur extends Facture
$this->type = 0; $this->type = 0;
$this->datep = $obj->df; $this->datep = $this->db->jdate($obj->df);
$this->date = $obj->df; $this->date = $this->db->jdate($obj->df);
$this->date_echeance = $obj->de; $this->date_echeance = $this->db->jdate($obj->de);
$this->libelle = $obj->libelle; $this->libelle = $obj->libelle;
$this->remise = $obj->remise; $this->remise = $obj->remise;

View File

@ -31,7 +31,7 @@ class FormActions
{ {
var $db; var $db;
var $error; var $error;
/** /**
* \brief Constructeur * \brief Constructeur
@ -40,7 +40,7 @@ class FormActions
function FormActions($DB) function FormActions($DB)
{ {
$this->db = $DB; $this->db = $DB;
return 1; return 1;
} }
@ -85,7 +85,7 @@ class FormActions
} }
} }
/** /**
* \brief Show list of actions for element * \brief Show list of actions for element
* \param object Object * \param object Object
@ -97,8 +97,8 @@ class FormActions
{ {
global $langs,$conf,$user; global $langs,$conf,$user;
global $bc; global $bc;
$sql = 'SELECT a.id, '.$this->db->pdate('a.datep').' as da, a.label, a.note,'; $sql = 'SELECT a.id, a.datep as da, a.label, a.note,';
$sql.= ' u.login'; $sql.= ' u.login';
$sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'user as u'; $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'user as u';
$sql.= ' WHERE a.fk_user_author = u.rowid'; $sql.= ' WHERE a.fk_user_author = u.rowid';
@ -133,7 +133,7 @@ class FormActions
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.'</a></td>'; print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.'</a></td>';
print '<td>'.dol_print_date($objp->da,'day').'</td>'; print '<td>'.dol_print_date($this->db->jdate($objp->da),'day').'</td>';
print '<td title="'.dol_escape_htmltag($objp->label).'">'.dol_trunc($objp->label,32).'</td>'; print '<td title="'.dol_escape_htmltag($objp->label).'">'.dol_trunc($objp->label,32).'</td>';
print '<td>'.$objp->login.'</td>'; print '<td>'.$objp->login.'</td>';
print '</tr>'; print '</tr>';
@ -141,7 +141,7 @@ class FormActions
} }
print '</table>'; print '</table>';
} }
return $num; return $num;
} }
else else
@ -151,10 +151,10 @@ class FormActions
} }
} }
/** /**
* \brief Retourne la liste des types de comptes financiers * \brief Retourne la liste des types de comptes financiers
* \param selected Type pr<EFBFBD>-s<EFBFBD>lectionn<EFBFBD> * \param selected Type pre-selectionne
* \param htmlname Nom champ formulaire * \param htmlname Nom champ formulaire
*/ */
function select_type_actions($selected='',$htmlname='actioncode') function select_type_actions($selected='',$htmlname='actioncode')
@ -165,7 +165,7 @@ class FormActions
require_once(DOL_DOCUMENT_ROOT."/html.form.class.php"); require_once(DOL_DOCUMENT_ROOT."/html.form.class.php");
$caction=new CActionComm($this->db); $caction=new CActionComm($this->db);
$form=new Form($this->db); $form=new Form($this->db);
$arraylist=$caction->liste_array(1,'code'); $arraylist=$caction->liste_array(1,'code');
$arraylist[0]='&nbsp;'; $arraylist[0]='&nbsp;';
asort($arraylist); asort($arraylist);
@ -173,5 +173,5 @@ class FormActions
$form->select_array($htmlname, $arraylist, $selected); $form->select_array($htmlname, $arraylist, $selected);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
} }
} }

View File

@ -250,7 +250,7 @@ class Livraison extends CommonObject
$sql = "SELECT l.rowid, l.fk_soc, l.date_creation, l.date_valid, l.ref, l.ref_client, l.fk_user_author,"; $sql = "SELECT l.rowid, l.fk_soc, l.date_creation, l.date_valid, l.ref, l.ref_client, l.fk_user_author,";
$sql.=" l.total_ht, l.fk_statut, l.fk_expedition, l.fk_user_valid, l.note, l.note_public"; $sql.=" l.total_ht, l.fk_statut, l.fk_expedition, l.fk_user_valid, l.note, l.note_public";
$sql.= ", ".$this->db->pdate("l.date_livraison")." as date_livraison, l.fk_adresse_livraison, l.model_pdf"; $sql.= ", l.date_livraison as date_livraison, l.fk_adresse_livraison, l.model_pdf";
$sql.= ", el.fk_source as origin_id"; $sql.= ", el.fk_source as origin_id";
$sql.= " FROM ".MAIN_DB_PREFIX."livraison as l"; $sql.= " FROM ".MAIN_DB_PREFIX."livraison as l";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON l.rowid = el.fk_target"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON l.rowid = el.fk_target";
@ -265,9 +265,9 @@ class Livraison extends CommonObject
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->date_livraison = $obj->date_livraison; $this->date_livraison = $this->db->jdate($obj->date_livraison);
$this->date_creation = $obj->date_creation; $this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_valid = $obj->date_valid; $this->date_valid = $this->db->jdate($obj->date_valid);
$this->ref = $obj->ref; $this->ref = $obj->ref;
$this->ref_client = $obj->ref_client; $this->ref_client = $obj->ref_client;
$this->socid = $obj->fk_soc; $this->socid = $obj->fk_soc;

View File

@ -69,7 +69,7 @@ class Paiement
*/ */
function fetch($id) function fetch($id)
{ {
$sql = 'SELECT p.rowid,'.$this->db->pdate('p.datep').' as dp, p.amount, p.statut, p.fk_bank'; $sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank';
$sql.= ', c.code as type_code, c.libelle as type_libelle'; $sql.= ', c.code as type_code, c.libelle as type_libelle';
$sql.= ', p.num_paiement, p.note, b.fk_account'; $sql.= ', p.num_paiement, p.note, b.fk_account';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p';
@ -87,8 +87,8 @@ class Paiement
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->date = $obj->dp; $this->date = $this->db->jdate($obj->dp);
$this->datepaye = $obj->dp; $this->datepaye = $this->db->jdate($obj->dp);
$this->numero = $obj->num_paiement; $this->numero = $obj->num_paiement;
$this->bank_account = $obj->fk_account; $this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank; $this->bank_line = $obj->fk_bank;
@ -337,10 +337,10 @@ class Paiement
*/ */
function info($id) function info($id)
{ {
$sql = 'SELECT c.rowid, '.$this->db->pdate('datec').' as datec, fk_user_creat, fk_user_modif'; $sql = 'SELECT c.rowid, c.datec, c.fk_user_creat, c.fk_user_modif,';
$sql .= ', '.$this->db->pdate('tms').' as tms'; $sql.= ' c.tms';
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement as c'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as c';
$sql .= ' WHERE c.rowid = '.$id; $sql.= ' WHERE c.rowid = '.$id;
dol_syslog('Paiement::info sql='.$sql); dol_syslog('Paiement::info sql='.$sql);
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -363,8 +363,8 @@ class Paiement
$muser->fetch(); $muser->fetch();
$this->user_modification = $muser; $this->user_modification = $muser;
} }
$this->date_creation = $obj->datec; $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $obj->tms; $this->date_modification = $this->db->jdate($obj->tms);
} }
$this->db->free($result); $this->db->free($result);
} }

View File

@ -100,7 +100,7 @@ else
} }
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,';
$sql.= ' p.fk_product_type, '.$db->pdate('p.tms').' as datem,'; $sql.= ' p.fk_product_type, p.tms as datem,';
$sql.= ' p.duration, p.envente as statut, p.seuil_stock_alerte'; $sql.= ' p.duration, p.envente as statut, p.seuil_stock_alerte';
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
if ($conf->categorie->enabled && ($catid || !$user->rights->categorie->voir)) if ($conf->categorie->enabled && ($catid || !$user->rights->categorie->voir))
@ -340,7 +340,7 @@ if ($resql)
} }
// Date // Date
print '<td align="center">'.dol_print_date($objp->datem,'day')."</td>\n"; print '<td align="center">'.dol_print_date($this->db->jdate($objp->datem),'day')."</td>\n";
// Duration // Duration
if ($conf->service->enabled && $type != 0) if ($conf->service->enabled && $type != 0)

View File

@ -180,17 +180,17 @@ class Entrepot extends CommonObject
$sql.= " WHERE fk_entrepot = " . $this->id; $sql.= " WHERE fk_entrepot = " . $this->id;
dol_syslog("Entrepot::delete sql=".$sql); dol_syslog("Entrepot::delete sql=".$sql);
$resql1=$this->db->query($sql); $resql1=$this->db->query($sql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_stock"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_stock";
$sql.= " WHERE fk_entrepot = " . $this->id; $sql.= " WHERE fk_entrepot = " . $this->id;
dol_syslog("Entrepot::delete sql=".$sql); dol_syslog("Entrepot::delete sql=".$sql);
$resql2=$this->db->query($sql); $resql2=$this->db->query($sql);
if ($resql1 && $resql2) if ($resql1 && $resql2)
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."entrepot"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."entrepot";
$sql.= " WHERE rowid = " . $this->id; $sql.= " WHERE rowid = " . $this->id;
dol_syslog("Entrepot::delete sql=".$sql); dol_syslog("Entrepot::delete sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
@ -213,7 +213,7 @@ class Entrepot extends CommonObject
dol_syslog("Entrepot::delete ".$this->error, LOG_ERR); dol_syslog("Entrepot::delete ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@ -276,8 +276,8 @@ class Entrepot extends CommonObject
*/ */
function info($id) function info($id)
{ {
$sql = "SELECT e.rowid, ".$this->db->pdate("datec")." as datec,"; $sql = "SELECT e.rowid, e.datec,";
$sql .= " ".$this->db->pdate("tms")." as datem,"; $sql .= " e.datem,";
$sql .= " fk_user_author"; $sql .= " fk_user_author";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql .= " WHERE e.rowid = ".$id; $sql .= " WHERE e.rowid = ".$id;
@ -303,8 +303,8 @@ class Entrepot extends CommonObject
$this->user_validation = $vuser; $this->user_validation = $vuser;
} }
$this->date_creation = $obj->datec; $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $obj->datem; $this->date_modification = $this->db->jdate($obj->datem);
} }

View File

@ -69,7 +69,7 @@ $projectstatic = new Project($db);
$userstatic = new User($db); $userstatic = new User($db);
$staticsoc=new Societe($db); $staticsoc=new Societe($db);
$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, ".$db->pdate("p.dateo")." as do, p.fk_user_resp,"; $sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.dateo as do, p.fk_user_resp,";
$sql.= " u.login,"; $sql.= " u.login,";
$sql.= " s.nom, s.rowid as socid, s.client"; $sql.= " s.nom, s.rowid as socid, s.client";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";

View File

@ -1514,7 +1514,7 @@ class Propal extends CommonObject
} }
} }
$sql= "SELECT rowid as facid, facnumber, total,".$this->db->pdate("datef")." as df, fk_user_author, fk_statut, paye"; $sql= "SELECT rowid as facid, facnumber, total, datef as df, fk_user_author, fk_statut, paye";
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE rowid IN (".implode(',',$linkedInvoices).")"; $sql.= " WHERE rowid IN (".implode(',',$linkedInvoices).")";
@ -1692,8 +1692,8 @@ class Propal extends CommonObject
function info($id) function info($id)
{ {
$sql = "SELECT c.rowid, "; $sql = "SELECT c.rowid, ";
$sql.= $this->db->pdate("datec")." as datec, ".$this->db->pdate("date_valid")." as datev, ".$this->db->pdate("date_cloture")." as dateo"; $sql.= " c.datec, c.date_valid as datev, c.date_cloture as dateo,";
$sql.= ", fk_user_author, fk_user_valid, fk_user_cloture"; $sql.= " c.fk_user_author, c.fk_user_valid, c.fk_user_cloture";
$sql.= " FROM ".MAIN_DB_PREFIX."propal as c"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as c";
$sql.= " WHERE c.rowid = ".$id; $sql.= " WHERE c.rowid = ".$id;
@ -1707,9 +1707,9 @@ class Propal extends CommonObject
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->date_creation = $obj->datec; $this->date_creation = $this->db->jdate($obj->datec);
$this->date_validation = $obj->datev; $this->date_validation = $this->db->jdate($obj->datev);
$this->date_cloture = $obj->dateo; $this->date_cloture = $this->db->jdate($obj->dateo);
$cuser = new User($this->db, $obj->fk_user_author); $cuser = new User($this->db, $obj->fk_user_author);
$cuser->fetch(); $cuser->fetch();

View File

@ -39,9 +39,9 @@ $langs->load("donations");
* View * View
*/ */
$sql = "SELECT ".$db->pdate("d.datedon")." as datedon, d.nom, d.prenom, d.amount, d.public, d.societe"; $sql = "SELECT d.datedon as datedon, d.nom, d.prenom, d.amount, d.public, d.societe";
$sql .= " FROM ".MAIN_DB_PREFIX."don as d"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d";
$sql .= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC"; $sql.= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC";
if ( $db->query( $sql) ) if ( $db->query( $sql) )
{ {
@ -69,13 +69,13 @@ if ( $db->query( $sql) )
print "<TR $bc[$var]>"; print "<TR $bc[$var]>";
if ($objp->public) if ($objp->public)
{ {
print "<td>".stripslashes($objp->prenom)." ".stripslashes($objp->nom)." ".stripslashes($objp->societe)."</td>\n"; print "<td>".$objp->prenom." ".$objp->nom." ".$objp->societe."</td>\n";
} }
else else
{ {
print "<td>Anonyme Anonyme</td>\n"; print "<td>Anonyme Anonyme</td>\n";
} }
print "<td>".dol_print_date($objp->datedon)."</td>\n"; print "<td>".dol_print_date($this->db->jdate($objp->datedon))."</td>\n";
print '<td align="right">'.number_format($objp->amount,2,'.',' ').' '.$langs->trans("Currency".$conf->monnaie).'</td>'; print '<td align="right">'.number_format($objp->amount,2,'.',' ').' '.$langs->trans("Currency".$conf->monnaie).'</td>';
print "</tr>"; print "</tr>";
$i++; $i++;

View File

@ -102,6 +102,9 @@ class Societe extends CommonObject
var $price_level; var $price_level;
var $datec;
var $date_update;
var $commercial_id; //Id du commercial affecte var $commercial_id; //Id du commercial affecte
var $import_key; var $import_key;
@ -532,9 +535,9 @@ class Societe extends CommonObject
} }
} }
$sql = 'SELECT s.rowid, s.nom, s.entity, s.address,'.$this->db->pdate('s.datec').' as dc, s.prefix_comm'; $sql = 'SELECT s.rowid, s.nom, s.entity, s.address, s.datec as dc, s.prefix_comm';
$sql .= ', s.price_level'; $sql .= ', s.price_level';
$sql .= ','. $this->db->pdate('s.tms').' as date_update'; $sql .= ', s.tms as date_update';
$sql .= ', s.tel, s.fax, s.email, s.url, s.cp, s.ville, s.note, s.client, s.fournisseur'; $sql .= ', s.tel, s.fax, s.email, s.url, s.cp, s.ville, s.note, s.client, s.fournisseur';
$sql .= ', s.siren, s.siret, s.ape, s.idprof4'; $sql .= ', s.siren, s.siret, s.ape, s.idprof4';
$sql .= ', s.capital, s.tva_intra'; $sql .= ', s.capital, s.tva_intra';
@ -580,7 +583,8 @@ class Societe extends CommonObject
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->entity = $obj->entity; $this->entity = $obj->entity;
$this->date_update = $obj->date_update; $this->datec = $this->db->jdate($obj->datec);
$this->date_update = $this->db->jdate($obj->date_update);
$this->nom = $obj->nom; $this->nom = $obj->nom;
$this->address = $obj->address; $this->address = $obj->address;
@ -640,7 +644,7 @@ class Societe extends CommonObject
$this->prefix_comm = $obj->prefix_comm; $this->prefix_comm = $obj->prefix_comm;
$this->remise_client = $obj->remise_client; $this->remise_client = $obj->remise_client;
$this->mode_reglement = $obj->mode_reglement; $this->mode_reglement = $obj->mode_reglement;
$this->cond_reglement = $obj->cond_reglement; $this->cond_reglement = $obj->cond_reglement;
$this->client = $obj->client; $this->client = $obj->client;
@ -686,7 +690,7 @@ class Societe extends CommonObject
global $conf,$langs; global $conf,$langs;
$sql = "SELECT l.rowid, l.label, l.fk_societe, l.nom, l.address, l.cp"; $sql = "SELECT l.rowid, l.label, l.fk_societe, l.nom, l.address, l.cp";
$sql .= ", ".$this->db->pdate("l.tms")."as dm, ".$this->db->pdate("l.datec")."as dc"; $sql .= ", l.tms as dm, l.datec as dc";
$sql .= ", l.ville, l.fk_pays, l.note, l.tel, l.fax"; $sql .= ", l.ville, l.fk_pays, l.note, l.tel, l.fax";
$sql .= ", p.libelle as pays, p.code as pays_code, s.nom as socname"; $sql .= ", p.libelle as pays, p.code as pays_code, s.nom as socname";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_adresse_livraison as l"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_adresse_livraison as l";
@ -701,8 +705,8 @@ class Societe extends CommonObject
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->datec = $obj->dc; $this->datec = $this->db->jdate($obj->dc);
$this->datem = $obj->dm; $this->datem = $this->db->jdate($obj->dm);
$this->label = $obj->label; $this->label = $obj->label;
$this->socid = $obj->fk_societe; $this->socid = $obj->fk_societe;
$this->societe = $obj->socname; $this->societe = $obj->socname;
@ -1829,7 +1833,7 @@ class Societe extends CommonObject
*/ */
function info($id) function info($id)
{ {
$sql = "SELECT s.rowid, s.nom, ".$this->db->pdate("datec")." as datec, ".$this->db->pdate("datea")." as datea,"; $sql = "SELECT s.rowid, s.nom, s.datec, s.datea,";
$sql.= " fk_user_creat, fk_user_modif"; $sql.= " fk_user_creat, fk_user_modif";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE s.rowid = ".$id; $sql.= " WHERE s.rowid = ".$id;
@ -1855,8 +1859,8 @@ class Societe extends CommonObject
$this->user_modification = $muser; $this->user_modification = $muser;
} }
$this->ref = $obj->nom; $this->ref = $obj->nom;
$this->date_creation = $obj->datec; $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $obj->datea; $this->date_modification = $this->db->jdate($obj->datea);
} }
$this->db->free($result); $this->db->free($result);

View File

@ -153,7 +153,7 @@ if ($_GET['delsoc']) print '<div class="warning">'.$langs->trans("CompanyDeleted
*/ */
$title=$langs->trans("ListOfThirdParties"); $title=$langs->trans("ListOfThirdParties");
$sql = "SELECT s.rowid, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea"; $sql = "SELECT s.rowid, s.nom, s.ville, s.datec, s.datea";
$sql.= ", st.libelle as stcomm, s.prefix_comm, s.client, s.fournisseur,"; $sql.= ", st.libelle as stcomm, s.prefix_comm, s.client, s.fournisseur,";
$sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4"; $sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";

View File

@ -150,10 +150,10 @@ class User extends CommonObject
$sql.= " u.pass, u.pass_crypted, u.pass_temp,"; $sql.= " u.pass, u.pass_crypted, u.pass_temp,";
$sql.= " u.fk_societe, u.fk_socpeople, u.fk_member, u.ldap_sid,"; $sql.= " u.fk_societe, u.fk_socpeople, u.fk_member, u.ldap_sid,";
$sql.= " u.statut, u.lang, u.entity,"; $sql.= " u.statut, u.lang, u.entity,";
$sql.= " ".$this->db->pdate("u.datec")." as datec,"; $sql.= " u.datec as datec,";
$sql.= " ".$this->db->pdate("u.tms")." as datem,"; $sql.= " u.tms as datem,";
$sql.= " ".$this->db->pdate("u.datelastlogin")." as datel,"; $sql.= " u.datelastlogin as datel,";
$sql.= " ".$this->db->pdate("u.datepreviouslogin")." as datep"; $sql.= " u.datepreviouslogin as datep";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.entity IN (0,".$conf->entity.")"; $sql.= " WHERE u.entity IN (0,".$conf->entity.")";
if ($sid) if ($sid)
@ -200,10 +200,10 @@ class User extends CommonObject
$this->lang = $obj->lang; $this->lang = $obj->lang;
$this->entity = $obj->entity; $this->entity = $obj->entity;
$this->datec = $obj->datec; $this->datec = $this->db->jdate($obj->datec);
$this->datem = $obj->datem; $this->datem = $this->db->jdate($obj->datem);
$this->datelastlogin = $obj->datel; $this->datelastlogin = $this->db->jdate($obj->datel);
$this->datepreviouslogin = $obj->datep; $this->datepreviouslogin = $this->db->jdate($obj->datep);
$this->webcal_login = $obj->webcal_login; $this->webcal_login = $obj->webcal_login;
$this->phenix_login = $obj->phenix_login; $this->phenix_login = $obj->phenix_login;
@ -1765,8 +1765,8 @@ class User extends CommonObject
*/ */
function info($id) function info($id)
{ {
$sql = "SELECT u.rowid, u.login as ref, ".$this->db->pdate("datec")." as datec,"; $sql = "SELECT u.rowid, u.login as ref, u.datec,";
$sql.= $this->db->pdate("u.tms")." as date_modification, u.entity"; $sql.= " u.tms as date_modification, u.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.rowid = ".$id; $sql.= " WHERE u.rowid = ".$id;
@ -1780,8 +1780,8 @@ class User extends CommonObject
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = (! $obj->ref) ? $obj->rowid : $obj->ref; $this->ref = (! $obj->ref) ? $obj->rowid : $obj->ref;
$this->date_creation = $obj->datec; $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $obj->date_modification; $this->date_modification = $this->db->jdate($obj->date_modification);
$this->entity = $obj->entity; $this->entity = $obj->entity;
} }

View File

@ -141,16 +141,16 @@ foreach ($accounts as $account)
$height = 280; $height = 280;
// Calcul de $min et $max // Calcul de $min et $max
$sql = "SELECT min(".$db->pdate("datev")."),max(".$db->pdate("datev").")"; $sql = "SELECT min(datev), max(datev)";
$sql .= " FROM ".MAIN_DB_PREFIX."bank"; $sql.= " FROM ".MAIN_DB_PREFIX."bank";
$sql .= " WHERE fk_account = ".$account; $sql.= " WHERE fk_account = ".$account;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$row = $db->fetch_row($resql); $row = $db->fetch_row($resql);
$min = $row[0]; $min = $this->db->jdate($row[0]);
$max = $row[1]; $max = $this->db->jdate($row[1]);
} }
else else
{ {