[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 183/323: Task #0001536: Achat - Vente : n'uti
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 183/323: Task #0001536: Achat - Vente : n'utilisez que les codes TVA disponibles |
Date: |
Wed, 14 Mar 2018 17:38:46 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 90ee4d4f475d1b313808913ebc1a69aa000b106a
Author: Dany De Bontridder <address@hidden>
Date: Sat Feb 10 14:44:23 2018 +0100
Task #0001536: Achat - Vente : n'utilisez que les codes TVA disponibles
---
html/ajax_misc.php | 24 +++++++++++++++++++++++-
html/js/scripts.js | 2 ++
include/class/acc_ledger_purchase.class.php | 1 +
include/class/acc_ledger_sold.class.php | 1 +
include/lib/itva_popup.class.php | 19 +++++++++++++++++--
5 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 13e11d4..70f4f93 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -419,7 +419,29 @@ EOF;
break;
case 'dsp_tva':
$cn = Dossier::connect();
- $Res = $cn->exec_sql("select * from tva_rate order by tva_rate
desc");
+ // Filter the VAT
+ $filter=$http->get("filter","string","none");
+ if ( $filter == 'sale') {
+ $Res = $cn->exec_sql("select *
+ from v_tva_rate
+ where
+ tva_sale <> '#'
+ order by tva_rate desc");
+
+ } elseif ($filter == "purchase") {
+
+ $Res = $cn->exec_sql("select *
+ from
+ v_tva_rate
+ where
+ tva_purchase <> '#'
+ order by tva_rate desc");
+ }else {
+
+ $Res = $cn->exec_sql("select * from v_tva_rate
+ where
+ order by tva_rate desc");
+ }
$Max = Database::num_row($Res);
$r = "";
$r.=HtmlInput::title_box(_('Choisissez la
TVA'),'tva_select',"close","","y");
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 6c8d1d3..46ddea9 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -496,6 +496,8 @@ function popup_select_tva(obj)
queryString += '&code=' + obj.jcode;
if (obj.compute)
queryString += '&compute=' + obj.compute;
+ if (obj.filter)
+ queryString += '&filter=' + obj.filter;
var action = new Ajax.Request(
"ajax_misc.php",
diff --git a/include/class/acc_ledger_purchase.class.php
b/include/class/acc_ledger_purchase.class.php
index c931a09..7dfc938 100644
--- a/include/class/acc_ledger_purchase.class.php
+++ b/include/class/acc_ledger_purchase.class.php
@@ -1262,6 +1262,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$Tva->js="onblur=\"format_number(this);onChange=clean_tva($i);compute_ledger($i)\"";
$Tva->in_table=true;
$Tva->set_attribute('compute',$i);
+ $Tva->set_filter("purchase");
$Tva->value=$march_tva_id;
$array[$i]['tva']=$Tva->input("e_march$i"."_tva_id");
diff --git a/include/class/acc_ledger_sold.class.php
b/include/class/acc_ledger_sold.class.php
index 6dbf6b1..b7e8d53 100644
--- a/include/class/acc_ledger_sold.class.php
+++ b/include/class/acc_ledger_sold.class.php
@@ -1291,6 +1291,7 @@ EOF;
$Tva = new ITva_Popup($this->db);
$Tva->in_table = true;
$Tva->set_attribute('compute', $i);
+ $Tva->set_filter("sale");
$Tva->js = 'onblur="format_number(this);clean_tva(' . $i .
');compute_ledger(' . $i . ')"';
$Tva->value = $march_tva_id;
diff --git a/include/lib/itva_popup.class.php b/include/lib/itva_popup.class.php
index f4731a3..948ddda 100644
--- a/include/lib/itva_popup.class.php
+++ b/include/lib/itva_popup.class.php
@@ -54,13 +54,15 @@ class ITva_Popup extends HtmlInput
* to have its own javascript for the button you can use
this->but_javascript)
* by default it is 'popup_select_tva(this)';
*/
+ private $filter; //!< filter the VAT by ledger PURCHASE or SALE or NO
FILTER, default=NO
public function __construct($p_name=null,$p_value="",$p_id="")
{
$this->name=$p_name;
$this->button=true;
$this->in_table=false;
- $this->value=$p_value;
- $this->id=$p_id;
+ $this->value=$p_value;
+ $this->id=$p_id;
+ $this->filter='none';
}
function with_button($p)
{
@@ -114,6 +116,18 @@ class ITva_Popup extends HtmlInput
}
/**
+ * Set a filter to limit the choice of VAT ;
+ * possible values are :
+ * - sale if there is an accounting for sale
+ * - purchase if there is an accounting for purchase
+ * - none : show VAT
+ *
+ */
+ function set_filter($p_filter)
+ {
+ $this->filter=$p_filter;
+ }
+ /**
address@hidden show a button, if it is pushed show a popup to select the
need vat
address@hidden
* - a ipopup must be created before with the name popup_tva
@@ -136,6 +150,7 @@ class ITva_Popup extends HtmlInput
$bt->set_attribute('jcode',$this->code->name);
if ( isset($this->compute))
$bt->set_attribute('compute',$this->compute);
+ $bt->set_attribute("filter", $this->filter);
$bt->javascript=(isset($this->but_javascript))?$this->but_javascript:'popup_select_tva(this)';
$r=$bt->input();
return $r;
- [Noalyss-commit] [noalyss] 224/323: Dashboard : Add event improve cosmetic, (continued)
- [Noalyss-commit] [noalyss] 224/323: Dashboard : Add event improve cosmetic, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 205/323: CSS : recover box, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 210/323: sorttable.js : alternate properly the color of the table rows, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 220/323: Welcome : adapt to small screen, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 195/323: demo is inactive by default, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 211/323: sorttable.js : Add an icon if the column is already sorted, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 196/323: Fix SQL, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 227/323: patch sql : remove commented code, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 225/323: Dashboard : Fix box, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 181/323: Task #0001535: TVA : réécriture du module CFGTVA, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 183/323: Task #0001536: Achat - Vente : n'utilisez que les codes TVA disponibles,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 215/323: Plugin : fix doc, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 213/323: Plugin : fix indent, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 234/323: Fix warning, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 230/323: index.css : CSS responsive, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 249/323: SQL Patch : correct syntax for new version, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 252/323: PLANANC : fix bug when creating first plan, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 226/323: Dashboard : remove dead code, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 217/323: Periode : fix bug, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 208/323: Missing file, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 233/323: Backward comptability for SQL function, Dany De Bontridder, 2018/03/14