noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
ITva_Popup Class Reference

let you choose a TVA in a popup More...

+ Inheritance diagram for ITva_Popup:
+ Collaboration diagram for ITva_Popup:

Public Member Functions

 __construct ($p_name=null, $p_value="", $p_id="")
 
 add_label ($p_code, $p_cn=null)
 add a field to show the selected tva's label
 
 dbutton ()
 show a button, if it is pushed show a popup to select the need vat
 
 display ()
 print in html the readonly value of the widget
 
 input ($p_name=null, $p_value=null)
 show the html input of the widget
 
 set_filter ($p_filter)
 Set a filter to limit the choice of VAT ; possible values are :
 
 with_button ($p)
 
- Public Member Functions inherited from HtmlInput
 __toString ()
 
 get_js_attr ()
 you can add attribute to this in javascript this function is a wrapper and create a script (in js) to modify "this" (in javascript) with the value of obj->attribute from PHP.
 
 get_node_attribute ()
 Insert attribute inside a INPUT TYPE, these attribute can be retrieved in javascript with element.getAttribute or changed with element.setAttribute example insert my_attribute into a checkbox <input type="checkbox" "my_attribute"="XX">
 
 get_placeholder ()
 
 get_value ()
 Return the value of input (IText, INum,...)
 
 make_object_deprecated ($p_name=null)
 Make a JSON object, this method create a javascript object with the attribute set, it returns a javascript string with the object.
 
 set_attribute ($p_name, $p_value)
 add an HTML attribute for the INPUT field
 
 set_placeholder ($placeholder)
 set HTML placeholder attribut
 
 set_value ($p_string)
 Set the value of input (IText, INum,...)
 
 setReadOnly ($p_read)
 

Static Public Member Functions

static set_vat_code (int $vat_code)
 show the Numeric ID or the code
 
static test_me ()
 
- Static Public Member Functions inherited from HtmlInput
static anchor ($p_text, $p_url="", $p_js="", $p_style=' class="line" ', $p_title="click", array $p_attribute=[])
 Return a simple LINK with a url or a javascript if $p_js is not null then p_url will be javascript:void(0) we don't add the event onclick.
 
static anchor_action ($action, $javascript, $id=NULL, $p_class="button", $p_symbole="")
 Anchor Html with javascript.
 
static anchor_close ($div, $p_js="")
 Return a html string with an anchor which close the inside popup.
 
static anchor_empty ($p_text, $p_id, $p_title="")
 let you create only a link and set an id on it.
 
static anchor_hide ($action, $javascript)
 Return a html string with an anchor to hide a div, put it in the right corner.
 
static array_to_hidden ($array, $global_array)
 transform request data to hidden
 
static array_to_string ($array, $global_array, $start="?")
 transform request data to string
 
