Fix: Status not complete
This commit is contained in:
parent
00f99e2d2b
commit
5ad8e3dd95
@ -30,119 +30,122 @@ include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
|
|||||||
|
|
||||||
class box_factures_fourn extends ModeleBoxes {
|
class box_factures_fourn extends ModeleBoxes {
|
||||||
|
|
||||||
var $boxcode="lastsupplierbills";
|
var $boxcode="lastsupplierbills";
|
||||||
var $boximg="object_bill";
|
var $boximg="object_bill";
|
||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("facture","fournisseur");
|
var $depends = array("facture","fournisseur");
|
||||||
|
|
||||||
var $db;
|
var $db;
|
||||||
var $param;
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* \brief Constructeur de la classe
|
||||||
*/
|
*/
|
||||||
function box_factures_fourn()
|
function box_factures_fourn()
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastSupplierBills");
|
$this->boxlabel=$langs->trans("BoxLastSupplierBills");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Charge les donnees en memoire pour affichage ulterieur
|
* \brief Charge les donnees en memoire pour affichage ulterieur
|
||||||
* \param $max Nombre maximum d'enregistrements a charger
|
* \param $max Nombre maximum d'enregistrements a charger
|
||||||
*/
|
*/
|
||||||
function loadBox($max=5)
|
function loadBox($max=5)
|
||||||
{
|
{
|
||||||
global $conf, $user, $langs, $db;
|
global $conf, $user, $langs, $db;
|
||||||
|
|
||||||
$this->max=$max;
|
$this->max=$max;
|
||||||
|
|
||||||
include_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php");
|
include_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php");
|
||||||
$facturestatic=new FactureFournisseur($db);
|
$facturestatic=new FactureFournisseur($db);
|
||||||
|
|
||||||
$this->info_box_head = array(
|
$this->info_box_head = array(
|
||||||
'text' => $langs->trans("BoxTitleLastSupplierBills",$max)
|
'text' => $langs->trans("BoxTitleLastSupplierBills",$max)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($user->rights->fournisseur->facture->lire)
|
if ($user->rights->fournisseur->facture->lire)
|
||||||
{
|
{
|
||||||
$sql = "SELECT s.nom, s.rowid as socid,";
|
$sql = "SELECT s.nom, s.rowid as socid,";
|
||||||
$sql.= " f.rowid as facid, f.facnumber, f.amount,";
|
$sql.= " f.rowid as facid, f.facnumber, f.amount,";
|
||||||
$sql.= " f.paye, f.fk_statut,";
|
$sql.= " f.paye, f.fk_statut,";
|
||||||
$sql.= ' f.datef as df,';
|
$sql.= ' f.datef as df,';
|
||||||
$sql.= ' f.datec as datec,';
|
$sql.= ' f.datec as datec,';
|
||||||
$sql.= ' f.date_lim_reglement as datelimite, f.tms';
|
$sql.= ' f.date_lim_reglement as datelimite, f.tms, f.type';
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f";
|
$sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||||
$sql.= " AND s.entity = ".$conf->entity;
|
$sql.= " AND s.entity = ".$conf->entity;
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||||
$sql.= " ORDER BY f.tms DESC";
|
$sql.= " ORDER BY f.tms DESC";
|
||||||
$sql.= $db->plimit($max, 0);
|
$sql.= $db->plimit($max, 0);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$now=gmmktime();
|
$now=gmmktime();
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';
|
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$datelimite=$db->jdate($objp->datelimite);
|
$datelimite=$db->jdate($objp->datelimite);
|
||||||
$datec=$db->jdate($objp->datec);
|
$datec=$db->jdate($objp->datec);
|
||||||
|
|
||||||
$late = '';
|
$late = '';
|
||||||
if ($objp->paye == 0 && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dol_print_date($datelimite,'day')));
|
if ($objp->paye == 0 && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dol_print_date($datelimite,'day')));
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||||
'logo' => $this->boximg,
|
'logo' => $this->boximg,
|
||||||
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
|
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
|
||||||
|
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||||
'text' => $objp->facnumber,
|
'text' => $objp->facnumber,
|
||||||
'text2'=> $late,
|
'text2'=> $late,
|
||||||
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
|
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
|
||||||
|
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
|
||||||
'text' => $objp->nom,
|
'text' => $objp->nom,
|
||||||
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
|
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
|
||||||
|
|
||||||
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
|
||||||
'text' => dol_print_date($datec,'day'));
|
'text' => dol_print_date($datec,'day'));
|
||||||
|
|
||||||
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
|
$fac = new FactureFournisseur($db);
|
||||||
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));
|
$fac->fetch($objp->facid);
|
||||||
|
$alreadypayed=$fac->getSommePaiement();
|
||||||
|
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
|
||||||
|
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypayed,$objp->type));
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpayedCustomerBills"));
|
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpayedCustomerBills"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
||||||
'text' => $langs->transnoentities("ReadPermissionNotAllowed"));
|
'text' => $langs->transnoentities("ReadPermissionNotAllowed"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showBox()
|
function showBox()
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* 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
|
||||||
@ -18,131 +18,134 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/includes/boxes/box_factures_fourn_imp.php
|
* \file htdocs/includes/boxes/box_factures_fourn_imp.php
|
||||||
\ingroup fournisseur
|
* \ingroup fournisseur
|
||||||
\brief Fichier de gestion d'une box des factures fournisseurs impayees
|
* \brief Fichier de gestion d'une box des factures fournisseurs impayees
|
||||||
\version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
|
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
|
||||||
|
|
||||||
|
|
||||||
class box_factures_fourn_imp extends ModeleBoxes {
|
class box_factures_fourn_imp extends ModeleBoxes {
|
||||||
|
|
||||||
var $boxcode="oldestunpayedsupplierbills";
|
var $boxcode="oldestunpayedsupplierbills";
|
||||||
var $boximg="object_bill";
|
var $boximg="object_bill";
|
||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("facture","fournisseur");
|
var $depends = array("facture","fournisseur");
|
||||||
|
|
||||||
var $db;
|
var $db;
|
||||||
var $param;
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* \brief Constructeur de la classe
|
||||||
*/
|
*/
|
||||||
function box_factures_fourn_imp()
|
function box_factures_fourn_imp()
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxOldestUnpayedSupplierBills");
|
$this->boxlabel=$langs->trans("BoxOldestUnpayedSupplierBills");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Charge les donnees en memoire pour affichage ulterieur
|
* \brief Charge les donnees en memoire pour affichage ulterieur
|
||||||
* \param $max Nombre maximum d'enregistrements a charger
|
* \param $max Nombre maximum d'enregistrements a charger
|
||||||
*/
|
*/
|
||||||
function loadBox($max=5)
|
function loadBox($max=5)
|
||||||
{
|
{
|
||||||
global $conf, $user, $langs, $db;
|
global $conf, $user, $langs, $db;
|
||||||
|
|
||||||
$this->max=$max;
|
|
||||||
|
|
||||||
include_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php");
|
|
||||||
$facturestatic=new FactureFournisseur($db);
|
|
||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpayedSupplierBills",$max));
|
$this->max=$max;
|
||||||
|
|
||||||
if ($user->rights->fournisseur->facture->lire)
|
include_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php");
|
||||||
{
|
$facturestatic=new FactureFournisseur($db);
|
||||||
$sql = "SELECT s.nom, s.rowid as socid,";
|
|
||||||
$sql.= " f.facnumber, f.date_lim_reglement as datelimite,";
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpayedSupplierBills",$max));
|
||||||
$sql.= " f.amount, f.datef as df,";
|
|
||||||
$sql.= " f.paye, f.fk_statut, f.rowid as facid";
|
if ($user->rights->fournisseur->facture->lire)
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
{
|
||||||
$sql.= ",".MAIN_DB_PREFIX."facture_fourn as f";
|
$sql = "SELECT s.nom, s.rowid as socid,";
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
$sql.= " f.rowid as facid, f.facnumber, f.date_lim_reglement as datelimite,";
|
||||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
$sql.= " f.amount, f.datef as df,";
|
||||||
$sql.= " AND s.entity = ".$conf->entity;
|
$sql.= " f.paye, f.fk_statut, f.type";
|
||||||
$sql.= " AND f.paye=0";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= " AND fk_statut = 1";
|
$sql.= ",".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||||
$sql.= " ORDER BY datelimite DESC, f.facnumber DESC ";
|
$sql.= " AND s.entity = ".$conf->entity;
|
||||||
$sql.= $db->plimit($max, 0);
|
$sql.= " AND f.paye=0";
|
||||||
|
$sql.= " AND fk_statut = 1";
|
||||||
$result = $db->query($sql);
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if ($result)
|
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||||
{
|
$sql.= " ORDER BY datelimite DESC, f.facnumber DESC ";
|
||||||
$num = $db->num_rows($result);
|
$sql.= $db->plimit($max, 0);
|
||||||
$now=gmmktime();
|
|
||||||
|
$result = $db->query($sql);
|
||||||
$i = 0;
|
if ($result)
|
||||||
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';
|
{
|
||||||
|
$num = $db->num_rows($result);
|
||||||
while ($i < $num)
|
$now=gmmktime();
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($result);
|
$i = 0;
|
||||||
$datelimite=$db->jdate($objp->datelimite);
|
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';
|
||||||
|
|
||||||
$late='';
|
while ($i < $num)
|
||||||
if ($datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));
|
{
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
$datelimite=$db->jdate($objp->datelimite);
|
||||||
|
|
||||||
|
$late='';
|
||||||
|
if ($datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||||
'logo' => $this->boximg,
|
'logo' => $this->boximg,
|
||||||
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
|
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
|
||||||
|
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||||
'text' => $objp->facnumber,
|
'text' => $objp->facnumber,
|
||||||
'text2'=> $late,
|
'text2'=> $late,
|
||||||
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
|
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
|
||||||
|
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
|
||||||
'text' => $objp->nom,
|
'text' => $objp->nom,
|
||||||
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
|
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
|
||||||
|
|
||||||
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
|
||||||
'text' => dol_print_date($datelimite,'day'));
|
'text' => dol_print_date($datelimite,'day'));
|
||||||
|
|
||||||
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
|
$fac = new FactureFournisseur($db);
|
||||||
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));
|
$fac->fetch($objp->facid);
|
||||||
|
$alreadypayed=$fac->getSommePaiement();
|
||||||
$i++;
|
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
|
||||||
}
|
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypayed,$objp->type));
|
||||||
|
|
||||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpayedSupplierBills"));
|
$i++;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpayedSupplierBills"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
||||||
'maxlength'=>500,
|
'maxlength'=>500,
|
||||||
'text' => ($db->error().' sql='.$sql));
|
'text' => ($db->error().' sql='.$sql));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
||||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showBox()
|
function showBox()
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user