TakePOS Split Sale fixes and improvements

This commit is contained in:
andreubisquerra 2021-10-23 11:59:40 +02:00 committed by GitHub
parent f5aebbf6b8
commit a95a99afef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,12 +103,10 @@ if ($action=="split") {
dol_htmloutput_errors($invoice->error, $invoice->errors, 1); dol_htmloutput_errors($invoice->error, $invoice->errors, 1);
} }
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid; $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid;
echo $sql;
$db->query($sql); $db->query($sql);
} }
} }
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set fk_facture=".$placeid." where rowid=".$line; $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set fk_facture=".$placeid." where rowid=".$line;
echo $sql;
$db->query($sql); $db->query($sql);
} }
$invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-SPLIT)'); $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-SPLIT)');
@ -167,11 +165,11 @@ if ($conf->global->TAKEPOS_COLOR_THEME == 1) {
<script> <script>
function Split(selectedline, split) { function Split(selectedline, split) {
$.ajax({ $.ajax({
url: "split.php?action=split&line="+selectedline+"&split="+split, url: "split.php?action=split&line="+selectedline+"&split="+split+"&place=<?php echo $place;?>",
context: document.body context: document.body
}).done(function() { }).done(function() {
$("#currentplace").load("invoice.php?place="+parent.place+"&invoiceid="+parent.invoiceid, function() { $("#currentplace").load("invoice.php?place="+parent.place+"&invoiceid="+parent.invoiceid, function() {
$('.posinvoiceline').click(function(){ $('#currentplace').find('.posinvoiceline').click(function(){
Split(this.id, 1); Split(this.id, 1);
}); });
}); });
@ -184,6 +182,11 @@ function Split(selectedline, split) {
} }
$( document ).ready(function() { $( document ).ready(function() {
if (parent.place=='SPLIT') {
parent.place=0;
parent.invoiceid=0;
parent.Refresh();
}
$("#currentplace").load("invoice.php?place="+parent.place+"&invoiceid="+parent.invoiceid, function() { $("#currentplace").load("invoice.php?place="+parent.place+"&invoiceid="+parent.invoiceid, function() {
$('#currentplace').find('.posinvoiceline') $('#currentplace').find('.posinvoiceline')
.click(function(){ .click(function(){
@ -197,7 +200,7 @@ $( document ).ready(function() {
}); });
}); });
if (parent.place=='SPLIT') parent.place=0;
$("#headersplit1").html("<?php echo $langs->trans("Place");?> "+parent.place); $("#headersplit1").html("<?php echo $langs->trans("Place");?> "+parent.place);
$("#headersplit2").html("<?php echo $langs->trans("SplitSale");?>"); $("#headersplit2").html("<?php echo $langs->trans("SplitSale");?>");