Fix Expense amount and tax amount update issue (#1955)

This commit is contained in:
FrancescoUK
2018-04-24 20:39:41 +01:00
parent 72825acfaf
commit c8d1bfee35
5 changed files with 19 additions and 19 deletions

View File

@@ -130,8 +130,8 @@ class Expenses extends Secure_Controller
'date' => $date_formatter->format('Y-m-d H:i:s'),
'supplier_name' => $this->input->post('supplier_name'),
'supplier_tax_code' => $this->input->post('supplier_tax_code'),
'amount' => $this->input->post('amount'),
'tax_amount' => $this->input->post('tax_amount'),
'amount' => parse_decimals($this->input->post('amount')),
'tax_amount' => parse_decimals($this->input->post('tax_amount')),
'payment_type' => $this->input->post('payment_type'),
'expense_category_id' => $this->input->post('expense_category_id'),
'description' => $this->input->post('description'),

View File

@@ -205,8 +205,7 @@ class Expense extends CI_Model
*/
public function save(&$expense_data, $expense_id = FALSE)
{
//$expense_id = $expense_data['expense_id'];
if(!$expense_id == -1 || !$this->exists($expense_id))
if(!$expense_id || !$this->exists($expense_id))
{
if($this->db->insert('expenses', $expense_data))
{

View File

@@ -109,9 +109,9 @@ class Giftcard extends CI_Model
/*
Inserts or updates a giftcard
*/
public function save(&$giftcard_data, $giftcard_id = -1)
public function save(&$giftcard_data, $giftcard_id = FALSE)
{
if($giftcard_id == -1 || !$this->exists($giftcard_id))
if(!$giftcard_id || !$this->exists($giftcard_id))
{
if($this->db->insert('giftcards', $giftcard_data))
{

View File

@@ -9,9 +9,9 @@ class Rewards extends CI_Model
/*
Inserts or updates a rewards
*/
public function save(&$rewards_data, $id = -1)
public function save(&$rewards_data, $rewards_id = FALSE)
{
if($id == -1 || !$this->exists($id))
if(!$rewards_id || !$this->exists($rewards_id))
{
if($this->db->insert('sales_reward_points', $rewards_data))
{
@@ -23,7 +23,7 @@ class Rewards extends CI_Model
return FALSE;
}
$this->db->where('id', $id);
$this->db->where('id', $rewards_id);
return $this->db->update('sales_reward_points', $rewards_data);
}

View File

@@ -175,22 +175,23 @@ class Tax extends CI_Model
if($this->db->insert('tax_codes', $tax_code_data))
{
$this->save_tax_rates($tax_rate_data, $tax_code);
return TRUE;
}
return FALSE;
}
$this->db->where('tax_code', $tax_code);
if($this->db->update('tax_codes', $tax_code_data))
{
$this->save_tax_rates($tax_rate_data, $tax_code);
return TRUE;
}
else
{
return FALSE;
$this->db->where('tax_code', $tax_code);
if($this->db->update('tax_codes', $tax_code_data))
{
$this->save_tax_rates($tax_rate_data, $tax_code);
return TRUE;
}
}
return FALSE;
}
/**