35 if (!defined(
'NOTOKENRENEWAL')) {
36 define(
'NOTOKENRENEWAL',
'1');
38 if (!defined(
'NOREQUIREMENU')) {
39 define(
'NOREQUIREMENU',
'1');
41 if (!defined(
'NOREQUIREHTML')) {
42 define(
'NOREQUIREHTML',
'1');
44 if (!defined(
'NOREQUIREAJAX')) {
45 define(
'NOREQUIREAJAX',
'1');
48 require
'../main.inc.php';
50include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
52$langs->loadLangs(array(
"main",
"bills",
"cashdesk",
"companies"));
56$facid =
GETPOST(
'facid',
'int');
58$action =
GETPOST(
'action',
'aZ09');
61if (!$user->hasRight(
'takepos',
'run')) {
73 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$db->escape($_SESSION[
"takeposterminal"].
"-".$place).
")'";
74 $resql = $db->query($sql);
75 $obj = $db->fetch_object($resql);
81$object->fetch($facid);
85$hookmanager->initHooks(array(
'takeposfrontend'));
86$reshook = $hookmanager->executeHooks(
'TakeposReceipt', $parameters, $object);
87if (!empty($hookmanager->resPrint)) {
88 print $hookmanager->resPrint;
108<?php echo
'<b>'.$mysoc->name.
'</b>'; ?>
114$constFreeText =
'TAKEPOS_HEADER'.(empty($_SESSION[
'takeposterminal']) ?
'0' : $_SESSION[
'takeposterminal']);
124 print nl2br($newfreetext);
130print $langs->trans(
'Date').
" ".
dol_print_date($object->date,
'day').
'<br>';
135 print str_replace(
")",
"", str_replace(
"-",
" ".$langs->trans(
'Place').
" ", str_replace(
"(PROV-POS", $langs->trans(
"Terminal").
" ", $object->ref)));
140 if ($object->socid !=
getDolGlobalInt(
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"])) {
142 if ($object->socid > 0) {
143 $soc->fetch($object->socid);
145 $soc->fetch(
getDolGlobalInt(
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"]));
147 print
"<br>".$langs->trans(
"Customer").
': '.$soc->name;
151 print
"<br>".$langs->trans(
"DateOfPrinting").
': '.
dol_print_date(
dol_now(),
'dayhour',
'tzuserrel').
'<br>';
157<table width=
"100%" style=
"border-top-style: double;">
160 <th
class=
"center"><?php print $langs->trans(
"Label"); ?></th>
161 <th
class=
"right"><?php print $langs->trans(
"Qty"); ?></th>
162 <th
class=
"right"><?php
if ($gift != 1) {
163 print $langs->trans(
"Price");
166 <th
class=
"right"><?php
if ($gift != 1) {
167 print $langs->trans(
"TotalHT");
170 <th
class=
"right"><?php
if ($gift != 1) {
171 print $langs->trans(
"TotalTTC");
177 if ($action ==
'without_details') {
180 print
'<td>' .
GETPOST(
'label',
'alphanohtml') .
'</td>';
181 print
'<td class="right">' . $qty .
'</td>';
182 print
'<td class="right">' .
price(
price2num($object->total_ttc / $qty,
'MU'), 1) .
'</td>';
184 print
'<td class="right">' .
price($object->total_ht, 1) .
'</td>';
186 print
'<td class="right">' .
price($object->total_ttc, 1) .
'</td>';
189 foreach ($object->lines as $line) {
193 <?php
if (!empty($line->product_label)) {
194 echo $line->product_label;
196 echo $line->description;
199 <td
class=
"right"><?php echo $line->qty; ?></td>
200 <td
class=
"right"><?php
if ($gift != 1) {
205 <td
class=
"right"><?php
if ($gift != 1) {
206 echo
price($line->total_ht, 1);
210 <td
class=
"right"><?php
if ($gift != 1) {
211 echo
price($line->total_ttc, 1);
223 <th
class=
"right"><?php
if ($gift != 1) {
224 echo $langs->trans(
"TotalHT");
226 <td
class=
"right"><?php
if ($gift != 1) {
227 echo
price($object->total_ht, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
230<?php
if ($conf->global->TAKEPOS_TICKET_VAT_GROUPPED) {
231 $vat_groups = array();
232 foreach ($object->lines as $line) {
233 if (!array_key_exists($line->tva_tx, $vat_groups)) {
234 $vat_groups[$line->tva_tx] = 0;
236 $vat_groups[$line->tva_tx] += $line->total_tva;
239 foreach ($vat_groups as $key => $val) {
242 <th align=
"right"><?php
if ($gift != 1) {
243 echo $langs->trans(
"VAT").
' '.
vatrate($key, 1);
245 <td align=
"right"><?php
if ($gift != 1) {
246 echo
price($val, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
253 <th
class=
"right"><?php
if ($gift != 1) {
254 echo $langs->trans(
"TotalVAT").
'</th><td class="right">'.
price($object->total_tva, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
261if (
price2num($object->total_localtax1,
'MU') || $mysoc->useLocalTax(1)) { ?>
263 <th
class=
"right"><?php
if ($gift != 1) {
264 echo
''.$langs->trans(
"TotalLT1").
'</th><td class="right">'.
price($object->total_localtax1, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
268<?php
if (
price2num($object->total_localtax2,
'MU') || $mysoc->useLocalTax(2)) { ?>
270 <th
class=
"right"><?php
if ($gift != 1) {
271 echo
''.$langs->trans(
"TotalLT2").
'</th><td class="right">'.
price($object->total_localtax2, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
276 <th
class=
"right"><?php
if ($gift != 1) {
277 echo
''.$langs->trans(
"TotalTTC").
'</th><td class="right">'.
price($object->total_ttc, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
281if (isModEnabled(
'multicurrency') && !empty($_SESSION[
"takeposcustomercurrency"]) && $_SESSION[
"takeposcustomercurrency"] !=
"" && $conf->currency != $_SESSION[
"takeposcustomercurrency"]) {
283 include_once DOL_DOCUMENT_ROOT.
'/multicurrency/class/multicurrency.class.php';
285 $multicurrency->fetch(0, $_SESSION[
"takeposcustomercurrency"]);
286 echo
'<tr><th class="right">';
288 echo
''.$langs->trans(
"TotalTTC").
' '.$_SESSION[
"takeposcustomercurrency"].
'</th><td class="right">'.
price($object->total_ttc * $multicurrency->rate->rate, 1,
'', 1, - 1, - 1, $_SESSION[
"takeposcustomercurrency"]).
"\n";
297 echo
'<td class="right">';
298 echo $langs->transnoentitiesnoconv(
"PaymentTypeShortLIQ");
300 echo
'<td class="right">';
302 echo
price($amount_payment, 1,
'', 1, - 1, - 1, $conf->currency);
306 $sql =
"SELECT p.pos_change as pos_change, p.datep as date, p.fk_paiement, p.num_paiement as num,";
307 $sql .=
" f.multicurrency_code,";
308 $sql .=
" pf.amount as amount, pf.multicurrency_amount,";
310 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiement_facture as pf, ".MAIN_DB_PREFIX.
"facture as f, ".MAIN_DB_PREFIX.
"paiement as p";
311 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as cp ON p.fk_paiement = cp.id";
312 $sql .=
" WHERE pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid AND pf.fk_facture = ".((int) $facid);
313 $sql .=
" ORDER BY p.datep";
315 $resql = $db->query($sql);
317 $num = $db->num_rows($resql);
321 $row = $db->fetch_object($resql);
324 echo
'<td class="right">';
325 echo $langs->transnoentitiesnoconv(
"PaymentTypeShort".$row->code);
327 echo
'<td class="right">';
328 $amount_payment = (isModEnabled(
'multicurrency') && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount;
330 if ((!isModEnabled(
'multicurrency') || $object->multicurrency_tx == 1) && $row->code ==
"LIQ" && $row->pos_change > 0) {
331 $amount_payment = $amount_payment + $row->pos_change;
332 $currency = $conf->currency;
335 $currency = $row->multicurrency_code;
337 echo
price($amount_payment, 1,
'', 1, - 1, - 1, $currency);
340 if ((!isModEnabled(
'multicurrency') || $object->multicurrency_tx == 1) && $row->code ==
"LIQ" && $row->pos_change > 0) {
342 echo
'<td class="right">';
343 echo $langs->trans(
"Change");
345 echo
'<td class="right">';
346 echo
price($row->pos_change, 1,
'', 1, - 1, - 1, $currency);
357<div style=
"border-top-style: double;">
362$constFreeText =
'TAKEPOS_FOOTER'.(empty($_SESSION[
'takeposterminal']) ?
'0' : $_SESSION[
'takeposterminal']);
376<script
type=
"text/javascript">
379 print
'window.print();';
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 formated for view output Used into pdf and HTML pages.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
if(preg_match('/crypted:/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.