From 39b6ec4f865877d10819abb56b40d950443e44d8 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sun, 18 Apr 2021 09:22:30 +0200 Subject: [PATCH] Bug Select_Box = problem with DIV id --- html/js/infobulle.js | 13 +- .../class/print_operation_currency.class.php | 143 ++++++++++++++++++ include/export/export_pcur01_csv.php | 30 ++++ include/export/export_pcur01_pdf.php | 30 ++++ include/print_currency01.inc.php | 61 ++++++++ include/sql/patch/upgrade156.sql | 27 ++++ 6 files changed, 298 insertions(+), 6 deletions(-) create mode 100644 include/class/print_operation_currency.class.php create mode 100644 include/export/export_pcur01_csv.php create mode 100644 include/export/export_pcur01_pdf.php create mode 100644 include/print_currency01.inc.php create mode 100644 include/sql/patch/upgrade156.sql diff --git a/html/js/infobulle.js b/html/js/infobulle.js index 81942ada4..94e160e31 100644 --- a/html/js/infobulle.js +++ b/html/js/infobulle.js @@ -73,22 +73,23 @@ function displayBulle(p_comment) { */ function displaySelectBox(p_name) { try { - if (! document.getElementById("select_box_content") ) { + var newDiv=null; + if (! document.getElementById("select_box_content"+p_name) ) { - var newDiv=new Element("div"); - newDiv.id="select_box_content"; + newDiv=new Element("div"); + newDiv.id="select_box_content"+p_name; document.body.appendChild(newDiv); newDiv.addClassName("select_box"); - $("select_box_content").onmouseleave=function() { + $("select_box_content"+p_name).onmouseleave=function() { try { - var newDiv=$("select_box_content"); + var newDiv=$("select_box_content"+p_name); newDiv.setStyle({display:"none"}); } catch(e) { alert(e.message); } } } else { - var newDiv=document.getElementById("select_box_content"); + newDiv=document.getElementById("select_box_content"+p_name); } newDiv.innerHTML=$("select_box"+p_name).innerHTML; var viewport = document.viewport.getDimensions(); diff --git a/include/class/print_operation_currency.class.php b/include/class/print_operation_currency.class.php new file mode 100644 index 000000000..58b07a992 --- /dev/null +++ b/include/class/print_operation_currency.class.php @@ -0,0 +1,143 @@ + + +/** + * @file + * @brief manage the operation in currency : export CSV, export PDF , output in HTML + */ +require_once NOALYSS_INCLUDE."/class/acc_currency.class.php"; + +class Print_Operation_Currency +{ + + private $from_date; + private $to_date; + private $currency_id; + private $from_account; + private $to_account; + + function __construct($cn) + { + + } + + public function getFrom_date() + { + return $this->from_date; + } + + public function getTo_date() + { + return $this->to_date; + } + + public function getCurrency() + { + return $this->currency; + } + + public function getFrom_account() + { + return $this->from_account; + } + + public function getTo_account() + { + return $this->to_account; + } + + public function setFrom_date($from_date) + { + $this->from_date=$from_date; + } + + public function setTo_date($to_date) + { + $this->to_date=$to_date; + } + + public function setCurrency($currency) + { + $this->currency=$currency; + } + + public function setFrom_account($from_account) + { + $this->from_account=$from_account; + } + public function from_get() + { + $http=new HttpInput(); + $this->from_date=$http->get("from_date","date"); + $this->to_date=$http->get("to_date","date"); + $this->from_account=$http->get("from_account"); + $this->to_account=$http->get("to_account"); + $this->currency_id=$http->get("currency_id","numeric"); + + } + public function setTo_account($to_account) + { + $this->to_account=$to_account; + } + /** + * @brief Return array of data + */ + function get_date() + { + $aArray=$this->cn->get_array("select jr_id, + j_date, + j_montant, + oc_amount, + j_poste, + jr_comment, + jr_internal, + jr_pj_number, + currency_id, + currency_rate, + currency_rate_ref, + f_id + from jrnx + join jrn on (jr_grpt_id=jrnx.j_grpt) + join operation_currency oc using (j_id) + where + j_poste >= $1 + and j_poste <= $2 + and j_date >= to_date($3 ,'DD.MM.YYYY') + and j_date <=to_date($4 ,'DD.MM.YYYY') + and currency_id = $5 + order by j_poste,j_date + ",[$this->from_account,$this->to_account,$this->from_date,$this->to_date,$this->currency_id]); + return $aArray; + } + function export_html() + { + + } + function export_csv() + { + + } + function export_pdf() + { + + } +} +?> diff --git a/include/export/export_pcur01_csv.php b/include/export/export_pcur01_csv.php new file mode 100644 index 000000000..2e911f13e --- /dev/null +++ b/include/export/export_pcur01_csv.php @@ -0,0 +1,30 @@ + + +if (!defined('ALLOWED')) + die('Appel direct ne sont pas permis'); + +/** + * @file + * @brief export currency in CSV + */ +require_once NOALYSS_INCLUDE.'/class/print_operation_currency.class.php'; +?> diff --git a/include/export/export_pcur01_pdf.php b/include/export/export_pcur01_pdf.php new file mode 100644 index 000000000..973464e6d --- /dev/null +++ b/include/export/export_pcur01_pdf.php @@ -0,0 +1,30 @@ + + +if (!defined('ALLOWED')) + die('Appel direct ne sont pas permis'); + +/** + * @file + * @brief export currency in PDF + */ +require_once NOALYSS_INCLUDE.'/class/print_operation_currency.class.php'; +?> diff --git a/include/print_currency01.inc.php b/include/print_currency01.inc.php new file mode 100644 index 000000000..62db6a8c3 --- /dev/null +++ b/include/print_currency01.inc.php @@ -0,0 +1,61 @@ + + +if (!defined('ALLOWED')) + die('Appel direct ne sont pas permis'); +require_once NOALYSS_INCLUDE.'/class/print_operation_currency.class.php'; + +/** + * @file + * @brief show all the operation in currency by accounting + */ +$action=$http->get("action","string","no"); +$print_operation_currency=new Print_Operation_Currency($cn); +if ( $action == "print") +{ + $print_operation_currency->from_request(); +} +$from_date=new IDate("from_date",$print_operation_currency->getFrom_date()); +$to_date=new IDate("to_date",$print_operation_currency->getTo_date()); + +$from_account=new IPoste("from_account",$print_operation_currency->getFrom_account()); + +$to_account=new IPoste("to_account",$print_operation_currency->getTo_account()); + +$from_account->name('from_account'); +$from_account->set_attribute('gDossier',Dossier::id()); +$from_account->set_attribute('jrn',0); +$from_account->set_attribute('account','from_account'); + +$to_account->name('to_account'); +$to_account->set_attribute('gDossier',Dossier::id()); +$to_account->set_attribute('jrn',0); +$to_account->set_attribute('account','to_account'); + +$acc_currency=new Acc_Currency($cn); +$selCurrency=$acc_currency->select_currency(); +$selCurrency->selected=$print_operation_currency->getCurrency(); + +?> +
+ + +
\ No newline at end of file diff --git a/include/sql/patch/upgrade156.sql b/include/sql/patch/upgrade156.sql new file mode 100644 index 000000000..02a3f1eff --- /dev/null +++ b/include/sql/patch/upgrade156.sql @@ -0,0 +1,27 @@ +begin; + + +insert into menu_ref (me_code,me_menu,me_file,me_description,me_type,me_description_etendue) +values('PCUR01','Devise','print_currency01.inc.php','Résumé par devise','ME','Résumé par devise afin de +faire de calculer les écarts de conversion (différence de change) pour les actifs et passifs'); + +insert into profile_menu (me_code,me_code_dep,p_id,p_order,p_type_display,pm_default,pm_id_dep) +select me_code,'PRINT',1,260,'E',0,6 from menu_ref where me_code='PCUR01' +union +select me_code,'PRINT',1,260,'E',0,35 from menu_ref where me_code='PCUR01' +union +select me_code,'PRINT',2,260,'E',0,719 from menu_ref where me_code='PCUR01' and exists (select 1 from profile where p_id=2) +union +select me_code,'PRINT',2,260,'E',0,716 from menu_ref where me_code='PCUR01' and exists (select 1 from profile where p_id=2) +; + +insert into menu_ref (me_code,me_menu,me_file,me_type) +values ('CSV:pcur01','Export Devise CSV','export_pcur01_csv.php','PR'), + ('PDF:pcur01','Export Devise PDF','export_pcur01_pdf.php','PR') +; + + +insert into version (val,v_description) values (157,'new feature Currency search'); +commit ; + +commit;