noalyss Version-9
print_currency01.inc.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * PhpCompta is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * PhpCompta is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with PhpCompta; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
21
22if (!defined('ALLOWED'))
23 die('Appel direct ne sont pas permis');
24/**
25 * @file
26 * @brief show all the operation in currency by accounting
27 */
29$action=$http->get("action","string","no");
30
31
32
33$search_type=$http->request("search_type","string","all");
35
36
37$from_date=new IDate("from_date",$print_operation_currency->getData_operation()->getFrom_date());
38$to_date=new IDate("to_date",$print_operation_currency->getData_operation()->getTo_date());
39
40$from_account=new IPoste("from_account",$http->request("from_account", "string", ""));
41
42$to_account=new IPoste("to_account",$http->request("to_account", "string", ""));
43
44$from_account->name='from_account';
45$from_account->set_attribute('gDossier',Dossier::id());
46$from_account->set_attribute('jrn',0);
47$from_account->set_attribute('account','from_account');
48
49$to_account->name='to_account';
50$to_account->set_attribute('gDossier',Dossier::id());
51$to_account->set_attribute('jrn',0);
52$to_account->set_attribute('account','to_account');
53
54$selCurrency=new ISelect("p_currency_code");
55$selCurrency->value=$cn->make_array("select id,cr_code_iso from currency where id > 0 order by cr_code_iso");
56$selCurrency->selected=$print_operation_currency->getData_operation()->getCurrency_id();
57
58
59
60if ( DEBUGNOALYSS > 1) { echo \Noalyss\Dbg::hidden_info("print_operation ",$print_operation_currency->getData_operation());}
61
62
63$msg["all"]=_("Aucun filtre");
64$msg["by_card"]=_("Par fiche");
65$msg["by_accounting"]=_("Par poste comptable");
66$msg["by_category"]=_("Par catégorie de fiche");
68$select_box->add_javascript(_("Aucun filtre"),"show_currency_type_search('all')",true);
69$select_box->add_javascript(_("Par fiche"),"show_currency_type_search('card_id')",true);
70$select_box->add_javascript(_("Par poste comptable"),"show_currency_type_search('account_id')",true);
71$select_box->add_javascript(_("Par catégorie de fiche"),"show_currency_type_search('card_category_div_id')",true);
72?>
73<div class="content">
74<script>
75 function show_currency_type_search(p_div)
76 {
77 let aDiv=["card_category_div_id","card_id","account_id"];
78
79 aDiv.forEach(a=>$(a).hide());
80 let showelt=document.getElementById(p_div);
81 if ( showelt) {
82 showelt.show();
83 }
84
85 $('search_type').value="all";
86
87
88
89 if ( p_div == 'card_category_div_id')
90 { $('search_type').value="by_category";}
91
92 if ( p_div == 'card_id')
93 { $('search_type').value="by_card";}
94 if ( p_div == 'account_id')
95 { $('search_type').value="by_accounting";}
96
97 $('select_boxfilter_type').hide();
98 if ( document.getElementById("select_box_contentfilter_type")) {
99 document.getElementById("select_box_contentfilter_type").hide();
100 }
101 return true;
102 }
103</script>
104<form method="get" action="<?=NOALYSS_URL?>/do.php" onsubmit="waiting_box();return true;">
105
106 <div class="form-group ">
107 <label for="from_date"><?=_("Depuis")?></label>
108 <?=$from_date->input()?>
109
110 <label for="to_date"><?=_("jusque")?></label>
111 <?=$to_date->input()?>
112
113 <label for="currency_code"><?=_("Devise")?></label>
114 <?=$selCurrency->input()?>
115 <?=$select_box->input()?>
116 </div>
117
118
119 <div id="account_id" style="display:<?=($search_type=="by_accounting")?"block":"none"?>"><!-- comment -->
120 <div class="form-group">
121 <label for="from_account"><?=_("plage de postes comptables")?></label>
122 <?=$from_account->input()?>
123
124 <label for="to_account"><?=_("jusque")?></label>
125 <?=$to_account->input()?>
126 </div>
127 </div>
128
129 <div id="card_id" style="display:<?=($search_type=="by_card")?"block":"none"?>"><!-- comment -->
130 <div class="form-group">
131 <label for="card"><?=_("Fiche")?></label>
132 <?php
133 // --- card
134 $card = new ICard("card");
135 $card->set_attribute("typecard","all");
136 $card->value=$http->request("card","string","");
137 $card->extra='all';
138 echo $card->input();
139 echo $card->search();
140 ?>
141 </div>
142 </div>
143
144 <div id="card_category_div_id" style="display:<?=($search_type=="by_category")?"block":"none"?>"><!-- comment -->
145 <div class="form-group">
146 <label for="card_category_id"><?=_("Fiche")?></label>
147 <?php
148 // --- card_category
149 $card_category=new ISelect ("card_category_id");
150 $card_category->value=$cn->make_array("select fd_id , fd_label from fiche_def order by fd_label");
151 $card_category->selected=$http->request("card_category_id","number",0);
152 ?>
153 <?=$card_category->input()?>
154 </div>
155 </div>
156
157 <?=HtmlInput::hidden("action","print")?>
158 <?=HtmlInput::hidden("search_type",$search_type)?>
159 <?=HtmlInput::hidden("ac",$http->request("ac"))?>
160 <?=Dossier::hidden()?>
161 <?=HtmlInput::submit(uniqid(), _("Afficher"))?>
162</form>
163<hr><!-- comment -->
164</div>
165
166<?php
167 if ( $action !=="print") { return;}
168///----- There is something to print here
169
170
171?>
172<div class="content" style="margin-top:1rem;margin-bottom: 1rem;">
173 <?php
174 try
175 {
176
177 \Noalyss\Dbg::echo_var(1 ,"SQL = ".
178 $print_operation_currency->getData_operation()->build_SQL());
179
180 echo $print_operation_currency->export_html();
181
182 }
183 catch (Exception $exc)
184 {
185 echo h2($exc->getMessage(),'class="error"');
186 return;
187 }
188
189
190 ?>
191</div>
192
193<div class="content" style="margin-top:1rem;margin-bottom: 1rem;">
194 <form method="get" id="export_csv" onsubmit="download_document_form(this);return false;" style="display:inline">
195 <?=HtmlInput::hidden("ac", $http->request("ac"))?>
196 <?=HtmlInput::hidden("gDossier", $http->request("gDossier","number"))?>
197 <?=HtmlInput::hidden("act", "CSV:pcur01")?>
198 <?=HtmlInput::array_to_hidden(["from_date","to_date","search_type","from_account","to_account","card","card_category_id","p_currency_code"],$_REQUEST)?>
199
200 <?=HtmlInput::submit(uniqid(),_("Export CSV"))?>
201 </form>
202</div>
h2($p_string, $p_class="", $raw="")
Definition: ac_common.php:68
$ret label
$opd_description style
$_REQUEST['ac']
static id()
return the 'gDossier' value after a check
static hidden()
return a string to set gDossier into a FORM
static hidden($p_name, $p_value, $p_id="")
static array_to_hidden($array, $global_array)
transform request data to hidden
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
manage the http input (get , post, request) and extract from an array
Input HTML for the card show buttons, in the file, you have to add card.js How to use :
Html Input : Input a date format dd.mm.yyyy The property title should be set to indicate what it is e...
Definition: idate.class.php:34
show a button, for selecting a account and a input text for manually inserting an account the differe...
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
static echo_var($n_level, $msg, $print=true)
Display the value of a var if DEBUGNOALYSS is greater than $n_level, the debugging info has a certain...
Definition: dbg.php:45
static build($p_search)
build a Print_Operation_Currency Object thanks the http request ($_REQUEST) with the right Filter
Display a kind of select.
if(DEBUGNOALYSS > 1) $msg["all"]
$print_operation_currency