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'));
85 $reshook = $hookmanager->executeHooks(
'TakeposReceipt', $parameters, $object);
86 if (!empty($hookmanager->resPrint)) {
87 print $hookmanager->resPrint;
107 <?php echo
'<b>'.$mysoc->name.
'</b>'; ?>
113 $constFreeText =
'TAKEPOS_HEADER'.$_SESSION[
'takeposterminal'];
114 if (!empty($conf->global->TAKEPOS_HEADER) || !empty($conf->global->{$constFreeText})) {
117 if (!empty($conf->global->TAKEPOS_HEADER)) {
118 $newfreetext .=
make_substitutions($conf->global->TAKEPOS_HEADER, $substitutionarray);
120 if (!empty($conf->global->{$constFreeText})) {
121 $newfreetext .=
make_substitutions($conf->global->{$constFreeText}, $substitutionarray);
123 print nl2br($newfreetext);
129 print $langs->trans(
'Date').
" ".
dol_print_date($object->date,
'day').
'<br>';
130 if (!empty($conf->global->TAKEPOS_RECEIPT_NAME)) {
131 print $conf->global->TAKEPOS_RECEIPT_NAME.
" ";
134 print str_replace(
")",
"", str_replace(
"-",
" ".$langs->trans(
'Place').
" ", str_replace(
"(PROV-POS", $langs->trans(
"Terminal").
" ", $object->ref)));
138 if ($conf->global->TAKEPOS_SHOW_CUSTOMER) {
139 if ($object->socid != $conf->global->{
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"]}) {
141 if ($object->socid > 0) {
142 $soc->fetch($object->socid);
144 $soc->fetch($conf->global->{
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"]});
146 print
"<br>".$langs->trans(
"Customer").
': '.$soc->name;
153 <table width=
"100%" style=
"border-top-style: double;">
156 <th
class=
"center"><?php print $langs->trans(
"Label"); ?></th>
157 <th
class=
"right"><?php print $langs->trans(
"Qty"); ?></th>
158 <th
class=
"right"><?php
if ($gift != 1) {
159 print $langs->trans(
"Price");
161 <?php
if (!empty($conf->global->TAKEPOS_SHOW_HT_RECEIPT)) { ?>
162 <th
class=
"right"><?php
if ($gift != 1) {
163 print $langs->trans(
"TotalHT");
166 <th
class=
"right"><?php
if ($gift != 1) {
167 print $langs->trans(
"TotalTTC");
173 if ($action ==
'without_details') {
176 print
'<td>' .
GETPOST(
'label',
'alphanohtml') .
'</td>';
177 print
'<td class="right">' . $qty .
'</td>';
178 print
'<td class="right">' .
price(
price2num($object->total_ttc / $qty,
'MU'), 1) .
'</td>';
179 if (!empty($conf->global->TAKEPOS_SHOW_HT_RECEIPT)) {
180 print
'<td class="right">' .
price($object->total_ht, 1) .
'</td>';
182 print
'<td class="right">' .
price($object->total_ttc, 1) .
'</td>';
185 foreach ($object->lines as $line) {
189 <?php
if (!empty($line->product_label)) {
190 echo $line->product_label;
192 echo $line->description;
195 <td
class=
"right"><?php echo $line->qty; ?></td>
196 <td
class=
"right"><?php
if ($gift != 1) {
200 if (!empty($conf->global->TAKEPOS_SHOW_HT_RECEIPT)) { ?>
201 <td
class=
"right"><?php
if ($gift != 1) {
202 echo
price($line->total_ht, 1);
207 <td
class=
"right"><?php
if ($gift != 1) {
208 echo
price($line->total_ttc, 1);
218 <table
class=
"right">
220 <th
class=
"right"><?php
if ($gift != 1) {
221 echo $langs->trans(
"TotalHT");
223 <td
class=
"right"><?php
if ($gift != 1) {
224 echo
price($object->total_ht, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
227 <?php
if ($conf->global->TAKEPOS_TICKET_VAT_GROUPPED) {
228 $vat_groups = array();
229 foreach ($object->lines as $line) {
230 if (!array_key_exists($line->tva_tx, $vat_groups)) {
231 $vat_groups[$line->tva_tx] = 0;
233 $vat_groups[$line->tva_tx] += $line->total_tva;
235 foreach ($vat_groups as $key => $val) {
238 <th align=
"right"><?php
if ($gift != 1) {
239 echo $langs->trans(
"VAT").
' '.
vatrate($key, 1);
241 <td align=
"right"><?php
if ($gift != 1) {
242 echo
price($val, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
249 <th
class=
"right"><?php
if ($gift != 1) {
250 echo $langs->trans(
"TotalVAT").
'</th><td class="right">'.
price($object->total_tva, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
255 <th
class=
"right"><?php
if ($gift != 1) {
256 echo
''.$langs->trans(
"TotalTTC").
'</th><td class="right">'.
price($object->total_ttc, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
260 if (
isModEnabled(
'multicurrency') && $_SESSION[
"takeposcustomercurrency"] !=
"" && $conf->currency != $_SESSION[
"takeposcustomercurrency"]) {
262 include_once DOL_DOCUMENT_ROOT.
'/multicurrency/class/multicurrency.class.php';
264 $multicurrency->fetch(0, $_SESSION[
"takeposcustomercurrency"]);
265 echo
'<tr><th class="right">';
267 echo
''.$langs->trans(
"TotalTTC").
' '.$_SESSION[
"takeposcustomercurrency"].
'</th><td class="right">'.
price($object->total_ttc * $multicurrency->rate->rate, 1,
'', 1, - 1, - 1, $_SESSION[
"takeposcustomercurrency"]).
"\n";
272 if ($conf->global->TAKEPOS_PRINT_PAYMENT_METHOD) {
273 $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,";
275 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiement_facture as pf, ".MAIN_DB_PREFIX.
"paiement as p";
276 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as cp ON p.fk_paiement = cp.id";
277 $sql .=
" WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".((int) $facid);
278 $sql .=
" ORDER BY p.datep";
279 $resql = $db->query($sql);
281 $num = $db->num_rows(
$resql);
284 $row = $db->fetch_object(
$resql);
286 echo
'<td class="right">';
287 echo $langs->transnoentitiesnoconv(
"PaymentTypeShort".$row->code);
289 echo
'<td class="right">';
290 $amount_payment = (
isModEnabled(
'multicurrency') && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount;
291 if ($row->code ==
"LIQ") {
292 $amount_payment = $amount_payment + $row->pos_change;
294 echo
price($amount_payment, 1,
'', 1, - 1, - 1, $conf->currency);
297 if ($row->code ==
"LIQ" && $row->pos_change > 0) {
299 echo
'<td class="right">';
300 echo $langs->trans(
"Change");
302 echo
'<td class="right">';
303 echo
price($row->pos_change, 1,
'', 1, - 1, - 1, $conf->currency);
313 <div style=
"border-top-style: double;">
318 $constFreeText =
'TAKEPOS_FOOTER'.$_SESSION[
'takeposterminal'];
319 if (!empty($conf->global->TAKEPOS_FOOTER) || !empty($conf->global->{$constFreeText})) {
322 if (!empty($conf->global->{$constFreeText})) {
323 $newfreetext .=
make_substitutions($conf->global->{$constFreeText}, $substitutionarray);
325 if (!empty($conf->global->TAKEPOS_FOOTER)) {
326 $newfreetext .=
make_substitutions($conf->global->TAKEPOS_FOOTER, $substitutionarray);
332 <script
type=
"text/javascript">
334 if ($facid) print
'window.print();';
Class to manage invoices.
const STATUS_DRAFT
Draft status.
Class to manage third parties objects (customers, suppliers, prospects...)
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("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->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
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).
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)
Return array of possible common substitutions.
isModEnabled($module)
Is Dolibarr module enabled.
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
if(!defined('NOREQUIREMENU')) 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.