diff --git a/application/controllers/sales.php b/application/controllers/sales.php index 606e4c172..9ef29e57f 100644 --- a/application/controllers/sales.php +++ b/application/controllers/sales.php @@ -69,10 +69,9 @@ class Sales extends Secure_area if ($this->sale_lib->get_mode() == 'return') { $this->sale_lib->is_valid_receipt($this->input->post('q')) && $suggestions[] = $this->input->post('q'); - } else { - $suggestions = $this->Item->get_item_search_suggestions($this->input->post('q'),$this->input->post('limit')); - $suggestions = array_merge($suggestions, $this->Item_kit->get_item_kit_search_suggestions($this->input->post('q'),$this->input->post('limit'))); } + $suggestions = array_merge($suggestions, $this->Item->get_item_search_suggestions($this->input->post('q'),$this->input->post('limit'))); + $suggestions = array_merge($suggestions, $this->Item_kit->get_item_kit_search_suggestions($this->input->post('q'),$this->input->post('limit'))); echo implode("\n",$suggestions); } @@ -81,7 +80,7 @@ class Sales extends Secure_area $suggestions = $this->Customer->get_customer_search_suggestions($this->input->post('q'),$this->input->post('limit')); echo implode("\n",$suggestions); } - + function suggest() { $search = $this->input->post('q', TRUE); diff --git a/application/libraries/Sale_lib.php b/application/libraries/Sale_lib.php index 6b57f1db7..5aca2503d 100644 --- a/application/libraries/Sale_lib.php +++ b/application/libraries/Sale_lib.php @@ -614,14 +614,14 @@ class Sale_lib { $price = $this->get_item_total($quantity, $price, $discount_percentage, TRUE); - $tax_fraction = bcdiv($tax_percentage, 100, PRECISION); if ($this->CI->config->config['tax_included']) { - $tax_fraction = bcadd(1, $tax_fraction, PRECISION); - $tax_fraction = bcdiv(1, $tax_fraction, PRECISION); - $price_tax_excl = bcmul($price, $tax_fraction, PRECISION); + $tax_fraction = bcadd(100, $tax_percentage, PRECISION); + $tax_fraction = bcdiv($tax_fraction, 100, PRECISION); + $price_tax_excl = bcdiv($price, $tax_fraction, PRECISION); return bcsub($price, $price_tax_excl, PRECISION); } + $tax_fraction = bcdiv($tax_percentage, 100, PRECISION); return bcmul($price, $tax_fraction, PRECISION); } diff --git a/test/login.js b/test/login.js index 0a1890a36..32a93f528 100644 --- a/test/login.js +++ b/test/login.js @@ -1,26 +1,34 @@ var assert = require("assert"); // node.js core module + describe("giftcard numbering test", function () { - it("giftcard numbering should increment", function (done) { - - var searchBox; - var browser = this.browser; - browser.get('http://localhost/pos/index.php?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=14241668456852') + it("application login should work fine", function (done) { + this.browser.get('http://localhost/pos/index.php?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=14241668456852') .elementByName('username').type("admin").getValue() - .then(function(value) { + .then(function (value) { assert.equal(value, "admin"); }) .elementByName('password').type("pointofsale").getValue() - .then(function(value) { + .then(function (value) { assert.ok(value, "pointofsale"); }) - .elementByName('loginButton').click() - .elementById('home_module_list').then(function(value) { - assert.ok(value, "Login failed!!") - }) - .then(done, done); - + .elementByName('loginButton').click().done(); }); + /*it("giftcard numbering should increment properly", function(done) { + this.browser.elementById('home_module_list').then(function(value) { + assert.ok(value, "Not logged in!!"); + }).elementsByCss('.menu_item').at(9).click().then(function(value) { + assert.ok(value, "giftcards link not found!"); + for (var i = 0; i < 10; i++) { + browser.elementByCss(".big_button").click().then(function (value) { + assert.ok(value, "No element found!"); + }).waitForElementById("value").type("100").then(function(value) { + assert.ok(value, "Giftcard value not set properly!"); + }).elementById("submit").click(); + } + }).done(); + });*/ + });