Merge pull request #598 from cbattarel/3.3
show costprice instead of buyingprice if setup of margin module is costprice
This commit is contained in:
commit
a30dd12cc0
@ -2649,7 +2649,7 @@ abstract class CommonObject
|
|||||||
if ($conf->global->MARGIN_TYPE == "1")
|
if ($conf->global->MARGIN_TYPE == "1")
|
||||||
print '<td align="right" width="80">'.$langs->trans('BuyingPrice').'</td>';
|
print '<td align="right" width="80">'.$langs->trans('BuyingPrice').'</td>';
|
||||||
else
|
else
|
||||||
print '<td align="right" width="80">'.$langs->trans('BuyingCost').'</td>';
|
print '<td align="right" width="80">'.$langs->trans('CostPrice').'</td>';
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print '<td align="right" width="50">'.$langs->trans('MarginRate').'</td>';
|
print '<td align="right" width="50">'.$langs->trans('MarginRate').'</td>';
|
||||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
@ -3049,7 +3049,10 @@ abstract class CommonObject
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td width="30%">'.$langs->trans('Margins').'</td>';
|
print '<td width="30%">'.$langs->trans('Margins').'</td>';
|
||||||
print '<td width="20%" align="right">'.$langs->trans('SellingPrice').'</td>';
|
print '<td width="20%" align="right">'.$langs->trans('SellingPrice').'</td>';
|
||||||
print '<td width="20%" align="right">'.$langs->trans('BuyingPrice').'</td>';
|
if ($conf->global->MARGIN_TYPE == "1")
|
||||||
|
print '<td width="20%" align="right">'.$langs->trans('BuyingPrice').'</td>';
|
||||||
|
else
|
||||||
|
print '<td width="20%" align="right">'.$langs->trans('CostPrice').'</td>';
|
||||||
print '<td width="20%" align="right">'.$langs->trans('Margin').'</td>';
|
print '<td width="20%" align="right">'.$langs->trans('Margin').'</td>';
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print '<td align="right">'.$langs->trans('MarginRate').'</td>';
|
print '<td align="right">'.$langs->trans('MarginRate').'</td>';
|
||||||
|
|||||||
@ -1,148 +1,155 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* Need to have following variables defined:
|
* Need to have following variables defined:
|
||||||
* $conf
|
* $conf
|
||||||
* $langs
|
* $langs
|
||||||
* $dateSelector
|
* $dateSelector
|
||||||
* $this (invoice, order, ...)
|
* $this (invoice, order, ...)
|
||||||
* $line defined
|
* $line defined
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$usemargins=0;
|
$usemargins=0;
|
||||||
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
|
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
|
||||||
<tr class="liste_titre nodrag nodrop">
|
<tr class="liste_titre nodrag nodrop">
|
||||||
<td
|
<td
|
||||||
<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>><div
|
<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>><div
|
||||||
id="add"></div> <?php echo $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone"); ?>
|
id="add"></div> <?php echo $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone"); ?>
|
||||||
</td>
|
</td>
|
||||||
<td align="right"><?php echo $langs->trans('VAT'); ?></td>
|
<td align="right"><?php echo $langs->trans('VAT'); ?></td>
|
||||||
<td align="right"><?php echo $langs->trans('PriceUHT'); ?></td>
|
<td align="right"><?php echo $langs->trans('PriceUHT'); ?></td>
|
||||||
<td align="right"><?php echo $langs->trans('Qty'); ?></td>
|
<td align="right"><?php echo $langs->trans('Qty'); ?></td>
|
||||||
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
||||||
<?php
|
<?php
|
||||||
$colspan = 4;
|
$colspan = 4;
|
||||||
if (! empty($usemargins))
|
if (! empty($usemargins))
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td>
|
<td align="right">
|
||||||
<?php
|
<?php
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
if ($conf->global->MARGIN_TYPE == "1")
|
||||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
echo $langs->trans('BuyingPrice');
|
||||||
}
|
else
|
||||||
?>
|
echo $langs->trans('CostPrice');
|
||||||
<td colspan="<?php echo $colspan; ?>"> </td>
|
?>
|
||||||
</tr>
|
</td>
|
||||||
|
<?php
|
||||||
<form name="addproduct" id="addproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
||||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
||||||
<input type="hidden" name="action" value="addline">
|
}
|
||||||
<input type="hidden" name="mode" value="libre">
|
?>
|
||||||
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
|
<td colspan="<?php echo $colspan; ?>"> </td>
|
||||||
|
</tr>
|
||||||
<tr <?php echo $bcnd[$var]; ?>>
|
|
||||||
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
|
<form name="addproduct" id="addproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
|
||||||
<?php
|
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||||
|
<input type="hidden" name="action" value="addline">
|
||||||
echo '<span>';
|
<input type="hidden" name="mode" value="libre">
|
||||||
echo $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1);
|
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
|
||||||
echo '</span>';
|
|
||||||
|
<tr <?php echo $bcnd[$var]; ?>>
|
||||||
if (is_object($hookmanager))
|
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
|
||||||
{
|
<?php
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
|
echo '<span>';
|
||||||
}
|
echo $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1);
|
||||||
|
echo '</span>';
|
||||||
if ((! empty($conf->product->enabled) && ! empty($conf->service->enabled)) || (empty($conf->product->enabled) && empty($conf->service->enabled))) echo '<br>';
|
|
||||||
|
if (is_object($hookmanager))
|
||||||
// Editor wysiwyg
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
$parameters=array();
|
||||||
$nbrows=ROWS_2;
|
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
|
||||||
$enabled=(! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0);
|
}
|
||||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
|
||||||
$doleditor=new DolEditor('dp_desc',GETPOST('dp_desc'),'',100,'dolibarr_details','',false,true,$enabled,$nbrows,70);
|
if ((! empty($conf->product->enabled) && ! empty($conf->service->enabled)) || (empty($conf->product->enabled) && empty($conf->service->enabled))) echo '<br>';
|
||||||
$doleditor->Create();
|
|
||||||
?>
|
// Editor wysiwyg
|
||||||
</td>
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
|
$nbrows=ROWS_2;
|
||||||
<td align="right"><?php
|
$enabled=(! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0);
|
||||||
if ($seller->tva_assuj == "0") echo '<input type="hidden" name="np_tva_tx" value="0">0';
|
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||||
else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer);
|
$doleditor=new DolEditor('dp_desc',GETPOST('dp_desc'),'',100,'dolibarr_details','',false,true,$enabled,$nbrows,70);
|
||||||
?>
|
$doleditor->Create();
|
||||||
</td>
|
?>
|
||||||
<td align="right"><input type="text" size="5" name="price_ht" value="<?php echo (isset($_POST["price_ht"])?$_POST["price_ht"]:''); ?>">
|
</td>
|
||||||
</td>
|
|
||||||
<td align="right"><input type="text" size="2" name="qty" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>"></td>
|
<td align="right"><?php
|
||||||
<td align="right" nowrap><input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" name="remise_percent">%</td>
|
if ($seller->tva_assuj == "0") echo '<input type="hidden" name="np_tva_tx" value="0">0';
|
||||||
<?php
|
else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer);
|
||||||
$colspan = 4;
|
?>
|
||||||
if (! empty($usemargins))
|
</td>
|
||||||
{
|
<td align="right"><input type="text" size="5" name="price_ht" value="<?php echo (isset($_POST["price_ht"])?$_POST["price_ht"]:''); ?>">
|
||||||
?>
|
</td>
|
||||||
<td align="right"><input type="text" size="5" name="buying_price"
|
<td align="right"><input type="text" size="2" name="qty" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>"></td>
|
||||||
value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
|
<td align="right" nowrap><input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" name="remise_percent">%</td>
|
||||||
</td>
|
<?php
|
||||||
<?php
|
$colspan = 4;
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
if (! empty($usemargins))
|
||||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
{
|
||||||
}
|
?>
|
||||||
?>
|
<td align="right"><input type="text" size="5" name="buying_price"
|
||||||
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>"><input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline"></td>
|
value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
|
||||||
</tr>
|
</td>
|
||||||
|
<?php
|
||||||
<?php
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
||||||
if (! empty($conf->service->enabled) && $dateSelector)
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
||||||
{
|
}
|
||||||
if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
|
?>
|
||||||
else $colspan = 9;
|
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>"><input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline"></td>
|
||||||
|
</tr>
|
||||||
if (! empty($usemargins))
|
|
||||||
{
|
<?php
|
||||||
$colspan++; // For the buying price
|
if (! empty($conf->service->enabled) && $dateSelector)
|
||||||
if($conf->global->DISPLAY_MARGIN_RATES) $colspan++;
|
{
|
||||||
if($conf->global->DISPLAY_MARK_RATES) $colspan++;
|
if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
|
||||||
}
|
else $colspan = 9;
|
||||||
?>
|
|
||||||
<tr <?php echo $bcnd[$var]; ?>>
|
if (! empty($usemargins))
|
||||||
<td colspan="<?php echo $colspan; ?>"><?php
|
{
|
||||||
if (! empty($object->element) && $object->element == 'contrat')
|
$colspan++; // For the buying price
|
||||||
{
|
if($conf->global->DISPLAY_MARGIN_RATES) $colspan++;
|
||||||
|
if($conf->global->DISPLAY_MARK_RATES) $colspan++;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<tr <?php echo $bcnd[$var]; ?>>
|
||||||
|
<td colspan="<?php echo $colspan; ?>"><?php
|
||||||
|
if (! empty($object->element) && $object->element == 'contrat')
|
||||||
|
{
|
||||||
print $langs->trans("DateStartPlanned").' ';
|
print $langs->trans("DateStartPlanned").' ';
|
||||||
$form->select_date('',"date_start_sl",$usehm,$usehm,1,"addline_sl");
|
$form->select_date('',"date_start_sl",$usehm,$usehm,1,"addline_sl");
|
||||||
print ' '.$langs->trans("DateEndPlanned").' ';
|
print ' '.$langs->trans("DateEndPlanned").' ';
|
||||||
$form->select_date('',"date_end_sl",$usehm,$usehm,1,"addline_sl");
|
$form->select_date('',"date_end_sl",$usehm,$usehm,1,"addline_sl");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||||
echo $form->select_date('','date_start',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addproduct");
|
echo $form->select_date('','date_start',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addproduct");
|
||||||
echo ' '.$langs->trans('to').' ';
|
echo ' '.$langs->trans('to').' ';
|
||||||
echo $form->select_date('','date_end',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addproduct");
|
echo $form->select_date('','date_end',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addproduct");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
<!-- END PHP TEMPLATE freeproductline_create.tpl.php -->
|
<!-- END PHP TEMPLATE freeproductline_create.tpl.php -->
|
||||||
|
|||||||
@ -1,200 +1,207 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Need to have following variables defined:
|
* Need to have following variables defined:
|
||||||
* $conf
|
* $conf
|
||||||
* $langs
|
* $langs
|
||||||
* $dateSelector
|
* $dateSelector
|
||||||
* $this (invoice, order, ...)
|
* $this (invoice, order, ...)
|
||||||
* $line defined
|
* $line defined
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$usemargins=0;
|
$usemargins=0;
|
||||||
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
|
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
||||||
|
|
||||||
<tr class="liste_titre nodrag nodrop">
|
<tr class="liste_titre nodrag nodrop">
|
||||||
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>>
|
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>>
|
||||||
<?php
|
<?php
|
||||||
echo $langs->trans("AddNewLine").' - ';
|
echo $langs->trans("AddNewLine").' - ';
|
||||||
if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('RecordedProducts');
|
if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('RecordedProducts');
|
||||||
else if (empty($conf->product->enabled) && ! empty($conf->service->enabled)) echo $langs->trans('RecordedServices');
|
else if (empty($conf->product->enabled) && ! empty($conf->service->enabled)) echo $langs->trans('RecordedServices');
|
||||||
else echo $langs->trans('RecordedProductsAndServices');
|
else echo $langs->trans('RecordedProductsAndServices');
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td align="right"><?php echo $langs->trans('Qty'); ?></td>
|
<td align="right"><?php echo $langs->trans('Qty'); ?></td>
|
||||||
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
||||||
<?php
|
<?php
|
||||||
$colspan = 4;
|
$colspan = 4;
|
||||||
if (! empty($usemargins))
|
if (! empty($usemargins))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
||||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
||||||
?>
|
?>
|
||||||
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td>
|
<td align="right">
|
||||||
<?php
|
<?php
|
||||||
}
|
if ($conf->global->MARGIN_TYPE == "1")
|
||||||
?>
|
echo $langs->trans('BuyingPrice');
|
||||||
<td colspan="<?php echo $colspan; ?>"> </td>
|
else
|
||||||
</tr>
|
echo $langs->trans('CostPrice');
|
||||||
|
?>
|
||||||
<form name="addpredefinedproduct" id="addpredefinedproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
|
</td>
|
||||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
<?php
|
||||||
<input type="hidden" name="action" value="addline">
|
}
|
||||||
<input type="hidden" name="mode" value="predefined">
|
?>
|
||||||
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
|
<td colspan="<?php echo $colspan; ?>"> </td>
|
||||||
|
</tr>
|
||||||
<script type="text/javascript">
|
|
||||||
jQuery(document).ready(function() {
|
<form name="addpredefinedproduct" id="addpredefinedproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
|
||||||
jQuery('#idprod').change(function() {
|
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||||
if (jQuery('#idprod').val() > 0) jQuery('#np_desc').focus();
|
<input type="hidden" name="action" value="addline">
|
||||||
});
|
<input type="hidden" name="mode" value="predefined">
|
||||||
});
|
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
|
||||||
</script>
|
|
||||||
|
<script type="text/javascript">
|
||||||
<tr <?php echo $bcnd[$var]; ?>>
|
jQuery(document).ready(function() {
|
||||||
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>>
|
jQuery('#idprod').change(function() {
|
||||||
<?php
|
if (jQuery('#idprod').val() > 0) jQuery('#np_desc').focus();
|
||||||
|
});
|
||||||
echo '<span>';
|
});
|
||||||
$filtertype='';
|
</script>
|
||||||
if (! empty($object->element) && $object->element == 'contrat') $filtertype='1';
|
|
||||||
$form->select_produits('','idprod',$filtertype,$conf->product->limit_size,$buyer->price_level);
|
<tr <?php echo $bcnd[$var]; ?>>
|
||||||
echo '</span>';
|
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>>
|
||||||
|
<?php
|
||||||
if (is_object($hookmanager))
|
|
||||||
{
|
echo '<span>';
|
||||||
$parameters=array('fk_parent_line'=>GETPOST('fk_parent_line','int'));
|
$filtertype='';
|
||||||
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
|
if (! empty($object->element) && $object->element == 'contrat') $filtertype='1';
|
||||||
}
|
$form->select_produits('','idprod',$filtertype,$conf->product->limit_size,$buyer->price_level);
|
||||||
|
echo '</span>';
|
||||||
echo '<br>';
|
|
||||||
|
if (is_object($hookmanager))
|
||||||
// Editor wysiwyg
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
$parameters=array('fk_parent_line'=>GETPOST('fk_parent_line','int'));
|
||||||
$nbrows=ROWS_2;
|
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
|
||||||
$enabled=(! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0);
|
}
|
||||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
|
||||||
$doleditor=new DolEditor('np_desc',GETPOST('np_desc"'),'',100,'dolibarr_details','',false,true,$enabled,$nbrows,70);
|
echo '<br>';
|
||||||
$doleditor->Create();
|
|
||||||
?>
|
// Editor wysiwyg
|
||||||
</td>
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
<td align="right"><input type="text" size="2" name="qty" value="1"></td>
|
$nbrows=ROWS_2;
|
||||||
<td align="right" nowrap><input type="text" size="1" name="remise_percent" value="<?php echo $buyer->remise_client; ?>">%</td>
|
$enabled=(! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0);
|
||||||
<?php
|
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||||
$colspan = 4;
|
$doleditor=new DolEditor('np_desc',GETPOST('np_desc"'),'',100,'dolibarr_details','',false,true,$enabled,$nbrows,70);
|
||||||
if (! empty($usemargins))
|
$doleditor->Create();
|
||||||
{
|
?>
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
</td>
|
||||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
<td align="right"><input type="text" size="2" name="qty" value="1"></td>
|
||||||
?>
|
<td align="right" nowrap><input type="text" size="1" name="remise_percent" value="<?php echo $buyer->remise_client; ?>">%</td>
|
||||||
<td align="right">
|
<?php
|
||||||
<select id="fournprice" name="fournprice" style="display: none;"></select>
|
$colspan = 4;
|
||||||
<input type="text" size="5" id="buying_price" name="buying_price" value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
|
if (! empty($usemargins))
|
||||||
</td>
|
{
|
||||||
<?php
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
||||||
}
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
||||||
?>
|
?>
|
||||||
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>">
|
<td align="right">
|
||||||
<input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>" name="addline">
|
<select id="fournprice" name="fournprice" style="display: none;"></select>
|
||||||
</td>
|
<input type="text" size="5" id="buying_price" name="buying_price" value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
|
||||||
</tr>
|
</td>
|
||||||
|
<?php
|
||||||
<?php
|
}
|
||||||
if (! empty($conf->service->enabled) && $dateSelector)
|
?>
|
||||||
{
|
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>">
|
||||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
|
<input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>" name="addline">
|
||||||
else $colspan = 9;
|
</td>
|
||||||
if (! empty($usemargins))
|
</tr>
|
||||||
{
|
|
||||||
$colspan++; // For the buying price
|
<?php
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
if (! empty($conf->service->enabled) && $dateSelector)
|
||||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
{
|
||||||
}
|
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
|
||||||
?>
|
else $colspan = 9;
|
||||||
<tr <?php echo $bcnd[$var]; ?>>
|
if (! empty($usemargins))
|
||||||
<td colspan="<?php echo $colspan; ?>">
|
{
|
||||||
<?php
|
$colspan++; // For the buying price
|
||||||
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
||||||
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<tr <?php echo $bcnd[$var]; ?>>
|
||||||
|
<td colspan="<?php echo $colspan; ?>">
|
||||||
|
<?php
|
||||||
if (! empty($object->element) && $object->element == 'contrat')
|
if (! empty($object->element) && $object->element == 'contrat')
|
||||||
{
|
{
|
||||||
print $langs->trans("DateStartPlanned").' ';
|
print $langs->trans("DateStartPlanned").' ';
|
||||||
$form->select_date('',"date_start",$usehm,$usehm,1,"addline");
|
$form->select_date('',"date_start",$usehm,$usehm,1,"addline");
|
||||||
print ' '.$langs->trans("DateEndPlanned").' ';
|
print ' '.$langs->trans("DateEndPlanned").' ';
|
||||||
$form->select_date('',"date_end",$usehm,$usehm,1,"addline");
|
$form->select_date('',"date_end",$usehm,$usehm,1,"addline");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||||
echo $form->select_date('','date_start_predef',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addpredefinedproduct");
|
echo $form->select_date('','date_start_predef',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addpredefinedproduct");
|
||||||
echo ' '.$langs->trans('to').' ';
|
echo ' '.$langs->trans('to').' ';
|
||||||
echo $form->select_date('','date_end_predef',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addpredefinedproduct");
|
echo $form->select_date('','date_end_predef',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addpredefinedproduct");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (! empty($usemargins))
|
if (! empty($usemargins))
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$("#idprod").change(function() {
|
$("#idprod").change(function() {
|
||||||
$("#fournprice options").remove();
|
$("#fournprice options").remove();
|
||||||
$("#fournprice").hide();
|
$("#fournprice").hide();
|
||||||
$("#buying_price").val("").show();
|
$("#buying_price").val("").show();
|
||||||
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': $(this).val()}, function(data) {
|
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': $(this).val()}, function(data) {
|
||||||
if (data && data.length > 0) {
|
if (data && data.length > 0) {
|
||||||
var options = '';
|
var options = '';
|
||||||
var i = 0;
|
var i = 0;
|
||||||
$(data).each(function() {
|
$(data).each(function() {
|
||||||
i++;
|
i++;
|
||||||
options += '<option value="'+this.id+'" price="'+this.price+'"';
|
options += '<option value="'+this.id+'" price="'+this.price+'"';
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
options += ' selected';
|
options += ' selected';
|
||||||
$("#buying_price").val(this.price);
|
$("#buying_price").val(this.price);
|
||||||
}
|
}
|
||||||
options += '>'+this.label+'</option>';
|
options += '>'+this.label+'</option>';
|
||||||
});
|
});
|
||||||
options += '<option value=null><?php echo $langs->trans("InputPrice"); ?></option>';
|
options += '<option value=null><?php echo $langs->trans("InputPrice"); ?></option>';
|
||||||
$("#buying_price").hide();
|
$("#buying_price").hide();
|
||||||
$("#fournprice").html(options).show();
|
$("#fournprice").html(options).show();
|
||||||
$("#fournprice").change(function() {
|
$("#fournprice").change(function() {
|
||||||
var selval = $(this).find('option:selected').attr("price");
|
var selval = $(this).find('option:selected').attr("price");
|
||||||
if (selval)
|
if (selval)
|
||||||
$("#buying_price").val(selval).hide();
|
$("#buying_price").val(selval).hide();
|
||||||
else
|
else
|
||||||
$('#buying_price').show();
|
$('#buying_price').show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'json');
|
'json');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<!-- END PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
<!-- END PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
||||||
|
|||||||
@ -73,12 +73,9 @@ if (! empty($idprod))
|
|||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
$title = $objp->nom.' - '.$objp->ref_fourn.' - ';
|
$title = $objp->nom.' - '.$objp->ref_fourn.' - ';
|
||||||
$label = '';
|
|
||||||
|
|
||||||
if ($objp->quantity == 1)
|
if ($objp->quantity == 1)
|
||||||
{
|
{
|
||||||
$label.= price($objp->fprice).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
|
|
||||||
|
|
||||||
$title.= price($objp->fprice);
|
$title.= price($objp->fprice);
|
||||||
$title.= getCurrencySymbol($conf->currency)."/";
|
$title.= getCurrencySymbol($conf->currency)."/";
|
||||||
|
|
||||||
@ -100,8 +97,6 @@ if (! empty($idprod))
|
|||||||
$title.=" - ";
|
$title.=" - ";
|
||||||
$title.= price($objp->unitprice).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
|
$title.= price($objp->unitprice).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
|
||||||
|
|
||||||
$label.= price($objp->unitprice).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
|
|
||||||
|
|
||||||
$price = $objp->unitprice;
|
$price = $objp->unitprice;
|
||||||
}
|
}
|
||||||
if ($objp->unitcharges > 0 && ($conf->global->MARGIN_TYPE == "2")) {
|
if ($objp->unitcharges > 0 && ($conf->global->MARGIN_TYPE == "2")) {
|
||||||
@ -111,6 +106,8 @@ if (! empty($idprod))
|
|||||||
}
|
}
|
||||||
if ($objp->duration) $label .= " - ".$objp->duration;
|
if ($objp->duration) $label .= " - ".$objp->duration;
|
||||||
|
|
||||||
|
$label = price($price).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
|
||||||
|
|
||||||
$prices[] = array("id" => $objp->idprodfournprice, "price" => price($price,0,'',0), "label" => $label, "title" => $title);
|
$prices[] = array("id" => $objp->idprodfournprice, "price" => price($price,0,'',0), "label" => $label, "title" => $title);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user