static button ($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
 
static button_action ($action, $javascript, $id=NULL, $p_class="button", $p_symbole="")
 button Html with javascript
 
static button_action_add ()
 
static button_action_remove_operation ($p_operation)
 
static button_anchor ($p_label, $p_value, $p_name="", $p_javascript="", $p_class="smallbutton")
 create a button with a ref
 
static button_choice_ledger ($p_array)
 
static button_close ($div_name, $class='smallbutton')
 close button for the HTML popup
 
static button_hide ($div_name)
 Hide the HTML popup.
 
static button_image ($javascript, $id="xx", $p_class='class="button"', $p_image="")
 button Html image
 
static calendar_zoom ($obj)
 Zoom the calendar.
 
static card_detail ($p_qcode, $pname='', $p_style="", $p_nohistory=false, $nofollowup=false)
 show the detail of a card
 
static default_value ($ind, $default, $array)
 return default if the value if the value doesn't exist in the array
 
static default_value_get ($ind, $default)
 return default if the value if the value doesn't exist in $_GET use HttpInput instead
 
static default_value_post ($ind, $default)
 return default if the value if the value doesn't exist in $_POST use HttpInput instead
 
static default_value_request ($ind, $default)
 return default if the value if the value doesn't exist in $_REQUEST use HttpInput instead
 
static detail_action ($ag_id, $p_mesg, $p_modify=1)
 return an anchor to view the detail of an action
 
static detail_modele_document_deprecated ($p_id, $p_mesg)
 return a string containing the html code for calling the modifyModeleDocument
 
static detail_op ($p_jr_id, $p_mesg)
 return a string containing the html code for calling the modifyOperation
 
static display_periode ($p_id)
 
static errorbulle ($p_comment)
 
static extension ()
 
static filter_list ($p_list_id)
 Display a field for searching an element in a list, the searchable text must be in an element with the className search-content.
 
static filter_table ($p_table_id, $p_col, $start_row)
 filter the rows in a table and keep the colored row in alternance
 
static filter_table_form ($p_table_id, $p_col, $start_row, $p_name, $p_old_value)
 filter the rows in a table and keep the colored row in alternance
 
static followup_card_button ($f_id, $p_mesg)
 display a div with the history of the card
 
static generate_id ($p_prefix)
 generate an unique id for a widget,
 
static get_to_hidden ($array)
 transform $_GET data to hidden
 
static get_to_string ($array, $start="?")
 transform $_GET data to string
 
static hidden ($p_name, $p_value, $p_id="")
 
static history_account ($p_account, $p_mesg, $p_style="", $p_exercice="")
 display a div with the history of the account
 
static history_anc_account ($p_account, $p_mesg, $p_style="", $p_exercice="")
 display a div with the history of the analytic account
 
static history_card ($f_id, $p_mesg, $p_style="", $p_exercice="")
 display a div with the history of the card
 
static history_card_button ($f_id, $p_mesg, $p_exercice="")
 display a div with the history of the card
 
static image_click ($p_image, $p_js, $p_message, $p_class="")
 Image to click ,.
 
static json_to_hidden ($p_json)
 transform a json to hidden
 
static post_to_hidden ($array)
 transform $_POST data to hidden
 
static post_to_string ($array)
 transform $_POST data to string
 
static print_window ()
 Javascript to print the current window.
 
static remove_stock ($p_id, $p_mesg)
 return a string containing the html code for calling the removeStock
 
static request_to_hidden (array $array)
 transform $_REQUEST data to hidden
 
static request_to_string ($array, $start="?")
 transform $_REQUEST data to string
 
static reset ($p_value)
 
static select_cat ($array_cat)
 create a hidden plus button to select the cat of ledger
 
static select_stock ($p_cn, $p_name, $p_mode)
 Create an ISelect object containing the available repository for reading or writing.
 
static show_receipt_document ($p_jr_id, $p_name="")
 Returns HTML code for displaying a icon with a link to a receipt document from the ledger.
 
static show_reconcile ($p_div, $let, $span="")
 
static simple_array_to_hidden ($array)
 Transform a double array as a HTML string with hidden html value array has the formarray ["name"]="x",array['value']="y") the key name will be the hidden input name;.
 
static submit ($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
 
static title_box ($p_name, $p_div, $p_mod="close", $p_js="", $p_draggable="n", $p_enlarge='n', $raw="")
 Title for boxes, you can customize the symbol thanks symbol with the mode "custom".
 
static warnbulle ($p_comment)
 

Static Public Attributes

static $vat_code =0
 

Protected Member Functions

 make_datalist ()
 

Private Attributes

 $filter
 by default, the p_name is the name/id of the input type the this->button is false (control if a button is visible) and this->in_table=false (return the widget inside a table) this->code is a span widget to display the code (in this case, you will to set this->cn as database connexion) to have its own javascript for the button you can use this->but_javascript) by default it is 'popup_select_tva(this)';
 

Additional Inherited Members

- Data Fields inherited from HtmlInput
 $attribute
 
 $css_size
 
 $ctrl
 
 $disabled
 
 $extra
 
 $extra2
 
 $heigh
 
 $id
 
 $javascript
 
 $label
 
 $name
 
 $placeholder
 
 $readOnly
 
 $require
 
 $selected
 
 $size
 
 $style
 
 $tabindex
 
 $table
 
 $type
 
 $value
 
 $width
 

Detailed Description

let you choose a TVA in a popup

$a=new IPopup('popup_tva');
$a->set_title('Choix de la tva');
echo $a->input();
$tva=new ITva_Popup("tva1");
$tva->with_button(true);
// You must add the attributes gDossier, popup
$tva->set_attribute('popup','popup_tva');
$tva->set_attribute('gDossier',dossier::id());
// We can add a label for the code
$tva->add_label('code');
$tva->js='onchange="set_tva_label(this);"';
echo $tva->input();
create a popup in html above the current layer the html inside the popup cannot contain any floating ...
let you choose a TVA in a popup

Definition at line 44 of file itva_popup.class.php.

Constructor & Destructor Documentation

◆ __construct()

ITva_Popup::__construct ( $p_name = null,
$p_value = "",
$p_id = "" )

Reimplemented from HtmlInput.

Definition at line 58 of file itva_popup.class.php.

59 {
60 $this->name = $p_name;
61 $this->button = true;
62 $this->in_table = false;
63 $this->value = $p_value;
64 $this->id = $p_id;
65 $this->filter = 'none';
66 }
$from_poste name
static button($p_name, $p_value, $p_javascript="", $p_class="smallbutton")

References $p_id, HtmlInput\button(), name, and value.

+ Here is the call graph for this function:

Member Function Documentation

