30if (!defined(
'NOTOKENRENEWAL')) {
31 define(
'NOTOKENRENEWAL',
'1');
33if (!defined(
'NOREQUIREMENU')) {
34 define(
'NOREQUIREMENU',
'1');
36if (!defined(
'NOREQUIREHTML')) {
37 define(
'NOREQUIREHTML',
'1');
39if (!defined(
'NOREQUIREAJAX')) {
40 define(
'NOREQUIREAJAX',
'1');
44require
'../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
59$langs->loadLangs(array(
"bills",
"cashdesk"));
61$place = (
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0');
63$invoiceid =
GETPOST(
'invoiceid',
'int');
66$action =
GETPOST(
'action',
'aZ09');
68if (!$user->hasRight(
'takepos',
'run')) {
75 $invoice->fetch($invoiceid);
77 $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
'takeposterminal'].
'-'.$place.
')');
82$constforcompanyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
'takeposterminal'];
84if ($invoice->socid > 0) {
85 $soc->fetch($invoice->socid);
96$arrayofcss = array(
'/takepos/css/pos.css.php');
104 var vatRate =
'<?php echo dol_escape_js($vatRateDefault); ?>';
112 function ApplyVATRate(
id, rate) {
113 console.log(
"Save selected VAT Rate into vatRate variable with value "+rate);
115 jQuery(
'button.vat_rate').removeClass(
'selected');
116 jQuery(
'#vat_rate_'+
id).addClass(
'selected');
123 console.log(
"We click so we call page invoice.php with invoiceid=<?php echo $invoiceid; ?>, place=<?php echo $place; ?>, amount="+$(
"#number").val()+
", tva_tx="+vatRate);
124 parent.$(
"#poslines").load(
"<?php echo DOL_URL_ROOT; ?>/takepos/invoice.php?action=freezone&token=<?php echo newToken(); ?>&invoiceid=<?php echo $invoiceid; ?>&place=<?php echo $place; ?>&number="+$(
"#number").val()+
"&tva_tx="+vatRate, {desc:$(
"#desc").val()});
125 parent.$.colorbox.close();
128 $( document ).ready(
function() {
136<input
type=
"text" id=
"desc" name=
"desc" class=
"takepospay" style=
"width:40%;" placeholder=
"<?php echo $langs->trans('Description'); ?>">
138if ($action ==
"freezone" && $user->hasRight(
'takepos',
'run')) {
139 echo
'<input type="text" id="number" name="number" class="takepospay" style="width:15%;" placeholder="'.$langs->trans(
getDolGlobalString(
"TAKEPOS_CHANGE_PRICE_HT") ?
'AmountHT' :
'AmountTTC').
'">';
141if ($action ==
"addnote" && $user->hasRight(
'takepos',
'run')) {
142 echo
'<input type="hidden" id="number" name="number" value="'.$idline.
'">';
145<input
type=
"hidden" name=
"place" class=
"takepospay" value=
"<?php echo $place; ?>">
146<input
type=
"submit" class=
"button takepospay clearboth" value=
"OK" onclick=
"Save(); return false;">
149if ($action ==
'freezone' && !
getDolGlobalString(
"TAKEPOS_USE_DEFAULT_VATRATE_FOR_FREEZONE") && $user->hasRight(
'takepos',
'run')) {
150 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
152 $form =
new Form($db);
153 $num = $form->load_cache_vatrates(
"'".$mysoc->country_code.
"'");
156 print $langs->trans(
'VAT').
' : ';
157 foreach ($form->cache_vatrates as $rate) {
158 print
'<button type="button" class="button item_value vat_rate'.($rate[
'txtva'] == $vatRateDefault ?
' selected' :
'').
'" id="vat_rate_'.$rate[
'rowid'].
'" onclick="ApplyVATRate(\''.$rate[
'rowid'].
'\', \
''.$rate[
'txtva'].
'\');
">'.$rate['txtva'].' %</button>';
Class to manage invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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.
get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
Function that return vat rate of a product line (according to seller, buyer and product vat rate) VAT...
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.