Fix price on takepos thumb must include vat

This commit is contained in:
Laurent Destailleur 2022-11-01 23:23:42 +01:00
parent b405caa96c
commit 75d784a6eb
5 changed files with 51 additions and 41 deletions

View File

@ -127,19 +127,23 @@ class Product extends CommonObject
public $type = self::TYPE_PRODUCT; public $type = self::TYPE_PRODUCT;
/** /**
* Selling price * Selling price without tax
* *
* @var float * @var float
*/ */
public $price; // Price net public $price;
public $price_formated; // used by takepos/ajax/ajax.php
/** /**
* Price with tax * Selling price with tax
* *
* @var float * @var float
*/ */
public $price_ttc; public $price_ttc;
public $price_ttc_formated; // used by takepos/ajax/ajax.php
/** /**
* Minimum price net * Minimum price net
* *

View File

@ -115,7 +115,7 @@ print '<tr class="oddeven"><td>';
print $langs->trans("NumberOfLinesToShow"); print $langs->trans("NumberOfLinesToShow");
print '<td colspan="2">'; print '<td colspan="2">';
$array = array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6"); $array = array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6");
print $form->selectarray('TAKEPOS_LINES_TO_SHOW', $array, (empty($conf->global->TAKEPOS_LINES_TO_SHOW) ? '2' : $conf->global->TAKEPOS_LINES_TO_SHOW), 0); print $form->selectarray('TAKEPOS_LINES_TO_SHOW', $array, getDolGlobalInt('TAKEPOS_LINES_TO_SHOW', 2), 0);
print "</td></tr>\n"; print "</td></tr>\n";
// D'ont display category // D'ont display category

View File

@ -84,7 +84,10 @@ if ($action == 'getProducts') {
} }
unset($prod->fields); unset($prod->fields);
unset($prod->db); unset($prod->db);
$prod->price_formated=price(price2num($prod->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency);
$prod->price_formated = price(price2num($prod->price, 'MT'), 1, $langs, 1, -1, -1, $conf->currency);
$prod->price_ttc_formated = price(price2num($prod->price_ttc, 'MT'), 1, $langs, 1, -1, -1, $conf->currency);
$res[] = $prod; $res[] = $prod;
} }
} }
@ -158,7 +161,7 @@ if ($action == 'getProducts') {
if (isset($barcode_value_list['ref'])) { if (isset($barcode_value_list['ref'])) {
// search product from reference // search product from reference
$sql = "SELECT rowid, ref, label, tosell, tobuy, barcode, price"; $sql = "SELECT rowid, ref, label, tosell, tobuy, barcode, price, price_ttc";
$sql .= " FROM " . $db->prefix() . "product as p"; $sql .= " FROM " . $db->prefix() . "product as p";
$sql .= " WHERE entity IN (" . getEntity('product') . ")"; $sql .= " WHERE entity IN (" . getEntity('product') . ")";
$sql .= " AND ref = '" . $db->escape($barcode_value_list['ref']) . "'"; $sql .= " AND ref = '" . $db->escape($barcode_value_list['ref']) . "'";
@ -207,6 +210,7 @@ if ($action == 'getProducts') {
'tobuy' => $obj->tobuy, 'tobuy' => $obj->tobuy,
'barcode' => $obj->barcode, 'barcode' => $obj->barcode,
'price' => $obj->price, 'price' => $obj->price,
'price_ttc' => $obj->price_ttc,
'object' => 'product', 'object' => 'product',
'img' => $ig, 'img' => $ig,
'qty' => $qty, 'qty' => $qty,
@ -223,7 +227,7 @@ if ($action == 'getProducts') {
} }
} }
$sql = 'SELECT p.rowid, p.ref, p.label, p.tosell, p.tobuy, p.barcode, p.price' ; $sql = 'SELECT p.rowid, p.ref, p.label, p.tosell, p.tobuy, p.barcode, p.price, p.price_ttc' ;
if (getDolGlobalInt('TAKEPOS_PRODUCT_IN_STOCK') == 1) { if (getDolGlobalInt('TAKEPOS_PRODUCT_IN_STOCK') == 1) {
$sql .= ', ps.reel'; $sql .= ', ps.reel';
} }
@ -299,10 +303,12 @@ if ($action == 'getProducts') {
'tobuy' => $obj->tobuy, 'tobuy' => $obj->tobuy,
'barcode' => $obj->barcode, 'barcode' => $obj->barcode,
'price' => $obj->price, 'price' => $obj->price,
'price_ttc' => $obj->price_ttc,
'object' => 'product', 'object' => 'product',
'img' => $ig, 'img' => $ig,
'qty' => 1, 'qty' => 1,
'price_formated' => price(price2num($obj->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency) 'price_formated' => price(price2num($obj->price, 'MT'), 1, $langs, 1, -1, -1, $conf->currency),
'price_ttc_formated' => price(price2num($obj->price_ttc, 'MT'), 1, $langs, 1, -1, -1, $conf->currency)
); );
// Add entries to row from hooks // Add entries to row from hooks
$parameters=array(); $parameters=array();

View File

@ -477,7 +477,7 @@ p.description_content{
div.description_content { div.description_content {
display: -webkit-box; display: -webkit-box;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
-webkit-line-clamp: <?php echo $conf->global->TAKEPOS_LINES_TO_SHOW; ?>; -webkit-line-clamp: <?php echo getDolGlobalInt('TAKEPOS_LINES_TO_SHOW', 2); ?>;
overflow: hidden; overflow: hidden;
padding-left: 2px; padding-left: 2px;
padding-right: 2px; padding-right: 2px;
@ -587,11 +587,11 @@ div#moreinfo, div#infowarehouse {
background: var(--colorbackhmenu1); background: var(--colorbackhmenu1);
color: var(--colortextbackhmenu); color: var(--colortextbackhmenu);
font-size: 2em; font-size: 2em;
padding: 5px; padding: 4px;
border-radius: 2px; border-radius: 2px;
opacity: 0.9; opacity: 0.9;
padding-left: 8px; padding-left: 6px;
padding-right: 8px; padding-right: 6px;
} }
@ -841,11 +841,11 @@ div#moreinfo, div#infowarehouse {
padding-bottom: 2px; padding-bottom: 2px;
margin-left: 2px; margin-left: 2px;
} }
.div4 .wrapper.divempty, .div4 img, .div4 .wrapper:nth-last-child(1), .div4 .wrapper:nth-last-child(2), #prodiv22, #prodiv23, .catwatermark { .div4 .wrapper.divempty, .div4 img, .div4 .wrapper:nth-last-child(1), .div4 .wrapper:nth-last-child(2), #prodiv22, #prodiv23, .catwatermark {
display: none!important; display: none!important;
} }
.tab-category { .tab-category {
float: left; float: left;
position: relative; position: relative;
@ -858,7 +858,7 @@ div#moreinfo, div#infowarehouse {
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
} }
.div4 .wrapper, .tab-category { .div4 .wrapper, .tab-category {
width: auto; width: auto;
height: auto; height: auto;
@ -868,7 +868,7 @@ div#moreinfo, div#infowarehouse {
border: 1px solid #FFF!important; border: 1px solid #FFF!important;
border-top: 3px solid #FFF!important; border-top: 3px solid #FFF!important;
} }
.div4 .tab-category.active { .div4 .tab-category.active {
border-right: 1px solid #CCC !important; border-right: 1px solid #CCC !important;
border-left: 1px solid #CCC !important; border-left: 1px solid #CCC !important;
@ -890,42 +890,42 @@ div#moreinfo, div#infowarehouse {
padding-top: 0px; padding-top: 0px;
background: -webkit-linear-gradient(top, rgba(250,250,250,0), rgba(250,250,250,0.5), rgba(250,250,250,0.95), rgba(250,250,250,1)); background: -webkit-linear-gradient(top, rgba(250,250,250,0), rgba(250,250,250,0.5), rgba(250,250,250,0.95), rgba(250,250,250,1));
} }
.div5 .description .description_content { .div5 .description .description_content {
font-weight: bold; font-weight: bold;
font-size: 14px; font-size: 14px;
padding-left: 10px; padding-left: 10px;
} }
.div5 .wrapper2 { .div5 .wrapper2 {
width: 100%; width: 100%;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
padding: 10px; padding: 10px;
} }
.div5 .wrapper2.divempty { .div5 .wrapper2.divempty {
display: none; display: none;
} }
div.wrapper2 { div.wrapper2 {
float: none; float: none;
} }
.div5 .arrow { .div5 .arrow {
width: auto; width: auto;
height: auto; height: auto;
display: none!important; display: none!important;
} }
.div5 .arrow .centerinmiddle { .div5 .arrow .centerinmiddle {
transform: translate(0, 0); transform: translate(0, 0);
} }
.div5 .imgadd { .div5 .imgadd {
display: flex; display: flex;
} }
div.wrapper2{ div.wrapper2{
height:10%; height:10%;
} }
@ -1009,12 +1009,12 @@ html {
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
background: #f1f1f1; background: #f1f1f1;
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background: #888; background: #888;
} }
.topnav::-webkit-scrollbar-track{ .topnav::-webkit-scrollbar-track{

View File

@ -367,7 +367,7 @@ function LoadProducts(position, issubcat) {
?> ?>
if (data[parseInt(idata)]['price_formated']) { if (data[parseInt(idata)]['price_formated']) {
$("#proprice"+ishow).attr("class", "productprice"); $("#proprice"+ishow).attr("class", "productprice");
$("#proprice"+ishow).html(data[parseInt(idata)]['price_formated']); $("#proprice"+ishow).html(data[parseInt(idata)]['price_ttc_formated']);
} }
console.log("#prodiv"+ishow+".data(rowid)="+data[idata]['id']); console.log("#prodiv"+ishow+".data(rowid)="+data[idata]['id']);
console.log($("#prodiv"+ishow)); console.log($("#prodiv"+ishow));
@ -449,7 +449,7 @@ function MoreProducts(moreorless) {
$("#probutton"+ishow).show(); $("#probutton"+ishow).show();
if (data[parseInt(idata)]['price_formated']) { if (data[parseInt(idata)]['price_formated']) {
$("#proprice"+ishow).attr("class", "productprice"); $("#proprice"+ishow).attr("class", "productprice");
$("#proprice"+ishow).html(data[parseInt(idata)]['price_formated']); $("#proprice"+ishow).html(data[parseInt(idata)]['price_ttc_formated']);
} }
$("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']); $("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']);
$("#prodiv"+ishow).data("rowid",data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']);
@ -657,7 +657,7 @@ function Search2(keyCodeForEnter, moreorless) {
$("#probutton" + i).show(); $("#probutton" + i).show();
if (data[i]['price_formated']) { if (data[i]['price_formated']) {
$("#proprice" + i).attr("class", "productprice"); $("#proprice" + i).attr("class", "productprice");
$("#proprice" + i).html(data[i]['price_formated']); $("#proprice" + i).html(data[i]['price_ttc_formated']);
} }
$("#proimg" + i).attr("title", titlestring); $("#proimg" + i).attr("title", titlestring);
if( undefined !== data[i]['img']) { if( undefined !== data[i]['img']) {
@ -939,15 +939,15 @@ $( document ).ready(function() {
} }
} }
?> ?>
/* For Header Scroll */ /* For Header Scroll */
var elem1 = $("#topnav-left")[0]; var elem1 = $("#topnav-left")[0];
var elem2 = $("#topnav-right")[0]; var elem2 = $("#topnav-right")[0];
var checkOverflow = function() { var checkOverflow = function() {
if (scrollBars().horizontal) $("#topnav").addClass("overflow"); if (scrollBars().horizontal) $("#topnav").addClass("overflow");
else $("#topnav").removeClass("overflow"); else $("#topnav").removeClass("overflow");
} }
var scrollBars = function(){ var scrollBars = function(){
var container= $('#topnav')[0]; var container= $('#topnav')[0];
return { return {
@ -955,43 +955,43 @@ $( document ).ready(function() {
horizontal:container.scrollWidth > container.clientWidth horizontal:container.scrollWidth > container.clientWidth
}; };
} }
$(window).resize(function(){ $(window).resize(function(){
checkOverflow(); checkOverflow();
}); });
let resizeObserver = new ResizeObserver(() => { let resizeObserver = new ResizeObserver(() => {
checkOverflow(); checkOverflow();
}); });
resizeObserver.observe(elem1); resizeObserver.observe(elem1);
resizeObserver.observe(elem2); resizeObserver.observe(elem2);
checkOverflow(); checkOverflow();
var pressTimer = []; var pressTimer = [];
var direction = 1; var direction = 1;
var step = 200; var step = 200;
$(".indicator").mousedown(function(){ $(".indicator").mousedown(function(){
direction = $(this).hasClass("left") ? -1 : 1; direction = $(this).hasClass("left") ? -1 : 1;
scrollTo(); scrollTo();
pressTimer.push(setInterval(scrollTo, 100)); pressTimer.push(setInterval(scrollTo, 100));
}); });
$(".indicator").mouseup(function(){ $(".indicator").mouseup(function(){
pressTimer.forEach(clearInterval); pressTimer.forEach(clearInterval);
}); });
$("body").mouseup(function(){ $("body").mouseup(function(){
pressTimer.forEach(clearInterval); pressTimer.forEach(clearInterval);
console.log("body"); console.log("body");
}); });
function scrollTo(){ function scrollTo(){
console.log("here"); console.log("here");
var pos = $("#topnav").scrollLeft(); var pos = $("#topnav").scrollLeft();
document.getElementById("topnav").scrollTo({ left: $("#topnav").scrollLeft() + direction * step, behavior: 'smooth' }) document.getElementById("topnav").scrollTo({ left: $("#topnav").scrollLeft() + direction * step, behavior: 'smooth' })
} }
$("#topnav").scroll(function(){ $("#topnav").scroll(function(){
if (($("#topnav").offsetWidth + $("#topnav").scrollLeft >= $("#topnav").scrollWidth)) { if (($("#topnav").offsetWidth + $("#topnav").scrollLeft >= $("#topnav").scrollWidth)) {
console.log("end"); console.log("end");