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';
51$langs->loadLangs(array(
"main",
"bills",
"cashdesk",
"banks"));
53$action =
GETPOST(
'action',
'aZ09');
56if (!$user->hasRight(
'takepos',
'run')) {
65if ($action ==
"split" && $user->hasRight(
'takepos',
'run')) {
70 $ret = $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-SPLIT)');
72 $placeid = $invoice->id;
74 $constforcompanyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
77 $invoice->module_source =
'takepos';
78 $invoice->pos_source = $_SESSION[
"takeposterminal"];
79 $invoice->entity = !empty($_SESSION[
"takeposinvoiceentity"]) ? $_SESSION[
"takeposinvoiceentity"] :
$conf->entity;
80 if ($invoice->socid <= 0) {
81 $langs->load(
'errors');
84 $placeid = $invoice->create($user);
88 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture SET ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-SPLIT)'";
89 $sql .=
" WHERE rowid = ".((int) $placeid);
93 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet SET fk_facture = ".((int) $placeid).
" WHERE rowid = ".((int) $line);
95 } elseif ($split==0) {
97 if ($place ==
"SPLIT") {
100 $ret = $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-'.$place.
')');
102 $placeid = $invoice->id;
104 $constforcompanyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
107 $invoice->module_source =
'takepos';
108 $invoice->pos_source = $_SESSION[
"takeposterminal"];
109 $invoice->entity = !empty($_SESSION[
"takeposinvoiceentity"]) ? $_SESSION[
"takeposinvoiceentity"] :
$conf->entity;
110 if ($invoice->socid <= 0) {
111 $langs->load(
'errors');
114 $placeid = $invoice->create($user);
119 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture SET ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
120 $sql .=
" WHERE rowid = ".((int) $placeid);
124 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set fk_facture=".$placeid.
" where rowid=".$line;
127 $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-SPLIT)');
128 $invoice->update_price();
130 $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-'.$place.
')');
131 $invoice->update_price();
140if (isset($invoiceid) && $invoiceid > 0) {
141 $invoice->fetch($invoiceid);
143 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
144 $resql = $db->query($sql);
145 $obj = $db->fetch_object($resql);
147 $invoiceid = $obj->rowid;
149 if (!isset($invoiceid)) {
152 $invoice->fetch($invoiceid);
156$arrayofcss = array(
'/takepos/css/pos.css.php');
158 $arrayofcss[] =
'/takepos/css/colorful.css';
167top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
170$arrayOfValidPaymentModes = array();
171$arrayOfValidBankAccount = array();
174<body
class=
"takepossplitphp">
177function Split(selectedline, split) {
179 url:
"split.php?action=split&token=<?php echo newToken(); ?>&line="+selectedline+
"&split="+split+
"&place=<?php echo $place;?>",
180 context: document.body
182 $(
"#currentplace").load(
"invoice.php?place="+parent.place+
"&invoiceid="+parent.invoiceid,
function() {
183 $(
'#currentplace').find(
'.posinvoiceline').click(function(){
187 $(
"#splitplace").load(
"invoice.php?place=SPLIT",
function() {
188 $(
'#splitplace').find(
'.posinvoiceline').click(
function(){
195$( document ).ready(
function() {
196 if (parent.place==
'SPLIT') {
201 $(
"#currentplace").load(
"invoice.php?place="+parent.place+
"&invoiceid="+parent.invoiceid,
function() {
202 $(
'#currentplace').find(
'.posinvoiceline')
208 $(
"#splitplace").load(
"invoice.php?place=SPLIT",
function() {
209 $(
'#splitplace').find(
'.posinvoiceline').click(
function(){
216 $(
"#headersplit1").html(
"<?php echo $langs->trans("Place
");?> "+parent.place);
217 $(
"#headersplit2").html(
"<?php echo $langs->trans("SplitSale
");?>");
222<div
class=
"headersplit">
223 <a href=
"#" onclick=
"top.location.href='index.php?place='+parent.place"><div
class=
"headercontent" id=
"headersplit1"></div></a>
226<div
class=
"rowsplit">
227 <div
class=
"splitsale" id=
"currentplace"></div>
230<div
class=
"headersplit">
231 <a href=
"#" onclick=
"top.location.href='index.php?place=SPLIT'"><div
class=
"headercontent" id=
"headersplit2"></div></a>
234<div
class=
"rowsplit">
235 <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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.