29 if (!isset($action)) {
34 if (!defined(
'NOTOKENRENEWAL')) {
35 define(
'NOTOKENRENEWAL',
'1');
37 if (!defined(
'NOREQUIREMENU')) {
38 define(
'NOREQUIREMENU',
'1');
40 if (!defined(
'NOREQUIREHTML')) {
41 define(
'NOREQUIREHTML',
'1');
43 if (!defined(
'NOREQUIREAJAX')) {
44 define(
'NOREQUIREAJAX',
'1');
47 require
'../main.inc.php';
49 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
51 $langs->loadLangs(array(
"main",
"bills",
"cashdesk",
"companies"));
53 $place = (
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') : 0);
55 $facid =
GETPOST(
'facid',
'int');
57 $action =
GETPOST(
'action',
'aZ09');
60 if (empty($user->rights->takepos->run)) {
72 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$db->escape($_SESSION[
"takeposterminal"].
"-".$place).
")'";
74 $obj = $db->fetch_object(
$resql);
80 $object->fetch($facid);
83 $parameters = array();
84 $hookmanager->initHooks(array(
'takeposfrontend'), $facid);
85 $reshook = $hookmanager->executeHooks(
'TakeposReceipt', $parameters, $object);
86 if (!empty($hookmanager->resPrint)) {
87 print $hookmanager->resPrint;
108 <?php echo
'<b>'.$mysoc->name.
'</b>'; ?>
114 $constFreeText =
'TAKEPOS_HEADER'.(empty($_SESSION[
'takeposterminal']) ?
'0' : $_SESSION[
'takeposterminal']);
115 if (!empty($conf->global->TAKEPOS_HEADER) || !empty($conf->global->{$constFreeText})) {
118 if (!empty($conf->global->TAKEPOS_HEADER)) {
119 $newfreetext .=
make_substitutions($conf->global->TAKEPOS_HEADER, $substitutionarray);
121 if (!empty($conf->global->{$constFreeText})) {
122 $newfreetext .=
make_substitutions($conf->global->{$constFreeText}, $substitutionarray);
124 print nl2br($newfreetext);
130 print $langs->trans(
'Date').
" ".
dol_print_date($object->date,
'day').
'<br>';
131 if (!empty($conf->global->TAKEPOS_RECEIPT_NAME)) {
132 print $conf->global->TAKEPOS_RECEIPT_NAME.
" ";
135 print str_replace(
")",
"", str_replace(
"-",
" ".$langs->trans(
'Place').
" ", str_replace(
"(PROV-POS", $langs->trans(
"Terminal").
" ", $object->ref)));
139 if ($conf->global->TAKEPOS_SHOW_CUSTOMER) {
140 if ($object->socid != $conf->global->{
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"]}) {
142 if ($object->socid > 0) {
143 $soc->fetch($object->socid);
145 $soc->fetch($conf->global->{
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"]});
147 print
"<br>".$langs->trans(
"Customer").
': '.$soc->name;
154 <table width=
"100%" style=
"border-top-style: double;">
157 <th
class=
"center"><?php print $langs->trans(
"Label"); ?></th>
158 <th
class=
"right"><?php print $langs->trans(
"Qty"); ?></th>
159 <th
class=
"right"><?php
if ($gift != 1) {
160 print $langs->trans(
"Price");
162 <?php
if (!empty($conf->global->TAKEPOS_SHOW_HT_RECEIPT)) { ?>
163 <th
class=
"right"><?php
if ($gift != 1) {
164 print $langs->trans(
"TotalHT");
167 <th
class=
"right"><?php
if ($gift != 1) {
168 print $langs->trans(
"TotalTTC");
174 if ($action ==
'without_details') {
177 print
'<td>' .
GETPOST(
'label',
'alphanohtml') .
'</td>';
178 print
'<td class="right">' . $qty .
'</td>';
179 print
'<td class="right">' .
price(
price2num($object->total_ttc / $qty,
'MU'), 1) .
'</td>';
180 if (!empty($conf->global->TAKEPOS_SHOW_HT_RECEIPT)) {
181 print
'<td class="right">' .
price($object->total_ht, 1) .
'</td>';
183 print
'<td class="right">' .
price($object->total_ttc, 1) .
'</td>';
186 foreach ($object->lines as $line) {
190 <?php
if (!empty($line->product_label)) {
191 echo $line->product_label;
193 echo $line->description;
196 <td
class=
"right"><?php echo $line->qty; ?></td>
197 <td
class=
"right"><?php
if ($gift != 1) {
201 if (!empty($conf->global->TAKEPOS_SHOW_HT_RECEIPT)) { ?>
202 <td
class=
"right"><?php
if ($gift != 1) {
203 echo
price($line->total_ht, 1);
208 <td
class=
"right"><?php
if ($gift != 1) {
209 echo
price($line->total_ttc, 1);
219 <table
class=
"right">
221 <th
class=
"right"><?php
if ($gift != 1) {
222 echo $langs->trans(
"TotalHT");
224 <td
class=
"right"><?php
if ($gift != 1) {
225 echo
price($object->total_ht, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
228 <?php
if ($conf->global->TAKEPOS_TICKET_VAT_GROUPPED) {
229 $vat_groups = array();
230 foreach ($object->lines as $line) {
231 if (!array_key_exists($line->tva_tx, $vat_groups)) {
232 $vat_groups[$line->tva_tx] = 0;
234 $vat_groups[$line->tva_tx] += $line->total_tva;
236 foreach ($vat_groups as $key => $val) {
239 <th align=
"right"><?php
if ($gift != 1) {
240 echo $langs->trans(
"VAT").
' '.
vatrate($key, 1);
242 <td align=
"right"><?php
if ($gift != 1) {
243 echo
price($val, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
250 <th
class=
"right"><?php
if ($gift != 1) {
251 echo $langs->trans(
"TotalVAT").
'</th><td class="right">'.
price($object->total_tva, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
256 <th
class=
"right"><?php
if ($gift != 1) {
257 echo
''.$langs->trans(
"TotalTTC").
'</th><td class="right">'.
price($object->total_ttc, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
261 if (
isModEnabled(
'multicurrency') && $_SESSION[
"takeposcustomercurrency"] !=
"" && $conf->currency != $_SESSION[
"takeposcustomercurrency"]) {
263 include_once DOL_DOCUMENT_ROOT.
'/multicurrency/class/multicurrency.class.php';
265 $multicurrency->fetch(0, $_SESSION[
"takeposcustomercurrency"]);
266 echo
'<tr><th class="right">';
268 echo
''.$langs->trans(
"TotalTTC").
' '.$_SESSION[
"takeposcustomercurrency"].
'</th><td class="right">'.
price($object->total_ttc * $multicurrency->rate->rate, 1,
'', 1, - 1, - 1, $_SESSION[
"takeposcustomercurrency"]).
"\n";
273 if ($conf->global->TAKEPOS_PRINT_PAYMENT_METHOD) {
274 $sql =
"SELECT p.pos_change as pos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
276 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiement_facture as pf, ".MAIN_DB_PREFIX.
"paiement as p";
277 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as cp ON p.fk_paiement = cp.id";
278 $sql .=
" WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".((int) $facid);
279 $sql .=
" ORDER BY p.datep";
280 $resql = $db->query($sql);
282 $num = $db->num_rows(
$resql);
285 $row = $db->fetch_object(
$resql);
287 echo
'<td class="right">';
288 echo $langs->transnoentitiesnoconv(
"PaymentTypeShort".$row->code);
290 echo
'<td class="right">';
291 $amount_payment = (
isModEnabled(
'multicurrency') && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount;
292 if ($row->code ==
"LIQ") {
293 $amount_payment = $amount_payment + $row->pos_change;
295 echo
price($amount_payment, 1,
'', 1, - 1, - 1, $conf->currency);
298 if ($row->code ==
"LIQ" && $row->pos_change > 0) {
300 echo
'<td class="right">';
301 echo $langs->trans(
"Change");
303 echo
'<td class="right">';
304 echo
price($row->pos_change, 1,
'', 1, - 1, - 1, $conf->currency);
314 <div style=
"border-top-style: double;">
319 $constFreeText =
'TAKEPOS_FOOTER'.(empty($_SESSION[
'takeposterminal']) ?
'0' : $_SESSION[
'takeposterminal']);
320 if (!empty($conf->global->TAKEPOS_FOOTER) || !empty($conf->global->{$constFreeText})) {
323 if (!empty($conf->global->{$constFreeText})) {
324 $newfreetext .=
make_substitutions($conf->global->{$constFreeText}, $substitutionarray);
326 if (!empty($conf->global->TAKEPOS_FOOTER)) {
327 $newfreetext .=
make_substitutions($conf->global->TAKEPOS_FOOTER, $substitutionarray);
333 <script
type=
"text/javascript">