Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
35c0695513
@ -1,6 +1,9 @@
|
||||
--------------------------------------------------------------
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
***** ChangeLog for 3.4.2 compared to 3.4.1 *****
|
||||
Fix: Bad rounding on margin calculations and display.
|
||||
Fix: Option drpo table into backup was broken.
|
||||
|
||||
***** ChangeLog for 3.5 compared to 3.4.* *****
|
||||
For users:
|
||||
|
||||
@ -1,4 +1,18 @@
|
||||
dolibarr (3.5.0) unstable; urgency=low
|
||||
dolibarr (3.5.0-1) unstable; urgency=low
|
||||
|
||||
[ Laurent Destailleur (eldy) ]
|
||||
* New upstream release.
|
||||
|
||||
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Mon, 22 Apr 2013 12:00:00 +0100
|
||||
|
||||
dolibarr (3.4.1-3) unstable; urgency=low
|
||||
|
||||
[ Laurent Destailleur (eldy) ]
|
||||
* Maintenance release.
|
||||
|
||||
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Mon, 22 Apr 2013 12:00:00 +0100
|
||||
|
||||
dolibarr (3.4.0-3) unstable; urgency=low
|
||||
|
||||
[ Laurent Destailleur (eldy) ]
|
||||
* New upstream release.
|
||||
|
||||
@ -219,7 +219,7 @@ print $langs->trans("BackupDescY").'<br><br>';
|
||||
<fieldset><legend> <input type="checkbox" name="sql_structure"
|
||||
value="structure" id="checkbox_sql_structure" checked="checked" /> <label
|
||||
for="checkbox_sql_structure"> <?php echo $langs->trans('ExportStructure') ?></label> </legend> <input
|
||||
type="checkbox" name="drop" value="1" id="checkbox_dump_drop" /> <label
|
||||
type="checkbox" name="drop"<?php echo ((! isset($_GET["drop"]) && ! isset($_POST["drop"])) || GETPOST('drop'))?' checked="checked"':''; ?> id="checkbox_dump_drop" /> <label
|
||||
for="checkbox_dump_drop"><?php echo $langs->trans("AddDropTable"); ?></label><br>
|
||||
</fieldset>
|
||||
|
||||
@ -274,7 +274,7 @@ print $langs->trans("BackupDescY").'<br><br>';
|
||||
|
||||
<br>
|
||||
<fieldset><legend><?php echo $langs->trans('ExportStructure') ?></legend> <input
|
||||
type="checkbox" name="nobin_drop" value="1" id="checkbox_dump_drop" /> <label
|
||||
type="checkbox" name="nobin_drop"<?php echo ((! isset($_GET["nobin_drop"]) && ! isset($_POST["nobin_drop"])) || GETPOST('nobin_drop'))?' checked="checked"':''; ?> id="checkbox_dump_drop" /> <label
|
||||
for="checkbox_dump_drop"><?php echo $langs->trans("AddDropTable"); ?></label><br>
|
||||
</fieldset>
|
||||
|
||||
@ -433,4 +433,4 @@ print '<br>';
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
?>
|
||||
|
||||
@ -134,7 +134,8 @@ if ($what == 'mysql')
|
||||
if (GETPOST("drop_database")) $param.=" --add-drop-database";
|
||||
if (GETPOST("sql_structure"))
|
||||
{
|
||||
if (GETPOST("drop")) $param.=" --add-drop-table";
|
||||
if (GETPOST("drop")) $param.=" --add-drop-table=TRUE";
|
||||
else $param.=" --add-drop-table=FALSE";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,37 +1,37 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/facture/class/facture.class.php
|
||||
* \ingroup facture
|
||||
* \brief File of class to manage invoices
|
||||
*/
|
||||
* \ingroup facture
|
||||
* \brief File of class to manage invoices
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/commoninvoice.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT .'/product/class/product.class.php';
|
||||
|
||||
@ -96,6 +96,7 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl
|
||||
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
||||
$idpays = $p[0];
|
||||
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref_supplier, f.type, f.datef, f.libelle,";
|
||||
$sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type, fd.localtax1_tx, fd.localtax2_tx, fd.total_localtax1, fd.total_localtax2,";
|
||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,";
|
||||
@ -111,6 +112,9 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.t
|
||||
else $sql.= " AND f.type IN (0,1,2,3)";
|
||||
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
|
||||
// TODO Find a better trick to avoid problem with some mysql installations
|
||||
if (in_array($db->type, array('mysql', 'mysqli'))) $db->query('SET SQL_BIG_SELECTS=1');
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
|
||||
@ -116,6 +116,9 @@ $sql.= " AND fd.product_type IN (0,1)";
|
||||
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
$sql.= " ORDER BY f.rowid";
|
||||
|
||||
// TODO Find a better trick to avoid problem with some mysql installations
|
||||
if (in_array($db->type, array('mysql', 'mysqli'))) $db->query('SET SQL_BIG_SELECTS=1');
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
|
||||
@ -297,20 +297,7 @@ if ($id > 0)
|
||||
}
|
||||
|
||||
// Type
|
||||
print "<tr><td>".$langs->trans("Type")."</td><td>".$object->type_libelle."</td><td>".$langs->trans("Payments")."</td></tr>";
|
||||
|
||||
// Period end date
|
||||
print "<tr><td>".$langs->trans("PeriodEndDate")."</td>";
|
||||
print "<td>";
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print $form->select_date($object->periode, 'period', 0, 0, 0, 'charge', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print dol_print_date($object->periode,"day");
|
||||
}
|
||||
print "</td>";
|
||||
print "<tr><td>".$langs->trans("Type")."</td><td>".$object->type_libelle."</td>";
|
||||
|
||||
$rowspan=5;
|
||||
print '<td rowspan="'.$rowspan.'" valign="top">';
|
||||
@ -337,8 +324,8 @@ if ($id > 0)
|
||||
$i = 0; $total = 0;
|
||||
echo '<table class="nobordernopadding" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Amount").'</td><td> </td></tr>';
|
||||
print '<td>'.$langs->trans("Payments").'</td><td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Amount").'</td><td> </td></tr>';
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
@ -349,12 +336,12 @@ if ($id > 0)
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").'</a> ';
|
||||
print dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
||||
print "<td>".$objp->paiement_type.' '.$objp->num_paiement."</td>\n";
|
||||
print '<td align="right">'.price($objp->amount)."</td><td> ".$langs->trans("Currency".$conf->currency)."</td>\n";
|
||||
print '<td align="right">'.price($objp->amount)."</td><td> ".$langs->trans("Currency".$conf->currency)."</td>\n";
|
||||
print "</tr>";
|
||||
$totalpaye += $objp->amount;
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
if ($object->paye == 0)
|
||||
{
|
||||
print "<tr><td colspan=\"2\" align=\"right\">".$langs->trans("AlreadyPaid")." :</td><td align=\"right\"><b>".price($totalpaye)."</b></td><td> ".$langs->trans("Currency".$conf->currency)."</td></tr>\n";
|
||||
@ -376,6 +363,19 @@ if ($id > 0)
|
||||
|
||||
print "</tr>";
|
||||
|
||||
// Period end date
|
||||
print "<tr><td>".$langs->trans("PeriodEndDate")."</td>";
|
||||
print "<td>";
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print $form->select_date($object->periode, 'period', 0, 0, 0, 'charge', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print dol_print_date($object->periode,"day");
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
// Due date
|
||||
if ($action == 'edit')
|
||||
{
|
||||
@ -393,8 +393,6 @@ if ($id > 0)
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
||||
|
||||
print '<tr><td colspan="2"> </td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
if ($action == 'edit')
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
<<<<<<< HEAD
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
=======
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
>>>>>>> refs/remotes/origin/3.4
|
||||
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
@ -2043,6 +2048,7 @@ abstract class CommonObject
|
||||
|
||||
/**
|
||||
* Function to get extra fields of a member into $this->array_options
|
||||
* This method is in most cases called by method fetch of objects but you can call it separately.
|
||||
*
|
||||
* @param int $rowid Id of line
|
||||
* @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label()
|
||||
@ -3194,14 +3200,14 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
if ($marginInfos['pa_products'] > 0)
|
||||
$marginInfos['margin_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pa_products'],5);
|
||||
$marginInfos['margin_rate_products'] = 100 * $marginInfos['margin_on_products'] / $marginInfos['pa_products'];
|
||||
if ($marginInfos['pv_products'] > 0)
|
||||
$marginInfos['mark_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pv_products'],5);
|
||||
$marginInfos['mark_rate_products'] = 100 * $marginInfos['margin_on_products'] / $marginInfos['pv_products'];
|
||||
|
||||
if ($marginInfos['pa_services'] > 0)
|
||||
$marginInfos['margin_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pa_services'],5);
|
||||
$marginInfos['margin_rate_services'] = 100 * $marginInfos['margin_on_services'] / $marginInfos['pa_services'];
|
||||
if ($marginInfos['pv_services'] > 0)
|
||||
$marginInfos['mark_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pv_services'],5);
|
||||
$marginInfos['mark_rate_services'] = 100 * $marginInfos['margin_on_services'] / $marginInfos['pv_services'];
|
||||
|
||||
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
|
||||
if ($marginInfos['pv_total'] < 0)
|
||||
@ -3209,9 +3215,9 @@ abstract class CommonObject
|
||||
else
|
||||
$marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total'];
|
||||
if ($marginInfos['pa_total'] > 0)
|
||||
$marginInfos['total_margin_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pa_total'],5);
|
||||
$marginInfos['total_margin_rate'] = 100 * $marginInfos['total_margin'] / $marginInfos['pa_total'];
|
||||
if ($marginInfos['pv_total'] > 0)
|
||||
$marginInfos['total_mark_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pv_total'],5);
|
||||
$marginInfos['total_mark_rate'] = 100 * $marginInfos['total_margin'] / $marginInfos['pv_total'];
|
||||
|
||||
return $marginInfos;
|
||||
}
|
||||
@ -3230,6 +3236,8 @@ abstract class CommonObject
|
||||
|
||||
if (! $user->rights->margins->liretous) return;
|
||||
|
||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
|
||||
$marginInfo = $this->getMarginInfos($force_price);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -3249,34 +3257,34 @@ abstract class CommonObject
|
||||
//if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) {
|
||||
print '<tr class="impair">';
|
||||
print '<td>'.$langs->trans('MarginOnProducts').'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pv_products']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pa_products']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['margin_on_products']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pv_products'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pa_products'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print '<td align="right">'.(($marginInfo['margin_rate_products'] == '')?'n/a':price($marginInfo['margin_rate_products']).'%').'</td>';
|
||||
print '<td align="right">'.(($marginInfo['margin_rate_products'] == '')?'n/a':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print '<td align="right">'.(($marginInfo['mark_rate_products'] == '')?'n/a':price($marginInfo['mark_rate_products']).'%').'</td>';
|
||||
print '<td align="right">'.(($marginInfo['mark_rate_products'] == '')?'n/a':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').'</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="pair">';
|
||||
print '<td>'.$langs->trans('MarginOnServices').'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pv_services']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pa_services']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['margin_on_services']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pv_services'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pa_services'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print '<td align="right">'.(($marginInfo['margin_rate_services'] == '')?'n/a':price($marginInfo['margin_rate_services']).'%').'</td>';
|
||||
print '<td align="right">'.(($marginInfo['margin_rate_services'] == '')?'n/a':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print '<td align="right">'.(($marginInfo['mark_rate_services'] == '')?'n/a':price($marginInfo['mark_rate_services']).'%').'</td>';
|
||||
print '<td align="right">'.(($marginInfo['mark_rate_services'] == '')?'n/a':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').'</td>';
|
||||
print '</tr>';
|
||||
//}
|
||||
print '<tr class="impair">';
|
||||
print '<td>'.$langs->trans('TotalMargin').'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pv_total']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pa_total']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['total_margin']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pv_total'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pa_total'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['total_margin'], null, null, null, null, $rounding).'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print '<td align="right">'.(($marginInfo['total_margin_rate'] == '')?'n/a':price($marginInfo['total_margin_rate']).'%').'</td>';
|
||||
print '<td align="right">'.(($marginInfo['total_margin_rate'] == '')?'n/a':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print '<td align="right">'.(($marginInfo['total_mark_rate'] == '')?'n/a':price($marginInfo['total_mark_rate']).'%').'</td>';
|
||||
print '<td align="right">'.(($marginInfo['total_mark_rate'] == '')?'n/a':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').'</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
@ -138,17 +138,17 @@ class FormFile
|
||||
$out .= ' ('.$langs->trans("UploadDisabled").')';
|
||||
}
|
||||
$out .= "</td></tr>";
|
||||
|
||||
|
||||
if ($savingdocmask)
|
||||
{
|
||||
$out .= '<tr>';
|
||||
if (! empty($options)) $out .= '<td>'.$options.'</td>';
|
||||
$out .= '<td valign="middle" class="nowrap">';
|
||||
$out .= '<input type="checkbox" checked="checked" name="savingdocmask" value="'.dol_escape_js($savingdocmask).'"> '.$langs->trans("SaveUploadedFileWithMask", preg_replace('/__file__/',$langs->transnoentitiesnoconv("OriginFileName"),$savingdocmask), $langs->transnoentitiesnoconv("OriginFileName"));
|
||||
$out .= '<input type="checkbox" checked="checked" name="savingdocmask" value="'.dol_escape_js($savingdocmask).'"> '.$langs->trans("SaveUploadedFileWithMask", preg_replace('/__file__/',$langs->transnoentitiesnoconv("OriginFileName"),$savingdocmask), $langs->transnoentitiesnoconv("OriginFileName"));
|
||||
$out .= '</td>';
|
||||
$out .= '</tr>';
|
||||
$out .= '</tr>';
|
||||
}
|
||||
|
||||
|
||||
$out .= "</table>";
|
||||
|
||||
$out .= '</form>';
|
||||
@ -663,12 +663,13 @@ class FormFile
|
||||
* @param int $permtodelete Permission to delete
|
||||
* @param int $useinecm Change output for use in ecm module
|
||||
* @param string $textifempty Text to show if filearray is empty ('NoFileFound' if not defined)
|
||||
* @param int $maxlength Maximum length of file name shown
|
||||
* @param int $maxlength Maximum length of file name shown
|
||||
* @param string $title Title before list
|
||||
* @param string $url Full url to use for click links ('' = autodetect)
|
||||
* @param int $showrelpart 0=Show only filename (default), 1=Show first level 1 dir
|
||||
* @return int <0 if KO, nb of files shown if OK
|
||||
*/
|
||||
function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='')
|
||||
function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0)
|
||||
{
|
||||
global $user, $conf, $langs, $hookmanager;
|
||||
global $bc;
|
||||
@ -741,8 +742,7 @@ class FormFile
|
||||
print '&file='.$filepath.'">';
|
||||
|
||||
print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' ';
|
||||
if ($file['level1name'] <> $object->id)
|
||||
print $file['level1name'].'/';
|
||||
if ($showrelpart == 1) print $file['level1name'].'/';
|
||||
print dol_trunc($file['name'],$maxlength,'middle');
|
||||
print '</a>';
|
||||
print "</td>\n";
|
||||
|
||||
@ -77,6 +77,11 @@ function dol_decode($chain)
|
||||
*/
|
||||
function dol_hash($chain,$type=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Salt value
|
||||
if (! empty($conf->global->MAIN_SECURITY_SALT)) $chain=$conf->global->MAIN_SECURITY_SALT.$chain;
|
||||
|
||||
if ($type == 1) return sha1($chain);
|
||||
else if ($type == 2) return sha1(md5($chain));
|
||||
else return md5($chain);
|
||||
|
||||
@ -25,8 +25,9 @@ if (GETPOST('dol_optimize_smallscreen')) $conf->dol_optimize_smallscreen=1;
|
||||
if (GETPOST('dol_no_mouse_hover')) $conf->dol_no_mouse_hover=1;
|
||||
if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile=1;
|
||||
|
||||
$arrayofjs=array('/core/js/dst.js'); // Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second
|
||||
print top_htmlhead('',$langs->trans('Login').' '.$title,0,0,$arrayofjs);
|
||||
$arrayofjs=array('/core/js/dst.js'); // Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second
|
||||
$titleofloginpage=$langs->trans('Login').' '.$title; // title is defined by dol_loginfunction in security2.lib.php
|
||||
print top_htmlhead('',$titleofloginpage,0,0,$arrayofjs);
|
||||
?>
|
||||
<!-- BEGIN PHP TEMPLATE LOGIN.TPL.PHP -->
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -121,14 +121,15 @@
|
||||
<?php }
|
||||
|
||||
if (! empty($conf->margin->enabled) && empty($user->societe_id)) {
|
||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
?>
|
||||
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->pa_ht); ?></td>
|
||||
<?php if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) {?>
|
||||
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo (($line->pa_ht == 0)?'n/a':price($line->marge_tx).'%'); ?></td>
|
||||
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo (($line->pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?></td>
|
||||
<?php
|
||||
}
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?>
|
||||
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->marque_tx).'%'; ?></td>
|
||||
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->marque_tx, null, null, null, null, $rounding).'%'; ?></td>
|
||||
<?php } } ?>
|
||||
|
||||
<?php if ($line->special_code == 3) { ?>
|
||||
|
||||
@ -1,51 +1,52 @@
|
||||
# Dolibarr language file - Source file is en_US - marges
|
||||
CHARSET=UTF-8
|
||||
|
||||
# Margin=Margin
|
||||
# Margins=Margins
|
||||
# TotalMargin=Total Margin
|
||||
# MarginOnProducts=Margin / Products
|
||||
# MarginOnServices=Margin / Services
|
||||
# MarginRate=Margin rate
|
||||
# MarkRate=Mark rate
|
||||
# DisplayMarginRates=Display margin rates
|
||||
# DisplayMarkRates=Display mark rates
|
||||
# InputPrice=Input price
|
||||
Margin=Marge
|
||||
Margins=Marges
|
||||
TotalMargin=Marge Totaal
|
||||
MarginOnProducts=Marge / Training
|
||||
MarginOnServices=Marge / Dienst
|
||||
MarginRate=Marge verhouding
|
||||
MarkRate=Markerings verhouding
|
||||
DisplayMarginRates=Toon Marge Verhouding
|
||||
DisplayMarkRates=Toon Markeringsverhouding
|
||||
InputPrice=Voer Prijs in
|
||||
|
||||
# margin=Profit margins management
|
||||
# margesSetup=Profit margins management setup
|
||||
margin=Winst marge management
|
||||
margesSetup=Winst marge management setup
|
||||
|
||||
# MarginDetails=Margin details
|
||||
MarginDetails=Marge details
|
||||
|
||||
# ProductMargins=Product margins
|
||||
# CustomerMargins=Customer margins
|
||||
# AgentMargins=Agent margins
|
||||
ProductMargins=Product marge
|
||||
CustomerMargins=Klant marges
|
||||
AgentMargins=Acc. Manager marges
|
||||
|
||||
ProductService=Product of Dienst
|
||||
# AllProducts=All products and services
|
||||
# ChooseProduct/Service=Choose product or service
|
||||
# CommercialAgent=Commercial agent
|
||||
ProductService=Trainning of Dienst
|
||||
AllProducts=Alle Trainingen en Diensten
|
||||
ChooseProduct/Service=Kies Training of Dienst
|
||||
CommercialAgent=Commerciel Agent
|
||||
|
||||
StartDate=Begindatum
|
||||
EndDate=Einddatum
|
||||
StartDate=Start datum
|
||||
EndDate=Eind datum
|
||||
Launch=Start
|
||||
|
||||
# ForceBuyingPriceIfNull=Force buying price if null
|
||||
# ForceBuyingPriceIfNullDetails=if "ON", margin will be zero on line (buying price = selling price), otherwise ("OFF"), marge will be equal to selling price (buying price = 0)
|
||||
# MARGIN_METHODE_FOR_DISCOUNT=Margin method for global discounts
|
||||
# UseDiscountAsProduct=As a product
|
||||
# UseDiscountAsService=As a service
|
||||
# UseDiscountOnTotal=On subtotal
|
||||
# MARGIN_METHODE_FOR_DISCOUNT_DETAILS=Defines if a global discount is treated as a product, a service, or only on subtotal for margin calculation.
|
||||
ForceBuyingPriceIfNull=Forceer een inkoopprijs indien null
|
||||
ForceBuyingPriceIfNullDetails=indien "ON", marge wodt nul (inkoopprijs = verkoopprijs), anders("OFF"), marge is gelijk verkoopprijs (inkoopprijs = 0)
|
||||
MARGIN_METHODE_FOR_DISCOUNT=Marge methode voor globale discounts
|
||||
UseDiscountAsProduct=Als een training
|
||||
UseDiscountAsService=Als een dienst
|
||||
UseDiscountOnTotal=Op subtotaal
|
||||
MARGIN_METHODE_FOR_DISCOUNT_DETAILS=Definieert als een globale discount wordt behandelt als een training, een dienst, of alleen een subtotaal voor marge berekening.
|
||||
|
||||
# MARGIN_TYPE=Margin type
|
||||
# MargeBrute=Raw margin
|
||||
# MargeNette=Net margin
|
||||
# MARGIN_TYPE_DETAILS=Raw margin : Selling price - Buying price<br/>Net margin : Selling price - Cost price
|
||||
MARGIN_TYPE=Marge type
|
||||
MargeBrute=Groffe marge
|
||||
MargeNette=Netto marge
|
||||
MARGIN_TYPE_DETAILS=Groffe marge : Verkoopprijs - Inkoopprijs<br/>Netto marge : Verkoopprijs - Kostprijs
|
||||
|
||||
# CostPrice=Cost price
|
||||
# BuyingCost=Cost price
|
||||
# UnitCharges=Unit charges
|
||||
# Charges=Charges
|
||||
CostPrice=Kostprijs
|
||||
BuyingCost=Kostprijs
|
||||
UnitCharges=Unit toeslag
|
||||
Charges=Toeslag
|
||||
|
||||
# AgentContactType=Contact type used for commissioning
|
||||
# AgentContactTypeDetails=Défine what contact type (linked on invoices) will be associated with commercial agents
|
||||
AgentContactType=Contact type used voor commissie
|
||||
AgentContactTypeDetails=Definieer het contact type (gelinked op facturen) wordt geassocieerd met commercieel agent
|
||||
|
||||
@ -168,9 +168,6 @@ if ($result)
|
||||
print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
$cumul_achat = 0;
|
||||
$cumul_vente = 0;
|
||||
$cumul_qty = 0;
|
||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
|
||||
if ($num > 0)
|
||||
@ -187,13 +184,13 @@ if ($result)
|
||||
|
||||
if ($marge < 0)
|
||||
{
|
||||
$marginRate = ($pa != 0)?-1*(100 * round($marge / $pa, 5)):'' ;
|
||||
$markRate = ($pv != 0)?-1*(100 * round($marge / $pv, 5)):'' ;
|
||||
$marginRate = ($pa != 0)?-1*(100 * $marge / $pa):'' ;
|
||||
$markRate = ($pv != 0)?-1*(100 * $marge / $pv):'' ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$marginRate = ($pa != 0)?(100 * round($marge / $pa, 5)):'' ;
|
||||
$markRate = ($pv != 0)?(100 * round($marge / $pv, 5)):'' ;
|
||||
$marginRate = ($pa != 0)?(100 * $marge / $pa):'' ;
|
||||
$markRate = ($pv != 0)?(100 * $marge / $pv):'' ;
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
@ -210,18 +207,16 @@ if ($result)
|
||||
print "<td>".$userstatic->getFullName($langs,0,0,0)."</td>\n";
|
||||
}
|
||||
|
||||
print "<td align=\"right\">".price($pv)."</td>\n";
|
||||
print "<td align=\"right\">".price($pa)."</td>\n";
|
||||
print "<td align=\"right\">".price($marge)."</td>\n";
|
||||
print "<td align=\"right\">".price($pv, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($pa, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($marge, null, null, null, null, $rounding)."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
$cumul_achat += round($objp->buying_price, $rounding);
|
||||
$cumul_vente += round($objp->selling_price, $rounding);
|
||||
}
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
@ -210,7 +210,7 @@ if ($result)
|
||||
|
||||
$cumul_achat = 0;
|
||||
$cumul_vente = 0;
|
||||
$cumul_qty = 0;
|
||||
|
||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
|
||||
if ($num > 0)
|
||||
@ -227,13 +227,13 @@ if ($result)
|
||||
|
||||
if ($marge < 0)
|
||||
{
|
||||
$marginRate = ($pa != 0)?-1*(100 * round($marge / $pa, 5)):'' ;
|
||||
$markRate = ($pv != 0)?-1*(100 * round($marge / $pv, 5)):'' ;
|
||||
$marginRate = ($pa != 0)?-1*(100 * $marge / $pa):'' ;
|
||||
$markRate = ($pv != 0)?-1*(100 * $marge / $pv):'' ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$marginRate = ($pa != 0)?(100 * round($marge / $pa, 5)):'' ;
|
||||
$markRate = ($pv != 0)?(100 * round($marge / $pv, 5)):'' ;
|
||||
$marginRate = ($pa != 0)?(100 * $marge / $pa):'' ;
|
||||
$markRate = ($pv != 0)?(100 * $marge / $pv):'' ;
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
@ -255,18 +255,18 @@ if ($result)
|
||||
print "<td>".$companystatic->getNomUrl(1,'customer')."</td>\n";
|
||||
}
|
||||
|
||||
print "<td align=\"right\">".price($pv)."</td>\n";
|
||||
print "<td align=\"right\">".price($pa)."</td>\n";
|
||||
print "<td align=\"right\">".price($marge)."</td>\n";
|
||||
print "<td align=\"right\">".price($pv, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($pa, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($marge, null, null, null, null, $rounding)."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
$cumul_achat += round($objp->buying_price, $rounding);
|
||||
$cumul_vente += round($objp->selling_price, $rounding);
|
||||
$cumul_achat += $objp->buying_price;
|
||||
$cumul_vente += $objp->selling_price;
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,13 +275,13 @@ if ($result)
|
||||
$totalMargin = $cumul_vente - $cumul_achat;
|
||||
if ($totalMargin < 0)
|
||||
{
|
||||
$marginRate = ($cumul_achat != 0)?-1*(100 * round($totalMargin / $cumul_achat, 5)):'';
|
||||
$markRate = ($cumul_vente != 0)?-1*(100 * round($totalMargin / $cumul_vente, 5)):'';
|
||||
$marginRate = ($cumul_achat != 0)?-1*(100 * $totalMargin / $cumul_achat):'';
|
||||
$markRate = ($cumul_vente != 0)?-1*(100 * $totalMargin / $cumul_vente):'';
|
||||
}
|
||||
else
|
||||
{
|
||||
$marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):'';
|
||||
$markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):'';
|
||||
$marginRate = ($cumul_achat != 0)?(100 * $totalMargin / $cumul_achat):'';
|
||||
$markRate = ($cumul_vente != 0)?(100 * $totalMargin / $cumul_vente):'';
|
||||
}
|
||||
|
||||
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
||||
@ -290,13 +290,13 @@ if ($result)
|
||||
else
|
||||
print '<td>';
|
||||
print $langs->trans('TotalMargin')."</td>";
|
||||
print "<td align=\"right\">".price($cumul_vente)."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_achat)."</td>\n";
|
||||
print "<td align=\"right\">".price($totalMargin)."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_vente, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_achat, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($totalMargin, null, null, null, null, $rounding)."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
@ -322,9 +322,9 @@ $(document).ready(function() {
|
||||
$("div.fiche form").submit();
|
||||
});
|
||||
|
||||
$("#totalMargin").html("<?php echo price($totalMargin); ?>");
|
||||
$("#marginRate").html("<?php echo (($marginRate === '')?'n/a':price($marginRate)."%"); ?>");
|
||||
$("#markRate").html("<?php echo (($markRate === '')?'n/a':price($markRate)."%"); ?>");
|
||||
$("#totalMargin").html("<?php echo price($totalMargin, null, null, null, null, $rounding); ?>");
|
||||
$("#marginRate").html("<?php echo (($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%"); ?>");
|
||||
$("#markRate").html("<?php echo (($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%"); ?>");
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -125,10 +125,10 @@ function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localta
|
||||
|
||||
// calcul taux marge
|
||||
if ($paht_ret != 0)
|
||||
$marge_tx_ret = round((100 * $marge) / $paht_ret, 3);
|
||||
$marge_tx_ret = (100 * $marge) / $paht_ret;
|
||||
// calcul taux marque
|
||||
if ($pu_ht_remise != 0)
|
||||
$marque_tx_ret = round((100 * $marge) / $pu_ht_remise, 3);
|
||||
$marque_tx_ret = (100 * $marge) / $pu_ht_remise;
|
||||
|
||||
return array($paht_ret, $marge_tx_ret, $marque_tx_ret);
|
||||
}
|
||||
|
||||
@ -215,7 +215,6 @@ if ($result)
|
||||
|
||||
$cumul_achat = 0;
|
||||
$cumul_vente = 0;
|
||||
$cumul_qty = 0;
|
||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
|
||||
if ($num > 0)
|
||||
@ -231,13 +230,13 @@ if ($result)
|
||||
|
||||
if ($marge < 0)
|
||||
{
|
||||
$marginRate = ($pa != 0)?-1*(100 * round($marge / $pa, 5)):'' ;
|
||||
$markRate = ($pv != 0)?-1*(100 * round($marge / $pv, 5)):'' ;
|
||||
$marginRate = ($pa != 0)?-1*(100 * $marge / $pa):'' ;
|
||||
$markRate = ($pv != 0)?-1*(100 * $marge / $pv):'' ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$marginRate = ($pa != 0)?(100 * round($marge / $pa, 5)):'' ;
|
||||
$markRate = ($pv != 0)?(100 * round($marge / $pv, 5)):'' ;
|
||||
$marginRate = ($pa != 0)?(100 * $marge / $pa):'' ;
|
||||
$markRate = ($pv != 0)?(100 * $marge / $pv):'' ;
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
@ -261,18 +260,18 @@ if ($result)
|
||||
$text.= ' - '.$objp->label;
|
||||
print "<td>".$product_static->getNomUrl(1)."</td>\n";
|
||||
}
|
||||
print "<td align=\"right\">".price($pv)."</td>\n";
|
||||
print "<td align=\"right\">".price($pa)."</td>\n";
|
||||
print "<td align=\"right\">".price($marge)."</td>\n";
|
||||
print "<td align=\"right\">".price($pv, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($pa, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($marge, null, null, null, null, $rounding)."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
$cumul_achat += round($objp->buying_price, $rounding);
|
||||
$cumul_vente += round($objp->selling_price, $rounding);
|
||||
$cumul_achat += $objp->buying_price;
|
||||
$cumul_vente += $objp->selling_price;
|
||||
}
|
||||
|
||||
}
|
||||
@ -282,13 +281,13 @@ if ($result)
|
||||
$totalMargin = $cumul_vente - $cumul_achat;
|
||||
if ($totalMargin < 0)
|
||||
{
|
||||
$marginRate = ($cumul_achat != 0)?-1*(100 * round($totalMargin / $cumul_achat, 5)):'';
|
||||
$markRate = ($cumul_vente != 0)?-1*(100 * round($totalMargin / $cumul_vente, 5)):'';
|
||||
$marginRate = ($cumul_achat != 0)?-1*(100 * $totalMargin / $cumul_achat):'';
|
||||
$markRate = ($cumul_vente != 0)?-1*(100 * $totalMargin / $cumul_vente):'';
|
||||
}
|
||||
else
|
||||
{
|
||||
$marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):'';
|
||||
$markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):'';
|
||||
$marginRate = ($cumul_achat != 0)?(100 * $totalMargin / $cumul_achat):'';
|
||||
$markRate = ($cumul_vente != 0)?(100 * $totalMargin / $cumul_vente):'';
|
||||
}
|
||||
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
||||
if ($id > 0)
|
||||
@ -296,13 +295,13 @@ if ($result)
|
||||
else
|
||||
print '<td>';
|
||||
print $langs->trans('TotalMargin')."</td>";
|
||||
print "<td align=\"right\">".price($cumul_vente)."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_achat)."</td>\n";
|
||||
print "<td align=\"right\">".price($totalMargin)."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_vente, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_achat, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($totalMargin, null, null, null, null, $rounding)."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
@ -330,9 +329,9 @@ $(document).ready(function() {
|
||||
$("div.fiche form").submit();
|
||||
});
|
||||
|
||||
$("#totalMargin").html("<?php echo price($totalMargin); ?>");
|
||||
$("#marginRate").html("<?php echo (($marginRate === '')?'n/a':price($marginRate)."%"); ?>");
|
||||
$("#markRate").html("<?php echo (($markRate === '')?'n/a':price($markRate)."%"); ?>");
|
||||
$("#totalMargin").html("<?php echo price($totalMargin, null, null, null, null, $rounding); ?>");
|
||||
$("#marginRate").html("<?php echo (($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%"); ?>");
|
||||
$("#markRate").html("<?php echo (($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%"); ?>");
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -196,13 +196,13 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
if ($objp->marge < 0)
|
||||
{
|
||||
$marginRate = ($objp->buying_price != 0)?-1*(100 * round($objp->marge / $objp->buying_price, 5)):'' ;
|
||||
$markRate = ($objp->selling_price != 0)?-1*(100 * round($objp->marge / $objp->selling_price, 5)):'' ;
|
||||
$marginRate = ($objp->buying_price != 0)?-1*(100 * $objp->marge / $objp->buying_price):'' ;
|
||||
$markRate = ($objp->selling_price != 0)?-1*(100 * $objp->marge / $objp->selling_price):'' ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price, 5)):'' ;
|
||||
$markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price, 5)):'' ;
|
||||
$marginRate = ($objp->buying_price != 0)?(100 * $objp->marge / $objp->buying_price):'' ;
|
||||
$markRate = ($objp->selling_price != 0)?(100 * $objp->marge / $objp->selling_price):'' ;
|
||||
}
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
@ -215,19 +215,19 @@ if ($id > 0 || ! empty($ref))
|
||||
print "<td>".$objp->code_client."</td>\n";
|
||||
print "<td align=\"center\">";
|
||||
print dol_print_date($db->jdate($objp->datef),'day')."</td>";
|
||||
print "<td align=\"right\">".price($objp->selling_price)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->buying_price)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->qty)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->marge)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->selling_price, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->buying_price, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->qty, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->marge, null, null, null, null, $rounding)."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
$cumul_achat += round($objp->buying_price, $rounding);
|
||||
$cumul_vente += round($objp->selling_price, $rounding);
|
||||
$cumul_achat += $objp->buying_price;
|
||||
$cumul_vente += $objp->selling_price;
|
||||
$cumul_qty += $objp->qty;
|
||||
}
|
||||
}
|
||||
@ -237,24 +237,24 @@ if ($id > 0 || ! empty($ref))
|
||||
$totalMargin = $cumul_vente - $cumul_achat;
|
||||
if ($totalMargin < 0)
|
||||
{
|
||||
$marginRate = ($cumul_achat != 0)?-1*(100 * round($totalMargin / $cumul_achat, 5)):'';
|
||||
$markRate = ($cumul_vente != 0)?-1*(100 * round($totalMargin / $cumul_vente, 5)):'';
|
||||
$marginRate = ($cumul_achat != 0)?-1*(100 * $totalMargin / $cumul_achat):'';
|
||||
$markRate = ($cumul_vente != 0)?-1*(100 * $totalMargin / $cumul_vente):'';
|
||||
}
|
||||
else
|
||||
{
|
||||
$marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):'';
|
||||
$markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):'';
|
||||
$marginRate = ($cumul_achat != 0)?(100 * $totalMargin / $cumul_achat):'';
|
||||
$markRate = ($cumul_vente != 0)?(100 * $totalMargin / $cumul_vente):'';
|
||||
}
|
||||
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
||||
print '<td colspan=4>'.$langs->trans('TotalMargin')."</td>";
|
||||
print "<td align=\"right\">".price($cumul_vente)."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_achat)."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_qty)."</td>\n";
|
||||
print "<td align=\"right\">".price($totalMargin)."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_vente, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_achat, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_qty, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($totalMargin, null, null, null, null, $rounding)."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
print '<td align="right"> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
@ -278,8 +278,8 @@ $db->close();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#totalMargin").html("<?php echo price($totalMargin); ?>");
|
||||
$("#marginRate").html("<?php echo (($marginRate === '')?'n/a':price($marginRate)."%"); ?>");
|
||||
$("#markRate").html("<?php echo (($markRate === '')?'n/a':price($markRate)."%"); ?>");
|
||||
$("#totalMargin").html("<?php echo price($totalMargin, null, null, null, null, $rounding); ?>");
|
||||
$("#marginRate").html("<?php echo (($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%"); ?>");
|
||||
$("#markRate").html("<?php echo (($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%"); ?>");
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -175,7 +175,7 @@ if ($socid > 0)
|
||||
|
||||
$cumul_achat = 0;
|
||||
$cumul_vente = 0;
|
||||
$cumul_qty = 0;
|
||||
|
||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
|
||||
if ($num > 0)
|
||||
@ -187,13 +187,13 @@ if ($socid > 0)
|
||||
|
||||
if ($objp->marge < 0)
|
||||
{
|
||||
$marginRate = ($objp->buying_price != 0)?-1*(100 * round($objp->marge / $objp->buying_price, 5)):'' ;
|
||||
$markRate = ($objp->selling_price != 0)?-1*(100 * round($objp->marge / $objp->selling_price, 5)):'' ;
|
||||
$marginRate = ($objp->buying_price != 0)?-1*(100 * $objp->marge / $objp->buying_price):'' ;
|
||||
$markRate = ($objp->selling_price != 0)?-1*(100 * $objp->marge / $objp->selling_price):'' ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price, 5)):'' ;
|
||||
$markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price, 5)):'' ;
|
||||
$marginRate = ($objp->buying_price != 0)?(100 * $objp->marge / $objp->buying_price):'' ;
|
||||
$markRate = ($objp->selling_price != 0)?(100 * $objp->marge / $objp->selling_price):'' ;
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
@ -206,18 +206,18 @@ if ($socid > 0)
|
||||
print "</td>\n";
|
||||
print "<td align=\"center\">";
|
||||
print dol_print_date($db->jdate($objp->datef),'day')."</td>";
|
||||
print "<td align=\"right\">".price($objp->selling_price)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->buying_price)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->marge)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->selling_price, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->buying_price, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->marge, null, null, null, null, $rounding)."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
$cumul_achat += round($objp->buying_price, $rounding);
|
||||
$cumul_vente += round($objp->selling_price, $rounding);
|
||||
$cumul_achat += $objp->buying_price;
|
||||
$cumul_vente += $objp->selling_price;
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,23 +226,23 @@ if ($socid > 0)
|
||||
$totalMargin = $cumul_vente - $cumul_achat;
|
||||
if ($totalMargin < 0)
|
||||
{
|
||||
$marginRate = ($cumul_achat != 0)?-1*(100 * round($totalMargin / $cumul_achat, 5)):'';
|
||||
$markRate = ($cumul_vente != 0)?-1*(100 * round($totalMargin / $cumul_vente, 5)):'';
|
||||
$marginRate = ($cumul_achat != 0)?-1*(100 * $totalMargin / $cumul_achat):'';
|
||||
$markRate = ($cumul_vente != 0)?-1*(100 * $totalMargin / $cumul_vente):'';
|
||||
}
|
||||
else
|
||||
{
|
||||
$marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):'';
|
||||
$markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):'';
|
||||
$marginRate = ($cumul_achat != 0)?(100 * $totalMargin / $cumul_achat):'';
|
||||
$markRate = ($cumul_vente != 0)?(100 * $totalMargin / $cumul_vente):'';
|
||||
}
|
||||
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
||||
print '<td colspan=2>'.$langs->trans('TotalMargin')."</td>";
|
||||
print "<td align=\"right\">".price($cumul_vente)."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_achat)."</td>\n";
|
||||
print "<td align=\"right\">".price($totalMargin)."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_vente, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_achat, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($totalMargin, null, null, null, null, $rounding)."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
print '<td align="right"> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user