Fix discount parsing (#3114)

This commit is contained in:
Jeroen Peelaerts
2021-04-06 11:06:53 +02:00
committed by jekkos
parent adb17c9865
commit b400223c57
4 changed files with 5 additions and 5 deletions

View File

@@ -125,9 +125,9 @@ class Receivings extends Secure_Controller
$serialnumber = $this->input->post('serialnumber');
$price = parse_decimals($this->input->post('price'));
$quantity = parse_quantity($this->input->post('quantity'));
$discount = parse_decimals($this->input->post('discount'));
$discount_type = $this->input->post('discount_type');
$item_location = $this->input->post('location');
$discount = $discount_type ? parse_quantity($this->input->post('discount')) : parse_decimals($this->input->post('discount'));
$receiving_quantity = $this->input->post('receiving_quantity');
if($this->form_validation->run() != FALSE)

View File

@@ -476,8 +476,8 @@ class Sales extends Secure_Controller
$serialnumber = $this->input->post('serialnumber');
$price = parse_decimals($this->input->post('price'));
$quantity = parse_quantity($this->input->post('quantity'));
$discount = parse_decimals($this->input->post('discount'));
$discount_type = $this->input->post('discount_type');
$discount = $discount_type ? parse_quantity($this->input->post('discount')) : parse_decimals($this->input->post('discount'));
$item_location = $this->input->post('location');
$discounted_total = $this->input->post('discounted_total') != '' ? $this->input->post('discounted_total') : NULL;

View File

@@ -167,7 +167,7 @@ if (isset($success))
?>
<td>
<div class="input-group">
<?php echo form_input(array('name'=>'discount', 'class'=>'form-control input-sm', 'value'=>to_decimals($item['discount'], 0), 'onClick'=>'this.select();')); ?>
<?php echo form_input(array('name'=>'discount', 'class'=>'form-control input-sm', 'value'=>$item['discount_type'] ? to_currency_no_money($item['discount']) : to_decimals($item['discount'], 0), 'onClick'=>'this.select();')); ?>
<span class="input-group-btn">
<?php echo form_checkbox(array('id'=>'discount_toggle', 'name'=>'discount_toggle', 'value'=>1, 'data-toggle'=>"toggle",'data-size'=>'small', 'data-onstyle'=>'success', 'data-on'=>'<b>'.$this->config->item('currency_symbol').'</b>', 'data-off'=>'<b>%</b>', 'data-line'=>$line, 'checked'=>$item['discount_type'])); ?>
</span>

View File

@@ -195,7 +195,7 @@ if(isset($success))
<td>
<div class="input-group">
<?php echo form_input(array('name'=>'discount', 'class'=>'form-control input-sm', 'value'=>$item['discount'], 'tabindex'=>++$tabindex, 'onClick'=>'this.select();')); ?>
<?php echo form_input(array('name'=>'discount', 'class'=>'form-control input-sm', 'value'=>$item['discount_type'] ? to_currency_no_money($item['discount']) : to_decimals($item['discount'], 0), 'tabindex'=>++$tabindex, 'onClick'=>'this.select();')); ?>
<span class="input-group-btn">
<?php echo form_checkbox(array('id'=>'discount_toggle', 'name'=>'discount_toggle', 'value'=>1, 'data-toggle'=>"toggle",'data-size'=>'small', 'data-onstyle'=>'success', 'data-on'=>'<b>'.$this->config->item('currency_symbol').'</b>', 'data-off'=>'<b>%</b>', 'data-line'=>$line, 'checked'=>$item['discount_type'])); ?>
</span>