28 if (!isset($action)) {
33 if (!defined(
'NOTOKENRENEWAL')) define(
'NOTOKENRENEWAL',
'1');
34 if (!defined(
'NOREQUIREMENU')) define(
'NOREQUIREMENU',
'1');
35 if (!defined(
'NOREQUIREHTML')) define(
'NOREQUIREHTML',
'1');
36 if (!defined(
'NOREQUIREAJAX')) define(
'NOREQUIREAJAX',
'1');
38 require
'../main.inc.php';
40 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
42 $langs->loadLangs(array(
"main",
"cashdesk",
"companies"));
44 $place = (
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') : 0);
46 $facid =
GETPOST(
'facid',
'int');
50 if (empty($user->rights->takepos->run)) {
63 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
65 $obj = $db->fetch_object(
$resql);
72 $object->fetch($facid);
75 $hookmanager->initHooks(array(
'takeposfrontend'), $facid);
76 $reshook = $hookmanager->executeHooks(
'TakeposReceipt', $parameters, $object);
77 if (!empty($hookmanager->resPrint)) {
78 print $hookmanager->resPrint;
99 <?php echo
'<b>'.$mysoc->name.
'</b>'; ?>
105 $constFreeText =
'TAKEPOS_HEADER'.$_SESSION[
'takeposterminal'];
106 if (!empty($conf->global->TAKEPOS_HEADER) || !empty($conf->global->{$constFreeText}))
110 if (!empty($conf->global->TAKEPOS_HEADER)) $newfreetext .=
make_substitutions($conf->global->TAKEPOS_HEADER, $substitutionarray);
111 if (!empty($conf->global->{$constFreeText})) $newfreetext .=
make_substitutions($conf->global->{$constFreeText}, $substitutionarray);
119 if (!empty($conf->global->TAKEPOS_RECEIPT_NAME))
print $conf->global->TAKEPOS_RECEIPT_NAME.
" ";
120 if ($object->statut ==
Facture::STATUS_DRAFT)
print str_replace(
")",
"", str_replace(
"-",
" ".$langs->trans(
'Place').
" ", str_replace(
"(PROV-POS", $langs->trans(
"Terminal").
" ", $object->ref)));
121 else print $object->ref;
122 if ($conf->global->TAKEPOS_SHOW_CUSTOMER)
124 if ($object->socid != $conf->global->{
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"]})
127 if ($object->socid > 0) $soc->fetch($object->socid);
128 else $soc->fetch($conf->global->{
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"]});
129 print "<br>".$langs->trans(
"Customer").
': '.$soc->name;
136 <table width=
"100%" style=
"border-top-style: double;">
139 <th
class=
"center"><?php
print $langs->trans(
"Label"); ?></th>
140 <th
class=
"right"><?php
print $langs->trans(
"Qty"); ?></th>
141 <th
class=
"right"><?php
if ($gift != 1)
print $langs->trans(
"Price"); ?></th>
142 <th
class=
"right"><?php
if ($gift != 1)
print $langs->trans(
"TotalTTC"); ?></th>
147 foreach ($object->lines as $line)
152 <?php
if (!empty($line->product_label)) echo $line->product_label;
153 else echo $line->description; ?>
155 <td
class=
"right"><?php echo $line->qty; ?></td>
156 <td
class=
"right"><?php
if ($gift != 1) echo
price(
price2num($line->total_ttc / $line->qty,
'MT'), 1); ?></td>
157 <td
class=
"right"><?php
if ($gift != 1) echo
price($line->total_ttc, 1); ?></td>
165 <table
class=
"right">
167 <th
class=
"right"><?php
if ($gift != 1) echo $langs->trans(
"TotalHT"); ?></th>
168 <td
class=
"right"><?php
if ($gift != 1) echo
price($object->total_ht, 1,
'', 1, - 1, - 1, $conf->currency).
"\n"; ?></td>
170 <?php
if ($conf->global->TAKEPOS_TICKET_VAT_GROUPPED) {
171 $vat_groups = array();
172 foreach ($object->lines as $line)
174 if (!array_key_exists($line->tva_tx, $vat_groups)) {
175 $vat_groups[$line->tva_tx] = 0;
177 $vat_groups[$line->tva_tx] += $line->total_tva;
179 foreach ($vat_groups as $key => $val) {
182 <th align=
"right"><?php
if ($gift != 1) echo $langs->trans(
"VAT").
' '.
vatrate($key, 1); ?></th>
183 <td align=
"right"><?php
if ($gift != 1) echo
price($val, 1,
'', 1, - 1, - 1, $conf->currency).
"\n"; ?></td>
189 <th
class=
"right"><?php
if ($gift != 1) echo $langs->trans(
"TotalVAT").
'</th><td class="right">'.
price($object->total_tva, 1,
'', 1, - 1, - 1, $conf->currency).
"\n"; ?></td>
193 <th
class=
"right"><?php
if ($gift != 1) echo
''.$langs->trans(
"TotalTTC").
'</th><td class="right">'.
price($object->total_ttc, 1,
'', 1, - 1, - 1, $conf->currency).
"\n"; ?></td>
196 if (!empty($conf->multicurrency->enabled) && $_SESSION[
"takeposcustomercurrency"] !=
"" && $conf->currency != $_SESSION[
"takeposcustomercurrency"]) {
198 include_once DOL_DOCUMENT_ROOT.
'/multicurrency/class/multicurrency.class.php';
200 $multicurrency->fetch(0, $_SESSION[
"takeposcustomercurrency"]);
201 echo
'<tr><th class="right">';
202 if ($gift != 1) echo
''.$langs->trans(
"TotalTTC").
' '.$_SESSION[
"takeposcustomercurrency"].
'</th><td class="right">'.
price($object->total_ttc * $multicurrency->rate->rate, 1,
'', 1, - 1, - 1, $_SESSION[
"takeposcustomercurrency"]).
"\n";
206 if ($conf->global->TAKEPOS_PRINT_PAYMENT_METHOD) {
207 $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,";
209 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiement_facture as pf, ".MAIN_DB_PREFIX.
"paiement as p";
210 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as cp ON p.fk_paiement = cp.id";
211 $sql .=
" WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$facid;
212 $sql .=
" ORDER BY p.datep";
213 $resql = $db->query($sql);
216 $num = $db->num_rows(
$resql);
219 $row = $db->fetch_object(
$resql);
221 echo
'<td class="right">';
222 echo $langs->transnoentitiesnoconv(
"PaymentTypeShort".$row->code);
224 echo
'<td class="right">';
225 $amount_payment = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount;
226 if ($row->code ==
"LIQ") $amount_payment = $amount_payment + $row->pos_change;
227 echo
price($amount_payment, 1,
'', 1, - 1, - 1, $conf->currency);
230 if ($row->code ==
"LIQ" && $row->pos_change > 0)
233 echo
'<td class="right">';
234 echo $langs->trans(
"Change");
236 echo
'<td class="right">';
237 echo
price($row->pos_change, 1,
'', 1, - 1, - 1, $conf->currency);
247 <div style=
"border-top-style: double;">
252 $constFreeText =
'TAKEPOS_FOOTER'.$_SESSION[
'takeposterminal'];
253 if (!empty($conf->global->TAKEPOS_FOOTER) || !empty($conf->global->{$constFreeText}))
257 if (!empty($conf->global->{$constFreeText})) $newfreetext .=
make_substitutions($conf->global->{$constFreeText}, $substitutionarray);
258 if (!empty($conf->global->TAKEPOS_FOOTER)) $newfreetext .=
make_substitutions($conf->global->TAKEPOS_FOOTER, $substitutionarray);
263 <script
type=
"text/javascript">
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype= 'text/html', $forcenocache=0)
Show HTTP header.
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...
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
Class to manage third parties objects (customers, suppliers, prospects...)
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
const STATUS_DRAFT
Draft status.
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 ...
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages...
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
make_substitutions($text, $substitutionarray, $outputlangs=null)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
Class to manage invoices.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type