Fix: Remove usage of pdate()
This commit is contained in:
parent
2aac1761e3
commit
62f4345e92
@ -586,7 +586,7 @@ class Adherent extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
// 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.= " WHERE fk_adherent='".$this->id."'";
|
||||
$sql.= " ORDER by dateadh DESC"; // Sort by start subscription date
|
||||
@ -596,7 +596,7 @@ class Adherent extends CommonObject
|
||||
if ($resql)
|
||||
{
|
||||
$obj=$this->db->fetch_object($resql);
|
||||
$datefin=$obj->datef;
|
||||
$datefin=$this->db->jdate($obj->datef);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$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.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,";
|
||||
$sql.= " d.photo, d.fk_adherent_type, d.morphy,";
|
||||
$sql.= " ".$this->db->pdate("d.datec")." as datec,";
|
||||
$sql.= " ".$this->db->pdate("d.tms")." as datem,";
|
||||
$sql.= " ".$this->db->pdate("d.datefin")." as datefin,";
|
||||
$sql.= " d.datec as datec,";
|
||||
$sql.= " d.tms as datem,";
|
||||
$sql.= " d.datefin as datefin,";
|
||||
$sql.= " d.naiss as datenaiss,";
|
||||
$sql.= " ".$this->db->pdate("d.datevalid")." as datev,";
|
||||
$sql.= " d.datevalid as datev,";
|
||||
$sql.= " d.pays,";
|
||||
$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,";
|
||||
@ -976,11 +976,11 @@ class Adherent extends CommonObject
|
||||
$this->statut = $obj->statut;
|
||||
$this->public = $obj->public;
|
||||
|
||||
$this->datec = $obj->datec;
|
||||
$this->datem = $obj->datem;
|
||||
$this->datefin = $obj->datefin;
|
||||
$this->datevalid = $obj->datevalid;
|
||||
$this->naiss = $obj->datenaiss;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->datem = $this->db->jdate($obj->datem);
|
||||
$this->datefin = $this->db->jdate($obj->datefin);
|
||||
$this->datevalid = $this->db->jdate($obj->datev);
|
||||
$this->naiss = $this->db->jdate($obj->datenaiss);
|
||||
|
||||
$this->note = $obj->note;
|
||||
$this->morphy = $obj->morphy;
|
||||
@ -2007,9 +2007,9 @@ class Adherent extends CommonObject
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT a.rowid, '.$this->db->pdate('a.datec').' as datec,';
|
||||
$sql.= ' '.$this->db->pdate('a.datevalid').' as datev,';
|
||||
$sql.= ' '.$this->db->pdate('a.tms').' as datem,';
|
||||
$sql = 'SELECT a.rowid, a.datec as datec,';
|
||||
$sql.= ' a.datevalid as datev,';
|
||||
$sql.= ' a.tms as datem,';
|
||||
$sql.= ' a.fk_user_author, a.fk_user_valid, a.fk_user_mod';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'adherent as a';
|
||||
$sql.= ' WHERE a.rowid = '.$id;
|
||||
@ -2043,9 +2043,9 @@ class Adherent extends CommonObject
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_validation = $obj->datev;
|
||||
$this->date_modification = $obj->datem;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
@ -267,8 +267,8 @@ print '<td valign="top" width="50%">';
|
||||
*/
|
||||
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe,";
|
||||
$sql.= " c.rowid as crowid, c.cotisation,";
|
||||
$sql.= " ".$db->pdate("c.dateadh")." as dateadh,";
|
||||
$sql.= " ".$db->pdate("c.datef")." as datef,";
|
||||
$sql.= " c.dateadh,";
|
||||
$sql.= " c.datef,";
|
||||
$sql.= " c.fk_bank,";
|
||||
$sql.= " b.rowid as bid,";
|
||||
$sql.= " ba.rowid as baid, ba.label, ba.bank";
|
||||
@ -308,8 +308,8 @@ if ($result)
|
||||
$cotisationstatic->ref=$objp->crowid;
|
||||
$cotisationstatic->id=$objp->crowid;
|
||||
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($objp->datef,'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($this->db->jdate($objp->datef),'day')."</td>\n";
|
||||
print '<td align="right">'.price($objp->cotisation).'</td>';
|
||||
if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE)
|
||||
{
|
||||
|
||||
@ -100,10 +100,10 @@ class Cotisation extends CommonObject
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
$sql ="SELECT rowid, fk_adherent, ".$this->db->pdate("datec")." as datec,";
|
||||
$sql ="SELECT rowid, fk_adherent, datec,";
|
||||
$sql.=" tms,";
|
||||
$sql.=" ".$this->db->pdate("dateadh")." as dateadh,";
|
||||
$sql.=" ".$this->db->pdate("datef")." as datef,";
|
||||
$sql.=" dateadh,";
|
||||
$sql.=" datef,";
|
||||
$sql.=" cotisation, note, fk_bank";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."cotisation";
|
||||
$sql.=" WHERE rowid=".$rowid;
|
||||
@ -120,10 +120,10 @@ class Cotisation extends CommonObject
|
||||
$this->ref = $obj->rowid;
|
||||
|
||||
$this->fk_adherent = $obj->fk_adherent;
|
||||
$this->datec = $obj->datec;
|
||||
$this->datem = $obj->tms;
|
||||
$this->dateh = $obj->dateadh;
|
||||
$this->datef = $obj->datef;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->datem = $this->db->jdate($obj->tms);
|
||||
$this->dateh = $this->db->jdate($obj->dateadh);
|
||||
$this->datef = $this->db->jdate($obj->datef);
|
||||
$this->amount = $obj->cotisation;
|
||||
$this->note = $obj->note;
|
||||
$this->fk_bank = $obj->fk_bank;
|
||||
|
||||
@ -18,19 +18,19 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/chargesociales.class.php
|
||||
\ingroup facture
|
||||
\brief Fichier de la classe des charges sociales
|
||||
\version $Id$
|
||||
*/
|
||||
* \file htdocs/chargesociales.class.php
|
||||
* \ingroup facture
|
||||
* \brief Fichier de la classe des charges sociales
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
|
||||
|
||||
|
||||
/** \class ChargeSociales
|
||||
\brief Classe permettant la gestion des paiements des charges
|
||||
La tva collectee n'est calculee que sur les factures payees.
|
||||
*/
|
||||
* \brief Classe permettant la gestion des paiements des charges
|
||||
* La tva collectee n'est calculee que sur les factures payees.
|
||||
*/
|
||||
class ChargeSociales extends CommonObject
|
||||
{
|
||||
var $db;
|
||||
@ -61,8 +61,8 @@ class ChargeSociales extends CommonObject
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
$sql = "SELECT cs.rowid,".$this->db->pdate("cs.date_ech")." as date_ech,";
|
||||
$sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, ".$this->db->pdate("cs.periode")." as periode,";
|
||||
$sql = "SELECT cs.rowid, cs.date_ech,";
|
||||
$sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode,";
|
||||
$sql.= " c.libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql.= " WHERE cs.fk_type = c.id";
|
||||
@ -78,13 +78,13 @@ class ChargeSociales extends CommonObject
|
||||
|
||||
$this->id = $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->type = $obj->fk_type;
|
||||
$this->type_libelle = $obj->libelle;
|
||||
$this->amount = $obj->amount;
|
||||
$this->paye = $obj->paye;
|
||||
$this->periode = $obj->periode;
|
||||
$this->periode = $this->db->jdate($obj->periode);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -2024,7 +2024,7 @@ else
|
||||
* Show object in view mode
|
||||
*/
|
||||
|
||||
$now=gmmktime();
|
||||
$now=dol_now();
|
||||
|
||||
$id = $_GET['facid'];
|
||||
$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&facid='.$fac->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
|
||||
if ($fac->type != 2)
|
||||
{
|
||||
if ($_GET['action'] == 'editinvoicedate')
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* 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>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -19,10 +19,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/resultat/index.php
|
||||
\brief Page reporting resultat
|
||||
\version $Id$
|
||||
*/
|
||||
* \file htdocs/compta/resultat/index.php
|
||||
* \brief Page reporting resultat
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.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());
|
||||
$nbofyear=4;
|
||||
if (! $year_start) {
|
||||
$year_start = $year_current - ($nbofyear-1);
|
||||
$year_end = $year_current;
|
||||
$year_start = $year_current - ($nbofyear-1);
|
||||
$year_end = $year_current;
|
||||
}
|
||||
else {
|
||||
$year_end=$year_start + ($nbofyear-1);
|
||||
$year_end=$year_start + ($nbofyear-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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')
|
||||
@ -59,22 +59,22 @@ $html=new Form($db);
|
||||
// Affiche en-tete du rapport
|
||||
if ($modecompta=="CREANCES-DETTES")
|
||||
{
|
||||
$nom=$langs->trans("AnnualSummaryDueDebtMode");
|
||||
$nom.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
$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>":"");
|
||||
$description=$langs->trans("RulesResultDue");
|
||||
$builddate=time();
|
||||
$exportlink=$langs->trans("NotYetAvailable");
|
||||
$nom=$langs->trans("AnnualSummaryDueDebtMode");
|
||||
$nom.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
$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>":"");
|
||||
$description=$langs->trans("RulesResultDue");
|
||||
$builddate=time();
|
||||
$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
else {
|
||||
$nom=$langs->trans("AnnualSummaryInputOutputMode");
|
||||
$nom.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
$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>":"");
|
||||
$description=$langs->trans("RulesResultInOut");
|
||||
$builddate=time();
|
||||
$exportlink=$langs->trans("NotYetAvailable");
|
||||
$nom=$langs->trans("AnnualSummaryInputOutputMode");
|
||||
$nom.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
$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>":"");
|
||||
$description=$langs->trans("RulesResultInOut");
|
||||
$builddate=time();
|
||||
$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
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_ttc = 0;
|
||||
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.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.fk_statut in (1,2)";
|
||||
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.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.fk_statut in (1,2)";
|
||||
} else {
|
||||
/*
|
||||
* 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)
|
||||
*/
|
||||
/*
|
||||
* 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)
|
||||
*/
|
||||
$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.= ", ".MAIN_DB_PREFIX."paiement_facture as pf";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."paiement as p";
|
||||
$sql.= " WHERE p.rowid = pf.fk_paiement";
|
||||
$sql.= " AND pf.fk_facture = f.rowid";
|
||||
$sql.= " WHERE p.rowid = pf.fk_paiement";
|
||||
$sql.= " AND pf.fk_facture = f.rowid";
|
||||
}
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if ($socid) $sql.= " AND f.fk_soc = $socid";
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= " ORDER BY dm";
|
||||
|
||||
print $sql;
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_object($result);
|
||||
$encaiss[$row->dm] = $row->amount_ht;
|
||||
$encaiss_ttc[$row->dm] = $row->amount_ttc;
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_object($result);
|
||||
$encaiss[$row->dm] = $row->amount_ht;
|
||||
$encaiss_ttc[$row->dm] = $row->amount_ttc;
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// On ajoute les paiements clients anciennes version, non lies par paiement_facture
|
||||
if ($modecompta != 'CREANCES-DETTES') {
|
||||
$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.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."paiement as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
|
||||
$sql.= " WHERE pf.rowid IS NULL";
|
||||
$sql.= " AND p.fk_bank = b.rowid";
|
||||
$sql.= " AND b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= " ORDER BY dm";
|
||||
if ($modecompta != 'CREANCES-DETTES') {
|
||||
$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.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."paiement as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
|
||||
$sql.= " WHERE pf.rowid IS NULL";
|
||||
$sql.= " AND p.fk_bank = b.rowid";
|
||||
$sql.= " AND b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= " ORDER BY dm";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_object($result);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_object($result);
|
||||
|
||||
$encaiss[$row->dm] += $row->amount_ht;
|
||||
$encaiss_ttc[$row->dm] += $row->amount_ttc;
|
||||
$encaiss[$row->dm] += $row->amount_ht;
|
||||
$encaiss_ttc[$row->dm] += $row->amount_ttc;
|
||||
|
||||
// For DEBUG Only
|
||||
if (preg_match('/^2007/',$row->dm))
|
||||
{
|
||||
$subtotal_ht = $subtotal_ht + $row->amount_ht;
|
||||
$subtotal_ttc = $subtotal_ttc + $row->amount_ttc;
|
||||
$subtotal_ht = $subtotal_ht + $row->amount_ht;
|
||||
$subtotal_ttc = $subtotal_ttc + $row->amount_ttc;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
/*
|
||||
print "<br>Facture clients: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n";
|
||||
for ($mois = 1 ; $mois <= 12 ; $mois++)
|
||||
{
|
||||
$annee = 2007;
|
||||
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee));
|
||||
print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
|
||||
print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
|
||||
}
|
||||
*/
|
||||
print "<br>Facture clients: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n";
|
||||
for ($mois = 1 ; $mois <= 12 ; $mois++)
|
||||
{
|
||||
$annee = 2007;
|
||||
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee));
|
||||
print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
|
||||
print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* Frais, factures fournisseurs.
|
||||
@ -181,10 +181,10 @@ for ($mois = 1 ; $mois <= 12 ; $mois++)
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
|
||||
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.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql.= " WHERE f.fk_statut IN (1,2)";
|
||||
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.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql.= " WHERE f.fk_statut IN (1,2)";
|
||||
} else {
|
||||
$sql = "SELECT sum(p.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p";
|
||||
@ -200,171 +200,171 @@ $sql.= " GROUP BY dm";
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_object($result);
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_object($result);
|
||||
|
||||
$decaiss[$row->dm] = $row->amount_ht;
|
||||
$decaiss_ttc[$row->dm] = $row->amount_ttc;
|
||||
$decaiss[$row->dm] = $row->amount_ht;
|
||||
$decaiss_ttc[$row->dm] = $row->amount_ttc;
|
||||
|
||||
// For DEBUG Only
|
||||
if (preg_match('/^2007/',$row->dm))
|
||||
{
|
||||
$subtotal_ht = $subtotal_ht + $row->amount_ht;
|
||||
$subtotal_ttc = $subtotal_ttc + $row->amount_ttc;
|
||||
$subtotal_ht = $subtotal_ht + $row->amount_ht;
|
||||
$subtotal_ttc = $subtotal_ttc + $row->amount_ttc;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
/*
|
||||
print "<br>Facture fournisseurs: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n";
|
||||
for ($mois = 1 ; $mois <= 12 ; $mois++)
|
||||
{
|
||||
$annee = 2007;
|
||||
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee));
|
||||
print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
|
||||
print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
|
||||
}
|
||||
*/
|
||||
|
||||
print "<br>Facture fournisseurs: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n";
|
||||
for ($mois = 1 ; $mois <= 12 ; $mois++)
|
||||
{
|
||||
$annee = 2007;
|
||||
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee));
|
||||
print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
|
||||
print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* TVA
|
||||
*/
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
// TVA a payer
|
||||
$sql = "SELECT sum(f.tva) as amount, date_format(f.datef,'%Y-%m') as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE f.fk_statut IN (1,2)";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm DESC";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$decaiss[$obj->dm] += $obj->amount;
|
||||
$decaiss_ttc[$obj->dm] += $obj->amount;
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
// TVA a recuperer
|
||||
$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.= " WHERE f.fk_statut IN (1,2)";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$encaiss[$obj->dm] += $obj->amount;
|
||||
$encaiss_ttc[$obj->dm] += $obj->amount;
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
// TVA a payer
|
||||
$sql = "SELECT sum(f.tva) as amount, date_format(f.datef,'%Y-%m') as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE f.fk_statut IN (1,2)";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm DESC";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$decaiss[$obj->dm] += $obj->amount;
|
||||
$decaiss_ttc[$obj->dm] += $obj->amount;
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
// TVA a recuperer
|
||||
$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.= " WHERE f.fk_statut IN (1,2)";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$encaiss[$obj->dm] += $obj->amount;
|
||||
$encaiss_ttc[$obj->dm] += $obj->amount;
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// TVA reellement deja payee
|
||||
$sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||
$sql.= " WHERE amount > 0";
|
||||
$sql.= " AND t.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$decaiss[$obj->dm] += $obj->amount;
|
||||
$decaiss_ttc[$obj->dm] += $obj->amount;
|
||||
// For DEBUG Only
|
||||
if (preg_match('/^2007/',$obj->dm))
|
||||
{
|
||||
$subtotal_ht = $subtotal_ht + $obj->amount;
|
||||
$subtotal_ttc = $subtotal_ttc + $obj->amount;
|
||||
// TVA reellement deja payee
|
||||
$sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||
$sql.= " WHERE amount > 0";
|
||||
$sql.= " AND t.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$decaiss[$obj->dm] += $obj->amount;
|
||||
$decaiss_ttc[$obj->dm] += $obj->amount;
|
||||
// For DEBUG Only
|
||||
if (preg_match('/^2007/',$obj->dm))
|
||||
{
|
||||
$subtotal_ht = $subtotal_ht + $obj->amount;
|
||||
$subtotal_ttc = $subtotal_ttc + $obj->amount;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
// TVA recuperee
|
||||
$sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||
$sql.= " WHERE amount < 0";
|
||||
$sql.= " AND t.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$encaiss[$obj->dm] += $obj->amount;
|
||||
$encaiss_ttc[$obj->dm] += $obj->amount;
|
||||
// For DEBUG Only
|
||||
if (preg_match('/^2007/',$obj->dm))
|
||||
{
|
||||
$subtotal_ht = $subtotal_ht + $obj->amount;
|
||||
$subtotal_ttc = $subtotal_ttc + $obj->amount;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
// TVA recuperee
|
||||
$sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||
$sql.= " WHERE amount < 0";
|
||||
$sql.= " AND t.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$encaiss[$obj->dm] += $obj->amount;
|
||||
$encaiss_ttc[$obj->dm] += $obj->amount;
|
||||
// For DEBUG Only
|
||||
if (preg_match('/^2007/',$obj->dm))
|
||||
{
|
||||
$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";
|
||||
for ($mois = 1 ; $mois <= 12 ; $mois++)
|
||||
{
|
||||
$annee = 2007;
|
||||
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee));
|
||||
print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
|
||||
print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
|
||||
}
|
||||
*/
|
||||
print "<br>TVA: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n";
|
||||
for ($mois = 1 ; $mois <= 12 ; $mois++)
|
||||
{
|
||||
$annee = 2007;
|
||||
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee));
|
||||
print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
|
||||
print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* Charges sociales non deductibles
|
||||
@ -372,26 +372,26 @@ for ($mois = 1 ; $mois <= 12 ; $mois++)
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
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.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as s";
|
||||
$sql.= " WHERE s.fk_type = c.id";
|
||||
$sql.= " AND c.deductible = 0";
|
||||
if ($year) {
|
||||
$sql.= " AND s.date_ech between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'";
|
||||
}
|
||||
$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.= ", ".MAIN_DB_PREFIX."chargesociales as s";
|
||||
$sql.= " WHERE s.fk_type = c.id";
|
||||
$sql.= " AND c.deductible = 0";
|
||||
if ($year) {
|
||||
$sql.= " AND s.date_ech between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'";
|
||||
}
|
||||
}
|
||||
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.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
$sql.= " WHERE p.fk_charge = s.rowid";
|
||||
$sql.= " AND s.fk_type = c.id";
|
||||
$sql.= " AND c.deductible = 0";
|
||||
if ($year) {
|
||||
$sql.= " AND p.datep between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'";
|
||||
}
|
||||
$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.= ", ".MAIN_DB_PREFIX."chargesociales as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
$sql.= " WHERE p.fk_charge = s.rowid";
|
||||
$sql.= " AND s.fk_type = c.id";
|
||||
$sql.= " AND c.deductible = 0";
|
||||
if ($year) {
|
||||
$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.= " GROUP BY c.libelle, dm";
|
||||
@ -399,39 +399,39 @@ $sql.= " GROUP BY c.libelle, dm";
|
||||
$result=$db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$decaiss[$obj->dm] += $obj->amount_ht;
|
||||
$decaiss_ttc[$obj->dm] += $obj->amount_ttc;
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
// For DEBUG Only
|
||||
if (preg_match('/^2007/',$obj->dm))
|
||||
{
|
||||
$subtotal_ht = $subtotal_ht + $obj->amount_ht;
|
||||
$subtotal_ttc = $subtotal_ttc + $obj->amount_ttc;
|
||||
$decaiss[$obj->dm] += $obj->amount_ht;
|
||||
$decaiss_ttc[$obj->dm] += $obj->amount_ttc;
|
||||
|
||||
// For DEBUG Only
|
||||
if (preg_match('/^2007/',$obj->dm))
|
||||
{
|
||||
$subtotal_ht = $subtotal_ht + $obj->amount_ht;
|
||||
$subtotal_ttc = $subtotal_ttc + $obj->amount_ttc;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} 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";
|
||||
for ($mois = 1 ; $mois <= 12 ; $mois++)
|
||||
{
|
||||
$annee = 2007;
|
||||
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee));
|
||||
print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
|
||||
print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
|
||||
}
|
||||
*/
|
||||
print "<br>Charges sociales non deduc: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n";
|
||||
for ($mois = 1 ; $mois <= 12 ; $mois++)
|
||||
{
|
||||
$annee = 2007;
|
||||
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee));
|
||||
print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
|
||||
print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* Charges sociales deductibles
|
||||
@ -440,66 +440,66 @@ $subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
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.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as s";
|
||||
$sql.= " WHERE s.fk_type = c.id";
|
||||
$sql.= " AND c.deductible = 1";
|
||||
if ($year) {
|
||||
$sql.= " AND s.date_ech between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'";
|
||||
}
|
||||
$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.= ", ".MAIN_DB_PREFIX."chargesociales as s";
|
||||
$sql.= " WHERE s.fk_type = c.id";
|
||||
$sql.= " AND c.deductible = 1";
|
||||
if ($year) {
|
||||
$sql.= " AND s.date_ech between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'";
|
||||
}
|
||||
}
|
||||
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.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
$sql.= " WHERE p.fk_charge = s.rowid";
|
||||
$sql.= " AND s.fk_type = c.id";
|
||||
$sql.= " AND c.deductible = 1";
|
||||
if ($year) {
|
||||
$sql.= " AND p.datep between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'";
|
||||
}
|
||||
$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.= ", ".MAIN_DB_PREFIX."chargesociales as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
$sql.= " WHERE p.fk_charge = s.rowid";
|
||||
$sql.= " AND s.fk_type = c.id";
|
||||
$sql.= " AND c.deductible = 1";
|
||||
if ($year) {
|
||||
$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.= " GROUP BY c.libelle, dm";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$decaiss[$obj->dm] += $obj->amount_ht;
|
||||
$decaiss_ttc[$obj->dm] += $obj->amount_ttc;
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
// For DEBUG Only
|
||||
if (preg_match('/^2007/',$obj->dm))
|
||||
{
|
||||
$subtotal_ht = $subtotal_ht + $obj->amount_ht;
|
||||
$subtotal_ttc = $subtotal_ttc + $obj->amount_ttc;
|
||||
$decaiss[$obj->dm] += $obj->amount_ht;
|
||||
$decaiss_ttc[$obj->dm] += $obj->amount_ttc;
|
||||
|
||||
// For DEBUG Only
|
||||
if (preg_match('/^2007/',$obj->dm))
|
||||
{
|
||||
$subtotal_ht = $subtotal_ht + $obj->amount_ht;
|
||||
$subtotal_ttc = $subtotal_ttc + $obj->amount_ttc;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
/*
|
||||
print "<br>Charges sociales deduc: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n";
|
||||
for ($mois = 1 ; $mois <= 12 ; $mois++)
|
||||
{
|
||||
$annee = 2007;
|
||||
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee));
|
||||
print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
|
||||
print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
|
||||
}
|
||||
*/
|
||||
print "<br>Charges sociales deduc: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."<br>\n";
|
||||
for ($mois = 1 ; $mois <= 12 ; $mois++)
|
||||
{
|
||||
$annee = 2007;
|
||||
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee));
|
||||
print 'Mois '.$mois.': '.$decaiss_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++)
|
||||
{
|
||||
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 class="liste_titre">';
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
{
|
||||
print '<td align="right">'.$langs->trans("Outcome").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Income").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Outcome").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Income").'</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
@ -560,9 +560,9 @@ $nbcols=0;
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("TotalTTC").'</td>';
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
{
|
||||
$nbcols+=2;
|
||||
print '<td align="right">'.(isset($totsorties[$annee])?price($totsorties[$annee]):' ').'</td>';
|
||||
print '<td align="right">'.(isset($totentrees[$annee])?price($totentrees[$annee]):' ').'</td>';
|
||||
$nbcols+=2;
|
||||
print '<td align="right">'.(isset($totsorties[$annee])?price($totsorties[$annee]):' ').'</td>';
|
||||
print '<td align="right">'.(isset($totentrees[$annee])?price($totentrees[$annee]):' ').'</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
@ -576,11 +576,11 @@ $var=!$var;
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Profit").'</td>';
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
{
|
||||
print '<td align="right" colspan="2"> ';
|
||||
if (isset($totentrees[$annee]) || isset($totsorties[$annee])) {
|
||||
print price($totentrees[$annee]-$totsorties[$annee]).'</td>';
|
||||
// print '<td> </td>';
|
||||
}
|
||||
print '<td align="right" colspan="2"> ';
|
||||
if (isset($totentrees[$annee]) || isset($totsorties[$annee])) {
|
||||
print price($totentrees[$annee]-$totsorties[$annee]).'</td>';
|
||||
// print '<td> </td>';
|
||||
}
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -654,10 +654,10 @@ class Contact extends CommonObject
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = "SELECT c.rowid, ".$this->db->pdate("c.datec")." as datec, c.fk_user_creat";
|
||||
$sql .= ", ".$this->db->pdate("c.tms")." as tms, c.fk_user_modif";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$sql .= " WHERE c.rowid = ".$id;
|
||||
$sql = "SELECT c.rowid, c.datec as datec, c.fk_user_creat,";
|
||||
$sql.= " c.tms as tms, c.fk_user_modif";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$sql.= " WHERE c.rowid = ".$id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -680,9 +680,8 @@ class Contact extends CommonObject
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_modification = $obj->tms;
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
@ -1125,8 +1125,8 @@ class Contrat extends CommonObject
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.ref, ".$this->db->pdate("datec")." as datec, ".$this->db->pdate("date_cloture")." as date_cloture,";
|
||||
$sql.= $this->db->pdate("c.tms")." as date_modification,";
|
||||
$sql = "SELECT c.rowid, c.ref, c.datec, c.date_cloture,";
|
||||
$sql.= " c.tms as date_modification,";
|
||||
$sql.= " fk_user_author, fk_user_cloture";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql.= " WHERE c.rowid = ".$id;
|
||||
@ -1152,9 +1152,9 @@ class Contrat extends CommonObject
|
||||
$this->user_cloture = $cuser;
|
||||
}
|
||||
$this->ref = (! $obj->ref) ? $obj->rowid : $obj->ref;
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_modification = $obj->date_modification;
|
||||
$this->date_cloture = $obj->date_cloture;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$this->date_cloture = $this->db->jdate($obj->date_cloture);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
@ -1529,17 +1529,17 @@ class ContratLigne
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
|
||||
$sql.= " ".$this->db->pdate('t.tms')." as tms,";
|
||||
$sql.= " t.tms,";
|
||||
$sql.= " t.fk_contrat,";
|
||||
$sql.= " t.fk_product,";
|
||||
$sql.= " t.statut,";
|
||||
$sql.= " t.label,";
|
||||
$sql.= " t.description,";
|
||||
$sql.= " ".$this->db->pdate('t.date_commande')." as date_commande,";
|
||||
$sql.= " ".$this->db->pdate('t.date_ouverture_prevue')." as date_ouverture_prevue,";
|
||||
$sql.= " ".$this->db->pdate('t.date_ouverture')." as date_ouverture,";
|
||||
$sql.= " ".$this->db->pdate('t.date_fin_validite')." as date_fin_validite,";
|
||||
$sql.= " ".$this->db->pdate('t.date_cloture')." as date_cloture,";
|
||||
$sql.= " t.date_commande,";
|
||||
$sql.= " t.date_ouverture_prevue as date_ouverture_prevue,";
|
||||
$sql.= " t.date_ouverture as date_ouverture,";
|
||||
$sql.= " t.date_fin_validite as date_fin_validite,";
|
||||
$sql.= " t.date_cloture as date_cloture,";
|
||||
$sql.= " t.tva_tx,";
|
||||
$sql.= " t.qty,";
|
||||
$sql.= " t.remise_percent,";
|
||||
@ -1570,17 +1570,17 @@ class ContratLigne
|
||||
$this->id = $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_product = $obj->fk_product;
|
||||
$this->statut = $obj->statut;
|
||||
$this->label = $obj->label;
|
||||
$this->description = $obj->description;
|
||||
$this->date_commande = $obj->date_commande;
|
||||
$this->date_ouverture_prevue = $obj->date_ouverture_prevue;
|
||||
$this->date_ouverture = $obj->date_ouverture;
|
||||
$this->date_fin_validite = $obj->date_fin_validite;
|
||||
$this->date_cloture = $obj->date_cloture;
|
||||
$this->date_commande = $this->db->jdate($obj->date_commande);
|
||||
$this->date_ouverture_prevue = $this->db->jdate($obj->date_ouverture_prevue);
|
||||
$this->date_ouverture = $this->db->jdate($obj->date_ouverture);
|
||||
$this->date_fin_validite = $this->db->jdate($obj->date_fin_validite);
|
||||
$this->date_cloture = $this->db->jdate($obj->date_cloture);
|
||||
$this->tva_tx = $obj->tva_tx;
|
||||
$this->qty = $obj->qty;
|
||||
$this->remise_percent = $obj->remise_percent;
|
||||
|
||||
@ -166,10 +166,10 @@ class Events // extends CommonObject
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " ".$this->db->pdate('t.tms').",";
|
||||
$sql.= " t.tms,";
|
||||
$sql.= " t.type,";
|
||||
$sql.= " t.entity,";
|
||||
$sql.= " ".$this->db->pdate('t.dateevent').",";
|
||||
$sql.= " t.dateevent,";
|
||||
$sql.= " t.description,";
|
||||
$sql.= " t.ip,";
|
||||
$sql.= " t.user_agent";
|
||||
@ -185,10 +185,10 @@ class Events // extends CommonObject
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->tms = $obj->tms;
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
$this->type = $obj->type;
|
||||
$this->entity = $obj->entity;
|
||||
$this->dateevent = $obj->dateevent;
|
||||
$this->dateevent = $this->db->jdate($obj->dateevent);
|
||||
$this->description = $obj->description;
|
||||
$this->ip = $obj->ip;
|
||||
$this->user_agent = $obj->user_agent;
|
||||
|
||||
@ -426,8 +426,8 @@ class Don extends CommonObject
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
$sql = "SELECT d.rowid, ".$this->db->pdate("d.datec")." as datec,";
|
||||
$sql.= " ".$this->db->pdate("d.datedon")." as datedon,";
|
||||
$sql = "SELECT d.rowid, d.datec,";
|
||||
$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.= " p.title as projet";
|
||||
$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->ref = $obj->rowid;
|
||||
$this->datec = $obj->datec;
|
||||
$this->date = $obj->datedon;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->date = $this->db->jdate($obj->datedon);
|
||||
$this->prenom = $obj->prenom;
|
||||
$this->nom = $obj->nom;
|
||||
$this->societe = $obj->societe;
|
||||
|
||||
@ -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.= ", 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.= ", el.fk_source as origin_id";
|
||||
$sql.= ", ori.ref_client";
|
||||
@ -263,7 +263,7 @@ class Expedition extends CommonObject
|
||||
$this->origin_id = $obj->origin_id;
|
||||
$this->livraison_id = $obj->livraison_id;
|
||||
$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->fk_delivery_address = $obj->fk_adresse_livraison;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
|
||||
@ -545,11 +545,11 @@ class Facture extends CommonObject
|
||||
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.= ','.$this->db->pdate('f.datef').' as df';
|
||||
$sql.= ','.$this->db->pdate('f.date_lim_reglement').' as dlr';
|
||||
$sql.= ','.$this->db->pdate('f.datec').' as datec';
|
||||
$sql.= ','.$this->db->pdate('f.date_valid').' as datev';
|
||||
$sql.= ','.$this->db->pdate('f.tms').' as datem';
|
||||
$sql.= ', f.datef as df';
|
||||
$sql.= ', f.date_lim_reglement as dlr';
|
||||
$sql.= ', f.datec as datec';
|
||||
$sql.= ', f.date_valid as datev';
|
||||
$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.fk_facture_source';
|
||||
$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_client = $obj->ref_client;
|
||||
$this->type = $obj->type;
|
||||
$this->date = $obj->df;
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_validation = $obj->datev;
|
||||
$this->date = $this->db->jdate($obj->df);
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
$this->datem = $this->db->jdate($obj->datem);
|
||||
$this->amount = $obj->amount;
|
||||
$this->remise_percent = $obj->remise_percent;
|
||||
@ -592,7 +592,7 @@ class Facture extends CommonObject
|
||||
$this->close_note = $obj->close_note;
|
||||
$this->socid = $obj->fk_soc;
|
||||
$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_code = $obj->mode_reglement_code;
|
||||
$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.= ' 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.= ' 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';
|
||||
@ -699,10 +699,10 @@ class Facture extends CommonObject
|
||||
$faclig->fk_remise_except = $objp->fk_remise_except;
|
||||
$faclig->produit_id = $objp->fk_product;
|
||||
$faclig->fk_product = $objp->fk_product;
|
||||
$faclig->date_start = $objp->date_start;
|
||||
$faclig->date_end = $objp->date_end;
|
||||
$faclig->date_start = $objp->date_start;
|
||||
$faclig->date_end = $objp->date_end;
|
||||
$faclig->date_start = $this->db->jdate($objp->date_start);
|
||||
$faclig->date_end = $this->db->jdate($objp->date_end);
|
||||
$faclig->date_start = $this->db->jdate($objp->date_start);
|
||||
$faclig->date_end = $this->db->jdate($objp->date_end);
|
||||
$faclig->info_bits = $objp->info_bits;
|
||||
$faclig->total_ht = $objp->total_ht;
|
||||
$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.= ' 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.fk_code_ventilation, fd.fk_export_compta,';
|
||||
$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->fk_product = $objp->fk_product;
|
||||
$this->product_type = $objp->product_type;
|
||||
$this->date_start = $objp->date_start;
|
||||
$this->date_end = $objp->date_end;
|
||||
$this->date_start = $this->db->jdate($objp->date_start);
|
||||
$this->date_end = $this->db->jdate($objp->date_end);
|
||||
$this->info_bits = $objp->info_bits;
|
||||
$this->total_ht = $objp->total_ht;
|
||||
$this->total_tva = $objp->total_tva;
|
||||
|
||||
@ -186,9 +186,9 @@ class Fichinter extends CommonObject
|
||||
function fetch($rowid,$ref='')
|
||||
{
|
||||
$sql = "SELECT rowid, ref, description, fk_soc, fk_statut,";
|
||||
$sql.= " ".$this->db->pdate("datec")." as datec,";
|
||||
$sql.= " ".$this->db->pdate("date_valid")." as datev,";
|
||||
$sql.= " ".$this->db->pdate("tms")." as datem,";
|
||||
$sql.= " datec,";
|
||||
$sql.= " as datev,";
|
||||
$sql.= " datem,";
|
||||
$sql.= " duree, fk_projet, note_public, note_private, model_pdf";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f";
|
||||
if ($ref) $sql.= " WHERE f.ref='".$ref."'";
|
||||
@ -208,9 +208,9 @@ class Fichinter extends CommonObject
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->duree = $obj->duree;
|
||||
$this->datec = $obj->datec;
|
||||
$this->datev = $obj->datev;
|
||||
$this->datem = $obj->datem;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->datev = $this->db->jdate($obj->datev);
|
||||
$this->datem = $this->db->jdate($obj->datem);
|
||||
$this->projetidp = $obj->fk_projet;
|
||||
$this->projet_id = $obj->fk_projet;
|
||||
$this->note_public = $obj->note_public;
|
||||
@ -449,11 +449,11 @@ class Fichinter extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT f.rowid, ";
|
||||
$sql.= $this->db->pdate("f.datec")." as datec";
|
||||
$sql.= ", ".$this->db->pdate("f.date_valid")." as datev";
|
||||
$sql.= ", f.fk_user_author";
|
||||
$sql.= ", f.fk_user_valid";
|
||||
$sql = "SELECT f.rowid,";
|
||||
$sql.= " datec,";
|
||||
$sql.= " f.date_valid as datev,";
|
||||
$sql.= " f.fk_user_author,";
|
||||
$sql.= " f.fk_user_valid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f";
|
||||
$sql.= " WHERE f.rowid = ".$id;
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
@ -468,8 +468,8 @@ class Fichinter extends CommonObject
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_validation = $obj->datev;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
|
||||
$cuser = new User($this->db, $obj->fk_user_author);
|
||||
$cuser->fetch();
|
||||
@ -818,7 +818,7 @@ class FichinterLigne
|
||||
function fetch($rowid)
|
||||
{
|
||||
$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.= ' WHERE ft.rowid = '.$rowid;
|
||||
|
||||
@ -829,7 +829,7 @@ class FichinterLigne
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$this->rowid = $objp->rowid;
|
||||
$this->fk_fichinter = $objp->fk_fichinter;
|
||||
$this->datei = $objp->datei;
|
||||
$this->datei = $this->db->jdate($objp->datei);
|
||||
$this->desc = $objp->description;
|
||||
$this->duration = $objp->duree;
|
||||
$this->rang = $objp->rang;
|
||||
|
||||
@ -73,7 +73,7 @@ class PaiementFourn
|
||||
*/
|
||||
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.= ' p.num_paiement, p.note, b.fk_account';
|
||||
$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);
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->date = $obj->dp;
|
||||
$this->date = $this->db->jdate($obj->dp);
|
||||
$this->numero = $obj->num_paiement;
|
||||
$this->bank_account = $obj->fk_account;
|
||||
$this->bank_line = $obj->fk_bank;
|
||||
@ -342,10 +342,9 @@ class PaiementFourn
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT c.rowid, '.$this->db->pdate('datec').' as datec, fk_user_author';
|
||||
$sql .= ', '.$this->db->pdate('tms').' as tms';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as c';
|
||||
$sql .= ' WHERE c.rowid = '.$id;
|
||||
$sql = 'SELECT c.rowid, datec, fk_user_author, tms';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as c';
|
||||
$sql.= ' WHERE c.rowid = '.$id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -367,8 +366,8 @@ class PaiementFourn
|
||||
$muser->fetch();
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_modification = $obj->tms;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
@ -538,7 +537,7 @@ class PaiementFourn
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."paiementfourn";
|
||||
$sql.= " SET datep = ".$this->db->idate($date);
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
|
||||
dol_syslog("PaiementFourn::update_date sql=".$sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
|
||||
@ -57,7 +57,7 @@ class CommandeFournisseur extends Commande
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->products = array();
|
||||
|
||||
|
||||
// List of language codes for status
|
||||
$this->statuts[0] = 'StatusOrderDraft';
|
||||
$this->statuts[1] = 'StatusOrderValidated';
|
||||
@ -81,7 +81,7 @@ class CommandeFournisseur extends Commande
|
||||
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.= " ".$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.= " cm.libelle as methode_commande";
|
||||
$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_tva = $obj->tva;
|
||||
$this->total_ttc = $obj->total_ttc;
|
||||
$this->date_commande = $obj->date_commande; // date a laquelle la commande a ete transmise
|
||||
$this->date = $obj->date_creation;
|
||||
$this->date_commande = $this->db->jdate($obj->date_commande); // date a laquelle la commande a ete transmise
|
||||
$this->date = $this->db->jdate($obj->date_creation);
|
||||
$this->remise_percent = $obj->remise_percent;
|
||||
$this->methode_commande_id = $obj->fk_methode_commande;
|
||||
$this->methode_commande = $obj->methode_commande;
|
||||
|
||||
@ -216,10 +216,10 @@ class FactureFournisseur extends Facture
|
||||
{
|
||||
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.= ' 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.= ' 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';
|
||||
@ -239,9 +239,9 @@ class FactureFournisseur extends Facture
|
||||
|
||||
$this->type = 0;
|
||||
|
||||
$this->datep = $obj->df;
|
||||
$this->date = $obj->df;
|
||||
$this->date_echeance = $obj->de;
|
||||
$this->datep = $this->db->jdate($obj->df);
|
||||
$this->date = $this->db->jdate($obj->df);
|
||||
$this->date_echeance = $this->db->jdate($obj->de);
|
||||
$this->libelle = $obj->libelle;
|
||||
|
||||
$this->remise = $obj->remise;
|
||||
|
||||
@ -31,7 +31,7 @@ class FormActions
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructeur
|
||||
@ -40,7 +40,7 @@ class FormActions
|
||||
function FormActions($DB)
|
||||
{
|
||||
$this->db = $DB;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ class FormActions
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Show list of actions for element
|
||||
* \param object Object
|
||||
@ -97,8 +97,8 @@ class FormActions
|
||||
{
|
||||
global $langs,$conf,$user;
|
||||
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.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'user as u';
|
||||
$sql.= ' WHERE a.fk_user_author = u.rowid';
|
||||
@ -133,7 +133,7 @@ class FormActions
|
||||
$var=!$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>'.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>'.$objp->login.'</td>';
|
||||
print '</tr>';
|
||||
@ -141,7 +141,7 @@ class FormActions
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
|
||||
return $num;
|
||||
}
|
||||
else
|
||||
@ -151,10 +151,10 @@ class FormActions
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \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
|
||||
*/
|
||||
function select_type_actions($selected='',$htmlname='actioncode')
|
||||
@ -165,7 +165,7 @@ class FormActions
|
||||
require_once(DOL_DOCUMENT_ROOT."/html.form.class.php");
|
||||
$caction=new CActionComm($this->db);
|
||||
$form=new Form($this->db);
|
||||
|
||||
|
||||
$arraylist=$caction->liste_array(1,'code');
|
||||
$arraylist[0]=' ';
|
||||
asort($arraylist);
|
||||
@ -173,5 +173,5 @@ class FormActions
|
||||
$form->select_array($htmlname, $arraylist, $selected);
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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.=" 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.= " FROM ".MAIN_DB_PREFIX."livraison as l";
|
||||
$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);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->date_livraison = $obj->date_livraison;
|
||||
$this->date_creation = $obj->date_creation;
|
||||
$this->date_valid = $obj->date_valid;
|
||||
$this->date_livraison = $this->db->jdate($obj->date_livraison);
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_valid = $this->db->jdate($obj->date_valid);
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->socid = $obj->fk_soc;
|
||||
|
||||
@ -69,7 +69,7 @@ class Paiement
|
||||
*/
|
||||
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.= ', p.num_paiement, p.note, b.fk_account';
|
||||
$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);
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->date = $obj->dp;
|
||||
$this->datepaye = $obj->dp;
|
||||
$this->date = $this->db->jdate($obj->dp);
|
||||
$this->datepaye = $this->db->jdate($obj->dp);
|
||||
$this->numero = $obj->num_paiement;
|
||||
$this->bank_account = $obj->fk_account;
|
||||
$this->bank_line = $obj->fk_bank;
|
||||
@ -337,10 +337,10 @@ class Paiement
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT c.rowid, '.$this->db->pdate('datec').' as datec, fk_user_creat, fk_user_modif';
|
||||
$sql .= ', '.$this->db->pdate('tms').' as tms';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement as c';
|
||||
$sql .= ' WHERE c.rowid = '.$id;
|
||||
$sql = 'SELECT c.rowid, c.datec, c.fk_user_creat, c.fk_user_modif,';
|
||||
$sql.= ' c.tms';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as c';
|
||||
$sql.= ' WHERE c.rowid = '.$id;
|
||||
|
||||
dol_syslog('Paiement::info sql='.$sql);
|
||||
$result = $this->db->query($sql);
|
||||
@ -363,8 +363,8 @@ class Paiement
|
||||
$muser->fetch();
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_modification = $obj->tms;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
|
||||
@ -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.= ' 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.= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
if ($conf->categorie->enabled && ($catid || !$user->rights->categorie->voir))
|
||||
@ -340,7 +340,7 @@ if ($resql)
|
||||
}
|
||||
|
||||
// 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
|
||||
if ($conf->service->enabled && $type != 0)
|
||||
|
||||
@ -180,17 +180,17 @@ class Entrepot extends CommonObject
|
||||
$sql.= " WHERE fk_entrepot = " . $this->id;
|
||||
dol_syslog("Entrepot::delete sql=".$sql);
|
||||
$resql1=$this->db->query($sql);
|
||||
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_stock";
|
||||
$sql.= " WHERE fk_entrepot = " . $this->id;
|
||||
dol_syslog("Entrepot::delete sql=".$sql);
|
||||
$resql2=$this->db->query($sql);
|
||||
|
||||
|
||||
if ($resql1 && $resql2)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."entrepot";
|
||||
$sql.= " WHERE rowid = " . $this->id;
|
||||
|
||||
|
||||
dol_syslog("Entrepot::delete sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -213,7 +213,7 @@ class Entrepot extends CommonObject
|
||||
dol_syslog("Entrepot::delete ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -276,8 +276,8 @@ class Entrepot extends CommonObject
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = "SELECT e.rowid, ".$this->db->pdate("datec")." as datec,";
|
||||
$sql .= " ".$this->db->pdate("tms")." as datem,";
|
||||
$sql = "SELECT e.rowid, e.datec,";
|
||||
$sql .= " e.datem,";
|
||||
$sql .= " fk_user_author";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
|
||||
$sql .= " WHERE e.rowid = ".$id;
|
||||
@ -303,8 +303,8 @@ class Entrepot extends CommonObject
|
||||
$this->user_validation = $vuser;
|
||||
}
|
||||
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_modification = $obj->datem;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ $projectstatic = new Project($db);
|
||||
$userstatic = new User($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.= " s.nom, s.rowid as socid, s.client";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
|
||||
@ -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.= " WHERE rowid IN (".implode(',',$linkedInvoices).")";
|
||||
|
||||
@ -1692,8 +1692,8 @@ class Propal extends CommonObject
|
||||
function info($id)
|
||||
{
|
||||
$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.= ", fk_user_author, fk_user_valid, fk_user_cloture";
|
||||
$sql.= " c.datec, c.date_valid as datev, c.date_cloture as dateo,";
|
||||
$sql.= " c.fk_user_author, c.fk_user_valid, c.fk_user_cloture";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal as c";
|
||||
$sql.= " WHERE c.rowid = ".$id;
|
||||
|
||||
@ -1707,9 +1707,9 @@ class Propal extends CommonObject
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_validation = $obj->datev;
|
||||
$this->date_cloture = $obj->dateo;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
$this->date_cloture = $this->db->jdate($obj->dateo);
|
||||
|
||||
$cuser = new User($this->db, $obj->fk_user_author);
|
||||
$cuser->fetch();
|
||||
|
||||
@ -39,9 +39,9 @@ $langs->load("donations");
|
||||
* View
|
||||
*/
|
||||
|
||||
$sql = "SELECT ".$db->pdate("d.datedon")." as datedon, d.nom, d.prenom, d.amount, d.public, d.societe";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||
$sql .= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC";
|
||||
$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.= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC";
|
||||
|
||||
if ( $db->query( $sql) )
|
||||
{
|
||||
@ -69,13 +69,13 @@ if ( $db->query( $sql) )
|
||||
print "<TR $bc[$var]>";
|
||||
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
|
||||
{
|
||||
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 "</tr>";
|
||||
$i++;
|
||||
|
||||
@ -102,6 +102,9 @@ class Societe extends CommonObject
|
||||
|
||||
var $price_level;
|
||||
|
||||
var $datec;
|
||||
var $date_update;
|
||||
|
||||
var $commercial_id; //Id du commercial affecte
|
||||
|
||||
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 .= ','. $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.siren, s.siret, s.ape, s.idprof4';
|
||||
$sql .= ', s.capital, s.tva_intra';
|
||||
@ -580,7 +583,8 @@ class Societe extends CommonObject
|
||||
$this->ref = $obj->rowid;
|
||||
$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->address = $obj->address;
|
||||
@ -640,7 +644,7 @@ class Societe extends CommonObject
|
||||
|
||||
$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->cond_reglement = $obj->cond_reglement;
|
||||
$this->client = $obj->client;
|
||||
@ -686,7 +690,7 @@ class Societe extends CommonObject
|
||||
global $conf,$langs;
|
||||
|
||||
$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 .= ", p.libelle as pays, p.code as pays_code, s.nom as socname";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_adresse_livraison as l";
|
||||
@ -701,8 +705,8 @@ class Societe extends CommonObject
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->datec = $obj->dc;
|
||||
$this->datem = $obj->dm;
|
||||
$this->datec = $this->db->jdate($obj->dc);
|
||||
$this->datem = $this->db->jdate($obj->dm);
|
||||
$this->label = $obj->label;
|
||||
$this->socid = $obj->fk_societe;
|
||||
$this->societe = $obj->socname;
|
||||
@ -1829,7 +1833,7 @@ class Societe extends CommonObject
|
||||
*/
|
||||
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.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE s.rowid = ".$id;
|
||||
@ -1855,8 +1859,8 @@ class Societe extends CommonObject
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
$this->ref = $obj->nom;
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_modification = $obj->datea;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datea);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
@ -153,7 +153,7 @@ if ($_GET['delsoc']) print '<div class="warning">'.$langs->trans("CompanyDeleted
|
||||
*/
|
||||
$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.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
|
||||
@ -150,10 +150,10 @@ class User extends CommonObject
|
||||
$sql.= " u.pass, u.pass_crypted, u.pass_temp,";
|
||||
$sql.= " u.fk_societe, u.fk_socpeople, u.fk_member, u.ldap_sid,";
|
||||
$sql.= " u.statut, u.lang, u.entity,";
|
||||
$sql.= " ".$this->db->pdate("u.datec")." as datec,";
|
||||
$sql.= " ".$this->db->pdate("u.tms")." as datem,";
|
||||
$sql.= " ".$this->db->pdate("u.datelastlogin")." as datel,";
|
||||
$sql.= " ".$this->db->pdate("u.datepreviouslogin")." as datep";
|
||||
$sql.= " u.datec as datec,";
|
||||
$sql.= " u.tms as datem,";
|
||||
$sql.= " u.datelastlogin as datel,";
|
||||
$sql.= " u.datepreviouslogin as datep";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
|
||||
if ($sid)
|
||||
@ -200,10 +200,10 @@ class User extends CommonObject
|
||||
$this->lang = $obj->lang;
|
||||
$this->entity = $obj->entity;
|
||||
|
||||
$this->datec = $obj->datec;
|
||||
$this->datem = $obj->datem;
|
||||
$this->datelastlogin = $obj->datel;
|
||||
$this->datepreviouslogin = $obj->datep;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->datem = $this->db->jdate($obj->datem);
|
||||
$this->datelastlogin = $this->db->jdate($obj->datel);
|
||||
$this->datepreviouslogin = $this->db->jdate($obj->datep);
|
||||
|
||||
$this->webcal_login = $obj->webcal_login;
|
||||
$this->phenix_login = $obj->phenix_login;
|
||||
@ -1765,8 +1765,8 @@ class User extends CommonObject
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = "SELECT u.rowid, u.login as ref, ".$this->db->pdate("datec")." as datec,";
|
||||
$sql.= $this->db->pdate("u.tms")." as date_modification, u.entity";
|
||||
$sql = "SELECT u.rowid, u.login as ref, u.datec,";
|
||||
$sql.= " u.tms as date_modification, u.entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE u.rowid = ".$id;
|
||||
|
||||
@ -1780,8 +1780,8 @@ class User extends CommonObject
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
$this->ref = (! $obj->ref) ? $obj->rowid : $obj->ref;
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_modification = $obj->date_modification;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$this->entity = $obj->entity;
|
||||
}
|
||||
|
||||
|
||||
@ -141,16 +141,16 @@ foreach ($accounts as $account)
|
||||
$height = 280;
|
||||
|
||||
// Calcul de $min et $max
|
||||
$sql = "SELECT min(".$db->pdate("datev")."),max(".$db->pdate("datev").")";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$sql = "SELECT min(datev), max(datev)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " WHERE fk_account = ".$account;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$row = $db->fetch_row($resql);
|
||||
$min = $row[0];
|
||||
$max = $row[1];
|
||||
$min = $this->db->jdate($row[0]);
|
||||
$max = $this->db->jdate($row[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user