Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
6ef0b8e330
@ -169,8 +169,9 @@ if (! empty($triggers))
|
||||
//print 'module='.$module.'<br>';
|
||||
if (! empty($conf->$module->enabled))
|
||||
{
|
||||
// Discard special case.
|
||||
// Discard special case: If option FICHINTER_CLASSIFY_BILLED is not set, we discard both trigger FICHINTER_CLASSIFY_BILLED and FICHINTER_CLASSIFY_UNBILLED
|
||||
if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;
|
||||
if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
@ -341,11 +341,14 @@ dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
||||
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup);
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Define the legend/list of calendard to show
|
||||
$s=''; $link='';
|
||||
|
||||
$showextcals=$listofextcals;
|
||||
// Legend
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
|
||||
if (! empty($conf->use_javascript_ajax)) // If javascript on
|
||||
{
|
||||
$s='';
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {' . "\n";
|
||||
$s.='jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });' . "\n";
|
||||
@ -358,7 +361,10 @@ if (! empty($conf->use_javascript_ajax))
|
||||
$s.='});' . "\n";
|
||||
$s.='</script>' . "\n";
|
||||
|
||||
// Local calendar
|
||||
$s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> ' . $langs->trans("LocalAgenda").' </div>';
|
||||
|
||||
// External calendars
|
||||
if (is_array($showextcals) && count($showextcals) > 0)
|
||||
{
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
@ -377,13 +383,23 @@ if (! empty($conf->use_javascript_ajax))
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_ext' . $htmlname . '" name="check_ext' . $htmlname . '" checked> ' . $val['name'] . ' </div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Birthdays
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' </div>';
|
||||
|
||||
// Calendars from hooks
|
||||
$parameters=array(); $object=null;
|
||||
$reshook=$hookmanager->executeHooks('addCalendarChoice',$parameters,$object,$action);
|
||||
if (empty($reshook))
|
||||
{
|
||||
$s.= $hookmanager->resPrint;
|
||||
}
|
||||
elseif ($reshook > 1)
|
||||
{
|
||||
$s = $hookmanager->resPrint;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$link='';
|
||||
// Add link to show birthdays
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
else // If javascript off
|
||||
{
|
||||
$newparam=$param; // newparam is for birthday links
|
||||
$newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam);
|
||||
@ -396,10 +412,10 @@ if (empty($conf->use_javascript_ajax))
|
||||
$link.='</a>';
|
||||
}
|
||||
|
||||
print_fiche_titre($s,$link.' '.$nav, '');
|
||||
print_fiche_titre($s, $link.' '.$nav, '');
|
||||
|
||||
|
||||
// Get event in an array
|
||||
// Load events from database into $eventarray
|
||||
$eventarray=array();
|
||||
|
||||
$sql = 'SELECT ';
|
||||
@ -470,6 +486,7 @@ if ($filtert > 0 || $usergroup > 0)
|
||||
$sql.= ' ORDER BY datep';
|
||||
//print $sql;
|
||||
|
||||
|
||||
dol_syslog("comm/action/index.php", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -571,6 +588,7 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// Complete $eventarray with birthdates
|
||||
if ($showbirthday)
|
||||
{
|
||||
// Add events in array
|
||||
@ -638,6 +656,7 @@ if ($showbirthday)
|
||||
}
|
||||
}
|
||||
|
||||
// Complete $eventarray with external import Ical
|
||||
if (count($listofextcals))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/ical.class.php';
|
||||
@ -878,6 +897,15 @@ if (count($listofextcals))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Complete $eventarray with events coming from external module
|
||||
$parameters=array(); $object=null;
|
||||
$reshook=$hookmanager->executeHooks('getCalendarEvents',$parameters,$object,$action);
|
||||
if (! empty($hookmanager->resArray['eventarray'])) $eventarray=array_merge($eventarray, $hookmanager->resArray['eventarray']);
|
||||
|
||||
|
||||
|
||||
$maxnbofchar=18;
|
||||
$cachethirdparties=array();
|
||||
$cachecontacts=array();
|
||||
|
||||
@ -270,22 +270,22 @@ if ($result)
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('AskPriceSupplierDate'),$_SERVER["PHP_SELF"],'p.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="12" name="search_societe" value="'.$search_societe.'">';
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Date
|
||||
print '<td class="liste_titre" colspan="1" align="center">';
|
||||
//print $langs->trans('Month').': ';
|
||||
@ -294,7 +294,7 @@ if ($result)
|
||||
$syear = $year;
|
||||
$formother->select_year($syear,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'">';
|
||||
@ -353,7 +353,7 @@ if ($result)
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
|
||||
$url = DOL_URL_ROOT.'/comm/card.php?socid='.$objp->rowid;
|
||||
|
||||
// Company
|
||||
@ -364,12 +364,12 @@ if ($result)
|
||||
print '<td>';
|
||||
print $companystatic->getNomUrl(1,'customer');
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Date askprice
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->dp), 'day');
|
||||
print "</td>\n";
|
||||
|
||||
|
||||
print '<td align="right">'.price($objp->total_ht)."</td>\n";
|
||||
|
||||
$userstatic->id=$objp->fk_user_author;
|
||||
|
||||
@ -205,7 +205,7 @@ if ($result)
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -420,7 +420,7 @@ if ($object->fetch($id) >= 0)
|
||||
}
|
||||
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
|
||||
print '</tr>';
|
||||
|
||||
@ -459,7 +459,7 @@ if ($object->fetch($id) >= 0)
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Reset"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -9,8 +9,8 @@
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
@ -255,6 +255,7 @@ if ($result)
|
||||
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_author) $param.='&search_author='.$search_author;
|
||||
if ($search_town) $param.='&search_town='.$search_town;
|
||||
|
||||
print_barre_liste($langs->trans('ListOfProposals').' '.($socid?'- '.$soc->name:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_commercial.png');
|
||||
|
||||
// Lignes des champs de filtre
|
||||
@ -310,7 +311,7 @@ if ($result)
|
||||
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -351,9 +351,8 @@ if ($resql)
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -416,7 +415,7 @@ if ($resql)
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
|
||||
print '</td>';
|
||||
|
||||
@ -474,8 +473,8 @@ if ($resql)
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '<td align="center">';
|
||||
print $prospectstatic->LibStatut($prospectstatic->status,3);
|
||||
print '<td align="right">';
|
||||
print $prospectstatic->LibStatut($prospectstatic->status,5);
|
||||
print '</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
@ -130,13 +130,8 @@ $sql.= ' WHERE c.fk_soc = s.rowid';
|
||||
$sql.= ' AND c.entity IN ('.getEntity('commande', 1).')';
|
||||
if ($socid) $sql.= ' AND s.rowid = '.$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($search_ref) {
|
||||
$sql .= natural_search('c.ref', $search_ref);
|
||||
}
|
||||
if ($sall)
|
||||
{
|
||||
$sql .= natural_search(array('c.ref', 'c.note_private'), $sall);
|
||||
}
|
||||
if ($search_ref) $sql .= natural_search('c.ref', $search_ref);
|
||||
if ($sall) $sql .= natural_search(array('c.ref', 'c.note_private'), $sall);
|
||||
if ($viewstatut <> '')
|
||||
{
|
||||
if ($viewstatut < 4 && $viewstatut > -3)
|
||||
@ -190,24 +185,12 @@ else if ($deliveryyear > 0)
|
||||
{
|
||||
$sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,12,false))."'";
|
||||
}
|
||||
if (!empty($search_company))
|
||||
{
|
||||
$sql .= natural_search('s.nom', $search_company);
|
||||
}
|
||||
if (!empty($search_ref_customer))
|
||||
{
|
||||
$sql.= ' AND c.ref_client LIKE \'%'.$db->escape($search_ref_customer).'%\'';
|
||||
}
|
||||
if (!empty($search_company)) $sql .= natural_search('s.nom', $search_company);
|
||||
if (!empty($search_ref_customer)) $sql.= natural_search('c.ref_client', $search_ref_customer);
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
}
|
||||
if ($search_total_ht != '')
|
||||
{
|
||||
$sql.= natural_search('c.total_ht', $search_total_ht, 1);
|
||||
}
|
||||
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder;
|
||||
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1);
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
@ -216,7 +199,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
|
||||
$sql.= $db->plimit($limit + 1,$offset);
|
||||
|
||||
//print $sql;
|
||||
@ -291,7 +273,7 @@ if ($resql)
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" colspan="9">';
|
||||
print '<td class="liste_titre" colspan="10">';
|
||||
print $moreforfilter;
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -304,6 +286,7 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'c.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -328,6 +311,7 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="6" name="search_total_ht" value="'.$search_total_ht.'">';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print "</td></tr>\n";
|
||||
@ -493,6 +477,8 @@ if ($resql)
|
||||
// Statut
|
||||
print '<td align="right" class="nowrap">'.$generic_commande->LibStatut($objp->fk_statut,$objp->facturee,5).'</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
$total+=$objp->total_ht;
|
||||
@ -507,7 +493,8 @@ if ($resql)
|
||||
print '<td class="nowrap" colspan="5">'.$langs->trans('TotalHT').'</td>';
|
||||
// Total HT
|
||||
print '<td align="right" class="nowrap">'.price($total).'</td>';
|
||||
print '<td class="nowrap"> </td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -129,7 +129,7 @@ if ($action == 'create')
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="facid" value="'.$object->id.'">';
|
||||
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
$rowspan=4;
|
||||
@ -202,7 +202,7 @@ if ($action == 'create')
|
||||
$sql = 'SELECT l.fk_product, l.product_type, l.label as custom_label, l.description, l.qty, l.rowid, l.tva_tx,';
|
||||
$sql.= ' l.fk_remise_except,';
|
||||
$sql.= ' l.remise_percent, l.subprice, l.info_bits,';
|
||||
$sql.= ' l.total_ht, l.total_tva, l.total_ttc,';
|
||||
$sql.= ' l.total_ht, l.total_tva as total_vat, l.total_ttc,';
|
||||
$sql.= ' l.date_start,';
|
||||
$sql.= ' l.date_end,';
|
||||
$sql.= ' l.product_type,';
|
||||
@ -220,7 +220,7 @@ if ($action == 'create')
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0; $total = 0;
|
||||
|
||||
echo '<table class="notopnoleftnoright" width="100%">';
|
||||
echo '<table class="noborder" width="100%">';
|
||||
if ($num)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
@ -572,7 +572,7 @@ else
|
||||
/*
|
||||
* List mode
|
||||
*/
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, f.titre, f.total, f.rowid as facid";
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
@ -594,8 +594,10 @@ else
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"));
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER['PHP_SELF'],"s.nom","","&socid=$socid","",$sortfiled,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"),'','','','','align="right"');
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre($langs->trans("AmountHT"),'','','','','align="right"');
|
||||
print_liste_field_titre($langs->trans("AmountVAT"),'','','','','align="right"');
|
||||
print_liste_field_titre($langs->trans("AmountTTC"),'','','','','align="right"');
|
||||
print_liste_field_titre(''); // Field may contains ling text
|
||||
print "</tr>\n";
|
||||
|
||||
if ($num > 0)
|
||||
@ -616,19 +618,21 @@ else
|
||||
print '<td>'.$companystatic->getNomUrl(1,'customer').'</td>';
|
||||
|
||||
print '<td align="right">'.price($objp->total).'</td>'."\n";
|
||||
print '<td align="right">'.price($objp->total_vat).'</td>'."\n";
|
||||
print '<td align="right">'.price($objp->total_ttc).'</td>'."\n";
|
||||
|
||||
echo '<td align="center">';
|
||||
|
||||
print '<td align="center">';
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
echo '<a href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$objp->socid.'&fac_rec='.$objp->facid.'">';
|
||||
echo $langs->trans("CreateBill"),'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$objp->socid.'&fac_rec='.$objp->facid.'">';
|
||||
print $langs->trans("CreateBill").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo " ";
|
||||
print " ";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,30 +180,12 @@ if ($filtre)
|
||||
$sql .= ' AND ' . trim($filt[0]) . ' = ' . trim($filt[1]);
|
||||
}
|
||||
}
|
||||
if ($search_ref)
|
||||
{
|
||||
$sql .= natural_search('f.facnumber', $search_ref);
|
||||
}
|
||||
if ($search_refcustomer)
|
||||
{
|
||||
$sql .= natural_search('f.ref_client', $search_refcustomer);
|
||||
}
|
||||
if ($search_societe)
|
||||
{
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
if ($search_montant_ht != '')
|
||||
{
|
||||
$sql.= natural_search('f.total', $search_montant_ht, 1);
|
||||
}
|
||||
if ($search_montant_ttc != '')
|
||||
{
|
||||
$sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
|
||||
}
|
||||
if ($search_status != '')
|
||||
{
|
||||
$sql.= " AND f.fk_statut = '".$db->escape($search_status)."'";
|
||||
}
|
||||
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
|
||||
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
|
||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
|
||||
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
|
||||
if ($search_status != '') $sql.= " AND f.fk_statut = '".$db->escape($search_status)."'";
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0 && empty($day))
|
||||
@ -258,7 +240,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
//print $sql;
|
||||
|
||||
@ -307,7 +288,7 @@ if ($resql)
|
||||
if ($moreforfilter)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" colspan="10">';
|
||||
print '<td class="liste_titre" colspan="11">';
|
||||
print $moreforfilter;
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -323,6 +304,7 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Received'),$_SERVER['PHP_SELF'],'am','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut,paye,am','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
// Filters lines
|
||||
@ -345,9 +327,10 @@ if ($resql)
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="8" name="search_societe" value="'.$search_societe.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
|
||||
print '<td class="liste_titre" align="right"> </td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
|
||||
print '<td class="liste_titre" align="right"> </td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print "</td></tr>\n";
|
||||
@ -439,7 +422,9 @@ if ($resql)
|
||||
print '<td align="right" class="nowrap">';
|
||||
print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$paiement,$objp->type);
|
||||
print "</td>";
|
||||
//print "<td> </td>";
|
||||
|
||||
print "<td></td>";
|
||||
|
||||
print "</tr>\n";
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_tva+=$objp->total_tva;
|
||||
@ -457,7 +442,8 @@ if ($resql)
|
||||
print '<td class="liste_total" align="right">'.price($total_tva,0,$langs).'</td>';
|
||||
print '<td class="liste_total" align="right">'.price($total_ttc,0,$langs).'</td>';
|
||||
print '<td class="liste_total" align="right">'.price($totalrecu,0,$langs).'</td>';
|
||||
print '<td class="liste_total" align="center"> </td>';
|
||||
print '<td class="liste_total"></td>';
|
||||
print '<td class="liste_total"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -654,13 +654,16 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Rest"),$_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder);
|
||||
|
||||
$searchpitco='<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
$searchpitco.='<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Reset"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
if (empty($mode))
|
||||
{
|
||||
print_liste_field_titre($langs->trans("PDFMerge"),$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($searchpitco,$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_liste_field_titre($langs->trans("Remind"),$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($searchpitco,$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
@ -695,9 +698,6 @@ if ($resql)
|
||||
print $form->selectarray('filtre', $liststatus, $filter, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '<br>';
|
||||
if (empty($mode))
|
||||
{
|
||||
if ($conf->use_javascript_ajax) print '<a href="#" id="checkall">'.$langs->trans("All").'</a> / <a href="#" id="checknone">'.$langs->trans("None").'</a>';
|
||||
|
||||
@ -705,7 +705,7 @@ if (! GETPOST('action'))
|
||||
print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'dp','','','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Type'),$_SERVER["PHP_SELF"],'libelle','','','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'fa_amount','','','align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < min($num,$limit))
|
||||
@ -728,6 +728,6 @@ if (! GETPOST('action'))
|
||||
}
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -68,6 +68,12 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_company="";
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('paymentlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -81,24 +87,37 @@ if (GETPOST("orphelins"))
|
||||
// Paiements lies a aucune facture (pour aide au diagnostic)
|
||||
$sql = "SELECT p.rowid, p.datep as dp, p.amount,";
|
||||
$sql.= " p.statut, p.num_paiement,";
|
||||
//$sql.= " c.libelle as paiement_type";
|
||||
$sql.= " c.code as paiement_code";
|
||||
// Add fields for extrafields
|
||||
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."paiement as p,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."c_paiement as c)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
|
||||
$sql.= " WHERE p.fk_paiement = c.id";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
$sql.= " AND pf.fk_facture IS NULL";
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT DISTINCT p.rowid, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives
|
||||
$sql.= " p.statut, p.num_paiement,";
|
||||
//$sql.= " c.libelle as paiement_type,";
|
||||
$sql.= " c.code as paiement_code,";
|
||||
$sql.= " ba.rowid as bid, ba.label,";
|
||||
$sql.= " s.rowid as socid, s.nom as name";
|
||||
//$sql.= " f.facnumber";
|
||||
// Add fields for extrafields
|
||||
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement as p)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
@ -127,6 +146,10 @@ else
|
||||
if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'";
|
||||
if ($search_amount) $sql .=" AND p.amount='".$db->escape(price2num($search_amount))."'";
|
||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
@ -157,11 +180,13 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$paramlist,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$paramlist,'align="right"',$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans("Invoices"),"","","",$paramlist,'align="left"',$sortfield,$sortorder);
|
||||
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
||||
{
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$paramlist,'align="right"',$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre('');
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$paramlist,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
// Lines for filters fields
|
||||
@ -199,7 +224,7 @@ if ($resql)
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print '<td width="40">';
|
||||
print '<td>';
|
||||
$paymentstatic->id=$objp->rowid;
|
||||
$paymentstatic->ref=$objp->rowid;
|
||||
print $paymentstatic->getNomUrl(1);
|
||||
|
||||
@ -134,7 +134,7 @@ if ($result)
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -164,6 +164,7 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cs.paye","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -184,6 +185,8 @@ if ($resql)
|
||||
print '<input class="flat" type="text" size="6" name="search_amount" value="'.$search_amount.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
// Status
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print "</td></tr>\n";
|
||||
@ -228,6 +231,8 @@ if ($resql)
|
||||
|
||||
print '<td align="right" class="nowrap">'.$chargesociale_static->LibStatut($obj->paye,5,$obj->alreadypayed).'</a></td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
@ -140,7 +140,7 @@ if ($result)
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dm","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -311,7 +311,7 @@ if ($result)
|
||||
print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"p.tms", $begin, $param, 'align="center"', $sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ContactVisibility"),$_SERVER["PHP_SELF"],"p.priv", $begin, $param, 'align="center"', $sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut", $begin, $param, 'align="center"', $sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
// Lines for filter fields
|
||||
|
||||
@ -116,8 +116,8 @@ class HookManager
|
||||
* @param array $parameters Array of parameters
|
||||
* @param Object $object Object to use hooks on
|
||||
* @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
|
||||
* @return mixed For 'addreplace hooks (doActions,formObjectOptions,pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop standard actions, <0 if KO.
|
||||
* For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint.
|
||||
* @return mixed For 'addreplace hooks (doActions,formObjectOptions,pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop standard actions, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results and set into ->resArray.
|
||||
* For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results and set into ->resArray.
|
||||
* All types can also return some values into an array ->results.
|
||||
* $this->error or this->errors are also defined by class called by this function if error.
|
||||
*/
|
||||
@ -128,7 +128,7 @@ class HookManager
|
||||
$parameters['context']=join(':',$this->contextarray);
|
||||
dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']);
|
||||
|
||||
// Define type of hook ('output' or 'addreplace'. 'returnvalue' is deprecated).
|
||||
// Define type of hook ('output' or 'addreplace'. 'returnvalue' is deprecated because a 'addreplace' hook can also return resPrint and resArray).
|
||||
$hooktype='output';
|
||||
if (in_array(
|
||||
$method,
|
||||
@ -146,7 +146,8 @@ class HookManager
|
||||
'paymentsupplierinvoices',
|
||||
'printAddress',
|
||||
'printSearchForm',
|
||||
'formatEvent'
|
||||
'formatEvent',
|
||||
'addCalendarChoice'
|
||||
)
|
||||
)) $hooktype='addreplace';
|
||||
// Deprecated hook types ('returnvalue')
|
||||
|
||||
@ -876,7 +876,7 @@ class FormOther
|
||||
$min_year = $currentyear-$min_year;
|
||||
if(empty($selected) && empty($useempty)) $selected = $currentyear;
|
||||
|
||||
$out.= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '"'.$option.' >';
|
||||
$out.= '<select class="flat" placeholder="aa" id="' . $htmlname . '" name="' . $htmlname . '"'.$option.' >';
|
||||
if($useempty)
|
||||
{
|
||||
$selected_html='';
|
||||
|
||||
@ -971,6 +971,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
|
||||
$out.="<tr ".$bc[$var].">";
|
||||
|
||||
// Date
|
||||
$out.='<td width="120" align="left" class="nowrap">';
|
||||
$out.=dol_print_date($datep,'dayhour');
|
||||
if ($datep2 && $datep2 != $datep)
|
||||
@ -998,7 +999,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
|
||||
// Title of event
|
||||
//$out.='<td colspan="2">'.dol_trunc($obj->label,40).'</td>';
|
||||
$out.='<td colspan="2">'.$actionstatic->getNomUrl(1,40).'</td>';
|
||||
$out.='<td colspan="2">'.$actionstatic->getNomUrl(1,120).'</td>';
|
||||
|
||||
// Contact pour cette action
|
||||
if (empty($objcon->id) && $obj->fk_contact > 0)
|
||||
@ -1240,14 +1241,14 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
//$actionstatic->libelle=$libelle;
|
||||
$actionstatic->libelle=$histo[$key]['note'];
|
||||
$actionstatic->id=$histo[$key]['id'];
|
||||
$out.=$actionstatic->getNomUrl(1,40);
|
||||
$out.=$actionstatic->getNomUrl(1,120);
|
||||
}
|
||||
if (isset($histo[$key]['type']) && $histo[$key]['type']=='mailing')
|
||||
{
|
||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"),"email").' ';
|
||||
$transcode=$langs->trans("Action".$histo[$key]['acode']);
|
||||
$libelle=($transcode!="Action".$histo[$key]['acode']?$transcode:'Send mass mailing');
|
||||
$out.=dol_trunc($libelle,40);
|
||||
$out.=dol_trunc($libelle,120);
|
||||
}
|
||||
$out.='</td>';
|
||||
|
||||
|
||||
@ -2639,7 +2639,7 @@ function dol_print_error_email($prefixcode)
|
||||
* @param string $td Options of attribute td ("" by defaut, example: 'align="center"')
|
||||
* @param string $sortfield Current field used to sort
|
||||
* @param string $sortorder Current sort order
|
||||
* @param string $prefix Prefix for css
|
||||
* @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag.
|
||||
* @return void
|
||||
*/
|
||||
function print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $td="", $sortfield="", $sortorder="", $prefix="")
|
||||
@ -2659,7 +2659,7 @@ function print_liste_field_titre($name, $file="", $field="", $begin="", $morepar
|
||||
* @param string $moreattrib Add more attributes on th ("" by defaut)
|
||||
* @param string $sortfield Current field used to sort
|
||||
* @param string $sortorder Current sort order
|
||||
* @param string $prefix Prefix for css
|
||||
* @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag.
|
||||
* @return string
|
||||
*/
|
||||
function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="")
|
||||
@ -2675,7 +2675,7 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
|
||||
|
||||
// If field is used as sort criteria we use a specific class
|
||||
// Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom")
|
||||
if ($field && ($sortfield == $field || $sortfield == preg_replace("/^[^\.]+\./","",$field))) $out.= '<'.$tag.' class="liste_titre_sel" '. $moreattrib.'>';
|
||||
if ($field && ($sortfield == $field || $sortfield == preg_replace("/^[^\.]+\./","",$field))) $out.= '<'.$tag.' class="'.$prefix.'liste_titre_sel" '. $moreattrib.'>';
|
||||
else $out.= '<'.$tag.' class="'.$prefix.'liste_titre" '. $moreattrib.'>';
|
||||
|
||||
if (! empty($conf->dol_optimize_smallscreen) && empty($thead) && $field) // If this is a sort field
|
||||
|
||||
@ -1194,6 +1194,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire && $user->rights->projet->lire, '', $mainmenu, 'projects');
|
||||
$newmenu->add("/projet/card.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
|
||||
$newmenu->add("/projet/list.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
|
||||
$newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
|
||||
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
{
|
||||
|
||||
@ -133,7 +133,7 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("DateReceived"), $_SERVER["PHP_SELF"],"l.date_delivery","",$param, 'align="center"',$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"],"e.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
@ -158,7 +158,8 @@ if ($resql)
|
||||
// Status
|
||||
print '<td></td>';
|
||||
// Search
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -191,7 +191,7 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("TotalVAT"),$_SERVER["PHP_SELF"],"d.total_tva","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("TotalTTC"),$_SERVER["PHP_SELF"],"d.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Statut"),$_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
// Filters
|
||||
@ -263,10 +263,13 @@ if ($resql)
|
||||
print '<td align="right">'.price($objp->total_ttc).'</td>';
|
||||
|
||||
$expensereporttmp->status=$objp->status;
|
||||
print '<td align="right" colspan="2">';
|
||||
print '<td align="right">';
|
||||
//print $objp->status;
|
||||
print $expensereporttmp->getLibStatut(5);
|
||||
print '</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$total_total_ht = $total_total_ht + $objp->total_ht;
|
||||
|
||||
@ -145,7 +145,7 @@ if ($result)
|
||||
print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$urlparam,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -224,6 +224,7 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
@ -200,7 +200,7 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"dc","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('DateDeliveryPlanned'),$_SERVER["PHP_SELF"],'cf.date_livraison','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cf.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
* Copyright (C) 2015 juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Abbes Bahfir <bafbes@gmail.com>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
@ -264,7 +264,7 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"fac.total_ht","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"fac.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
// Line for filters
|
||||
|
||||
@ -202,7 +202,7 @@ if ($resql)
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -276,7 +276,7 @@ print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],'','','',
|
||||
print_liste_field_titre($langs->trans("DateDebCP"),$_SERVER["PHP_SELF"],"cp.date_debut","",'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateFinCP"),$_SERVER["PHP_SELF"],"cp.date_fin","",'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cp.statut","",'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
// FILTRES
|
||||
@ -395,7 +395,8 @@ if (! empty($holiday->holiday))
|
||||
print '</td>';
|
||||
print '<td align="center">'.dol_print_date($infos_CP['date_debut'],'day').'</td>';
|
||||
print '<td align="center">'.dol_print_date($infos_CP['date_fin'],'day').'</td>';
|
||||
print '<td align="right" colspan="2">'.$holidaystatic->LibStatut($infos_CP['statut'],5).'</td>';
|
||||
print '<td align="right">'.$holidaystatic->LibStatut($infos_CP['statut'],5).'</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
}
|
||||
|
||||
@ -725,3 +725,7 @@ INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (
|
||||
INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (6,'WIN' ,'Won', 60, 100,1);
|
||||
INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (7,'LOST' ,'Lost', 70, 0,1);
|
||||
|
||||
|
||||
DELETE FROM llx_c_action_trigger where code = 'PROPAL_CLASSIFYBILLED';
|
||||
DELETE FROM llx_c_action_trigger where code = 'FICHINTER_CLASSIFYBILLED';
|
||||
|
||||
|
||||
@ -158,3 +158,5 @@ AssignTask=Assign
|
||||
ProjectOverview=Overview
|
||||
ManageTasks=Use projects to follow tasks and time
|
||||
ManageOpportunitiesStatus=Use projects to follow leads/opportinuties
|
||||
ProjectNbProjectByMonth=Nb of created projects by month
|
||||
ProjectsStatistics=Statistics on projects/leads
|
||||
@ -808,7 +808,8 @@ class Product extends CommonObject
|
||||
{
|
||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductAlreadyExists",$this->ref);
|
||||
if (empty($conf->barcode->enabled)) $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductAlreadyExists",$this->ref);
|
||||
else $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductBarCodeAlreadyExists",$this->barcode);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ else
|
||||
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print '<td class="liste_titre" align="right">'.$langs->trans("PhysicalStock").'</td>';
|
||||
print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
@ -381,11 +381,11 @@ else
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->selectarray('tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')),$tosell,1);
|
||||
print '</td >';
|
||||
|
||||
print '<td align="center">';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->selectarray('tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$tobuy,1);
|
||||
print '</td>';
|
||||
|
||||
@ -393,6 +393,7 @@ else
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("RemoveFilter"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
|
||||
|
||||
@ -518,6 +518,10 @@ else
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
$head = stock_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("Warehouse"), 0, 'stock');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
@ -559,7 +563,9 @@ else
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
|
||||
@ -31,9 +31,10 @@ $langs->load("stocks");
|
||||
// Security check
|
||||
$result=restrictedArea($user,'stock');
|
||||
|
||||
$sref=GETPOST("sref","alpha");
|
||||
$snom=GETPOST("snom","alpha");
|
||||
$search_ref=GETPOST("sref","alpha")?GETPOST("sref","alpha"):GETPOST("search_ref","alpha");
|
||||
$search_label=GETPOST("snom","alpha")?GETPOST("snom","alpha"):GETPOST("search_label","alpha");
|
||||
$sall=GETPOST("sall","alpha");
|
||||
$search_status=GETPOST("search_status","int");
|
||||
|
||||
$sortfield = GETPOST("sortfield");
|
||||
$sortorder = GETPOST("sortorder");
|
||||
@ -52,6 +53,7 @@ $year = strftime("%Y",time());
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$warehouse=new Entrepot($db);
|
||||
|
||||
$sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,";
|
||||
$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
|
||||
@ -59,22 +61,14 @@ $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
|
||||
$sql.= " WHERE e.entity IN (".getEntity('stock', 1).")";
|
||||
if ($sref)
|
||||
{
|
||||
$sql.= " AND e.label LIKE '%".$db->escape($sref)."%'";
|
||||
}
|
||||
if ($sall)
|
||||
{
|
||||
$sql.= " AND (e.label LIKE '%".$db->escape($sall)."%'";
|
||||
$sql.= " OR e.description LIKE '%".$db->escape($sall)."%'";
|
||||
$sql.= " OR e.lieu LIKE '%".$db->escape($sall)."%'";
|
||||
$sql.= " OR e.address LIKE '%".$db->escape($sall)."%'";
|
||||
$sql.= " OR e.town LIKE '%".$db->escape($sall)."%')";
|
||||
}
|
||||
if ($search_ref) $sql.= natural_search("e.label", $search_ref); // ref
|
||||
if ($search_label) $sql.= natural_search("e.lieu", $search_label); // label
|
||||
if ($search_status != '' && $search_status >= 0) $sql.= " AND e.statut = ".$search_status;
|
||||
if ($sall) $sql.= natural_search(array('e.label','e.description','e.lieu','e.address','e.town'), $sall);
|
||||
$sql.= " GROUP BY e.rowid, e.label, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays";
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
print $sql;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -87,6 +81,12 @@ if ($result)
|
||||
|
||||
print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder,'',$num);
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print "<tr class=\"liste_titre\">";
|
||||
@ -95,8 +95,34 @@ if ($result)
|
||||
print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "e.valo_pmp",'','','align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'','','align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "e.statut",'','','align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_ref" size="6" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_label" size="10" value="'.dol_escape_htmltag($search_label).'">';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" colspan="2">';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print $form->selectarray('search_status', $warehouse->statuts, $search_status, 1, 0, 0, '', 1);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre nowrap" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("RemoveFilter"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
if ($num)
|
||||
{
|
||||
$entrepot=new Entrepot($db);
|
||||
@ -128,6 +154,9 @@ if ($result)
|
||||
print '</td>';
|
||||
// Status
|
||||
print '<td align="right">'.$entrepot->LibStatut($objp->statut,5).'</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$total += price2num($objp->estimatedvalue,'MU');
|
||||
@ -148,7 +177,8 @@ if ($result)
|
||||
print $form->textwithtooltip($langs->trans("Variable"),$htmltext);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -156,6 +186,7 @@ if ($result)
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -501,12 +501,12 @@ if ($resql)
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" valign="right">';
|
||||
print $langs->trans('Month').': <input class="flat" type="text" size="2" maxlength="2" name="month" value="'.$month.'">';
|
||||
print '<input class="flat" type="text" size="2" maxlength="2" placeholder="'.dol_escape_htmltag($langs->trans("Month")).'" name="month" value="'.$month.'">';
|
||||
if (empty($conf->productbatch->enabled)) print ' ';
|
||||
else print '<br>';
|
||||
print $langs->trans('Year').': ';
|
||||
//else print '<br>';
|
||||
$syear = $year?$year:-1;
|
||||
$formother->select_year($syear,'year',1, 20, 5);
|
||||
print '<input class="flat" type="text" size="2" maxlength="4" placeholder="'.dol_escape_htmltag($langs->trans("Year")).'" name="year" value="'.($syear > 0 ? $syear : '').'">';
|
||||
//print $formother->selectyear($syear,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
// Product Ref
|
||||
print '<td class="liste_titre" align="left">';
|
||||
|
||||
327
htdocs/projet/class/projectstats.class.php
Normal file
327
htdocs/projet/class/projectstats.class.php
Normal file
@ -0,0 +1,327 @@
|
||||
<?php
|
||||
/* Lead
|
||||
* Copyright (C) 2014-2015 Florian HENRY <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
|
||||
|
||||
class ProjectStats extends Stats
|
||||
{
|
||||
protected $db;
|
||||
private $project;
|
||||
public $userid;
|
||||
public $socid;
|
||||
public $year;
|
||||
function __construct($db) {
|
||||
global $conf, $user;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
require_once 'project.class.php';
|
||||
|
||||
$this->project = new Project($this->db);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return all leads grouped by status
|
||||
*
|
||||
* @param int $limit Limit results
|
||||
* @return array|int
|
||||
* @throws Exception
|
||||
*/
|
||||
function getAllProjectByStatus($limit = 5)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$datay = array ();
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql .= " count(DISTINCT t.rowid), t.fk_opp_status";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
||||
$sql .= $this->buildWhere();
|
||||
$sql .= " GROUP BY t.fk_opp_status";
|
||||
|
||||
$result = array ();
|
||||
$res = array ();
|
||||
|
||||
dol_syslog(get_class($this) . '::' . __METHOD__ . "", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
$other = 0;
|
||||
while ( $i < $num ) {
|
||||
$row = $this->db->fetch_row($resql);
|
||||
if ($i < $limit || $num == $limit)
|
||||
$result[$i] = array (
|
||||
$this->projet->status[$row[1]] . '(' . $row[0] . ')',
|
||||
$row[0]
|
||||
);
|
||||
else
|
||||
$other += $row[1];
|
||||
$i ++;
|
||||
}
|
||||
if ($num > $limit)
|
||||
$result[$i] = array (
|
||||
$langs->transnoentitiesnoconv("Other"),
|
||||
$other
|
||||
);
|
||||
$this->db->free($resql);
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . '::' . __METHOD__ . ' ' . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return count, and sum of products
|
||||
*
|
||||
* @return array of values
|
||||
*/
|
||||
function getAllByYear()
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$datay = array ();
|
||||
|
||||
$sql = "SELECT date_format(t.datec,'%Y') as year, COUNT(t.rowid) as nb, SUM(t.opp_amount) as total, AVG(t.opp_amount) as avg";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id)
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||
$sql .= $this->buildWhere();
|
||||
$sql .= " GROUP BY year";
|
||||
$sql .= $this->db->order('year', 'DESC');
|
||||
|
||||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function buildWhere() {
|
||||
$sqlwhere_str = '';
|
||||
$sqlwhere = array ();
|
||||
|
||||
$sqlwhere[] = ' t.entity IN (' . getEntity('project') . ')';
|
||||
|
||||
if (! empty($this->userid))
|
||||
$sqlwhere[] = ' t.fk_user_resp=' . $this->userid;
|
||||
if (! empty($this->socid))
|
||||
$sqlwhere[] = ' t.fk_soc=' . $this->socid;
|
||||
if (! empty($this->year) && empty($this->yearmonth))
|
||||
$sqlwhere[] = " date_format(t.datec,'%Y')='" . $this->year . "'";
|
||||
if (! empty($this->yearmonth))
|
||||
$sqlwhere[] = " t.datec BETWEEN '" . $this->db->idate(dol_get_first_day($this->yearmonth)) . "' AND '" . $this->db->idate(dol_get_last_day($this->yearmonth)) . "'";
|
||||
|
||||
if (! empty($this->status))
|
||||
$sqlwhere[] = " t.fk_opp_status IN (" . $this->status . ")";
|
||||
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sqlwhere_str = ' WHERE ' . implode(' AND ', $sqlwhere);
|
||||
}
|
||||
|
||||
return $sqlwhere_str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Project number by month for a year
|
||||
*
|
||||
* @param int $year scan
|
||||
* @return array of values
|
||||
*/
|
||||
function getNbByMonth($year) {
|
||||
global $user;
|
||||
|
||||
$this->yearmonth = $year;
|
||||
|
||||
$sql = "SELECT date_format(t.datec,'%m') as dm, COUNT(*) as nb";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id)
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||
$sql .= $this->buildWhere();
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$this->yearmonth=0;
|
||||
|
||||
$res = $this->_getNbByMonth($year, $sql);
|
||||
// var_dump($res);print '<br>';
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Project amount by month for a year
|
||||
*
|
||||
* @param int $year scan
|
||||
* @return array with amount by month
|
||||
*/
|
||||
function getAmountByMonth($year) {
|
||||
global $user;
|
||||
|
||||
$this->yearmonth = $year;
|
||||
|
||||
$sql = "SELECT date_format(t.datec,'%m') as dm, SUM(t.opp_amount)";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id)
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||
$sql .= $this->buildWhere();
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
$this->yearmonth=0;
|
||||
|
||||
$res = $this->_getAmountByMonth($year, $sql);
|
||||
// var_dump($res);print '<br>';
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return amount of elements by month for several years
|
||||
*
|
||||
* @param int $endyear End year
|
||||
* @param int $startyear Start year
|
||||
* @param int $cachedelay accept for cache file (0=No read, no save of cache, -1=No read but save)
|
||||
* @return array of values
|
||||
*/
|
||||
function getTransformRateByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
if ($startyear > $endyear) return - 1;
|
||||
|
||||
$datay = array();
|
||||
|
||||
// Search into cache
|
||||
if (! empty($cachedelay))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/json.lib.php';
|
||||
}
|
||||
|
||||
$newpathofdestfile = $conf->user->dir_temp . '/' . get_class($this) . '_' . __FUNCTION__ . '_' . (empty($this->cachefilesuffix) ? '' : $this->cachefilesuffix . '_') . $langs->defaultlang . '_user' . $user->id . '.cache';
|
||||
$newmask = '0644';
|
||||
|
||||
$nowgmt = dol_now();
|
||||
|
||||
$foundintocache = 0;
|
||||
if ($cachedelay > 0) {
|
||||
$filedate = dol_filemtime($newpathofdestfile);
|
||||
if ($filedate >= ($nowgmt - $cachedelay)) {
|
||||
$foundintocache = 1;
|
||||
|
||||
$this->_lastfetchdate[get_class($this) . '_' . __FUNCTION__] = $filedate;
|
||||
} else {
|
||||
dol_syslog(get_class($this) . '::' . __FUNCTION__ . " cache file " . $newpathofdestfile . " is not found or older than now - cachedelay (" . $nowgmt . " - " . $cachedelay . ") so we can't use it.");
|
||||
}
|
||||
}
|
||||
|
||||
// Load file into $data
|
||||
if ($foundintocache) // Cache file found and is not too old
|
||||
{
|
||||
dol_syslog(get_class($this) . '::' . __FUNCTION__ . " read data from cache file " . $newpathofdestfile . " " . $filedate . ".");
|
||||
$data = dol_json_decode(file_get_contents($newpathofdestfile), true);
|
||||
} else {
|
||||
$year = $startyear;
|
||||
while ( $year <= $endyear ) {
|
||||
$datay[$year] = $this->getTransformRateByMonth($year);
|
||||
$year ++;
|
||||
}
|
||||
|
||||
$data = array ();
|
||||
// $data = array('xval'=>array(0=>xlabel,1=>yval1,2=>yval2...),...)
|
||||
for($i = 0; $i < 12; $i ++) {
|
||||
$data[$i][] = $datay[$endyear][$i][0]; // set label
|
||||
$year = $startyear;
|
||||
while ( $year <= $endyear ) {
|
||||
$data[$i][] = $datay[$year][$i][1]; // set yval for x=i
|
||||
$year ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Save cache file
|
||||
if (empty($foundintocache) && ($cachedelay > 0 || $cachedelay == - 1)) {
|
||||
dol_syslog(get_class($this) . '::' . __FUNCTION__ . " save cache file " . $newpathofdestfile . " onto disk.");
|
||||
if (! dol_is_dir($conf->user->dir_temp))
|
||||
dol_mkdir($conf->user->dir_temp);
|
||||
$fp = fopen($newpathofdestfile, 'w');
|
||||
fwrite($fp, dol_json_encode($data));
|
||||
fclose($fp);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
$newmask = $conf->global->MAIN_UMASK;
|
||||
@chmod($newpathofdestfile, octdec($newmask));
|
||||
|
||||
$this->_lastfetchdate[get_class($this) . '_' . __FUNCTION__] = $nowgmt;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Project transformation rate by month for a year
|
||||
*
|
||||
* @param int $year scan
|
||||
* @return array with amount by month
|
||||
*/
|
||||
function getTransformRateByMonth($year) {
|
||||
global $user;
|
||||
|
||||
$this->yearmonth = $year;
|
||||
|
||||
$sql = "SELECT date_format(t.datec,'%m') as dm, count(t.opp_amount)";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id)
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||
$sql .= $this->buildWhere();
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res_total = $this->_getNbByMonth($year, $sql);
|
||||
|
||||
$this->status=6;
|
||||
|
||||
$sql = "SELECT date_format(t.datec,'%m') as dm, count(t.opp_amount)";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id)
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||
$sql .= $this->buildWhere();
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$this->status=0;
|
||||
$this->yearmonth=0;
|
||||
|
||||
$res_only_wined = $this->_getNbByMonth($year, $sql);
|
||||
|
||||
$res=array();
|
||||
|
||||
foreach($res_total as $key=>$total_row) {
|
||||
//var_dump($total_row);
|
||||
if (!empty($total_row[1])) {
|
||||
$res[$key]=array($total_row[0],(100*$res_only_wined[$key][1])/$total_row[1]);
|
||||
} else {
|
||||
$res[$key]=array($total_row[0],0);
|
||||
}
|
||||
|
||||
}
|
||||
// var_dump($res);print '<br>';
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
@ -281,7 +281,7 @@ if ($resql)
|
||||
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print_liste_field_titre($langs->trans("OpportunityStatus"),$_SERVER["PHP_SELF"],'p.fk_opp_statut',"",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -331,7 +331,7 @@ if ($resql)
|
||||
print '<td class="liste_titre nowrap" align="right">';
|
||||
print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('Draft'),'1'=>$langs->trans('Opened'),'2'=>$langs->trans('Closed')),$search_status);
|
||||
print '</td>';
|
||||
print '<td width="56">';
|
||||
print '<td>';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("RemoveFilter"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
|
||||
367
htdocs/projet/stats/index.php
Normal file
367
htdocs/projet/stats/index.php
Normal file
@ -0,0 +1,367 @@
|
||||
<?php
|
||||
/* Lead
|
||||
* Copyright (C) 2014-2015 Florian HENRY <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/projectstats.class.php';
|
||||
|
||||
// Security check
|
||||
if (! $user->rights->projet->lire)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
|
||||
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
|
||||
|
||||
$userid=GETPOST('userid','int');
|
||||
$socid=GETPOST('socid','int');
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
$nowyear=strftime("%Y", dol_now());
|
||||
$year = GETPOST('year')>0?GETPOST('year'):$nowyear;
|
||||
//$startyear=$year-2;
|
||||
$startyear=$year-1;
|
||||
$endyear=$year;
|
||||
|
||||
$langs->load('projects');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$includeuserlist=array();
|
||||
|
||||
|
||||
llxHeader('', $langs->trans('Projects'));
|
||||
|
||||
$title=$langs->trans("ProjectsStatistics");
|
||||
$dir=$conf->projet->dir_output.'/temp';
|
||||
|
||||
print_fiche_titre($title,'','title_project.png');
|
||||
|
||||
dol_mkdir($dir);
|
||||
|
||||
|
||||
$stats_project= new ProjectStats($db);
|
||||
if (!empty($userid) && $userid!=-1) $stats_project->userid=$userid;
|
||||
if (!empty($socid) && $socid!=-1) $stats_project->socid=$socid;
|
||||
if (!empty($year)) $stats_project->year=$year;
|
||||
|
||||
|
||||
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
$data1 = $stats_project->getAllProjectByStatus();
|
||||
if (!is_array($data1) && $data1<0) {
|
||||
setEventMessages($stats_project->error, null, 'errors');
|
||||
}
|
||||
if (empty($data1))
|
||||
{
|
||||
$showpointvalue=0;
|
||||
$nocolor=1;
|
||||
$data1=array(array(0=>$langs->trans("None"),1=>1));
|
||||
}
|
||||
|
||||
$filenamenb = $conf->project->dir_output . "/stats/projectbystatus.png";
|
||||
$fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=projectstats&file=projectbystatus.png';
|
||||
$px = new DolGraph();
|
||||
$mesg = $px->isGraphKo();
|
||||
if (empty($mesg)) {
|
||||
$i=0;$tot=count($data1);$legend=array();
|
||||
while ($i <= $tot)
|
||||
{
|
||||
$data1[$i][0]=$data1[$i][0]; // Required to avoid error "Could not draw pie with labels contained inside canvas"
|
||||
$legend[]=$data1[$i][0];
|
||||
$i++;
|
||||
}
|
||||
$px->SetData($data1);
|
||||
unset($data1);
|
||||
|
||||
if ($nocolor)
|
||||
$px->SetDataColor(array (
|
||||
array (
|
||||
220,
|
||||
220,
|
||||
220
|
||||
)
|
||||
));
|
||||
$px->SetPrecisionY(0);
|
||||
$px->SetLegend($legend);
|
||||
$px->setShowLegend(0);
|
||||
$px->setShowPointValue($showpointvalue);
|
||||
$px->setShowPercent(1);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue());
|
||||
$px->SetWidth(300);
|
||||
$px->SetHeight(300);
|
||||
$px->SetShading(3);
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetCssPrefix("cssboxes");
|
||||
$px->SetType(array (
|
||||
'pie'
|
||||
));
|
||||
$px->SetTitle($langs->trans('ProjectNbProjectByStatus'));
|
||||
$result=$px->draw($filenamenb, $fileurlnb);
|
||||
if ($result<0) {
|
||||
setEventMessages($px->error, null, 'errors');
|
||||
}
|
||||
} else {
|
||||
setEventMessages(null, $mesgs, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Build graphic number of object
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
$data = $stats_project->getNbByMonthWithPrevYear($endyear,$startyear);
|
||||
//var_dump($data);
|
||||
|
||||
$filenamenb = $conf->project->dir_output . "/stats/projectnbprevyear-".$year.".png";
|
||||
$fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=projectstats&file=projectnbprevyear-'.$year.'.png';
|
||||
|
||||
$px1 = new DolGraph();
|
||||
$mesg = $px1->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px1->SetData($data);
|
||||
$px1->SetPrecisionY(0);
|
||||
$i=$startyear;$legend=array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
$legend[]=$i;
|
||||
$i++;
|
||||
}
|
||||
$px1->SetLegend($legend);
|
||||
$px1->SetMaxValue($px1->GetCeilMaxValue());
|
||||
$px1->SetWidth($WIDTH);
|
||||
$px1->SetHeight($HEIGHT);
|
||||
$px1->SetYLabel($langs->trans("ProjectNbProject"));
|
||||
$px1->SetShading(3);
|
||||
$px1->SetHorizTickIncrement(1);
|
||||
$px1->SetPrecisionY(0);
|
||||
$px1->mode='depth';
|
||||
$px1->SetTitle($langs->trans("ProjectNbProjectByMonth"));
|
||||
|
||||
$px1->draw($filenamenb,$fileurlnb);
|
||||
}
|
||||
|
||||
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
// Build graphic amount of object
|
||||
$data = $stats_project->getAmountByMonthWithPrevYear($endyear,$startyear);
|
||||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
$filenamenb = $conf->project->dir_output . "/stats/projectamountprevyear-".$year.".png";
|
||||
$fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=projectstats&file=projectamountprevyear-'.$year.'.png';
|
||||
|
||||
$px2 = new DolGraph();
|
||||
$mesg = $px2->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px2->SetData($data);
|
||||
$i=$startyear;$legend=array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
$legend[]=$i;
|
||||
$i++;
|
||||
}
|
||||
$px2->SetLegend($legend);
|
||||
$px2->SetMaxValue($px2->GetCeilMaxValue());
|
||||
$px2->SetMinValue(min(0,$px2->GetFloorMinValue()));
|
||||
$px2->SetWidth($WIDTH);
|
||||
$px2->SetHeight($HEIGHT);
|
||||
$px2->SetYLabel($langs->trans("ProjectAmountOfProject"));
|
||||
$px2->SetShading(3);
|
||||
$px2->SetHorizTickIncrement(1);
|
||||
$px2->SetPrecisionY(0);
|
||||
$px2->mode='depth';
|
||||
$px2->SetTitle($langs->trans("ProjectAmountOfProjectsByMonth"));
|
||||
|
||||
$px2->draw($filenamenb,$fileurlnb);
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
// Build graphic with transformation rate
|
||||
$data = $stats_project->getTransformRateByMonthWithPrevYear($endyear,$startyear);
|
||||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
$filenamenb = $conf->project->dir_output . "/stats/projecttransrateprevyear-".$year.".png";
|
||||
$fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=projectstats&file=projecttransrateprevyear-'.$year.'.png';
|
||||
|
||||
$px3 = new DolGraph();
|
||||
$mesg = $px3->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px3->SetData($data);
|
||||
$i=$startyear;$legend=array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
$legend[]=$i;
|
||||
$i++;
|
||||
}
|
||||
$px3->SetLegend($legend);
|
||||
$px3->SetMaxValue($px3->GetCeilMaxValue());
|
||||
$px3->SetMinValue(min(0,$px3->GetFloorMinValue()));
|
||||
$px3->SetWidth($WIDTH);
|
||||
$px3->SetHeight($HEIGHT);
|
||||
$px3->SetYLabel($langs->trans("ProjectTransRateOfProject"));
|
||||
$px3->SetShading(3);
|
||||
$px3->SetHorizTickIncrement(1);
|
||||
$px3->SetPrecisionY(0);
|
||||
$px3->mode='depth';
|
||||
$px3->SetTitle($langs->trans("ProjectTransRateOfProjectsByMonth"));
|
||||
|
||||
$px3->draw($filenamenb,$fileurlnb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Show array
|
||||
$stats_project->year=0;
|
||||
$data_all_year = $stats_project->getAllByYear();
|
||||
if (!empty($year)) $stats_project->year=$year;
|
||||
$arrayyears=array();
|
||||
foreach($data_all_year as $val) {
|
||||
$arrayyears[$val['year']]=$val['year'];
|
||||
}
|
||||
if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear;
|
||||
|
||||
|
||||
$h=0;
|
||||
$head = array();
|
||||
$head[$h][0] = DOL_URL_ROOT . '/projet/stats/index.php?mode='.$mode;
|
||||
$head[$h][1] = $langs->trans("ByMonthYear");
|
||||
$head[$h][2] = 'byyear';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,$type);
|
||||
|
||||
dol_fiche_head($head,'byyear',$langs->trans("Statistics"), 0, '');
|
||||
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
if ($mode == 'customer') $filter='s.client in (1,2,3)';
|
||||
if ($mode == 'supplier') $filter='s.fournisseur = 1';
|
||||
print $form->select_company($socid,'socid',$filter,1);
|
||||
print '</td></tr>';
|
||||
// User
|
||||
/*print '<tr><td>'.$langs->trans("ProjectCommercial").'</td><td>';
|
||||
print $form->select_dolusers($userid, 'userid', 1, array(),0,$includeuserlist);
|
||||
print '</td></tr>';*/
|
||||
// Year
|
||||
print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
||||
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
|
||||
if (! in_array($nowyear,$arrayyears)) $arrayyears[$nowyear]=$nowyear;
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year',$arrayyears,$year,0);
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br><br>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr height="24">';
|
||||
print '<td align="center">'.$langs->trans("Year").'</td>';
|
||||
print '<td align="center">'.$langs->trans("NbOfProjects").'</td>';
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$oldyear=0;
|
||||
foreach ($data_all_year as $val)
|
||||
{
|
||||
$year = $val['year'];
|
||||
while ($year && $oldyear > $year+1)
|
||||
{ // If we have empty year
|
||||
$oldyear--;
|
||||
print '<tr height="24">';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
print '<td align="right">0</td>';
|
||||
print '<td align="right">0</td>';
|
||||
}
|
||||
print '<td align="right">0</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '<tr height="24">';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></td>';
|
||||
print '<td align="right">'.$val['nb'].'</td>';
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>';
|
||||
print '<td align="right">'.price(price2num($val['avg'],'MT'),1).'</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
$oldyear=$year;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
$stringtoshow.= '<table class="border" width="100%"><tr valign="top"><td align="center">';
|
||||
if ($mesg) { print $mesg; }
|
||||
else {
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
$stringtoshow.= $px->show();
|
||||
$stringtoshow.= "<br>\n";
|
||||
}
|
||||
$stringtoshow.= $px1->show();
|
||||
$stringtoshow.= "<br>\n";
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
$stringtoshow.= $px2->show();
|
||||
$stringtoshow.= "<br>\n";
|
||||
$stringtoshow.= $px3->show();
|
||||
}
|
||||
}
|
||||
$stringtoshow.= '</td></tr></table>';
|
||||
|
||||
print $stringtoshow;
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
|
||||
@ -337,6 +337,7 @@ if ($resql)
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$params,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
// Fields title search
|
||||
@ -390,11 +391,13 @@ if ($resql)
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Status
|
||||
print '<td></td>';
|
||||
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
@ -452,7 +455,9 @@ if ($resql)
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Status
|
||||
print '<td align="right">'.$companystatic->getLibStatut(3).'</td>';
|
||||
print '<td align="right">'.$companystatic->getLibStatut(5).'</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
|
||||
@ -377,7 +377,7 @@ if ($socid && $action != 'edit' && $action != "create")
|
||||
print '<td>'.$langs->trans("WithdrawMode").'</td>';
|
||||
}
|
||||
print_liste_field_titre($langs->trans("DefaultRIB"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ($rib_list as $rib)
|
||||
|
||||
@ -404,7 +404,9 @@ th .button {
|
||||
-webkit-border-radius:0px !important;
|
||||
border-radius:0px !important;
|
||||
}
|
||||
|
||||
.maxwidthsearch { /* Max width of column with the search picto */
|
||||
width: 54px;
|
||||
}
|
||||
.valignmiddle {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ if ($result)
|
||||
print_liste_field_titre($langs->trans("LastConnexion"),$_SERVER['PHP_SELF'],"u.datelastlogin",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("HierarchicalResponsible"),$_SERVER['PHP_SELF'],"u2.login",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER['PHP_SELF'],"u.statut",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
// Search bar
|
||||
|
||||
Loading…
Reference in New Issue
Block a user