This commit is contained in:
FrancescoUK
2017-07-11 22:43:08 +01:00
parent b7951ea5b2
commit 60db2cc4b0
5 changed files with 6 additions and 89 deletions

View File

@@ -616,88 +616,6 @@ class Config extends Secure_Controller
));
}
public function save_tax()
{
$this->db->trans_start();
$customer_sales_tax_support = $this->input->post('customer_sales_tax_support') != NULL;
$batch_save_data = array(
'default_tax_1_rate' => parse_decimals($this->input->post('default_tax_1_rate')),
'default_tax_1_name' => $this->input->post('default_tax_1_name'),
'default_tax_2_rate' => parse_decimals($this->input->post('default_tax_2_rate')),
'default_tax_2_name' => $this->input->post('default_tax_2_name'),
'tax_included' => $this->input->post('tax_included') != NULL,
'customer_sales_tax_support' => $customer_sales_tax_support,
'default_origin_tax_code' => $this->input->post('default_origin_tax_code')
);
$result = $this->Appconfig->batch_save($batch_save_data);
$success = $result ? TRUE : FALSE;
if($customer_sales_tax_support)
{
$not_to_delete = array();
foreach($this->input->post() as $key => $value)
{
if(strstr($key, 'tax_category'))
{
$tax_category_id = preg_replace("/.*?_(\d+)$/", "$1", $key);
$not_to_delete[] = $tax_category_id;
$array_save[$tax_category_id]['tax_category'] = $value;
}
elseif(strstr($key, 'tax_group_sequence'))
{
$tax_category_id = preg_replace("/.*?_(\d+)$/", "$1", $key);
$not_to_delete[] = $tax_category_id;
$array_save[$tax_category_id]['tax_group_sequence'] = $value;
}
}
if(!empty($array_save))
{
foreach($array_save as $key => $value)
{
// save or update
$prev_id = $key;
$category_data = array('tax_category' => $value['tax_category'], 'tax_group_sequence' => $value['tax_group_sequence']);
if($this->Tax->save_tax_category($category_data, $key))
{
if ($prev_id != $category_data['tax_category_id'])
{
unset($not_to_delete[$prev_id]);
$not_to_delete[] = $category_data['tax_category_id'];
}
}
}
}
// all locations not available in post will be deleted now
$tax_categories = $this->Tax->get_all_tax_categories()->result_array();
foreach($tax_categories as $tax_category)
{
if(!empty($tax_category['tax_category_id']) && !in_array($tax_category['tax_category_id'], $not_to_delete))
{
$this->Tax->delete_tax_category($tax_category['tax_category_id']);
}
}
}
$this->db->trans_complete();
$success2 = $this->db->trans_status();
$success3 = $success && $success2;
$this->_clear_session_state();
echo json_encode(array(
'success' => $success3,
'message' => $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully')
));
}
public function save_tax()
{
$this->db->trans_start();
@@ -770,7 +688,6 @@ class Config extends Secure_Controller
'success' => $success,
'message' => $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully')
));
}
public function save_rewards()

View File

@@ -70,11 +70,11 @@
<![endif]-->
<!-- start mincss template tags -->
<link rel="stylesheet" type="text/css" href="dist/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=033102c5d3"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=6f10bf8f1a"/>
<link rel="stylesheet" type="text/css" href="dist/style.css"/>
<!-- end mincss template tags -->
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=016835160a"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=2a9cf1bf65"></script>
<!-- end minjs template tags -->
<?php endif; ?>

View File

@@ -562,7 +562,7 @@ CREATE TABLE `ospos_sales` (
CREATE TABLE `ospos_sales_items` (
`sale_id` int(10) NOT NULL DEFAULT '0',
`item_id` int(10) NOT NULL DEFAULT '0',
`description` varchar(30) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`serialnumber` varchar(30) DEFAULT NULL,
`line` int(3) NOT NULL DEFAULT '0',
`quantity_purchased` decimal(15,3) NOT NULL DEFAULT '0',

View File

File diff suppressed because one or more lines are too long

View File

File diff suppressed because one or more lines are too long