add margin infos to templates
This commit is contained in:
parent
1de9dc15bf
commit
50c2a65b6a
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -39,7 +40,19 @@
|
||||
</td>
|
||||
<td align="right"><?php echo $langs->trans('Qty'); ?></td>
|
||||
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
||||
<td colspan="4"> </td>
|
||||
<?php
|
||||
$colspan = 4;
|
||||
if ($conf->marges->enabled) {
|
||||
?>
|
||||
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td>
|
||||
<?php
|
||||
if($conf->global->DISPLAY_MARGIN_RATES)
|
||||
$colspan++;
|
||||
if($conf->global->DISPLAY_MARK_RATES)
|
||||
$colspan++;
|
||||
}
|
||||
?>
|
||||
<td colspan="<?php echo $colspan; ?>"> </td>
|
||||
</tr>
|
||||
|
||||
<form name="addpredefinedproduct" id="addpredefinedproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
|
||||
@ -77,13 +90,38 @@ jQuery(document).ready(function() {
|
||||
</td>
|
||||
<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="center" valign="middle" colspan="4"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>" name="addline"></td>
|
||||
<?php
|
||||
$colspan = 4;
|
||||
if ($conf->marges->enabled) {
|
||||
?>
|
||||
<td align="right">
|
||||
<select id="np_fournprice" name="np_fournprice" style="display: none;"></select>
|
||||
<input type="text" size="5" id="np_buying_price" name="np_buying_price" value="<?php echo (isset($_POST["np_buying_price"])?$_POST["np_buying_price"]:''); ?>">
|
||||
</td>
|
||||
<?php
|
||||
if($conf->global->DISPLAY_MARGIN_RATES)
|
||||
$colspan++;
|
||||
if($conf->global->DISPLAY_MARK_RATES)
|
||||
$colspan++;
|
||||
}
|
||||
?>
|
||||
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>" name="addline"></td>
|
||||
</tr>
|
||||
|
||||
<?php if ($conf->service->enabled && $dateSelector) {?>
|
||||
<?php if ($conf->service->enabled && $dateSelector) {
|
||||
if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)
|
||||
$colspan = 10;
|
||||
else
|
||||
$colspan = 9;
|
||||
if ($conf->marges->enabled) {
|
||||
if($conf->global->DISPLAY_MARGIN_RATES)
|
||||
$colspan++;
|
||||
if($conf->global->DISPLAY_MARK_RATES)
|
||||
$colspan++;
|
||||
}
|
||||
?>
|
||||
<tr <?php echo $bcnd[$var]; ?>>
|
||||
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="10"' : ' colspan="9"'); ?>>
|
||||
<td colspan="<?php echo $colspan; ?>">
|
||||
<?php
|
||||
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");
|
||||
@ -95,4 +133,41 @@ jQuery(document).ready(function() {
|
||||
<?php } ?>
|
||||
|
||||
</form>
|
||||
<?php
|
||||
if ($conf->marges->enabled) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$("#idprod").change(function() {
|
||||
$("#np_fournprice options").remove();
|
||||
$("#np_buying_price").show();
|
||||
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/product/getSupplierPrices.php', {'idprod': $(this).val()}, function(data) {
|
||||
if (data.length > 0) {
|
||||
var options = '';
|
||||
var i = 0;
|
||||
$(data).each(function() {
|
||||
i++;
|
||||
options += '<option value="'+this.id+'" price="'+this.price+'"';
|
||||
if (i == 1) {
|
||||
options += ' selected';
|
||||
$("#np_buying_price").val(this.price);
|
||||
}
|
||||
options += '>'+this.label+'</option>';
|
||||
});
|
||||
options += '<option value=null><?php echo $langs->trans("InputPrice"); ?></option>';
|
||||
$("#np_fournprice").html(options);
|
||||
$("#np_buying_price").hide();
|
||||
$("#np_fournprice").show();
|
||||
$("#np_fournprice").change(function() {
|
||||
var selval = $(this).find('option:selected').attr("price");
|
||||
if (selval)
|
||||
$("#np_buying_price").val(selval).hide();
|
||||
else
|
||||
$('#np_buying_price').show();
|
||||
});
|
||||
}
|
||||
},
|
||||
'json');
|
||||
});
|
||||
</script>
|
||||
<?php } ?>
|
||||
<!-- END PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -82,6 +83,16 @@
|
||||
|
||||
<?php } ?>
|
||||
</td>
|
||||
<?php
|
||||
if ($conf->marges->enabled) {
|
||||
?>
|
||||
<td align="right">
|
||||
<select id="fournprice" name="fournprice"></select>
|
||||
<input type="text" size="5" id="buying_price" name="buying_price" style="display: none;" value="<?php echo price($line->pa_ht,0,'',0); ?>">
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<td align="center" colspan="5" valign="middle">
|
||||
<input type="submit" class="button" name="save" value="<?php echo $langs->trans("Save"); ?>"><br>
|
||||
@ -100,4 +111,55 @@
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?></form>
|
||||
<!-- END PHP TEMPLATE predefinedproductline_edit.tpl.php -->
|
||||
<?php
|
||||
if ($conf->marges->enabled) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/product/getSupplierPrices.php', {'idprod': <?php echo $line->fk_product; ?>}, function(data) {
|
||||
if (data.length > 0) {
|
||||
var options = '';
|
||||
var trouve=false;
|
||||
$(data).each(function() {
|
||||
options += '<option value="'+this.id+'" price="'+this.price+'"';
|
||||
<?php
|
||||
if ($line->fk_fournprice > 0) {
|
||||
?>
|
||||
if (this.id == <?php echo $line->fk_fournprice; ?>) {
|
||||
options += ' selected';
|
||||
$("#buying_price").val(this.price);
|
||||
trouve = true;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
options += '>'+this.label+'</option>';
|
||||
});
|
||||
options += '<option value=null'+(trouve?'':' selected')+'><?php echo $langs->trans("InputPrice"); ?></option>';
|
||||
$("#fournprice").html(options);
|
||||
if (trouve) {
|
||||
$("#buying_price").hide();
|
||||
$("#fournprice").show();
|
||||
}
|
||||
else {
|
||||
$("#buying_price").show();
|
||||
}
|
||||
$("#fournprice").change(function() {
|
||||
var selval = $(this).find('option:selected').attr("price");
|
||||
if (selval)
|
||||
$("#buying_price").val(selval).hide();
|
||||
else
|
||||
$('#buying_price').show();
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#fournprice").hide();
|
||||
$('#buying_price').show();
|
||||
}
|
||||
},
|
||||
'json');
|
||||
});
|
||||
</script>
|
||||
<?php } ?>
|
||||
<!-- END PHP TEMPLATE predefinedproductline_edit.tpl.php -->
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -51,7 +52,18 @@
|
||||
<td align="right"><?php echo dol_print_reduction($line->remise_percent,$langs); ?></td>
|
||||
<?php } else { ?>
|
||||
<td> </td>
|
||||
<?php } ?>
|
||||
<?php }
|
||||
|
||||
if ($conf->marges->enabled) {
|
||||
?>
|
||||
<td align="right" nowrap="nowrap"><?php echo price($line->pa_ht); ?></td>
|
||||
<?php if($conf->global->DISPLAY_MARGIN_RATES) {?>
|
||||
<td align="right" nowrap="nowrap"><?php echo (($line->pa_ht == 0)?'n/a':price($line->marge_tx).'%'); ?></td>
|
||||
<?php
|
||||
}
|
||||
if($conf->global->DISPLAY_MARK_RATES) {?>
|
||||
<td align="right" nowrap="nowrap"><?php echo price($line->marque_tx).'%'; ?></td>
|
||||
<?php } } ?>
|
||||
|
||||
<?php if ($line->special_code == 3) { ?>
|
||||
<td align="right" nowrap="nowrap"><?php echo $langs->trans('Option'); ?></td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user