mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
New: refund VAT
This commit is contained in:
@@ -33,7 +33,9 @@ $langs->load("banks");
|
||||
$langs->load("bills");
|
||||
|
||||
$id=GETPOST("id",'int');
|
||||
$action=GETPOST('action');
|
||||
$action=GETPOST("action","alpha");
|
||||
$refund=GETPOST("refund","int");
|
||||
if (empty($refund)) $refund=0;
|
||||
|
||||
// Security check
|
||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||
@@ -46,7 +48,6 @@ $tva = new Tva($db);
|
||||
$hookmanager->initHooks(array('taxvatcard','globalcard'));
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Actions
|
||||
*/
|
||||
@@ -69,7 +70,12 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
$tva->num_payment=GETPOST("num_payment");
|
||||
$tva->datev=$datev;
|
||||
$tva->datep=$datep;
|
||||
$tva->amount=GETPOST("amount");
|
||||
|
||||
$amount = GETPOST("amount");
|
||||
if ($refund == 1) {
|
||||
$amount= -$amount;
|
||||
}
|
||||
$tva->amount= $amount;
|
||||
$tva->label=GETPOST("label");
|
||||
$tva->note=GETPOST("note");
|
||||
|
||||
@@ -182,11 +188,45 @@ if ($id)
|
||||
// Formulaire saisie tva
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<form name='add' action=\"card.php\" method=\"post\">\n";
|
||||
print_fiche_titre($langs->trans("VAT") . ' - ' . $langs->trans("New"));
|
||||
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#radiopayment").click(function() {
|
||||
$("#Label").html(document.formvat.Label.value);
|
||||
document.formvat.refund.value=0;
|
||||
});
|
||||
$("#radiorefund").click(function() {
|
||||
$("#Label").html(document.formvat.Label.value);
|
||||
document.formsoc.refund.value=1;
|
||||
});
|
||||
});';
|
||||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" name="formvat" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print_fiche_titre($langs->trans("NewVATPayment"));
|
||||
print '<div id="selectmethod">';
|
||||
print '<div class="hideonsmartphone float">';
|
||||
print $langs->trans("Type").': ';
|
||||
print '</div>';
|
||||
print '<label for="radiopayment">';
|
||||
print '<input type="radio" id="radiopayment" class="flat" name="refund" value="0"'.($refund?'':' checked').'>';
|
||||
print ' ';
|
||||
print $langs->trans("Payment");
|
||||
print '</label>';
|
||||
print ' ';
|
||||
print '<label for="radiorefund">';
|
||||
print '<input type="radio" id="radiorefund" class="flat" name="refund" value="1"'.($refund?' checked':'').'>';
|
||||
print ' ';
|
||||
print $langs->trans("Refund");
|
||||
print '</label>';
|
||||
print '</div>';
|
||||
print "<br>\n";
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
@@ -202,7 +242,12 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->trans("VATPayment")).'"></td></tr>';
|
||||
if ($refund == 1) {
|
||||
$label = $langs->trans("VATRefund");
|
||||
} else {
|
||||
$label = $langs->trans("VATPayment");
|
||||
}
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" id="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$label).'"></td></tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.$_POST["amount"].'"></td></tr>';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2011-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -508,7 +508,7 @@ class Tva extends CommonObject
|
||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
|
||||
return -3;
|
||||
}
|
||||
if ($this->amount < 0 || $this->amount == '')
|
||||
if ($this->amount == '')
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
|
||||
return -4;
|
||||
|
||||
@@ -200,8 +200,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2251__+MAX_llx_menu__, 'accountancy', '', 2250__+MAX_llx_menu__, '/compta/sociales/charges.php?leftmenu=tax_social&action=create', 'MenuNewSocialContribution', 2, '', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2252__+MAX_llx_menu__, 'accountancy', '', 2250__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly', 'Payments', 2, '', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS)', __HANDLER__, 'left', 2300__+MAX_llx_menu__, 'accountancy', 'tax_vat', 2200__+MAX_llx_menu__, '/compta/tva/index.php?leftmenu=tax_vat&mainmenu=accountancy', 'VAT', 1, 'companies', '$user->rights->tax->charges->lire', '', 0, 7, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2301__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/card.php?leftmenu=tax_vat&action=create', 'NewPayment', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2302__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/reglement.php?leftmenu=tax_vat', 'Payments', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2301__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/card.php?leftmenu=tax_vat&action=create', 'New', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2302__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/reglement.php?leftmenu=tax_vat', 'List', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?leftmenu=tax_vat', 'ReportByCustomers', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
|
||||
-- Ventilation (accounting)
|
||||
|
||||
@@ -866,8 +866,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if (empty($conf->global->TAX_DISABLE_VAT_MENUS))
|
||||
{
|
||||
$newmenu->add("/compta/tva/index.php?leftmenu=tax_vat&mainmenu=accountancy",$langs->trans("VAT"),1,$user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat');
|
||||
if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
|
||||
if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/reglement.php?leftmenu=tax_vat",$langs->trans("Payments"),2,$user->rights->tax->charges->lire);
|
||||
if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create",$langs->trans("New"),2,$user->rights->tax->charges->creer);
|
||||
if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/reglement.php?leftmenu=tax_vat",$langs->trans("List"),2,$user->rights->tax->charges->lire);
|
||||
if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
|
||||
if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire);
|
||||
global $mysoc;
|
||||
|
||||
@@ -91,6 +91,8 @@ LT1PaymentES=RE Payment
|
||||
LT1PaymentsES=RE Payments
|
||||
VATPayment=VAT Payment
|
||||
VATPayments=VAT Payments
|
||||
VATRefund=VAT Refund
|
||||
Refund=Refund
|
||||
SocialContributionsPayments=Social/fiscal taxes payments
|
||||
ShowVatPayment=Show VAT payment
|
||||
TotalToPay=Total to pay
|
||||
|
||||
Reference in New Issue
Block a user