diff --git a/application/controllers/Receivings.php b/application/controllers/Receivings.php index af59a0e47..b0224ad63 100644 --- a/application/controllers/Receivings.php +++ b/application/controllers/Receivings.php @@ -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) diff --git a/application/controllers/Sales.php b/application/controllers/Sales.php index ab62d00de..7c0c891ad 100644 --- a/application/controllers/Sales.php +++ b/application/controllers/Sales.php @@ -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; diff --git a/application/views/receivings/receiving.php b/application/views/receivings/receiving.php index 5a445caf1..4b7a0d931 100644 --- a/application/views/receivings/receiving.php +++ b/application/views/receivings/receiving.php @@ -167,7 +167,7 @@ if (isset($success)) ?>
- 'discount', 'class'=>'form-control input-sm', 'value'=>to_decimals($item['discount'], 0), 'onClick'=>'this.select();')); ?> + 'discount', 'class'=>'form-control input-sm', 'value'=>$item['discount_type'] ? to_currency_no_money($item['discount']) : to_decimals($item['discount'], 0), 'onClick'=>'this.select();')); ?> 'discount_toggle', 'name'=>'discount_toggle', 'value'=>1, 'data-toggle'=>"toggle",'data-size'=>'small', 'data-onstyle'=>'success', 'data-on'=>''.$this->config->item('currency_symbol').'', 'data-off'=>'%', 'data-line'=>$line, 'checked'=>$item['discount_type'])); ?> diff --git a/application/views/sales/register.php b/application/views/sales/register.php index e6214c45f..5ed2c9ac5 100644 --- a/application/views/sales/register.php +++ b/application/views/sales/register.php @@ -195,7 +195,7 @@ if(isset($success))
- 'discount', 'class'=>'form-control input-sm', 'value'=>$item['discount'], 'tabindex'=>++$tabindex, 'onClick'=>'this.select();')); ?> + '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();')); ?> 'discount_toggle', 'name'=>'discount_toggle', 'value'=>1, 'data-toggle'=>"toggle",'data-size'=>'small', 'data-onstyle'=>'success', 'data-on'=>''.$this->config->item('currency_symbol').'', 'data-off'=>'%', 'data-line'=>$line, 'checked'=>$item['discount_type'])); ?>