From 15e50ecdb39fb389efc26f41c212cd702bb100fe Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 9 Sep 2015 21:35:41 +0200 Subject: [PATCH] Update work --- htdocs/compta/tva/card.php | 28 +++++++++++++-------------- htdocs/compta/tva/class/tva.class.php | 8 ++++++-- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 33c795ed10b..78883afbc30 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -167,8 +167,8 @@ if ($action == 'delete') /* -* View -*/ + * View + */ llxHeader(); @@ -194,16 +194,16 @@ if ($action == 'create') { print "\n".''."\n"; + $("#radiopayment").click(function() { + $("#label").val($(this).data("label")); + + }); + $("#radiorefund").click(function() { + $("#label").val($(this).data("label")); + + }); + });'; + print ''."\n"; } print '
'; @@ -215,13 +215,13 @@ if ($action == 'create') print $langs->trans("Type").':   '; print ''; print ''; print '   '; print ''; diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 74f77a9f8ea..68aeeebc2c8 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -577,8 +577,12 @@ class Tva extends CommonObject $result=$acc->fetch($this->accountid); if ($result <= 0) dol_print_error($this->db); - $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs($this->amount), '', '', $user); - + if ($this->amount > 0) { + $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs($this->amount), '', '', $user); + } else { + $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, abs($this->amount), '', '', $user); + } + // Update fk_bank into llx_tva. So we know vat line used to generate bank transaction if ($bank_line_id > 0) {