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;
/**
* Selling price
* Selling price without tax
*
* @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
*/
public $price_ttc;
public $price_ttc_formated; // used by takepos/ajax/ajax.php
/**
* Minimum price net
*

View File

@ -115,7 +115,7 @@ print '<tr class="oddeven"><td>';
print $langs->trans("NumberOfLinesToShow");
print '<td colspan="2">';
$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";
// D'ont display category

View File

@ -84,7 +84,10 @@ if ($action == 'getProducts') {
}
unset($prod->fields);
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;
}
}
@ -158,7 +161,7 @@ if ($action == 'getProducts') {
if (isset($barcode_value_list['ref'])) {
// 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 .= " WHERE entity IN (" . getEntity('product') . ")";
$sql .= " AND ref = '" . $db->escape($barcode_value_list['ref']) . "'";
@ -207,6 +210,7 @@ if ($action == 'getProducts') {
'tobuy' => $obj->tobuy,
'barcode' => $obj->barcode,
'price' => $obj->price,
'price_ttc' => $obj->price_ttc,
'object' => 'product',
'img' => $ig,
'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) {
$sql .= ', ps.reel';
}
@ -299,10 +303,12 @@ if ($action == 'getProducts') {
'tobuy' => $obj->tobuy,
'barcode' => $obj->barcode,
'price' => $obj->price,
'price_ttc' => $obj->price_ttc,
'object' => 'product',
'img' => $ig,
'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
$parameters=array();

View File

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

View File

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