28 if (!defined(
'NOCSRFCHECK')) {
29 define(
'NOCSRFCHECK',
'1');
31 if (!defined(
'NOTOKENRENEWAL')) {
32 define(
'NOTOKENRENEWAL',
'1');
34 if (!defined(
'NOREQUIREMENU')) {
35 define(
'NOREQUIREMENU',
'1');
37 if (!defined(
'NOREQUIREHTML')) {
38 define(
'NOREQUIREHTML',
'1');
40 if (!defined(
'NOREQUIREAJAX')) {
41 define(
'NOREQUIREAJAX',
'1');
44 require
'../main.inc.php';
45 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
47 $langs->loadLangs(array(
"main",
"bills",
"cashdesk",
"banks"));
49 $action =
GETPOST(
'action',
'aZ09');
50 $place = (
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') : 0);
52 if (empty($user->rights->takepos->run)) {
56 if ($action==
"split") {
58 $split =
GETPOST(
'split',
'int');
61 $ret = $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-SPLIT)');
63 $placeid = $invoice->id;
65 $constforcompanyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
66 $invoice->socid = $conf->global->$constforcompanyid;
68 $invoice->module_source =
'takepos';
69 $invoice->pos_source = $_SESSION[
"takeposterminal"];
70 $invoice->entity = !empty($_SESSION[
"takeposinvoiceentity"]) ? $_SESSION[
"takeposinvoiceentity"] : $conf->entity;
71 if ($invoice->socid <= 0) {
72 $langs->load(
'errors');
75 $placeid = $invoice->create($user);
79 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-SPLIT)' where rowid=".$placeid;
83 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set fk_facture=".$placeid.
" where rowid=".$line;
85 } elseif ($split==0) {
87 if ($place==
"SPLIT") $place=
"0";
88 $ret = $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-'.$place.
')');
90 $placeid = $invoice->id;
92 $constforcompanyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
93 $invoice->socid = $conf->global->$constforcompanyid;
95 $invoice->module_source =
'takepos';
96 $invoice->pos_source = $_SESSION[
"takeposterminal"];
97 $invoice->entity = !empty($_SESSION[
"takeposinvoiceentity"]) ? $_SESSION[
"takeposinvoiceentity"] : $conf->entity;
98 if ($invoice->socid <= 0) {
99 $langs->load(
'errors');
102 $placeid = $invoice->create($user);
106 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid=".$placeid;
110 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set fk_facture=".$placeid.
" where rowid=".$line;
113 $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-SPLIT)');
114 $invoice->update_price();
115 $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
"takeposterminal"].
'-'.$place.
')');
116 $invoice->update_price();
125 if ($invoiceid > 0) {
126 $invoice->fetch($invoiceid);
128 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
129 $resql = $db->query($sql);
130 $obj = $db->fetch_object(
$resql);
132 $invoiceid = $obj->rowid;
137 $invoice->fetch($invoiceid);
141 $arrayofcss = array(
'/takepos/css/pos.css.php');
142 $arrayofjs = array();
149 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
152 $arrayOfValidPaymentModes = array();
153 $arrayOfValidBankAccount = array();
157 <link rel=
"stylesheet" href=
"css/pos.css.php">
159 if ($conf->global->TAKEPOS_COLOR_THEME == 1) {
160 print
'<link rel="stylesheet" href="css/colorful.css">';
164 <body
class=
"takepossplitphp">
167 function Split(selectedline, split) {
169 url:
"split.php?action=split&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>
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_now($mode= 'auto')
Return date for now.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->supplier_invoice->lire)) if(isModEnabled('don')&&!empty($user->rights->don->lire)) if(isModEnabled('tax')&&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture')&&isModEnabled('commande')&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
top_htmlhead($head, $title= '', $disablejs=0, $disablehead=0, $arrayofjs= '', $arrayofcss= '', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
Class to manage invoices.
dol_htmloutput_errors($mesgstring= '', $mesgarray=array(), $keepembedded=0)
Print formated error messages to output (Used to show messages on html output).