28if (!defined(
'NOTOKENRENEWAL')) {
29 define(
'NOTOKENRENEWAL',
'1');
31if (!defined(
'NOREQUIREMENU')) {
32 define(
'NOREQUIREMENU',
'1');
34if (!defined(
'NOREQUIREHTML')) {
35 define(
'NOREQUIREHTML',
'1');
37if (!defined(
'NOREQUIREAJAX')) {
38 define(
'NOREQUIREAJAX',
'1');
42require
'../main.inc.php';
43require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
45$langs->loadLangs(array(
"main",
"bills",
"cashdesk",
"banks"));
47$action =
GETPOST(
'action',
'aZ09');
50if (!$user->hasRight(
'takepos',
'run')) {
59if ($action==
"split") {
61 $split =
GETPOST(
'split',
'int');
64 $ret = $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-SPLIT)');
66 $placeid = $invoice->id;
68 $constforcompanyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
71 $invoice->module_source =
'takepos';
72 $invoice->pos_source = $_SESSION[
"takeposterminal"];
73 $invoice->entity = !empty($_SESSION[
"takeposinvoiceentity"]) ? $_SESSION[
"takeposinvoiceentity"] : $conf->entity;
74 if ($invoice->socid <= 0) {
75 $langs->load(
'errors');
78 $placeid = $invoice->create($user);
82 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-SPLIT)' where rowid=".$placeid;
86 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set fk_facture=".$placeid.
" where rowid=".$line;
88 } elseif ($split==0) {
90 if ($place==
"SPLIT") {
93 $ret = $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-'.$place.
')');
95 $placeid = $invoice->id;
97 $constforcompanyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
100 $invoice->module_source =
'takepos';
101 $invoice->pos_source = $_SESSION[
"takeposterminal"];
102 $invoice->entity = !empty($_SESSION[
"takeposinvoiceentity"]) ? $_SESSION[
"takeposinvoiceentity"] : $conf->entity;
103 if ($invoice->socid <= 0) {
104 $langs->load(
'errors');
107 $placeid = $invoice->create($user);
111 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid=".$placeid;
115 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set fk_facture=".$placeid.
" where rowid=".$line;
118 $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-SPLIT)');
119 $invoice->update_price();
120 $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-'.$place.
')');
121 $invoice->update_price();
130if (isset($invoiceid) && $invoiceid > 0) {
131 $invoice->fetch($invoiceid);
133 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
134 $resql = $db->query($sql);
135 $obj = $db->fetch_object($resql);
137 $invoiceid = $obj->rowid;
139 if (!isset($invoiceid)) {
142 $invoice->fetch($invoiceid);
146$arrayofcss = array(
'/takepos/css/pos.css.php');
148 $arrayofcss[] =
'/takepos/css/colorful.css';
157top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
160$arrayOfValidPaymentModes = array();
161$arrayOfValidBankAccount = array();
164<body
class=
"takepossplitphp">
167function Split(selectedline, split) {
169 url:
"split.php?action=split&token=<?php echo newToken(); ?>&line="+selectedline+
"&split="+split+
"&place=<?php echo $place;?>",
170 context: document.body
172 $(
"#currentplace").load(
"invoice.php?place="+parent.place+
"&invoiceid="+parent.invoiceid,
function() {
173 $(
'#currentplace').find(
'.posinvoiceline').click(function(){
177 $(
"#splitplace").load(
"invoice.php?place=SPLIT",
function() {
178 $(
'#splitplace').find(
'.posinvoiceline').click(
function(){
185$( document ).ready(
function() {
186 if (parent.place==
'SPLIT') {
191 $(
"#currentplace").load(
"invoice.php?place="+parent.place+
"&invoiceid="+parent.invoiceid,
function() {
192 $(
'#currentplace').find(
'.posinvoiceline')
198 $(
"#splitplace").load(
"invoice.php?place=SPLIT",
function() {
199 $(
'#splitplace').find(
'.posinvoiceline').click(
function(){
206 $(
"#headersplit1").html(
"<?php echo $langs->trans("Place
");?> "+parent.place);
207 $(
"#headersplit2").html(
"<?php echo $langs->trans("SplitSale
");?>");
212<div
class=
"headersplit">
213 <a href=
"#" onclick=
"top.location.href='index.php?place='+parent.place"><div
class=
"headercontent" id=
"headersplit1"></div></a>
216<div
class=
"rowsplit">
217 <div
class=
"splitsale" id=
"currentplace"></div>
220<div
class=
"headersplit">
221 <a href=
"#" onclick=
"top.location.href='index.php?place=SPLIT'"><div
class=
"headercontent" id=
"headersplit2"></div></a>
224<div
class=
"rowsplit">
225 <div
class=
"splitsale" id=
"splitplace"></div>
Class to manage invoices.
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 formated 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)
Ouput 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.