Time spent
This commit is contained in:
parent
ed0e6753e3
commit
27cc7ef2b3
@ -146,6 +146,10 @@ if ($action == 'setModuleOptions')
|
||||
else if ($action == 'set')
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
if ($ret > 0 && empty($conf->global->EXPENSEREPORT_ADDON_PDF))
|
||||
{
|
||||
dolibarr_set_const($db, 'EXPENSEREPORT_ADDON_PDF', $value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'del')
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
@ -98,7 +98,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
// Statistics
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("Statistics").'</td>';
|
||||
print "</tr>\n";
|
||||
@ -111,7 +111,7 @@ foreach ($listoftype as $code => $label)
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print '<tr><td align="center" colspan="4">';
|
||||
print '<tr '.$bc[false].'><td align="center" colspan="4">';
|
||||
$data=array('series'=>$dataseries);
|
||||
dol_print_graph('stats',300,180,$data,1,'pie',1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -358,7 +358,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
|
||||
// Total with all taxes
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($this->postotalttc-2, $curY);
|
||||
$pdf->SetXY($this->postotalttc-1, $curY);
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 3, price($object->lines[$i]->total_ttc), 0, 'R');
|
||||
|
||||
$nexY+=5;
|
||||
|
||||
@ -46,6 +46,7 @@ $date_start = dol_mktime(0, 0, 0, GETPOST('date_debutmonth'), GETPOST('date_debu
|
||||
$date_end = dol_mktime(0, 0, 0, GETPOST('date_finmonth'), GETPOST('date_finday'), GETPOST('date_finyear'));
|
||||
$date = dol_mktime(0, 0, 0, GETPOST('datemonth'), GETPOST('dateday'), GETPOST('dateyear'));
|
||||
$fk_projet=GETPOST('fk_projet');
|
||||
$vatrate=GETPOST('vatrate');
|
||||
$ref=GETPOST("ref",'alpha');
|
||||
|
||||
// If socid provided by ajax company selector
|
||||
@ -175,7 +176,7 @@ if ($action == 'update' && $user->rights->expensereport->creer)
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer)
|
||||
if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer)
|
||||
{
|
||||
$object = new ExpenseReport($db);
|
||||
$object->fetch($id);
|
||||
@ -217,6 +218,8 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user
|
||||
|
||||
if ($emailTo && $emailFrom)
|
||||
{
|
||||
$filename=array(); $filedir=array(); $mimetype=array();
|
||||
|
||||
// SUBJECT
|
||||
$subject = $langs->trans("ExpenseReportWaitingForApproval");
|
||||
|
||||
@ -231,7 +234,6 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user
|
||||
|
||||
if($resultPDF):
|
||||
// ATTACHMENT
|
||||
$filename=array(); $filedir=array(); $mimetype=array();
|
||||
array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
|
||||
array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref) . "/" . dol_sanitizeFileName($object->ref).".pdf");
|
||||
array_push($mimetype,"application/pdf");
|
||||
@ -257,7 +259,7 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$mesg='';
|
||||
$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
|
||||
$mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo);
|
||||
$mesg.='<br>'.$mailfile->error;
|
||||
setEventMessage($mesg,'errors');
|
||||
}
|
||||
@ -845,7 +847,7 @@ if ($action == "addline")
|
||||
$object_ligne->fk_c_type_fees = GETPOST('fk_c_type_fees');
|
||||
|
||||
$object_ligne->fk_c_tva = GETPOST('fk_c_tva');
|
||||
$object_ligne->vatrate = price2num(GETPOST('vatrate'));
|
||||
$object_ligne->vatrate = price2num($vatrate);
|
||||
|
||||
$object_ligne->fk_projet = $fk_projet;
|
||||
|
||||
@ -890,10 +892,10 @@ if ($action == "addline")
|
||||
{
|
||||
$object_ligne->fk_expensereport = $_POST['fk_expensereport'];
|
||||
|
||||
$type = 0; // TODO What if service
|
||||
$type = 0; // TODO What if service ?
|
||||
$tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type);
|
||||
|
||||
$object_ligne->vatrate = price2num(GETPOST('vatrate'));
|
||||
$object_ligne->vatrate = price2num($vatrate);
|
||||
$object_ligne->total_ttc = $tmp[2];
|
||||
$object_ligne->total_ht = $tmp[0];
|
||||
$object_ligne->total_tva = $tmp[1];
|
||||
@ -1337,7 +1339,7 @@ else
|
||||
dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip');
|
||||
|
||||
if ($action == 'save'):
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save","","",1);
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_validate","","",1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
endif;
|
||||
|
||||
@ -1413,6 +1415,7 @@ else
|
||||
print '<td>'.$langs->trans("Statut").'</td>';
|
||||
print '<td>'.$object->getLibStatut(4).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("NotePublic").'</td>';
|
||||
print '<td>'.$object->note_public.'</td>';
|
||||
@ -1451,20 +1454,6 @@ else
|
||||
print '<td>'.$langs->trans("DATE_SAVE").'</td>';
|
||||
print '<td>'.dol_print_date($object->date_create,'dayhour').'</td></tr>';
|
||||
print '</tr>';
|
||||
if($object->fk_statut==6)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("AUTHORPAIEMENT").'</td>';
|
||||
print '<td>';
|
||||
$userfee=new User($db);
|
||||
$userfee->fetch($object->fk_user_paid);
|
||||
print $userfee->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DATE_PAIEMENT").'</td>';
|
||||
print '<td>'.$object->date_paiement.'</td></tr>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// User to inform
|
||||
if($object->fk_statut<3) // informed
|
||||
@ -1536,6 +1525,22 @@ else
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if($object->fk_statut==6)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("AUTHORPAIEMENT").'</td>';
|
||||
print '<td>';
|
||||
$userfee=new User($db);
|
||||
$userfee->fetch($object->fk_user_paid);
|
||||
print $userfee->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DATE_PAIEMENT").'</td>';
|
||||
print '<td>'.$object->date_paiement.'</td></tr>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -110,7 +110,7 @@ class ExpenseReport extends CommonObject
|
||||
|
||||
// List of language codes for status
|
||||
$this->statuts_short = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused');
|
||||
$this->statuts = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused');
|
||||
$this->statuts = array(0 => 'Draft', 2 => 'ValidatedWaitingApproval', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused');
|
||||
$this->statuts_logo = array(0 => 'statut0', 2 => 'statut1', 4 => 'statut5', 5 => 'statut3', 6 => 'statut6', 99 => 'statut8');
|
||||
|
||||
return 1;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
@ -70,13 +70,11 @@ $totalnb=$totalsum=0;
|
||||
$sql = "SELECT tf.code, tf.label, count(de.rowid) as nb, sum(de.total_ht) as km";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."expensereport_det as de, ".MAIN_DB_PREFIX."c_type_fees as tf";
|
||||
$sql.= " WHERE de.fk_expensereport = d.rowid AND de.fk_c_type_fees = tf.id";
|
||||
|
||||
// RESTRICT RIGHTS
|
||||
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous))
|
||||
{
|
||||
$sql.= " AND d.fk_user_author IN (".join(',',$childids).")\n";
|
||||
}
|
||||
|
||||
$sql.= " GROUP BY tf.code, tf.label";
|
||||
|
||||
$result = $db->query($sql);
|
||||
@ -202,7 +200,7 @@ if ($result)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td colspan="2">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print '</table><br>';
|
||||
}
|
||||
|
||||
@ -501,7 +501,7 @@ Module600Name=Notifications
|
||||
Module600Desc=Send EMail notifications on some Dolibarr business events to third-party contacts (setup defined on each thirdparty)
|
||||
Module700Name=Donations
|
||||
Module700Desc=Donation management
|
||||
Module770Name=Expense Report
|
||||
Module770Name=Expense reports
|
||||
Module770Desc=Management and claim expense reports (transportation, meal, ...)
|
||||
Module1120Name=Supplier commercial proposal
|
||||
Module1120Desc=Request supplier commercial proposal and prices
|
||||
|
||||
@ -191,3 +191,4 @@ WarningNotRelevant=Irrelevant operation for this dataset
|
||||
WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Feature disabled when display setup is optimized for blind person or text browsers.
|
||||
WarningPaymentDateLowerThanInvoiceDate=Payment date (%s) is earlier than invoice date (%s) for invoice %s.
|
||||
WarningTooManyDataPleaseUseMoreFilters=Too many data. Please use more filters
|
||||
WarningSomeLinesWithNullHourlyRate=Some times were recorded by users when their hourly rate was not defined. A value of 0 was used but this may result in wrong valuation of time spent.
|
||||
|
||||
@ -302,7 +302,7 @@ UnitPriceTTC=Unit price
|
||||
PriceU=U.P.
|
||||
PriceUHT=U.P. (net)
|
||||
AskPriceSupplierUHT=U.P. net Requested
|
||||
PriceUTTC=U.P.
|
||||
PriceUTTC=U.P. (inc. tax)
|
||||
Amount=Amount
|
||||
AmountInvoice=Invoice amount
|
||||
AmountPayment=Payment amount
|
||||
|
||||
@ -77,6 +77,7 @@ ListExpenseReportsAssociatedProject=List of expense reports associated with the
|
||||
ListDonationsAssociatedProject=List of donations associated with the project
|
||||
ListActionsAssociatedProject=List of events associated with the project
|
||||
ListTaskTimeUserProject=List of time consumed on tasks of project
|
||||
TaskTimeUserProject=Time consumed on tasks of project
|
||||
ActivityOnProjectThisWeek=Activity on project this week
|
||||
ActivityOnProjectThisMonth=Activity on project this month
|
||||
ActivityOnProjectThisYear=Activity on project this year
|
||||
|
||||
@ -76,6 +76,7 @@ BROUILLONNER=Reopen
|
||||
SendToValid=Sent on approval
|
||||
ModifyInfoGen=Edit
|
||||
ValidateAndSubmit=Validate and submit for approval
|
||||
ValidatedWaitingApproval=Validated (waiting for approval)
|
||||
|
||||
NOT_VALIDATOR=You are not allowed to approve this expense report
|
||||
NOT_AUTHOR=You are not the author of this expense report. Operation cancelled.
|
||||
|
||||
@ -930,7 +930,7 @@ class Task extends CommonObject
|
||||
$result=array();
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql.= " SUM(t.task_duration / 3600 * thm) as amount";
|
||||
$sql.= " SUM(t.task_duration / 3600 * ".$this->db->ifsql("t.thm IS NULL", 0, "t.thm").") as amount, SUM(".$this->db->ifsql("t.thm IS NULL", 1, 0).") as nblinesnull";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
|
||||
$sql.= " WHERE t.fk_task = ".$id;
|
||||
if (is_object($fuser) && $fuser->id > 0)
|
||||
@ -947,7 +947,8 @@ class Task extends CommonObject
|
||||
$datefieldname="task_datehour";
|
||||
$sql.=" AND (".$datefieldname." <= '".$this->db->idate($datee)."' OR ".$datefieldname." IS NULL)";
|
||||
}
|
||||
|
||||
//print $sql;
|
||||
|
||||
dol_syslog(get_class($this)."::getSumOfAmount", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -955,7 +956,8 @@ class Task extends CommonObject
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$result['amount'] = $obj->amount;
|
||||
|
||||
$result['nblinesnull'] = $obj->nblinesnull;
|
||||
|
||||
$this->db->free($resql);
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -463,7 +463,11 @@ foreach ($listofreferent as $key => $value)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($element instanceof Task) print $element->getNomUrl(1,'withproject','time');
|
||||
if ($element instanceof Task)
|
||||
{
|
||||
print $element->getNomUrl(1,'withproject','time');
|
||||
print ' - '.dol_trunc($element->label, 48);
|
||||
}
|
||||
else print $element->getNomUrl(1);
|
||||
|
||||
$element_doc = $element->element;
|
||||
@ -522,13 +526,19 @@ foreach ($listofreferent as $key => $value)
|
||||
print '</td>';
|
||||
|
||||
// Amount without tax
|
||||
$warning='';
|
||||
if (empty($value['disableamount']))
|
||||
{
|
||||
if ($tablename == 'don') $total_ht_by_line=$element->amount;
|
||||
elseif ($tablename == 'projet_task')
|
||||
{
|
||||
$tmp = $element->getSumOfAmount($elementuser, $dates, $datee);
|
||||
$tmp = $element->getSumOfAmount($elementuser, $dates, $datee); // $element is a task. $elementuser may be empty
|
||||
$total_ht_by_line = price2num($tmp['amount'],'MT');
|
||||
if ($tmp['nblinesnull'] > 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$warning=$langs->trans("WarningSomeLinesWithNullHourlyRate");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -538,6 +548,7 @@ foreach ($listofreferent as $key => $value)
|
||||
if (! $qualifiedfortotal) print '<strike>';
|
||||
print (isset($total_ht_by_line)?price($total_ht_by_line):' ');
|
||||
if (! $qualifiedfortotal) print '</strike>';
|
||||
if ($warning) print ' '.img_warning($warning);
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
@ -559,13 +570,18 @@ foreach ($listofreferent as $key => $value)
|
||||
if (! $qualifiedfortotal) print '<strike>';
|
||||
print (isset($total_ttc_by_line)?price($total_ttc_by_line):' ');
|
||||
if (! $qualifiedfortotal) print '</strike>';
|
||||
if ($warning) print ' '.img_warning($warning);
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
|
||||
// Status
|
||||
print '<td align="right">';
|
||||
if ($element instanceof CommonInvoice)
|
||||
if ($tablename == 'expensereport_det')
|
||||
{
|
||||
print $expensereport->getLibStatut(5);
|
||||
}
|
||||
else if ($element instanceof CommonInvoice)
|
||||
{
|
||||
//This applies for Facture and FactureFournisseur
|
||||
print $element->getLibStatut(5, $element->getSommePaiement());
|
||||
@ -694,6 +710,7 @@ print '<td align="right" width="100">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right" width="100">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=true;
|
||||
foreach ($listofreferent as $key => $value)
|
||||
{
|
||||
$name=$langs->trans($value['name']);
|
||||
@ -710,7 +727,6 @@ foreach ($listofreferent as $key => $value)
|
||||
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee);
|
||||
if (count($elementarray)>0 && is_array($elementarray))
|
||||
{
|
||||
$var=true;
|
||||
$total_ht = 0;
|
||||
$total_ttc = 0;
|
||||
|
||||
@ -793,11 +809,15 @@ foreach ($listofreferent as $key => $value)
|
||||
case 'Contrat':
|
||||
$newclassname = 'Contract';
|
||||
break;
|
||||
case 'Task':
|
||||
$newclassname = 'TaskTimeUserProject';
|
||||
break;
|
||||
default:
|
||||
$newclassname = $classname;
|
||||
}
|
||||
|
||||
print '<tr>';
|
||||
$var = ! $var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
// Module
|
||||
print '<td align="left">'.$langs->trans($newclassname).'</td>';
|
||||
// Nb
|
||||
|
||||
Loading…
Reference in New Issue
Block a user