NEW add VAT rates in free zone for product/service in cash desk
This commit is contained in:
parent
1212a63365
commit
f7cf5f8784
@ -50,6 +50,7 @@ top_httphead('text/css');
|
|||||||
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
|
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
|
||||||
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate');
|
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate');
|
||||||
else header('Cache-Control: no-cache');
|
else header('Cache-Control: no-cache');
|
||||||
|
header('Cache-Control: no-cache');
|
||||||
|
|
||||||
|
|
||||||
require DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
require DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||||
@ -119,7 +120,7 @@ button.calcbutton2 {
|
|||||||
width: calc(25% - 2px);
|
width: calc(25% - 2px);
|
||||||
height: calc(25% - 2px);
|
height: calc(25% - 2px);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 8pt;
|
font-size: 10pt;
|
||||||
margin: 1px;
|
margin: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,6 +160,19 @@ button.actionbutton {
|
|||||||
border-width: 0;
|
border-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button.item_value {
|
||||||
|
background: #bbbbbb;
|
||||||
|
border: #000000 1px solid;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.item_value.selected {
|
||||||
|
background: #ffffff;
|
||||||
|
color: #000000;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
div[aria-describedby="dialog-info"] button:before {
|
div[aria-describedby="dialog-info"] button:before {
|
||||||
content: "\f788";
|
content: "\f788";
|
||||||
font-family: "Font Awesome 5 Free";
|
font-family: "Font Awesome 5 Free";
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/takepos/floors.php
|
* \file htdocs/takepos/freezone.php
|
||||||
* \ingroup takepos
|
* \ingroup takepos
|
||||||
* \brief Popup to enter a free line
|
* \brief Popup to enter a free line
|
||||||
*/
|
*/
|
||||||
@ -32,6 +32,11 @@ if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
|||||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||||
|
|
||||||
require '../main.inc.php'; // Load $user and permissions
|
require '../main.inc.php'; // Load $user and permissions
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||||
|
|
||||||
|
global $mysoc;
|
||||||
|
|
||||||
$langs->loadLangs(array("bills", "cashdesk"));
|
$langs->loadLangs(array("bills", "cashdesk"));
|
||||||
|
|
||||||
@ -40,6 +45,20 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place
|
|||||||
$idline = GETPOST('idline', 'int');
|
$idline = GETPOST('idline', 'int');
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
|
// get invoice
|
||||||
|
$invoice = new Facture($db);
|
||||||
|
if ($place > 0) {
|
||||||
|
$invoice->fetch($place);
|
||||||
|
} else {
|
||||||
|
$invoice->fetch('', '(PROV-POS'.$_SESSION['takeposterminal'].'-'.$place.')');
|
||||||
|
}
|
||||||
|
|
||||||
|
// get default vat rate
|
||||||
|
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION['takeposterminal'];
|
||||||
|
$soc = new Societe($db);
|
||||||
|
if ($invoice->socid > 0) $soc->fetch($invoice->socid);
|
||||||
|
else $soc->fetch($conf->global->$constforcompanyid);
|
||||||
|
$vatRateDefault = get_default_tva($mysoc, $soc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -48,12 +67,28 @@ $action = GETPOST('action', 'alpha');
|
|||||||
$arrayofcss = array('/takepos/css/pos.css.php');
|
$arrayofcss = array('/takepos/css/pos.css.php');
|
||||||
$arrayofjs = array();
|
$arrayofjs = array();
|
||||||
|
|
||||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
|
var vatRate = '<?php echo dol_escape_js($vatRateDefault); ?>';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply new VAT rate
|
||||||
|
*
|
||||||
|
* @param {string} id VAT id
|
||||||
|
* @param {string} rate VAT rate
|
||||||
|
*/
|
||||||
|
function ApplyVATRate(id, rate) {
|
||||||
|
vatRate = rate;
|
||||||
|
jQuery('button.vat_rate').removeClass('selected');
|
||||||
|
jQuery('#vat_rate_' + id).addClass('selected');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save (validate)
|
||||||
|
*/
|
||||||
function Save() {
|
function Save() {
|
||||||
$.get( "invoice.php", { action: "<?php echo $action; ?>", place: "<?php echo $place; ?>", desc:$('#desc').val(), number:$('#number').val()} );
|
$.get( "invoice.php", { action: "<?php echo $action; ?>", place: "<?php echo $place; ?>", desc:$('#desc').val(), number:$('#number').val(), tva_tx: vatRate} );
|
||||||
parent.$.colorbox.close();
|
parent.$.colorbox.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,6 +107,21 @@ if ($action == "addnote") echo '<input type="hidden" id="number" name="number" v
|
|||||||
?>
|
?>
|
||||||
<input type="hidden" name="place" class="takepospay" value="<?php echo $place; ?>">
|
<input type="hidden" name="place" class="takepospay" value="<?php echo $place; ?>">
|
||||||
<input type="button" class="button takepospay clearboth" value="OK" onclick="Save();">
|
<input type="button" class="button takepospay clearboth" value="OK" onclick="Save();">
|
||||||
|
<?php
|
||||||
|
if ($action == 'freezone') {
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
$num = $form->load_cache_vatrates("'" . $mysoc->country_code . "'");
|
||||||
|
if ($num > 0) {
|
||||||
|
print '<br><br>';
|
||||||
|
print $langs->trans('VAT') . ' : ';
|
||||||
|
foreach ($form->cache_vatrates as $rate) {
|
||||||
|
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>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
</center>
|
</center>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||||
|
|
||||||
|
global $mysoc;
|
||||||
|
|
||||||
$langs->loadLangs(array("companies", "commercial", "bills", "cashdesk", "stocks"));
|
$langs->loadLangs(array("companies", "commercial", "bills", "cashdesk", "stocks"));
|
||||||
|
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
@ -327,7 +329,12 @@ if ($action == "freezone") {
|
|||||||
$customer = new Societe($db);
|
$customer = new Societe($db);
|
||||||
$customer->fetch($invoice->socid);
|
$customer->fetch($invoice->socid);
|
||||||
|
|
||||||
|
$tva_tx = GETPOST('tva_tx', 'alpha');
|
||||||
|
if ($tva_tx != '') {
|
||||||
|
$tva_tx = price2num($tva_tx);
|
||||||
|
} else {
|
||||||
$tva_tx = get_default_tva($mysoc, $customer);
|
$tva_tx = get_default_tva($mysoc, $customer);
|
||||||
|
}
|
||||||
|
|
||||||
// Local Taxes
|
// Local Taxes
|
||||||
$localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
|
$localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user