38 if (!defined(
'NOTOKENRENEWAL')) {
39 define(
'NOTOKENRENEWAL',
'1');
41 if (!defined(
'NOREQUIREMENU')) {
42 define(
'NOREQUIREMENU',
'1');
44 if (!defined(
'NOREQUIREHTML')) {
45 define(
'NOREQUIREHTML',
'1');
47 if (!defined(
'NOREQUIREAJAX')) {
48 define(
'NOREQUIREAJAX',
'1');
51 require
'../main.inc.php';
53include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
62$langs->loadLangs(array(
"main",
"bills",
"cashdesk",
"companies"));
68$action =
GETPOST(
'action',
'aZ09');
71if (!$user->hasRight(
'takepos',
'run')) {
88if (!$facid && (
string) $place !=
'' && !empty($_SESSION[
"takeposterminal"])) {
89 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture";
90 $sql .=
" WHERE ref = '(PROV-POS".$db->escape($_SESSION[
"takeposterminal"].
"-".$place).
")'";
91 $sql .=
" AND entity IN (".getEntity(
'invoice').
")";
93 $resql = $db->query($sql);
94 $obj = $db->fetch_object($resql);
100$result =
$object->fetch($facid);
102if ($result <= 0 || $object->module_source !=
'takepos' || !in_array(
$object->entity, explode(
',',
getEntity(
'invoice')))) {
111jQuery(document).ready(function () {
112 console.log('Call /blockedlog/ajax/block-add on output of receipt.php');
113 $.post('".DOL_URL_ROOT.
"/blockedlog/ajax/block-add.php'
117 , action: 'DOC_PREVIEW'
126$parameters = array();
127$hookmanager->initHooks(array(
'takeposfrontend'));
128$reshook = $hookmanager->executeHooks(
'TakeposReceipt', $parameters, $object);
129if (!empty($hookmanager->resPrint)) {
130 print $hookmanager->resPrint;
150@media only screen and (min-width: 1024px)
159<div style=
"font-size: 1.5em">
160<?php echo
'<b>'.$mysoc->name.
'</b>'; ?>
166$constFreeText =
'TAKEPOS_HEADER'.(empty($_SESSION[
'takeposterminal']) ?
'0' : $_SESSION[
'takeposterminal']);
169 $substitutionarray = getCommonSubstitutionArray($langs);
177 print nl2br($newfreetext);
188 print str_replace(
")",
"", str_replace(
"-",
" ".$langs->trans(
'Place').
" ", str_replace(
"(PROV-POS", $langs->trans(
"Terminal").
" ",
$object->ref)));
198 $soc->fetch(
getDolGlobalInt(
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"]));
200 print
"<br>".$langs->trans(
"Customer").
': '.$soc->name;
204 print
"<br>".$langs->trans(
"DateOfPrinting").
': '.
dol_print_date(
dol_now(),
'dayhour',
'tzuserrel').
'<br>';
210<
table class=
"centpercent" style=
"border-top-style: double;">
213 <th
class=
"center"><?php print $langs->trans(
"Label"); ?></th>
214 <th
class=
"right"><?php print $langs->trans(
"Qty"); ?></th>
215 <th
class=
"right"><?php
if ($gift != 1) {
216 print $langs->trans(
"Price");
219 <th
class=
"right"><?php
if ($gift != 1) {
220 print $langs->trans(
"TotalHT");
223 <th
class=
"right"><?php
if ($gift != 1) {
224 print $langs->trans(
"TotalTTC");
230 if ($action ==
'without_details') {
233 print
'<td>' .
GETPOST(
'label',
'alphanohtml') .
'</td>';
234 print
'<td class="right">' . $qty .
'</td>';
237 print
'<td class="right">' .
price(
$object->total_ht, 1) .
'</td>';
239 print
'<td class="right">' .
price(
$object->total_ttc, 1) .
'</td>';
242 foreach (
$object->lines as $line) {
246 <?php
if (!empty($line->product_label)) {
247 echo $line->product_label;
252 <td
class=
"right"><?php echo $line->qty; ?></td>
253 <td
class=
"right"><?php
if ($gift != 1) {
258 <td
class=
"right"><?php
if ($gift != 1) {
259 echo
price($line->total_ht, 1);
263 <td
class=
"right"><?php
if ($gift != 1) {
264 echo
price($line->total_ttc, 1);
274<
table class=
"right centpercent">
276 <th
class=
"right"><?php
if ($gift != 1) {
277 echo $langs->trans(
"TotalHT");
279 <td
class=
"right"><?php
if ($gift != 1) {
284 $vat_groups = array();
285 foreach (
$object->lines as $line) {
286 if (!array_key_exists($line->tva_tx, $vat_groups)) {
287 $vat_groups[$line->tva_tx] = 0;
289 $vat_groups[$line->tva_tx] += $line->total_tva;
292 foreach ($vat_groups as $key => $val) {
295 <th align=
"right"><?php
if ($gift != 1) {
296 echo $langs->trans(
"VAT").
' '.
vatrate($key,
true);
298 <td align=
"right"><?php
if ($gift != 1) {
299 echo
price($val, 1,
'', 1, - 1, - 1,
$conf->currency).
"\n";
306 <th
class=
"right"><?php
if ($gift != 1) {
307 echo $langs->trans(
"TotalVAT").
'</th><td class="right">'.
price(
$object->total_tva, 1,
'', 1, - 1, - 1,
$conf->currency).
"\n";
319if (($mysoc->localtax1_assuj ==
"1" && $mysoc->useLocalTax(1)) ||
price2num(
$object->total_localtax1,
'MU')) { ?>
321 <th
class=
"right"><?php
if ($gift != 1) {
322 echo
''.$langs->trans(
"TotalLT1").
'</th><td class="right">'.
price(
$object->total_localtax1, 1,
'', 1, - 1, - 1,
$conf->currency).
"\n";
326<?php
if (($mysoc->localtax2_assuj ==
"1" && $mysoc->useLocalTax(2)) ||
price2num(
$object->total_localtax2,
'MU')) { ?>
328 <th
class=
"right"><?php
if ($gift != 1) {
329 echo
''.$langs->trans(
"TotalLT2").
'</th><td class="right">'.
price(
$object->total_localtax2, 1,
'', 1, - 1, - 1,
$conf->currency).
"\n";
334 <th
class=
"right"><?php
if ($gift != 1) {
335 echo
''.$langs->trans(
"TotalTTC").
'</th><td class="right">'.
price(
$object->total_ttc, 1,
'', 1, - 1, - 1,
$conf->currency).
"\n";
339if (isModEnabled(
'multicurrency') && !empty($_SESSION[
"takeposcustomercurrency"]) && $_SESSION[
"takeposcustomercurrency"] !=
"" &&
$conf->currency != $_SESSION[
"takeposcustomercurrency"]) {
341 include_once DOL_DOCUMENT_ROOT.
'/multicurrency/class/multicurrency.class.php';
343 $multicurrency->fetch(0, $_SESSION[
"takeposcustomercurrency"]);
344 echo
'<tr><th class="right">';
346 echo
''.$langs->trans(
"TotalTTC").
' '.$_SESSION[
"takeposcustomercurrency"].
'</th><td class="right">'.
price(
$object->total_ttc * $multicurrency->rate->rate, 1,
'', 1, - 1, - 1, $_SESSION[
"takeposcustomercurrency"]).
"\n";
355 echo
'<td class="right">';
356 echo $langs->transnoentitiesnoconv(
"PaymentTypeShortLIQ");
358 echo
'<td class="right">';
360 echo
price($amount_payment, 1,
'', 1, - 1, - 1,
$conf->currency);
364 $sql =
"SELECT p.pos_change as pos_change, p.datep as date, p.fk_paiement, p.num_paiement as num,";
365 $sql .=
" f.multicurrency_code,";
366 $sql .=
" pf.amount as amount, pf.multicurrency_amount,";
368 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiement_facture as pf, ".MAIN_DB_PREFIX.
"facture as f, ".MAIN_DB_PREFIX.
"paiement as p";
369 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as cp ON p.fk_paiement = cp.id";
370 $sql .=
" WHERE pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid AND pf.fk_facture = ".((int) $facid);
371 $sql .=
" ORDER BY p.datep";
373 $resql = $db->query($sql);
375 $num = $db->num_rows($resql);
379 $row = $db->fetch_object($resql);
382 echo
'<td class="right">';
383 echo $langs->transnoentitiesnoconv(
"PaymentTypeShort".$row->code);
385 echo
'<td class="right">';
386 $amount_payment = (isModEnabled(
'multicurrency') &&
$object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount;
388 if ((!isModEnabled(
'multicurrency') ||
$object->multicurrency_tx == 1) && $row->code ==
"LIQ" && $row->pos_change > 0) {
389 $amount_payment += $row->pos_change;
390 $currency =
$conf->currency;
393 $currency = $row->multicurrency_code;
395 echo
price($amount_payment, 1,
'', 1, - 1, - 1, $currency);
398 if ((!isModEnabled(
'multicurrency') ||
$object->multicurrency_tx == 1) && $row->code ==
"LIQ" && $row->pos_change > 0) {
400 echo
'<td class="right">';
401 echo $langs->trans(
"Change");
403 echo
'<td class="right">';
404 echo
price($row->pos_change, 1,
'', 1, - 1, - 1, $currency);
415<div style=
"border-top-style: double;">
420$constFreeText =
'TAKEPOS_FOOTER'.(empty($_SESSION[
'takeposterminal']) ?
'0' : $_SESSION[
'takeposterminal']);
423 $substitutionarray = getCommonSubstitutionArray($langs);
435<script
type=
"text/javascript">
438 print
'window.print();';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Class to manage invoices.
const STATUS_DRAFT
Draft status.
Class to manage third parties objects (customers, suppliers, prospects...)
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formatted for view output Used into pdf and HTML pages.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
currentToken()
Return the value of token currently saved into session with name 'token'.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
treeview li table
No Email.
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...
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.