No more need to set scroolTop, lines are sorted with last added first

This commit is contained in:
Laurent Destailleur 2019-03-27 20:20:39 +01:00
parent ff10a2ab5a
commit 9105e205ff
4 changed files with 49 additions and 41 deletions

View File

@ -61,7 +61,7 @@ if ($action=="change") {
?>
<script>
parent.$("#poslines").load("invoice.php?place="+<?php print $place;?>, function() {
parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
//parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
parent.$.colorbox.close();
});
</script>

View File

@ -407,39 +407,47 @@ print "</tr>\n";
if ($placeid > 0)
{
$tmplines = array_reverse($invoice->lines);
foreach($tmplines as $line)
if (is_array($invoice->lines) && count($invoice->lines))
{
$htmlforlines = '';
$htmlforlines.= '<tr class="drag drop oddeven';
if ($line->special_code == "3") {
$htmlforlines.= ' order';
}
$htmlforlines.= '" id="' . $line->id . '">';
$htmlforlines.= '<td class="left">';
$htmlforlines.= $line->product_label;
if ($line->product_label && $line->desc) $htmlforlines.= '<br>';
if ($line->product_label != $line->desc)
$tmplines = array_reverse($invoice->lines);
foreach($tmplines as $line)
{
$firstline = dolGetFirstLineOfText($line->desc);
if ($firstline != $line->desc)
{
$htmlforlines.= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc);
}
else
{
$htmlforlines.= $line->desc;
}
}
if (!empty($line->array_options['options_order_notes'])) $htmlforlines.= "<br>(".$line->array_options['options_order_notes'].")";
$htmlforlines.= '</td>';
$htmlforlines.= '<td class="right">' . vatrate($line->remise_percent, true) . '</td>';
$htmlforlines.= '<td class="right">' . $line->qty . '</td>';
$htmlforlines.= '<td class="right">' . price($line->total_ttc) . '</td>';
$htmlforlines.= '</tr>'."\n";
$htmlforlines = '';
$htmlforlines.= '<tr class="drag drop oddeven';
if ($line->special_code == "3") {
$htmlforlines.= ' order';
}
$htmlforlines.= '" id="' . $line->id . '">';
$htmlforlines.= '<td class="left">';
$htmlforlines.= $line->product_label;
if ($line->product_label && $line->desc) $htmlforlines.= '<br>';
if ($line->product_label != $line->desc)
{
$firstline = dolGetFirstLineOfText($line->desc);
if ($firstline != $line->desc)
{
$htmlforlines.= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc);
}
else
{
$htmlforlines.= $line->desc;
}
}
if (!empty($line->array_options['options_order_notes'])) $htmlforlines.= "<br>(".$line->array_options['options_order_notes'].")";
$htmlforlines.= '</td>';
$htmlforlines.= '<td class="right">' . vatrate($line->remise_percent, true) . '</td>';
$htmlforlines.= '<td class="right">' . $line->qty . '</td>';
$htmlforlines.= '<td class="right">' . price($line->total_ttc) . '</td>';
$htmlforlines.= '</tr>'."\n";
print $htmlforlines;
}
}
else
{
print '<tr class="drag drop oddeven"><td class="left"><span class="opacitymedium">'.$langs->trans("Empty").'</span></td><td></td><td></td><td></td></tr>';
print $htmlforlines;
}
}

View File

@ -170,7 +170,7 @@ else print "var received=0;";
}
console.log("We click on the payment mode to pay amount = "+amountpayed);
parent.$("#poslines").load("invoice.php?place=<?php echo $place;?>&action=valid&pay="+payment+"&amount="+amountpayed+"&invoiceid="+invoiceid, function() {
parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
//parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
parent.$.colorbox.close();
});
}

View File

@ -66,9 +66,9 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
<?php
$categories = $categorie->get_full_arbo('product', 0, (($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)?$conf->global->TAKEPOS_ROOT_CATEGORY_ID:0));
//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0;
// Search root category to know its level
//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0;
$levelofrootcategory=0;
if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)
{
@ -267,7 +267,7 @@ function ClickProduct(position) {
function deleteline() {
$("#poslines").load("invoice.php?action=deleteline&place="+place+"&idline="+selectedline, function() {
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
});
}
@ -295,13 +295,13 @@ function TakeposOrderNotes() {
function Refresh() {
$("#poslines").load("invoice.php?place="+place, function() {
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
});
}
function Search() {
$("#poslines").load("invoice.php?action=search&place="+place, function() {
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
});
}
@ -334,7 +334,7 @@ function Edit(number){
if (editaction=='qty' && editnumber!=""){
$("#poslines").load("invoice.php?action=updateqty&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
editnumber="";
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
$("#qty").html("<?php echo $langs->trans("Qty"); ?>");
});
return;
@ -347,7 +347,7 @@ function Edit(number){
if (editaction=='p' && editnumber!=""){
$("#poslines").load("invoice.php?action=updateprice&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
editnumber="";
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
$("#price").html("<?php echo $langs->trans("Price"); ?>");
});
return;
@ -360,7 +360,7 @@ function Edit(number){
if (editaction=='r' && editnumber!=""){
$("#poslines").load("invoice.php?action=updatereduction&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
editnumber="";
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
$("#reduction").html("<?php echo $langs->trans("ReductionShort"); ?>");
});
return;
@ -395,13 +395,13 @@ function Edit(number){
function TakeposPrintingOrder(){
$("#poslines").load("invoice.php?action=order&place="+place, function() {
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
});
}
function TakeposPrintingTemp(){
$("#poslines").load("invoice.php?action=temp&place="+place, function() {
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
});
}