29if (!defined(
'NOTOKENRENEWAL')) {
30 define(
'NOTOKENRENEWAL',
'1');
32if (!defined(
'NOREQUIREMENU')) {
33 define(
'NOREQUIREMENU',
'1');
35if (!defined(
'NOREQUIREHTML')) {
36 define(
'NOREQUIREHTML',
'1');
38if (!defined(
'NOREQUIREAJAX')) {
39 define(
'NOREQUIREAJAX',
'1');
43require
'../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
46$langs->loadLangs(array(
"main",
"bills",
"cashdesk",
"banks"));
48$action =
GETPOST(
'action',
'aZ09');
51if (!$user->hasRight(
'takepos',
'run')) {
60if ($action==
"split" && $user->hasRight(
'takepos',
'run')) {
65 $ret = $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-SPLIT)');
67 $placeid = $invoice->id;
69 $constforcompanyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
72 $invoice->module_source =
'takepos';
73 $invoice->pos_source = $_SESSION[
"takeposterminal"];
74 $invoice->entity = !empty($_SESSION[
"takeposinvoiceentity"]) ? $_SESSION[
"takeposinvoiceentity"] : $conf->entity;
75 if ($invoice->socid <= 0) {
76 $langs->load(
'errors');
79 $placeid = $invoice->create($user);
83 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-SPLIT)' where rowid=".$placeid;
87 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set fk_facture=".$placeid.
" where rowid=".$line;
89 } elseif ($split==0) {
91 if ($place==
"SPLIT") {
94 $ret = $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-'.$place.
')');
96 $placeid = $invoice->id;
98 $constforcompanyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
101 $invoice->module_source =
'takepos';
102 $invoice->pos_source = $_SESSION[
"takeposterminal"];
103 $invoice->entity = !empty($_SESSION[
"takeposinvoiceentity"]) ? $_SESSION[
"takeposinvoiceentity"] : $conf->entity;
104 if ($invoice->socid <= 0) {
105 $langs->load(
'errors');
108 $placeid = $invoice->create($user);
112 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid=".$placeid;
116 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set fk_facture=".$placeid.
" where rowid=".$line;
119 $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-SPLIT)');
120 $invoice->update_price();
121 $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-'.$place.
')');
122 $invoice->update_price();
131if (isset($invoiceid) && $invoiceid > 0) {
132 $invoice->fetch($invoiceid);
134 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
135 $resql = $db->query($sql);
136 $obj = $db->fetch_object($resql);
138 $invoiceid = $obj->rowid;
140 if (!isset($invoiceid)) {
143 $invoice->fetch($invoiceid);
147$arrayofcss = array(
'/takepos/css/pos.css.php');
149 $arrayofcss[] =
'/takepos/css/colorful.css';
158top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
161$arrayOfValidPaymentModes = array();
162$arrayOfValidBankAccount = array();
165<body
class=
"takepossplitphp">
168function Split(selectedline, split) {
170 url:
"split.php?action=split&token=<?php echo newToken(); ?>&line="+selectedline+
"&split="+split+
"&place=<?php echo $place;?>",
171 context: document.body
173 $(
"#currentplace").load(
"invoice.php?place="+parent.place+
"&invoiceid="+parent.invoiceid,
function() {
174 $(
'#currentplace').find(
'.posinvoiceline').click(function(){
178 $(
"#splitplace").load(
"invoice.php?place=SPLIT",
function() {
179 $(
'#splitplace').find(
'.posinvoiceline').click(
function(){
186$( document ).ready(
function() {
187 if (parent.place==
'SPLIT') {
192 $(
"#currentplace").load(
"invoice.php?place="+parent.place+
"&invoiceid="+parent.invoiceid,
function() {
193 $(
'#currentplace').find(
'.posinvoiceline')
199 $(
"#splitplace").load(
"invoice.php?place=SPLIT",
function() {
200 $(
'#splitplace').find(
'.posinvoiceline').click(
function(){
207 $(
"#headersplit1").html(
"<?php echo $langs->trans("Place
");?> "+parent.place);
208 $(
"#headersplit2").html(
"<?php echo $langs->trans("SplitSale
");?>");
213<div
class=
"headersplit">
214 <a href=
"#" onclick=
"top.location.href='index.php?place='+parent.place"><div
class=
"headercontent" id=
"headersplit1"></div></a>
217<div
class=
"rowsplit">
218 <div
class=
"splitsale" id=
"currentplace"></div>
221<div
class=
"headersplit">
222 <a href=
"#" onclick=
"top.location.href='index.php?place=SPLIT'"><div
class=
"headercontent" id=
"headersplit2"></div></a>
225<div
class=
"rowsplit">
226 <div
class=
"splitsale" id=
"splitplace"></div>
Class to manage invoices.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formatted error messages to output (Used to show messages on html output).
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.