Fix rounding issues with tax inclusive pricing

Add autocomplete in return mode
This commit is contained in:
jekkos committed 2015-05-19 20:46:42 +02:00
1 parent 6a2a5278b8
commit 46f6824199
3 files changed
+28 -21

No files matched your search

+3 -4
View File
@@ -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);
+4 -4
View File
@@ -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);
}
+21 -13
View File
@@ -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();
});*/
});