';
+ $html=escape_xml($r);
+
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+$html
+$popup
+
+EOF;
+
+ break;
}
diff --git a/html/compute.php b/html/compute.php
index 695d2290e..2bb2b8afc 100644
--- a/html/compute.php
+++ b/html/compute.php
@@ -50,10 +50,18 @@ $cn=new Database(dossier::id());
$User=new User($cn);
$User->Check();
+/**
+ *@todo check with my_own if the vat must be computed instead of
+ *a special value
+ */
// Retrieve the rate of vat, it $t == -1 it means no VAT
if ( $t != -1 ){
$tva_rate=new Acc_Tva($cn);
$tva_rate->set_parameter('id',$t);
+ /**
+ *@todo if the tva_rate->load failed we have to return an
+ *error message "invalid tva"
+ */
$tva_rate->load();
}
diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js
index 6a51bd000..c152ea9f5 100644
--- a/html/js/acc_ledger.js
+++ b/html/js/acc_ledger.js
@@ -184,6 +184,9 @@ function compute_ledger(p_ctl_nb) {
var qcode=g("e_march"+p_ctl_nb).value;
if ( qcode.length == 0 ) { clean_ledger(p_ctl_nb);refresh_ledger();return;}
+ /**
+ *@todo if tva_id is empty send a value of -1
+ */
var tva_id=-1;
if ( g('e_march'+p_ctl_nb+'_tva_id') ) {
tva_id=g('e_march'+p_ctl_nb+'_tva_id').value;
@@ -223,12 +226,16 @@ function refresh_ledger() {
if (g('tvac')) g('tvac').innerHTML=Math.round(tvac*100)/100;
}
/**
- * @brief update the field htva, tva_id and tvac, callback function for compute_sold
+ *@brief update the field htva, tva_id and tvac, callback function for compute_sold
* it the field TVA in the answer contains NA it means that VAT is appliable and then do not
* update the VAT field except htva_martc
*/
function success_compute_ledger(request,json) {
-
+ /**
+ *@todo add a control
+ * - 0 everything is ok
+ * - 1 tva id is invalid
+ */
var answer=request.responseText.evalJSON(true);
var ctl=answer.ctl;
var rtva=answer.tva;
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 1d54b88a4..b976b9363 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -276,4 +276,40 @@ function success_cat_doc_remove(req) {
$('X'+row_id).style.display='none';
}
catch (e) { alert(e.message);}
+}
+/**
+ *@brief display the popup with vat and explanation
+ *@param obj with 4 attributes gdossier, ctl,popup and phpsessid
+ */
+function popup_select_tva(obj) {
+ try {
+ showIPopup(obj.popup);
+ var queryString="PHPSESSID="+obj.phpsessid+"&gDossier="+obj.gDossier+"&op=dsp_tva"+"&ctl="+obj.ctl+'&popup='+obj.popup;
+ var action = new Ajax.Request(
+ "ajax_misc.php" ,
+ { method:'get',
+ parameters:queryString,
+ onFailure:ajax_misc_failure,
+ onSuccess:success_popup_select_tva
+ }
+ );
+ } catch (e) {alert(e.message);}
+}
+/**
+ *@brief display the popup with vat and explanations
+ */
+function success_popup_select_tva(req) {
+ try {
+ var answer=req.responseXML;
+ var popup=answer.getElementsByTagName('popup');
+ if ( popup.length == 0 ) { var rec=req.responseText;alert ('erreur :'+rec);}
+ var html=answer.getElementsByTagName('code');
+
+ var name_ctl=popup[0].firstChild.nodeValue+'_content';
+ var nodeXml=html[0];
+ var code_html=getNodeText(nodeXml);
+ code_html=unescape_xml(code_html);
+ $(name_ctl).innerHTML=code_html;
+ } catch (e) {alert(e.message);}
+
}
\ No newline at end of file
diff --git a/html/style.css b/html/style.css
index c9a7d2e21..a1934a110 100644
--- a/html/style.css
+++ b/html/style.css
@@ -564,7 +564,7 @@ div.popup_border_title {
/*background:lightgrey;*/
z-index:10;
/*border:dotted 1px black;*/
- border: 3px groove black;
+ border: 3px groove lightblue;
background-color:#879ED4;
font-size: 110% ;
font-family: arial,sans-serif;
diff --git a/html/test.php b/html/test.php
index adede11c0..cfc37d6f8 100644
--- a/html/test.php
+++ b/html/test.php
@@ -64,7 +64,8 @@ $array=array(
array(25,'Search Ledger'),
array(26,'Gettext'),
array(27,'Card (class_fiche)'),
- array(28,'Extension')
+ array(28,'Extension'),
+ array(29,'ITVA popup')
);
$r='