Merge branch '7.0' of https://github.com/Dolibarr/dolibarr.git into 7.0_price
This commit is contained in:
commit
f52187e829
@ -36,11 +36,11 @@ $rowid=GETPOST('rowid','int');
|
|||||||
$entity=GETPOST('entity','int');
|
$entity=GETPOST('entity','int');
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
$update=GETPOST('update','alpha');
|
$update=GETPOST('update','alpha');
|
||||||
$delete=GETPOST('delete'); // Do not use alpha here
|
$delete=GETPOST('delete','none'); // Do not use alpha here
|
||||||
$debug=GETPOST('debug','int');
|
$debug=GETPOST('debug','int');
|
||||||
$consts=GETPOST('const','array');
|
$consts=GETPOST('const','array');
|
||||||
$constname=GETPOST('constname','alpha');
|
$constname=GETPOST('constname','alpha');
|
||||||
$constvalue=GETPOST('constvalue');
|
$constvalue=GETPOST('constvalue','none'); // We shoul dbe able to send everything here
|
||||||
$constnote=GETPOST('constnote','alpha');
|
$constnote=GETPOST('constnote','alpha');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ if (!$user->admin) accessforbidden();
|
|||||||
$id=GETPOST('rowid','int');
|
$id=GETPOST('rowid','int');
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
|
|
||||||
$mode = GETPOST('mode')?GETPOST('mode'):'createform'; // 'createform', 'filters', 'sortorder', 'focus'
|
$mode = GETPOST('mode','aZ09')?GETPOST('mode','aZ09'):'createform'; // 'createform', 'filters', 'sortorder', 'focus'
|
||||||
|
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
|
|||||||
@ -89,7 +89,7 @@ if ($action == 'update')
|
|||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$menu->titre=GETPOST('titre', 'alpha');
|
$menu->titre=GETPOST('titre', 'alpha');
|
||||||
$menu->leftmenu=GETPOST('leftmenu', 'alpha');
|
$menu->leftmenu=GETPOST('leftmenu', 'aZ09');
|
||||||
$menu->url=GETPOST('url','alpha');
|
$menu->url=GETPOST('url','alpha');
|
||||||
$menu->langs=GETPOST('langs','alpha');
|
$menu->langs=GETPOST('langs','alpha');
|
||||||
$menu->position=GETPOST('position','int');
|
$menu->position=GETPOST('position','int');
|
||||||
|
|||||||
@ -157,7 +157,7 @@ $i=0;
|
|||||||
foreach($_SESSION as $key => $val)
|
foreach($_SESSION as $key => $val)
|
||||||
{
|
{
|
||||||
if ($i > 0) print ', ';
|
if ($i > 0) print ', ';
|
||||||
print $key.' => '.$val;
|
print $key.' => '.dol_escape_htmltag($val);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|||||||
@ -39,7 +39,7 @@ $transkey=GETPOST('transkey','alpha');
|
|||||||
$transvalue=GETPOST('transvalue','alpha');
|
$transvalue=GETPOST('transvalue','alpha');
|
||||||
|
|
||||||
|
|
||||||
$mode = GETPOST('mode')?GETPOST('mode'):'overwrite';
|
$mode = GETPOST('mode','aZ09')?GETPOST('mode','aZ09'):'overwrite';
|
||||||
|
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
|
|||||||
@ -4376,7 +4376,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
if ($objectidnext) {
|
if ($objectidnext) {
|
||||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||||
} else {
|
} else {
|
||||||
//if ($resteapayer == 0) {
|
//if ($resteapayer == 0) { // Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
|
||||||
// print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
// print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||||
//} else {
|
//} else {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'. DOL_URL_ROOT .'/compta/paiement.php?facid=' . $object->id . '&action=create&accountid='.$object->fk_account.'">' . $langs->trans('DoPayment') . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'. DOL_URL_ROOT .'/compta/paiement.php?facid=' . $object->id . '&action=create&accountid='.$object->fk_account.'">' . $langs->trans('DoPayment') . '</a></div>';
|
||||||
|
|||||||
@ -613,6 +613,7 @@ class CMailFile
|
|||||||
|
|
||||||
if (! $res)
|
if (! $res)
|
||||||
{
|
{
|
||||||
|
$langs->load("errors");
|
||||||
$this->error="Failed to send mail with php mail";
|
$this->error="Failed to send mail with php mail";
|
||||||
$linuxlike=1;
|
$linuxlike=1;
|
||||||
if (preg_match('/^win/i',PHP_OS)) $linuxlike=0;
|
if (preg_match('/^win/i',PHP_OS)) $linuxlike=0;
|
||||||
|
|||||||
@ -173,7 +173,7 @@ abstract class CommonInvoice extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return amount (with tax) of all credit notes and deposits invoices used by invoice
|
* Return amount (with tax) of all credit notes invoices + excess received used by invoice
|
||||||
*
|
*
|
||||||
* @param int $multicurrency Return multicurrency_amount instead of amount
|
* @param int $multicurrency Return multicurrency_amount instead of amount
|
||||||
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise
|
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise
|
||||||
|
|||||||
@ -190,7 +190,12 @@ class Form
|
|||||||
$morealt=' style="width: '.$cols.'"';
|
$morealt=' style="width: '.$cols.'"';
|
||||||
$cols='';
|
$cols='';
|
||||||
}
|
}
|
||||||
$ret.='<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.($tmp[1]?$tmp[1]:'20').'"'.($cols?' cols="'.$cols.'"':'class="quatrevingtpercent"').$morealt.'">'.($editvalue?$editvalue:$value).'</textarea>';
|
|
||||||
|
$valuetoshow = ($editvalue?$editvalue:$value);
|
||||||
|
|
||||||
|
$ret.='<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.($tmp[1]?$tmp[1]:'20').'"'.($cols?' cols="'.$cols.'"':'class="quatrevingtpercent"').$morealt.'">';
|
||||||
|
$ret.=dol_string_neverthesehtmltags($valuetoshow, array('textarea'));
|
||||||
|
$ret.='</textarea>';
|
||||||
}
|
}
|
||||||
else if ($typeofdata == 'day' || $typeofdata == 'datepicker')
|
else if ($typeofdata == 'day' || $typeofdata == 'datepicker')
|
||||||
{
|
{
|
||||||
@ -288,7 +293,7 @@ class Form
|
|||||||
$out='';
|
$out='';
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if ($inputType == 'textarea') $value = dol_nl2br($value);
|
if (preg_match('/^text/',$inputType)) $value = dol_nl2br($value);
|
||||||
else if (preg_match('/^numeric/',$inputType)) $value = price($value);
|
else if (preg_match('/^numeric/',$inputType)) $value = price($value);
|
||||||
else if ($inputType == 'day' || $inputType == 'datepicker') $value = dol_print_date($value, 'day');
|
else if ($inputType == 'day' || $inputType == 'datepicker') $value = dol_print_date($value, 'day');
|
||||||
|
|
||||||
|
|||||||
@ -196,7 +196,7 @@ class FormActions
|
|||||||
|
|
||||||
if (! empty($conf->agenda->enabled))
|
if (! empty($conf->agenda->enabled))
|
||||||
{
|
{
|
||||||
$buttontoaddnewevent = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(),'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid>0?'&socid='.$object->socid:'').($projectid>0?'&projectid='.$projectid:'').'&backtopage='.urlencode($urlbacktopage).'">';
|
$buttontoaddnewevent = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(),'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid>0?'&socid='.$object->socid:($socid>0?'&socid='.$socid:'')).($projectid>0?'&projectid='.$projectid:'').'&backtopage='.urlencode($urlbacktopage).'">';
|
||||||
$buttontoaddnewevent.= $langs->trans("AddEvent");
|
$buttontoaddnewevent.= $langs->trans("AddEvent");
|
||||||
$buttontoaddnewevent.= '</a>';
|
$buttontoaddnewevent.= '</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -276,7 +276,7 @@ function GETPOSTISSET($paramname)
|
|||||||
* @param string $noreplace Force disable of replacement of __xxx__ strings.
|
* @param string $noreplace Force disable of replacement of __xxx__ strings.
|
||||||
* @return string|string[] Value found (string or array), or '' if check fails
|
* @return string|string[] Value found (string or array), or '' if check fails
|
||||||
*/
|
*/
|
||||||
function GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
|
function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
|
||||||
{
|
{
|
||||||
global $mysoc,$user,$conf;
|
global $mysoc,$user,$conf;
|
||||||
|
|
||||||
@ -4090,7 +4090,7 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou
|
|||||||
* 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT)
|
* 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT)
|
||||||
* 'MS'=Round to Max for stock quantity (MAIN_MAX_DECIMALS_STOCK)
|
* 'MS'=Round to Max for stock quantity (MAIN_MAX_DECIMALS_STOCK)
|
||||||
* @param int $alreadysqlnb Put 1 if you know that content is already universal format number
|
* @param int $alreadysqlnb Put 1 if you know that content is already universal format number
|
||||||
* @return string Amount with universal numeric format (Example: '99.99999') or unchanged text if conversion fails.
|
* @return string Amount with universal numeric format (Example: '99.99999') or unchanged text if conversion fails. If amount is null or '', it returns ''.
|
||||||
*
|
*
|
||||||
* @see price Opposite function of price2num
|
* @see price Opposite function of price2num
|
||||||
*/
|
*/
|
||||||
@ -5014,7 +5014,7 @@ function picto_required()
|
|||||||
* @param string $pagecodeto Encoding of input/output string
|
* @param string $pagecodeto Encoding of input/output string
|
||||||
* @return string String cleaned
|
* @return string String cleaned
|
||||||
*
|
*
|
||||||
* @see dol_escape_htmltag strip_tags
|
* @see dol_escape_htmltag strip_tags dol_string_onlythesehtmltags dol_string_neverthesehtmltags
|
||||||
*/
|
*/
|
||||||
function dol_string_nohtmltag($stringtoclean,$removelinefeed=1,$pagecodeto='UTF-8')
|
function dol_string_nohtmltag($stringtoclean,$removelinefeed=1,$pagecodeto='UTF-8')
|
||||||
{
|
{
|
||||||
@ -5041,6 +5041,51 @@ function dol_string_nohtmltag($stringtoclean,$removelinefeed=1,$pagecodeto='UTF-
|
|||||||
return trim($temp);
|
return trim($temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean a string to keep only desirable HTML tags.
|
||||||
|
*
|
||||||
|
* @param string $stringtoclean String to clean
|
||||||
|
* @return string String cleaned
|
||||||
|
*
|
||||||
|
* @see dol_escape_htmltag strip_tags dol_string_nohtmltag dol_string_neverthesehtmltags
|
||||||
|
*/
|
||||||
|
function dol_string_onlythesehtmltags($stringtoclean)
|
||||||
|
{
|
||||||
|
$allowed_tags = array(
|
||||||
|
"html", "head", "meta", "body", "b", "br", "div", "em", "font", "img", "hr", "i", "li", "link",
|
||||||
|
"ol", "p", "s", "section", "span", "strong", "title",
|
||||||
|
"table", "tr", "th", "td", "u", "ul"
|
||||||
|
);
|
||||||
|
|
||||||
|
$allowed_tags_string = join("><", $allowed_tags);
|
||||||
|
$allowed_tags_string = preg_replace('/^>/','',$allowed_tags_string);
|
||||||
|
$allowed_tags_string = preg_replace('/<$/','',$allowed_tags_string);
|
||||||
|
|
||||||
|
$temp = strip_tags($stringtoclean, $allowed_tags_string);
|
||||||
|
|
||||||
|
return $temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean a string from some undesirable HTML tags.
|
||||||
|
*
|
||||||
|
* @param string $stringtoclean String to clean
|
||||||
|
* @param array $disallowed_tags Array of tags not allowed
|
||||||
|
* @return string String cleaned
|
||||||
|
*
|
||||||
|
* @see dol_escape_htmltag strip_tags dol_string_nohtmltag dol_string_onlythesehtmltags
|
||||||
|
*/
|
||||||
|
function dol_string_neverthesehtmltags($stringtoclean, $disallowed_tags=array('textarea'))
|
||||||
|
{
|
||||||
|
$temp = $stringtoclean;
|
||||||
|
foreach($disallowed_tags as $tagtoremove)
|
||||||
|
{
|
||||||
|
$temp = preg_replace('/<\/?'.$tagtoremove.'>/', '', $temp);
|
||||||
|
$temp = preg_replace('/<\/?'.$tagtoremove.'\s+[^>]*>/', '', $temp);
|
||||||
|
}
|
||||||
|
return $temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return first line of text. Cut will depends if content is HTML or not.
|
* Return first line of text. Cut will depends if content is HTML or not.
|
||||||
@ -6103,7 +6148,7 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensiti
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
($case_sensitive) ? natsort($temp) : natcasesort($temp);
|
($case_sensitive) ? natsort($temp) : natcasesort($temp);
|
||||||
if($order!='asc') $temp=array_reverse($temp,TRUE);
|
if($order!='asc') $temp=array_reverse($temp,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sorted = array();
|
$sorted = array();
|
||||||
|
|||||||
@ -780,7 +780,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$pdf->SetFont('','', $default_font_size - 4);
|
$pdf->SetFont('','', $default_font_size - 4);
|
||||||
|
|
||||||
|
|
||||||
// Loop on each deposits and credit notes included
|
// Loop on each discount available (deposits and credit notes and excess of payment included)
|
||||||
$sql = "SELECT re.rowid, re.amount_ht, re.multicurrency_amount_ht, re.amount_tva, re.multicurrency_amount_tva, re.amount_ttc, re.multicurrency_amount_ttc,";
|
$sql = "SELECT re.rowid, re.amount_ht, re.multicurrency_amount_ht, re.amount_tva, re.multicurrency_amount_tva, re.amount_ttc, re.multicurrency_amount_ttc,";
|
||||||
$sql.= " re.description, re.fk_facture_source,";
|
$sql.= " re.description, re.fk_facture_source,";
|
||||||
$sql.= " f.type, f.datef";
|
$sql.= " f.type, f.datef";
|
||||||
@ -797,9 +797,10 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$y+=3;
|
$y+=3;
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
if ($obj->type == 2) $text=$outputlangs->trans("CreditNote");
|
if ($obj->type == 2) $text=$outputlangs->transnoentities("CreditNote");
|
||||||
elseif ($obj->type == 3) $text=$outputlangs->trans("Deposit");
|
elseif ($obj->type == 3) $text=$outputlangs->transnoentities("Deposit");
|
||||||
else $text=$outputlangs->trans("UnknownType");
|
elseif ($obj->type == 0) $text=$outputlangs->transnoentities("ExcessReceived");
|
||||||
|
else $text=$outputlangs->transnoentities("UnknownType");
|
||||||
|
|
||||||
$invoice->fetch($obj->fk_facture_source);
|
$invoice->fetch($obj->fk_facture_source);
|
||||||
|
|
||||||
@ -1289,7 +1290,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
|
|
||||||
$pdf->SetTextColor(0,0,0);
|
$pdf->SetTextColor(0,0,0);
|
||||||
|
|
||||||
$creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
|
$creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received
|
||||||
$depositsamount=$object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
|
$depositsamount=$object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
|
||||||
//print "x".$creditnoteamount."-".$depositsamount;exit;
|
//print "x".$creditnoteamount."-".$depositsamount;exit;
|
||||||
$resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
|
$resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
|
||||||
@ -1307,9 +1308,10 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
// Credit note
|
// Credit note
|
||||||
if ($creditnoteamount)
|
if ($creditnoteamount)
|
||||||
{
|
{
|
||||||
|
$labeltouse = ($outputlangs->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangs->transnoentities("CreditNotesOrExcessReceived") : $outputlangs->transnoentities("CreditNotes");
|
||||||
$index++;
|
$index++;
|
||||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("CreditNotes"), 0, 'L', 0);
|
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $labeltouse, 0, 'L', 0);
|
||||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||||
$pdf->MultiCell($largcol2, $tab2_hl, price($creditnoteamount, 0, $outputlangs), 0, 'R', 0);
|
$pdf->MultiCell($largcol2, $tab2_hl, price($creditnoteamount, 0, $outputlangs), 0, 'R', 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,7 @@ elseif ($module == 'shipping') { $permission=$user->rights->expedition->cr
|
|||||||
elseif ($module == 'product') { $permission=$user->rights->produit->creer;}
|
elseif ($module == 'product') { $permission=$user->rights->produit->creer;}
|
||||||
//else dol_print_error('','Bad value '.$module.' for param module');
|
//else dol_print_error('','Bad value '.$module.' for param module');
|
||||||
|
|
||||||
if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%'; // Rem: This var is for all notes, not only thirdparties note.
|
if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%'; // Rem: This var is for all notes, not only thirdparties note.
|
||||||
else $typeofdata='textarea:12:95%';
|
else $typeofdata='textarea:12:95%';
|
||||||
|
|
||||||
print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n";
|
print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n";
|
||||||
|
|||||||
@ -310,8 +310,7 @@ if ($search_status != '' && $search_status >= 0) $sql.=" AND d.fk_statut IN (".$
|
|||||||
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
|
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
|
||||||
&& (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)))
|
&& (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)))
|
||||||
{
|
{
|
||||||
$childids = $user->getAllChildIds();
|
$childids = $user->getAllChildIds(1);
|
||||||
$childids[]=$user->id;
|
|
||||||
$sql.= " AND d.fk_user_author IN (".join(',',$childids).")\n";
|
$sql.= " AND d.fk_user_author IN (".join(',',$childids).")\n";
|
||||||
}
|
}
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
@ -442,12 +441,15 @@ if ($resql)
|
|||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$user_id.'" class="butAction">'.$langs->trans("Modify").'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$user_id.'" class="butAction">'.$langs->trans("Modify").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$canedit=(($user->id == $user_id && $user->rights->expensereport->creer) || ($user->id != $user_id));
|
$childids = $user->getAllChildIds(1);
|
||||||
|
|
||||||
|
$canedit=((in_array($user_id, $childids) && $user->rights->expensereport->creer)
|
||||||
|
|| ($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->expensereport->writeall_advance));
|
||||||
|
|
||||||
// Boutons d'actions
|
// Boutons d'actions
|
||||||
if ($canedit)
|
if ($canedit)
|
||||||
{
|
{
|
||||||
print '<a href="'.DOL_URL_ROOT.'/expensereport/card.php?action=request&id='.$user_id.'" class="butAction">'.$langs->trans("AddTrip").'</a>';
|
print '<a href="'.DOL_URL_ROOT.'/expensereport/card.php?action=create&fk_user_author='.$fuser->id.'" class="butAction">'.$langs->trans("AddTrip").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -36,38 +36,35 @@ if ($conf->deplacement->enabled) require_once DOL_DOCUMENT_ROOT.'/compta/deplace
|
|||||||
if ($conf->expensereport->enabled) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
if ($conf->expensereport->enabled) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||||
|
|
||||||
$langs->load('users');
|
$langs->loadLangs(array('users','holidays','trips'));
|
||||||
$langs->load('holidays');
|
|
||||||
$langs->load('trips');
|
|
||||||
|
|
||||||
$socid=GETPOST("socid");
|
$socid=GETPOST("socid","int");
|
||||||
|
|
||||||
// Protection if external user
|
// Protection if external user
|
||||||
if ($user->societe_id > 0) accessforbidden();
|
if ($user->societe_id > 0) accessforbidden();
|
||||||
|
|
||||||
|
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
|
||||||
|
|
||||||
|
$holiday = new Holiday($db);
|
||||||
|
$holidaystatic=new Holiday($db);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// None
|
// Update sold
|
||||||
|
if (! empty($conf->holiday->enabled) && ! empty($setupcompanynotcomplete))
|
||||||
|
{
|
||||||
|
$result = $holiday->updateBalance();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$holiday = new Holiday($db);
|
|
||||||
$holidaystatic=new Holiday($db);
|
|
||||||
|
|
||||||
// Update sold
|
|
||||||
if (! empty($conf->holiday->enabled))
|
|
||||||
{
|
|
||||||
$result = $holiday->updateBalance();
|
|
||||||
}
|
|
||||||
|
|
||||||
$childids = $user->getAllChildIds();
|
$childids = $user->getAllChildIds();
|
||||||
$childids[]=$user->id;
|
$childids[]=$user->id;
|
||||||
|
|
||||||
@ -76,13 +73,13 @@ llxHeader('', $langs->trans('HRMArea'));
|
|||||||
print load_fiche_titre($langs->trans("HRMArea"),'', 'title_hrm.png');
|
print load_fiche_titre($langs->trans("HRMArea"),'', 'title_hrm.png');
|
||||||
|
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
|
|
||||||
if (! empty($setupcompanynotcomplete))
|
if (! empty($setupcompanynotcomplete))
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));
|
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));
|
||||||
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit').'">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
|
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit').'">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -526,7 +526,7 @@ foreach($valid_dashboardlines as $board)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//var_dump($totallate, $totaltodo);
|
//var_dump($totallate, $totaltodo);
|
||||||
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totallate = round($totallate / $totaltodo * 100, 2);
|
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) && !empty($totaltodo)) $totallate = round($totallate / $totaltodo * 100, 2);
|
||||||
//var_dump($totallate);
|
//var_dump($totallate);
|
||||||
$boxwork='';
|
$boxwork='';
|
||||||
$boxwork.='<div class="box">';
|
$boxwork.='<div class="box">';
|
||||||
|
|||||||
@ -47,16 +47,16 @@ $main_data_dir = GETPOST('main_data_dir') ? GETPOST('main_data_dir') : $main_dir
|
|||||||
// Dolibarr root URL
|
// Dolibarr root URL
|
||||||
$main_url = GETPOST('main_url');
|
$main_url = GETPOST('main_url');
|
||||||
// Database login informations
|
// Database login informations
|
||||||
$userroot=GETPOST('db_user_root');
|
$userroot=GETPOST('db_user_root','alpha');
|
||||||
$passroot=GETPOST('db_pass_root');
|
$passroot=GETPOST('db_pass_root','none');
|
||||||
// Database server
|
// Database server
|
||||||
$db_type=GETPOST('db_type','alpha');
|
$db_type=GETPOST('db_type','aZ09');
|
||||||
$db_host=GETPOST('db_host','alpha');
|
$db_host=GETPOST('db_host','alpha');
|
||||||
$db_name=GETPOST('db_name','alpha');
|
$db_name=GETPOST('db_name','aZ09');
|
||||||
$db_user=GETPOST('db_user','alpha');
|
$db_user=GETPOST('db_user','alpha');
|
||||||
$db_pass=GETPOST('db_pass');
|
$db_pass=GETPOST('db_pass','none');
|
||||||
$db_port=GETPOST('db_port','int');
|
$db_port=GETPOST('db_port','int');
|
||||||
$db_prefix=GETPOST('db_prefix','alpha');
|
$db_prefix=GETPOST('db_prefix','aZ09');
|
||||||
$db_create_database = GETPOST('db_create_database','none');
|
$db_create_database = GETPOST('db_create_database','none');
|
||||||
$db_create_user = GETPOST('db_create_user','none');
|
$db_create_user = GETPOST('db_create_user','none');
|
||||||
// Force https
|
// Force https
|
||||||
|
|||||||
@ -279,6 +279,7 @@ RelativeDiscount=Relative discount
|
|||||||
GlobalDiscount=Global discount
|
GlobalDiscount=Global discount
|
||||||
CreditNote=Credit note
|
CreditNote=Credit note
|
||||||
CreditNotes=Credit notes
|
CreditNotes=Credit notes
|
||||||
|
CreditNotesOrExcessReceived=Credit notes or excess received
|
||||||
Deposit=Down payment
|
Deposit=Down payment
|
||||||
Deposits=Down payments
|
Deposits=Down payments
|
||||||
DiscountFromCreditNote=Discount from credit note %s
|
DiscountFromCreditNote=Discount from credit note %s
|
||||||
|
|||||||
@ -76,7 +76,7 @@ MenuNewSocialContribution=New social/fiscal tax
|
|||||||
NewSocialContribution=New social/fiscal tax
|
NewSocialContribution=New social/fiscal tax
|
||||||
AddSocialContribution=Add social/fiscal tax
|
AddSocialContribution=Add social/fiscal tax
|
||||||
ContributionsToPay=Social/fiscal taxes to pay
|
ContributionsToPay=Social/fiscal taxes to pay
|
||||||
AccountancyTreasuryArea=Accountancy/Treasury area
|
AccountancyTreasuryArea=Billing and payment area
|
||||||
NewPayment=New payment
|
NewPayment=New payment
|
||||||
Payments=Payments
|
Payments=Payments
|
||||||
PaymentCustomerInvoice=Customer invoice payment
|
PaymentCustomerInvoice=Customer invoice payment
|
||||||
|
|||||||
@ -282,6 +282,7 @@ RelativeDiscount=Remise relative
|
|||||||
GlobalDiscount=Ligne de déduction
|
GlobalDiscount=Ligne de déduction
|
||||||
CreditNote=Avoir
|
CreditNote=Avoir
|
||||||
CreditNotes=Avoirs
|
CreditNotes=Avoirs
|
||||||
|
CreditNotesOrExcessReceived=Avoirs ou trop perçus
|
||||||
Deposit=Acompte
|
Deposit=Acompte
|
||||||
Deposits=Acomptes
|
Deposits=Acomptes
|
||||||
DiscountFromCreditNote=Remise issue de l'avoir %s
|
DiscountFromCreditNote=Remise issue de l'avoir %s
|
||||||
|
|||||||
@ -71,7 +71,7 @@ $loan_static = new Loan($db);
|
|||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend,";
|
$sql = "SELECT l.rowid, l.label, l.capital, l.paid, l.datestart, l.dateend,";
|
||||||
$sql.= " SUM(pl.amount_capital) as alreadypayed";
|
$sql.= " SUM(pl.amount_capital) as alreadypayed";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."loan as l LEFT JOIN ".MAIN_DB_PREFIX."payment_loan AS pl";
|
$sql.= " FROM ".MAIN_DB_PREFIX."loan as l LEFT JOIN ".MAIN_DB_PREFIX."payment_loan AS pl";
|
||||||
$sql.= " ON l.rowid = pl.fk_loan";
|
$sql.= " ON l.rowid = pl.fk_loan";
|
||||||
@ -83,7 +83,7 @@ if ($filtre) {
|
|||||||
$filtre=str_replace(":","=",$filtre);
|
$filtre=str_replace(":","=",$filtre);
|
||||||
$sql .= " AND ".$filtre;
|
$sql .= " AND ".$filtre;
|
||||||
}
|
}
|
||||||
$sql.= " GROUP BY l.rowid, l.label, l.capital, l.datestart, l.dateend";
|
$sql.= " GROUP BY l.rowid, l.label, l.capital, l.paid, l.datestart, l.dateend";
|
||||||
$sql.= $db->order($sortfield,$sortorder);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
|
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
|
|||||||
@ -242,6 +242,8 @@ if ($resql)
|
|||||||
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
|
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
|
||||||
if ($snom) $param.="&snom=".$snom;
|
if ($snom) $param.="&snom=".$snom;
|
||||||
if ($sref) $param.="&sref=".$sref;
|
if ($sref) $param.="&sref=".$sref;
|
||||||
|
if ($toolowstock) $param.="&toolowstock=".$toolowstock;
|
||||||
|
if ($search_categ) $param.="&search_categ=".$search_categ;
|
||||||
|
|
||||||
$formProduct = new FormProduct($db);
|
$formProduct = new FormProduct($db);
|
||||||
$formProduct->loadWarehouses();
|
$formProduct->loadWarehouses();
|
||||||
|
|||||||
@ -49,11 +49,13 @@ $hookmanager->initHooks(array('productstatsorder'));
|
|||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
|
|
||||||
|
// Load variable for pagination
|
||||||
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$offset = $conf->liste_limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortorder) $sortorder="DESC";
|
if (! $sortorder) $sortorder="DESC";
|
||||||
@ -112,7 +114,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
show_stats_for_company($product,$socid);
|
$nboflines = show_stats_for_company($product, $socid);
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
@ -142,24 +144,21 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$sql.= ' AND YEAR(c.date_commande) IN (' . $search_year . ')';
|
$sql.= ' AND YEAR(c.date_commande) IN (' . $search_year . ')';
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
|
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
|
||||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
//Calcul total qty and amount for global if full scan list
|
//Calcul total qty and amount for global if full scan list
|
||||||
$total_ht=0;
|
$total_ht=0;
|
||||||
$total_qty=0;
|
$total_qty=0;
|
||||||
$totalrecords=0;
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
// Count total nb of records
|
||||||
|
$totalofrecords = '';
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
$totalofrecords = $db->num_rows($result);
|
||||||
$totalrecords = $db->num_rows($result);
|
|
||||||
while ($objp = $db->fetch_object($result)) {
|
|
||||||
$total_ht+=$objp->total_ht;
|
|
||||||
$total_qty+=$objp->qty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -172,6 +171,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$option .= '&search_month='.$search_month;
|
$option .= '&search_month='.$search_month;
|
||||||
if (! empty($search_year))
|
if (! empty($search_year))
|
||||||
$option .= '&search_year='.$search_year;
|
$option .= '&search_year='.$search_year;
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||||
|
|
||||||
print '<form method="post" action="' . $_SERVER ['PHP_SELF'] . '?id='.$product->id.'" name="search_form">' . "\n";
|
print '<form method="post" action="' . $_SERVER ['PHP_SELF'] . '?id='.$product->id.'" name="search_form">' . "\n";
|
||||||
if (! empty($sortfield))
|
if (! empty($sortfield))
|
||||||
@ -183,7 +183,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$option .= '&page=' . $page;
|
$option .= '&page=' . $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_barre_liste($langs->trans("CustomersOrders"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,$totalrecords,'');
|
print_barre_liste($langs->trans("CustomersOrders"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
print '<div class="divsearchfield">';
|
print '<div class="divsearchfield">';
|
||||||
print $langs->trans('Period').' ('.$langs->trans("OrderDate") .') - ';
|
print $langs->trans('Period').' ('.$langs->trans("OrderDate") .') - ';
|
||||||
@ -211,20 +211,22 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$var=True;
|
while ($i < min($num, $limit))
|
||||||
while ($i < $num && $i < $conf->liste_limit)
|
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
$total_ht+=$objp->total_ht;
|
||||||
|
$total_qty+=$objp->qty;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td>';
|
|
||||||
$orderstatic->id=$objp->commandeid;
|
$orderstatic->id=$objp->commandeid;
|
||||||
$orderstatic->ref=$objp->ref;
|
$orderstatic->ref=$objp->ref;
|
||||||
$orderstatic->ref_client=$objp->ref_client;
|
$orderstatic->ref_client=$objp->ref_client;
|
||||||
|
$societestatic->fetch($objp->socid);
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>';
|
||||||
print $orderstatic->getNomUrl(1);
|
print $orderstatic->getNomUrl(1);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
$societestatic->fetch($objp->socid);
|
|
||||||
print '<td>'.$societestatic->getNomUrl(1).'</td>';
|
print '<td>'.$societestatic->getNomUrl(1).'</td>';
|
||||||
print "<td>".$objp->code_client."</td>\n";
|
print "<td>".$objp->code_client."</td>\n";
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
@ -234,15 +236,11 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<td align="right">'.$orderstatic->LibStatut($objp->statut,$objp->facture,5).'</td>';
|
print '<td align="right">'.$orderstatic->LibStatut($objp->statut,$objp->facture,5).'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
|
||||||
$total_ht+=$objp->total_ht;
|
|
||||||
$total_qty+=$objp->qty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td>' . $langs->trans('Total') . '</td>';
|
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
print '<td colspan="3"></td>';
|
print '<td colspan="3"></td>';
|
||||||
print '<td align="center">'.$total_qty.'</td>';
|
print '<td align="center">'.$total_qty.'</td>';
|
||||||
print '<td align="right">'.price($total_ht).'</td>';
|
print '<td align="right">'.price($total_ht).'</td>';
|
||||||
|
|||||||
@ -119,7 +119,7 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
show_stats_for_company($product, $socid);
|
$nboflines = show_stats_for_company($product, $socid);
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
@ -153,24 +153,21 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
|
||||||
if ($socid)
|
if ($socid)
|
||||||
$sql .= " AND c.fk_soc = " . $socid;
|
$sql .= " AND c.fk_soc = " . $socid;
|
||||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
// Calcul total qty and amount for global if full scan list
|
// Calcul total qty and amount for global if full scan list
|
||||||
$total_ht = 0;
|
$total_ht = 0;
|
||||||
$total_qty = 0;
|
$total_qty = 0;
|
||||||
$totalrecords = 0;
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
// Count total nb of records
|
||||||
|
$totalofrecords = '';
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
$totalofrecords = $db->num_rows($result);
|
||||||
$totalrecords = $db->num_rows($result);
|
|
||||||
while ( $objp = $db->fetch_object($result) ) {
|
|
||||||
$total_ht += $objp->total_ht;
|
|
||||||
$total_qty += $objp->qty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
@ -182,6 +179,7 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
$option .= '&search_month=' . $search_month;
|
$option .= '&search_month=' . $search_month;
|
||||||
if (! empty($search_year))
|
if (! empty($search_year))
|
||||||
$option .= '&search_year=' . $search_year;
|
$option .= '&search_year=' . $search_year;
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||||
|
|
||||||
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
||||||
if (! empty($sortfield))
|
if (! empty($sortfield))
|
||||||
@ -193,7 +191,7 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
$option .= '&page=' . $page;
|
$option .= '&page=' . $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, '');
|
print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
print '<div class="divsearchfield">';
|
print '<div class="divsearchfield">';
|
||||||
print $langs->trans('Period') . ' (' . $langs->trans("OrderDate") . ') - ';
|
print $langs->trans('Period') . ' (' . $langs->trans("OrderDate") . ') - ';
|
||||||
@ -219,20 +217,24 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "c.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "c.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
if ($num > 0) {
|
if ($num > 0)
|
||||||
$var = True;
|
{
|
||||||
while ( $i < $num && $i < $conf->liste_limit ) {
|
while ($i < min($num, $limit))
|
||||||
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
print '<tr ' . $bc[$var] . '>';
|
$total_ht+=$objp->total_ht;
|
||||||
print '<td>';
|
$total_qty+=$objp->qty;
|
||||||
|
|
||||||
$supplierorderstatic->id = $objp->commandeid;
|
$supplierorderstatic->id = $objp->commandeid;
|
||||||
$supplierorderstatic->ref = $objp->ref;
|
$supplierorderstatic->ref = $objp->ref;
|
||||||
$supplierorderstatic->statut = $objp->statut;
|
$supplierorderstatic->statut = $objp->statut;
|
||||||
|
$societestatic->fetch($objp->socid);
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>';
|
||||||
print $supplierorderstatic->getNomUrl(1);
|
print $supplierorderstatic->getNomUrl(1);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
$societestatic->fetch($objp->socid);
|
|
||||||
print '<td>' . $societestatic->getNomUrl(1) . '</td>';
|
print '<td>' . $societestatic->getNomUrl(1) . '</td>';
|
||||||
print "<td>" . $objp->code_client . "</td>\n";
|
print "<td>" . $objp->code_client . "</td>\n";
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
@ -241,16 +243,12 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
print '<td align="right">' . price($objp->total_ht) . "</td>\n";
|
print '<td align="right">' . price($objp->total_ht) . "</td>\n";
|
||||||
print '<td align="right">' . $supplierorderstatic->getLibStatut(4) . '</td>';
|
print '<td align="right">' . $supplierorderstatic->getLibStatut(4) . '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i ++;
|
$i++;
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
|
||||||
$total_ht += $objp->total_ht;
|
|
||||||
$total_qty += $objp->qty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td>' . $langs->trans('Total') . '</td>';
|
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
print '<td colspan="3"></td>';
|
print '<td colspan="3"></td>';
|
||||||
print '<td align="center">' . $total_qty . '</td>';
|
print '<td align="center">' . $total_qty . '</td>';
|
||||||
print '<td align="right">' . price($total_ht) . '</td>';
|
print '<td align="right">' . price($total_ht) . '</td>';
|
||||||
|
|||||||
@ -46,11 +46,13 @@ $hookmanager->initHooks(array('productstatscontract'));
|
|||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
|
|
||||||
|
// Load variable for pagination
|
||||||
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$offset = $conf->liste_limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortorder) $sortorder="DESC";
|
if (! $sortorder) $sortorder="DESC";
|
||||||
@ -102,7 +104,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
show_stats_for_company($product,$socid);
|
$nboflines = show_stats_for_company($product,$socid);
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
@ -133,7 +135,20 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||||
$sql.= " GROUP BY c.rowid, c.ref, c.ref_customer, c.ref_supplier, c.date_contrat, c.statut, s.nom, s.rowid, s.code_client";
|
$sql.= " GROUP BY c.rowid, c.ref, c.ref_customer, c.ref_supplier, c.date_contrat, c.statut, s.nom, s.rowid, s.code_client";
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
|
||||||
|
//Calcul total qty and amount for global if full scan list
|
||||||
|
$total_ht=0;
|
||||||
|
$total_qty=0;
|
||||||
|
|
||||||
|
// Count total nb of records
|
||||||
|
$totalofrecords = '';
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
|
$result = $db->query($sql);
|
||||||
|
$totalofrecords = $db->num_rows($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -145,6 +160,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$option .= '&search_month=' . $search_month;
|
$option .= '&search_month=' . $search_month;
|
||||||
if (! empty($search_year))
|
if (! empty($search_year))
|
||||||
$option .= '&search_year=' . $search_year;
|
$option .= '&search_year=' . $search_year;
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||||
|
|
||||||
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
||||||
if (! empty($sortfield))
|
if (! empty($sortfield))
|
||||||
@ -156,7 +172,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$option .= '&page=' . $page;
|
$option .= '&page=' . $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_barre_liste($langs->trans("Contrats"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,0,'');
|
print_barre_liste($langs->trans("Contrats"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
@ -177,8 +193,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$var=True;
|
while ($i < min($num, $limit))
|
||||||
while ($i < $num && $i < $conf->liste_limit)
|
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
|||||||
@ -50,15 +50,18 @@ $hookmanager->initHooks(array('productstatsinvoice'));
|
|||||||
|
|
||||||
$showmessage=GETPOST('showmessage');
|
$showmessage=GETPOST('showmessage');
|
||||||
|
|
||||||
|
// Load variable for pagination
|
||||||
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$offset = $conf->liste_limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortorder) $sortorder="DESC";
|
if (! $sortorder) $sortorder="DESC";
|
||||||
if (! $sortfield) $sortfield="f.datef";
|
if (! $sortfield) $sortfield="f.datef";
|
||||||
|
|
||||||
$search_month = GETPOST('search_month', 'aplha');
|
$search_month = GETPOST('search_month', 'aplha');
|
||||||
$search_year = GETPOST('search_year', 'int');
|
$search_year = GETPOST('search_year', 'int');
|
||||||
|
|
||||||
@ -129,7 +132,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
$nboflines = show_stats_for_company($product,$socid);
|
$nboflines = show_stats_for_company($product, $socid);
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
@ -164,25 +167,19 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
//Calcul total qty and amount for global if full scan list
|
// Calcul total qty and amount for global if full scan list
|
||||||
$total_ht=0;
|
$total_ht=0;
|
||||||
$total_qty=0;
|
$total_qty=0;
|
||||||
$totalrecords=0;
|
|
||||||
|
// Count total nb of records
|
||||||
|
$totalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
{
|
{
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
$totalofrecords = $db->num_rows($result);
|
||||||
{
|
|
||||||
$totalrecords = $db->num_rows($result);
|
|
||||||
while ($objp = $db->fetch_object($result))
|
|
||||||
{
|
|
||||||
$total_ht+=$objp->total_ht;
|
|
||||||
$total_qty+=$objp->qty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= $db->plimit($conf->liste_limit + 1, $offset);
|
$sql.= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -195,6 +192,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$option .= '&search_month='.$search_month;
|
$option .= '&search_month='.$search_month;
|
||||||
if (! empty($search_year))
|
if (! empty($search_year))
|
||||||
$option .= '&search_year='.$search_year;
|
$option .= '&search_year='.$search_year;
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||||
|
|
||||||
print '<form method="post" action="' . $_SERVER ['PHP_SELF'] . '?id='.$product->id.'" name="search_form">' . "\n";
|
print '<form method="post" action="' . $_SERVER ['PHP_SELF'] . '?id='.$product->id.'" name="search_form">' . "\n";
|
||||||
if (! empty($sortfield))
|
if (! empty($sortfield))
|
||||||
@ -206,7 +204,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$option .= '&page=' . $page;
|
$option .= '&page=' . $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_barre_liste($langs->trans("CustomersInvoices"),$page,$_SERVER["PHP_SELF"],"&id=".$product->id,$sortfield,$sortorder,'',$num,$totalrecords,'');
|
print_barre_liste($langs->trans("CustomersInvoices"), $page, $_SERVER["PHP_SELF"],"&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
print '<div class="divsearchfield">';
|
print '<div class="divsearchfield">';
|
||||||
print $langs->trans('Period').' ('.$langs->trans("DateInvoice") .') - ';
|
print $langs->trans('Period').' ('.$langs->trans("DateInvoice") .') - ';
|
||||||
@ -234,11 +232,13 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$var=True;
|
while ($i < min($num, $limit))
|
||||||
while ($i < min($num,$conf->liste_limit))
|
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
$total_ht+=$objp->total_ht;
|
||||||
|
$total_qty+=$objp->qty;
|
||||||
|
|
||||||
$invoicestatic->id=$objp->facid;
|
$invoicestatic->id=$objp->facid;
|
||||||
$invoicestatic->ref=$objp->facnumber;
|
$invoicestatic->ref=$objp->facnumber;
|
||||||
$societestatic->fetch($objp->socid);
|
$societestatic->fetch($objp->socid);
|
||||||
@ -257,15 +257,11 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5,$paiement,$objp->type).'</td>';
|
print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5,$paiement,$objp->type).'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
|
||||||
$total_ht+=$objp->total_ht;
|
|
||||||
$total_qty+=$objp->qty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td>' . $langs->trans('Total') . '</td>';
|
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
print '<td colspan="3"></td>';
|
print '<td colspan="3"></td>';
|
||||||
print '<td align="center">'.$total_qty.'</td>';
|
print '<td align="center">'.$total_qty.'</td>';
|
||||||
print '<td align="right">'.price($total_ht).'</td>';
|
print '<td align="right">'.price($total_ht).'</td>';
|
||||||
|
|||||||
@ -51,11 +51,13 @@ $hookmanager->initHooks(array('productstatssupplyinvoice'));
|
|||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
|
|
||||||
|
// Load variable for pagination
|
||||||
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
$page = GETPOST("page", 'int');
|
$page = GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$offset = $conf->liste_limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortorder) $sortorder = "DESC";
|
if (! $sortorder) $sortorder = "DESC";
|
||||||
@ -114,7 +116,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
show_stats_for_company($product, $socid);
|
$nboflines = show_stats_for_company($product, $socid);
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
@ -149,19 +151,16 @@ if ($id > 0 || ! empty($ref))
|
|||||||
// Calcul total qty and amount for global if full scan list
|
// Calcul total qty and amount for global if full scan list
|
||||||
$total_ht = 0;
|
$total_ht = 0;
|
||||||
$total_qty = 0;
|
$total_qty = 0;
|
||||||
$totalrecords = 0;
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
// Count total nb of records
|
||||||
|
$totalofrecords = '';
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
$totalofrecords = $db->num_rows($result);
|
||||||
$totalrecords = $db->num_rows($result);
|
|
||||||
while ( $objp = $db->fetch_object($result) ) {
|
|
||||||
$total_ht += $objp->total_ht;
|
|
||||||
$total_qty += $objp->qty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
|
$sql.= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -174,6 +173,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$option .= '&search_month=' . $search_month;
|
$option .= '&search_month=' . $search_month;
|
||||||
if (! empty($search_year))
|
if (! empty($search_year))
|
||||||
$option .= '&search_year=' . $search_year;
|
$option .= '&search_year=' . $search_year;
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||||
|
|
||||||
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
||||||
if (! empty($sortfield))
|
if (! empty($sortfield))
|
||||||
@ -185,7 +185,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$option .= '&page=' . $page;
|
$option .= '&page=' . $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_barre_liste($langs->trans("SuppliersInvoices"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, '');
|
print_barre_liste($langs->trans("SuppliersInvoices"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
print '<div class="divsearchfield">';
|
print '<div class="divsearchfield">';
|
||||||
print $langs->trans('Period') . ' (' . $langs->trans("DateInvoice") . ') - ';
|
print $langs->trans('Period') . ' (' . $langs->trans("DateInvoice") . ') - ';
|
||||||
@ -213,19 +213,21 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$var = True;
|
while ($i < min($num, $limit))
|
||||||
while ($i < $num && $i < $conf->liste_limit)
|
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
print '<tr ' . $bc[$var] . '>';
|
$total_ht+=$objp->total_ht;
|
||||||
print '<td>';
|
$total_qty+=$objp->qty;
|
||||||
|
|
||||||
$supplierinvoicestatic->id = $objp->facid;
|
$supplierinvoicestatic->id = $objp->facid;
|
||||||
$supplierinvoicestatic->ref = $objp->facnumber;
|
$supplierinvoicestatic->ref = $objp->facnumber;
|
||||||
|
$societestatic->fetch($objp->socid);
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>';
|
||||||
print $supplierinvoicestatic->getNomUrl(1);
|
print $supplierinvoicestatic->getNomUrl(1);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
$societestatic->fetch($objp->socid);
|
|
||||||
print '<td>' . $societestatic->getNomUrl(1) . '</td>';
|
print '<td>' . $societestatic->getNomUrl(1) . '</td>';
|
||||||
print "<td>" . $objp->code_client . "</td>\n";
|
print "<td>" . $objp->code_client . "</td>\n";
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
@ -234,16 +236,12 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<td align="right">' . price($objp->total_ht) . "</td>\n";
|
print '<td align="right">' . price($objp->total_ht) . "</td>\n";
|
||||||
print '<td align="right">' . $supplierinvoicestatic->LibStatut($objp->paye, $objp->statut, 5) . '</td>';
|
print '<td align="right">' . $supplierinvoicestatic->LibStatut($objp->paye, $objp->statut, 5) . '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i ++;
|
$i++;
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
|
||||||
$total_ht += $objp->total_ht;
|
|
||||||
$total_qty += $objp->qty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td>' . $langs->trans('Total') . '</td>';
|
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
print '<td colspan="3"></td>';
|
print '<td colspan="3"></td>';
|
||||||
print '<td align="center">' . $total_qty . '</td>';
|
print '<td align="center">' . $total_qty . '</td>';
|
||||||
print '<td align="right">' . price($total_ht) . '</td>';
|
print '<td align="right">' . price($total_ht) . '</td>';
|
||||||
|
|||||||
@ -114,7 +114,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
show_stats_for_company($product, $socid);
|
$nboflines = show_stats_for_company($product, $socid);
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
@ -148,24 +148,21 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
|
||||||
if ($socid)
|
if ($socid)
|
||||||
$sql .= " AND p.fk_soc = " . $socid;
|
$sql .= " AND p.fk_soc = " . $socid;
|
||||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
// Calcul total qty and amount for global if full scan list
|
// Calcul total qty and amount for global if full scan list
|
||||||
$total_ht = 0;
|
$total_ht = 0;
|
||||||
$total_qty = 0;
|
$total_qty = 0;
|
||||||
$totalrecords = 0;
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
// Count total nb of records
|
||||||
|
$totalofrecords = '';
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
$totalofrecords = $db->num_rows($result);
|
||||||
$totalrecords = $db->num_rows($result);
|
|
||||||
while ( $objp = $db->fetch_object($result) ) {
|
|
||||||
$total_ht += $objp->amount;
|
|
||||||
$total_qty += $objp->qty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -178,6 +175,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$option .= '&search_month=' . $search_month;
|
$option .= '&search_month=' . $search_month;
|
||||||
if (! empty($search_year))
|
if (! empty($search_year))
|
||||||
$option .= '&search_year=' . $search_year;
|
$option .= '&search_year=' . $search_year;
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||||
|
|
||||||
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
||||||
if (! empty($sortfield))
|
if (! empty($sortfield))
|
||||||
@ -189,7 +187,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$option .= '&page=' . $page;
|
$option .= '&page=' . $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, '');
|
print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
print '<div class="divsearchfield">';
|
print '<div class="divsearchfield">';
|
||||||
print $langs->trans('Period') . ' (' . $langs->trans("DatePropal") . ') - ';
|
print $langs->trans('Period') . ' (' . $langs->trans("DatePropal") . ') - ';
|
||||||
@ -216,20 +214,22 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$var = True;
|
while ($i < min($num, $limit))
|
||||||
while ($i < $num && $i < $conf->liste_limit)
|
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
print '<tr ' . $bc[$var] . '>';
|
$total_ht+=$objp->amount;
|
||||||
print '<td>';
|
$total_qty+=$objp->qty;
|
||||||
|
|
||||||
$propalstatic->id=$objp->propalid;
|
$propalstatic->id=$objp->propalid;
|
||||||
$propalstatic->ref=$objp->ref;
|
$propalstatic->ref=$objp->ref;
|
||||||
$propalstatic->ref_client=$objp->ref_client;
|
$propalstatic->ref_client=$objp->ref_client;
|
||||||
|
$societestatic->fetch($objp->socid);
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>';
|
||||||
print $propalstatic->getNomUrl(1);
|
print $propalstatic->getNomUrl(1);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
$societestatic->fetch($objp->socid);
|
|
||||||
print '<td>'.$societestatic->getNomUrl(1).'</td>';
|
print '<td>'.$societestatic->getNomUrl(1).'</td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print dol_print_date($db->jdate($objp->datep), 'dayhour') . "</td>";
|
print dol_print_date($db->jdate($objp->datep), 'dayhour') . "</td>";
|
||||||
@ -237,17 +237,13 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<td align="right">' . price($objp->amount) . '</td>' . "\n";
|
print '<td align="right">' . price($objp->amount) . '</td>' . "\n";
|
||||||
print '<td align="right">' . $propalstatic->LibStatut($objp->statut, 5) . '</td>';
|
print '<td align="right">' . $propalstatic->LibStatut($objp->statut, 5) . '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i ++;
|
$i++;
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
|
||||||
$total_ht += $objp->total_ht;
|
|
||||||
$total_qty += $objp->qty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td>' . $langs->trans('Total') . '</td>';
|
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
print '<td colspan="2"></td>';
|
print '<td colspan="2"></td>';
|
||||||
print '<td align="center">' . $total_qty . '</td>';
|
print '<td align="center">' . $total_qty . '</td>';
|
||||||
print '<td align="right">' . price($total_ht) . '</td>';
|
print '<td align="right">' . price($total_ht) . '</td>';
|
||||||
|
|||||||
@ -114,7 +114,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
show_stats_for_company($product, $socid);
|
$nboflines = show_stats_for_company($product, $socid);
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
@ -148,24 +148,21 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
|
||||||
if ($socid)
|
if ($socid)
|
||||||
$sql .= " AND p.fk_soc = " . $socid;
|
$sql .= " AND p.fk_soc = " . $socid;
|
||||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
// Calcul total qty and amount for global if full scan list
|
// Calcul total qty and amount for global if full scan list
|
||||||
$total_ht = 0;
|
$total_ht = 0;
|
||||||
$total_qty = 0;
|
$total_qty = 0;
|
||||||
$totalrecords = 0;
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
// Count total nb of records
|
||||||
|
$totalofrecords = '';
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
$totalofrecords = $db->num_rows($result);
|
||||||
$totalrecords = $db->num_rows($result);
|
|
||||||
while ( $objp = $db->fetch_object($result) ) {
|
|
||||||
$total_ht += $objp->amount;
|
|
||||||
$total_qty += $objp->qty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -178,6 +175,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$option .= '&search_month=' . $search_month;
|
$option .= '&search_month=' . $search_month;
|
||||||
if (! empty($search_year))
|
if (! empty($search_year))
|
||||||
$option .= '&search_year=' . $search_year;
|
$option .= '&search_year=' . $search_year;
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||||
|
|
||||||
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
||||||
if (! empty($sortfield))
|
if (! empty($sortfield))
|
||||||
@ -189,7 +187,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$option .= '&page=' . $page;
|
$option .= '&page=' . $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, '');
|
print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
print '<div class="divsearchfield">';
|
print '<div class="divsearchfield">';
|
||||||
print $langs->trans('Period') . ' (' . $langs->trans("DatePropal") . ') - ';
|
print $langs->trans('Period') . ' (' . $langs->trans("DatePropal") . ') - ';
|
||||||
@ -216,19 +214,21 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$var = True;
|
while ($i < min($num, $limit))
|
||||||
while ($i < $num && $i < $conf->liste_limit)
|
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
print '<tr ' . $bc[$var] . '>';
|
$total_ht+=$objp->amount;
|
||||||
print '<td>';
|
$total_qty+=$objp->qty;
|
||||||
|
|
||||||
$propalstatic->id=$objp->propalid;
|
$propalstatic->id=$objp->propalid;
|
||||||
$propalstatic->ref=$objp->ref;
|
$propalstatic->ref=$objp->ref;
|
||||||
|
$societestatic->fetch($objp->socid);
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>';
|
||||||
print $propalstatic->getNomUrl(1);
|
print $propalstatic->getNomUrl(1);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
$societestatic->fetch($objp->socid);
|
|
||||||
print '<td>'.$societestatic->getNomUrl(1).'</td>';
|
print '<td>'.$societestatic->getNomUrl(1).'</td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print dol_print_date($db->jdate($objp->date_valid), 'dayhour') . "</td>";
|
print dol_print_date($db->jdate($objp->date_valid), 'dayhour') . "</td>";
|
||||||
@ -236,17 +236,13 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<td align="right">' . price($objp->amount) . '</td>' . "\n";
|
print '<td align="right">' . price($objp->amount) . '</td>' . "\n";
|
||||||
print '<td align="right">' . $propalstatic->LibStatut($objp->statut, 5) . '</td>';
|
print '<td align="right">' . $propalstatic->LibStatut($objp->statut, 5) . '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i ++;
|
$i++;
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
|
||||||
$total_ht += $objp->total_ht;
|
|
||||||
$total_qty += $objp->qty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td>' . $langs->trans('Total') . '</td>';
|
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
print '<td colspan="2"></td>';
|
print '<td colspan="2"></td>';
|
||||||
print '<td align="center">' . $total_qty . '</td>';
|
print '<td align="center">' . $total_qty . '</td>';
|
||||||
print '<td align="right">' . price($total_ht) . '</td>';
|
print '<td align="right">' . price($total_ht) . '</td>';
|
||||||
|
|||||||
@ -1715,7 +1715,7 @@ class Project extends CommonObject
|
|||||||
// For external user, no check is done on company permission because readability is managed by public status of project and assignement.
|
// For external user, no check is done on company permission because readability is managed by public status of project and assignement.
|
||||||
//if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
//if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
||||||
$sql.= " WHERE p.fk_statut = 1";
|
$sql.= " WHERE p.fk_statut = 1";
|
||||||
$sql.= " AND p.entity IN (".getEntity('project', 0).')';
|
$sql.= " AND p.entity IN (".getEntity('project').')';
|
||||||
if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||||
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||||
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||||
@ -1791,7 +1791,7 @@ class Project extends CommonObject
|
|||||||
$sql = "SELECT count(p.rowid) as nb";
|
$sql = "SELECT count(p.rowid) as nb";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||||
$sql.= " WHERE";
|
$sql.= " WHERE";
|
||||||
$sql.= " p.entity IN (".getEntity('projet').")";
|
$sql.= " p.entity IN (".getEntity('project').")";
|
||||||
if (! $user->rights->projet->all->lire)
|
if (! $user->rights->projet->all->lire)
|
||||||
{
|
{
|
||||||
$projectsListId = $this->getProjectsAuthorizedForUser($user,0,1);
|
$projectsListId = $this->getProjectsAuthorizedForUser($user,0,1);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user