◆ add_label()

ITva_Popup::add_label ( $p_code,
$p_cn = null )

add a field to show the selected tva's label

Parameters
$p_codeis the name of the label where you can see the label of VAT
$p_cnis a database connection if NULL it doesn't seek in the database

Definition at line 231 of file itva_popup.class.php.

232 {
233 $this->cn = $p_cn;
234 $this->code = new ISpan($p_code);
235 }
$input_from cn

References cn.

◆ dbutton()

ITva_Popup::dbutton ( )

show a button, if it is pushed show a popup to select the need vat

Note
  • a ipopup must be created before with the name popup_tva
  • the javascript noalyss_script.js must be loaded
Returns
string with html code

Definition at line 192 of file itva_popup.class.php.

193 {
194 if (trim($this->name) == '') throw new Exception (_('Le nom ne peut ĂȘtre vide'));
195 $this->id = ($this->id == "") ? $this->name : $this->id;
196
197 // button
198 $bt = new ISmallButton('bt_' . $this->id);
199 $bt->tabindex = "-1";
200 $bt->label = ICON_SEARCH;
201
202 $bt->set_attribute('gDossier', dossier::id());
203 $bt->set_attribute('ctl', $this->id);
204 $bt->set_attribute('popup', 'popup_tva');
205 if (isset($this->code))
206 $bt->set_attribute('jcode', $this->code->name);
207 if (isset($this->compute))
208 $bt->set_attribute('compute', $this->compute);
209 $bt->set_attribute("filter", $this->filter);
210 $bt->javascript = (isset($this->but_javascript)) ? $this->but_javascript : 'popup_select_tva(this)';
211 $r = $bt->input();
212 return $r;
213 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
$input_from id
_("actif, passif,charge,...")
const ICON_SEARCH
Definition constant.php:103

References HtmlInput\$id, $r, _, ICON_SEARCH, and name.

Referenced by input().

◆ display()

ITva_Popup::display ( )

print in html the readonly value of the widget

Definition at line 216 of file itva_popup.class.php.

217 {
219 $tva = Acc_Tva::build($cn, $this->value);
220
221 $comment = ($tva->load() != "-1") ? $tva->tva_label : "";
222 $res = sprintf('<input type="text" name="%s" size="6" class="input_text_ro" value="%s" id="%s" readonly="">%s', $this->name, $this->value, $this->name, $comment);
223 return $res;
224 }
static build($db, $p_code)
retrieve TVA rate thanks the code that could be the tva_id or tva_code.
static connect()

References $cn, $res, Acc_Tva\build(), name, and value.

Referenced by input().

+ Here is the call graph for this function:

◆ input()

ITva_Popup::input ( $p_name = null,
$p_value = null )

show the html input of the widget

Definition at line 117 of file itva_popup.class.php.

118 {
119 $this->name = ($p_name == null) ? $this->name : $p_name;
120 $this->value = ($p_value == null) ? $this->value : $p_value;
121 $this->js = (isset($this->js)) ? $this->js : '';
122 $this->id = ($this->id == "") ? $this->name : $this->id;
123 if ($this->readOnly == true) return $this->display();
124
125 $this->set_attribute('gDossier', dossier::id());
126 $this->set_attribute('ctl', $this->name);
127
128 $code="";
129
130 // code is a span containing the label of the VAT (see add_label)
131 if (isset($this->code)) {
132 if ($this->cn != NULL) {
133 $cnx=Dossier::connect();
134 /* check if tva_id == integer */
135 if (trim($this->value) != '' && isNumber($this->value) == 1 && strpos($this->value, ',') === false)
136 $this->code->value = $cnx->get_value('select tva_label from tva_rate where tva_id=$1',
137 array($this->value));;
138 }
139 $this->set_attribute('jcode', $this->code->name);
140 $code = $this->code->input();
141
142 }
143 $strAttribut = $this->get_node_attribute();
144 // show tva code
145 if ( self::$vat_code == 1) {
146 if ( isNumber($this->value ) == 1) {
147 $cnx=Dossier::connect();
148 $this->value=$cnx->get_value('select tva_code from tva_rate where tva_id=$1',[$this->value]);
149 }
150 }
151
152 $str = '<input type="TEXT" class="input_text" name="%s" value="%s" id="%s" placeholder="%s" size="6" %s %s
153list="dl_tva_%s" autocomplete="off">';
154 $r = sprintf($str, $this->name, $this->value, $this->id, _("C.TVA"),$this->js, $strAttribut,$this->id);
155 $r.=$code;
156
157 if ($this->in_table)
158 $table = '<table>' . '<tr>' . td($r);
159
160 if ($this->button == true && !$this->in_table)
161 $r .= $this->dbutton();
162
163 if ($this->button == true && $this->in_table)
164 $r = $table . td($this->dbutton()) . '</tr></table>';
165
166 if ($this->table == 1) $r = td($r);
167 $r.=$this->make_datalist();
168 return $r;
169
170 }
isNumber($p_int)
td($p_string='', $p_extra='')
surround the string with td
Definition ac_common.php:83
set_attribute($p_name, $p_value)
add an HTML attribute for the INPUT field
get_node_attribute()
Insert attribute inside a INPUT TYPE, these attribute can be retrieved in javascript with element....
display()
print in html the readonly value of the widget
dbutton()
show a button, if it is pushed show a popup to select the need vat
$all table
$str
Definition fiche.inc.php:91
$icard readOnly

References $code, HtmlInput\$id, $r, $str, HtmlInput\$table, _, HtmlInput\button(), cn, dbutton(), display(), HtmlInput\get_node_attribute(), isNumber(), js, make_datalist(), name, readOnly, HtmlInput\set_attribute(), table, td(), and value.

+ Here is the call graph for this function:

◆ make_datalist()

ITva_Popup::make_datalist ( )
protected

Definition at line 75 of file itva_popup.class.php.

76 {
78 $r="";
79 switch ($this->filter) {
80 case 'none':
81 $sql="select tva_code,tva_label
82 from v_tva_rate
83 where
84 tva_purchase <> '#' and tva_sale <> '#'
85 order by tva_code ";
86 break;
87 case 'sale':
88 $sql="select tva_code,tva_label
89 from v_tva_rate
90 where
91 tva_sale <> '#'
92 order by tva_code ";
93 break;
94 case 'purchase':
95 $sql="select tva_code,tva_label
96 from v_tva_rate
97 where
98 tva_purchase <> '#'
99 order by tva_code ";
100 break;
101 }
102 $a_tva_code=$cn->get_array($sql);
103 if ( empty($a_tva_code)) return "";
104 $r.=sprintf('<datalist id="dl_tva_%s"">',$this->id);
105 foreach ($a_tva_code as $item) {
106 $r.=sprintf('<option value="%s">%s %s</option>'
107 ,$item['tva_code'],$item['tva_code']
108 ,htmlentities($item['tva_label']));
109 }
110 $r.='</datalist>';
111 return $r;
112
113 }

References $cn, $r, and $sql.

Referenced by input().

◆ set_filter()

ITva_Popup::set_filter ( $p_filter)

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

Definition at line 180 of file itva_popup.class.php.

181 {
182 $this->filter = $p_filter;
183 }

References $p_filter.

◆ set_vat_code()

static ITva_Popup::set_vat_code ( int $vat_code)
static

show the Numeric ID or the code

Parameters
int$vat_code0 for numeric , 1 for Code
Returns
void
Exceptions
Exceptionif $vat_code is

Definition at line 243 of file itva_popup.class.php.

244 {
245 if (isNumber($vat_code)==0){
246 throw new Exception("VAT_CODE [{$vat_code}]: invalide data",EXC_INVALID);
247 }
248 self::$vat_code= $vat_code;
249 }
const EXC_INVALID
Definition constant.php:346

References $vat_code, EXC_INVALID, and isNumber().

+ Here is the call graph for this function:

◆ test_me()

static ITva_Popup::test_me ( )
static

Definition at line 250 of file itva_popup.class.php.

251 {
252
253 $tva = new ITva_Popup("tva1");
254 $tva->with_button(true);
255 // We can add a label for the code
256 $tva->add_label('code');
257 $tva->js = 'onchange="set_tva_label(this);"';
258 echo $tva->input();
259
260 echo '<hr>';
261 echo $tva->dbutton();
262
263 }

◆ with_button()

ITva_Popup::with_button ( $p)

Definition at line 68 of file itva_popup.class.php.

69 {
70 if ($p == true)
71 $this->button = true;
72 else
73 $this->button = false;
74 }
$p
Definition calendar.php:9

References $p, and HtmlInput\button().

+ Here is the call graph for this function:

Field Documentation

◆ $filter

ITva_Popup::$filter
private

by default, the p_name is the name/id of the input type the this->button is false (control if a button is visible) and this->in_table=false (return the widget inside a table) this->code is a span widget to display the code (in this case, you will to set this->cn as database connexion) to have its own javascript for the button you can use this->but_javascript) by default it is 'popup_select_tva(this)';

filter the VAT by ledger PURCHASE or SALE or NO FILTER, default=NO

Definition at line 55 of file itva_popup.class.php.

◆ $vat_code

ITva_Popup::$vat_code =0
static

Definition at line 56 of file itva_popup.class.php.

Referenced by set_vat_code().


The documentation for this class was generated from the following file: