noalyss Version-9
Public Member Functions | Static Public Member Functions | Private Attributes
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 More...
 
 dbutton ()
 show a button, if it is pushed show a popup to select the need vat More...
 
 display ()
 print in html the readonly value of the widget More...
 
 input ($p_name=null, $p_value=null)
 show the html input of the widget More...
 
 set_filter ($p_filter)
 Set a filter to limit the choice of VAT ; possible values are : More...
 
 with_button ($p)
 
- Public Member Functions inherited from HtmlInput
 __construct ($p_name="", $p_value="", $p_id="")
 
 __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. More...
 
 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"> More...
 
 get_value ()
 Return the value of input (IText, INum,...) More...
 
 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. More...
 
 set_attribute ($p_name, $p_value)
 set the extra javascript property for the INPUT field More...
 
 set_value ($p_string)
 Set the value of input (IText, INum,...) More...
 
 setReadOnly ($p_read)
 

Static Public Member Functions

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 anchor 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. More...
 
static anchor_action ($action, $javascript, $id=NULL, $p_class="button", $p_symbole="")
 Anchor Html with javascript. More...
 
static anchor_close ($div, $p_js="")
 Return a html string with an anchor which close the inside popup. More...
 
static anchor_empty ($p_text, $p_id, $p_title="")
 let you create only a link and set an id on it. More...
 
static anchor_hide ($action, $javascript)
 Return a html string with an anchor to hide a div, put it in the right corner. More...
 
static array_to_hidden ($array, $global_array)
 transform request data to hidden More...
 
static array_to_string ($array, $global_array, $start="?")
 transform request data to string More...
 
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 More...
 
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 More...
 
static button_choice_ledger ($p_array)
 
static button_close ($div_name, $class='smallbutton')
 close button for the HTML popup More...
 
static button_hide ($div_name)
 Hide the HTML popup. More...
 
static button_image ($javascript, $id="xx", $p_class='class="button"', $p_image="")
 button Html image More...
 
static calendar_zoom ($obj)
 Zoom the calendar. More...
 
static card_detail ($p_qcode, $pname='', $p_style="", $p_nohistory=false, $nofollowup=false)
 show the detail of a card More...
 
static default_value ($ind, $default, $array)
 return default if the value if the value doesn't exist in the array More...
 
static default_value_get ($ind, $default)
 return default if the value if the value doesn't exist in $_GET use HttpInput instead More...
 
static default_value_post ($ind, $default)
 return default if the value if the value doesn't exist in $_POST use HttpInput instead More...
 
static default_value_request ($ind, $default)
 return default if the value if the value doesn't exist in $_REQUEST use HttpInput instead More...
 
static detail_action ($ag_id, $p_mesg, $p_modify=1)
 return an anchor to view the detail of an action More...
 
static detail_modele_document ($p_id, $p_mesg)
 return a string containing the html code for calling the modifyModeleDocument More...
 
static detail_op ($p_jr_id, $p_mesg)
 return a string containing the html code for calling the modifyOperation More...
 
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. More...
 
static filter_table ($p_table_id, $p_col, $start_row)
 filter the rows in a table and keep the colored row in alternance More...
 
static filter_table_form ($p_table_id, $p_col, $start_row, $p_name, $p_old_value)
 
static followup_card_button ($f_id, $p_mesg)
 display a div with the history of the card More...
 
static generate_id ($p_prefix)
 generate an unique id for a widget, More...
 
static get_to_hidden ($array)
 transform $_GET data to hidden More...
 
static get_to_string ($array, $start="?")
 transform $_GET data to string More...
 
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 More...
 
static history_anc_account ($p_account, $p_mesg, $p_style="", $p_exercice="")
 display a div with the history of the analytic account More...
 
static history_card ($f_id, $p_mesg, $p_style="", $p_exercice="")
 display a div with the history of the card More...
 
static history_card_button ($f_id, $p_mesg, $p_exercice="")
 display a div with the history of the card More...
 
static image_click ($p_image, $p_js, $p_message, $p_class="")
 Image to click ,. More...
 
static json_to_hidden ($p_json)
 transform a json to hidden More...
 
static post_to_hidden ($array)
 transform $_POST data to hidden More...
 
static post_to_string ($array)
 transform $_POST data to string More...
 
static print_window ()
 Javascript to print the current window. More...
 
static remove_stock ($p_id, $p_mesg)
 return a string containing the html code for calling the removeStock More...
 
static request_to_hidden (array $array)
 transform $_REQUEST data to hidden More...
 
static request_to_string ($array, $start="?")
 transform $_REQUEST data to string More...
 
static reset ($p_value)
 
static select_cat ($array_cat)
 create a hidden plus button to select the cat of ledger More...
 
static select_stock ($p_cn, $p_name, $p_mode)
 Create an ISelect object containing the available repository for reading or writing. More...
 
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. More...
 
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;. More...
 
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')
 Title for boxes, you can customize the symbol thanks symbol with the mode "custom". More...
 
static warnbulle ($p_comment)
 

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)'; More...
 

Additional Inherited Members

- Data Fields inherited from HtmlInput
 $attribute
 
 $css_size
 
 $ctrl
 
 $disabled
 
 $extra
 
 $extra2
 
 $heigh
 
 $id
 
 $javascript
 
 $label
 
 $name
 
 $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();
$input_from id
Definition: balance.inc.php:63
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 57 of file itva_popup.class.php.

58 {
59 $this->name = $p_name;
60 $this->button = true;
61 $this->in_table = false;
62 $this->value = $p_value;
63 $this->id = $p_id;
64 $this->filter = 'none';
65 }
$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 179 of file itva_popup.class.php.

180 {
181 $this->cn = $p_cn;
182 $this->code = new ISpan($p_code);
183 }
$input_from cn
Definition: balance.inc.php:66
Html Input.
Definition: ispan.class.php:32

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 141 of file itva_popup.class.php.

142 {
143 if (trim($this->name) == '') throw new Exception (_('Le nom ne peut ĂȘtre vide'));
144 $this->id = ($this->id == "") ? $this->name : $this->id;
145
146 // button
147 $bt = new ISmallButton('bt_' . $this->id);
148 $bt->tabindex = "-1";
149 $bt->label = _(' TVA ');
150 $bt->set_attribute('gDossier', dossier::id());
151 $bt->set_attribute('ctl', $this->id);
152 $bt->set_attribute('popup', 'popup_tva');
153 if (isset($this->code))
154 $bt->set_attribute('jcode', $this->code->name);
155 if (isset($this->compute))
156 $bt->set_attribute('compute', $this->compute);
157 $bt->set_attribute("filter", $this->filter);
158 $bt->javascript = (isset($this->but_javascript)) ? $this->but_javascript : 'popup_select_tva(this)';
159 $r = $bt->input();
160 return $r;
161 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r

References $r, id, and name.

Referenced by input().

◆ display()

ITva_Popup::display ( )

print in html the readonly value of the widget

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

165 {
167 $tva = new Acc_Tva($cn, $this->value);
168
169 $comment = ($tva->load() != "-1") ? $tva->tva_label : "";
170 $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);
171 return $res;
172 }
Acc_Tva is used for to map the table tva_rate parameter are.
static connect()

References $cn, $res, Dossier\connect(), 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 76 of file itva_popup.class.php.

77 {
78 $this->name = ($p_name == null) ? $this->name : $p_name;
79 $this->value = ($p_value == null) ? $this->value : $p_value;
80 $this->js = (isset($this->js)) ? $this->js : '';
81 $this->id = ($this->id == "") ? $this->name : $this->id;
82 if ($this->readOnly == true) return $this->display();
83
84 $this->set_attribute('gDossier', dossier::id());
85 $this->set_attribute('ctl', $this->name);
86
87 $code="";
88
89 // code is a span containing the label of the VAT (see add_label)
90 if (isset($this->code)) {
91 if ($this->cn != NULL) {
92 /* check if tva_id == integer */
93 if (trim($this->value) != '' && isNumber($this->value) == 1 && strpos($this->value, ',') === false)
94 $this->code->value = $this->cn->get_value('select tva_label from tva_rate where tva_id=$1',
95 array($this->value));;
96 }
97 $this->set_attribute('jcode', $this->code->name);
98 $code = $this->code->input();
99
100 }
101 $strAttribut = $this->get_node_attribute();
102
103
104 $str = '<input type="TEXT" class="input_text" name="%s" value="%s" id="%s" placeholder="%s" size="3" %s %s>';
105 $r = sprintf($str, $this->name, $this->value, $this->id, _("C.TVA"),$this->js, $strAttribut);
106 $r.=$code;
107 if ($this->in_table)
108 $table = '<table>' . '<tr>' . td($r);
109
110 if ($this->button == true && !$this->in_table)
111 $r .= $this->dbutton();
112
113 if ($this->button == true && $this->in_table)
114 $r = $table . td($this->dbutton()) . '</tr></table>';
115
116 if ($this->table == 1) $r = td($r);
117 return $r;
118
119 }
isNumber($p_int)
Definition: ac_common.php:215
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
$code
set_attribute($p_name, $p_value)
set the extra javascript property 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, $r, $str, HtmlInput\$table, HtmlInput\button(), cn, dbutton(), display(), HtmlInput\get_node_attribute(), id, isNumber(), js, name, readOnly, HtmlInput\set_attribute(), table, td(), and value.

+ Here is the call graph for this function:

◆ 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 129 of file itva_popup.class.php.

130 {
131 $this->filter = $p_filter;
132 }

References $p_filter.

◆ test_me()

static ITva_Popup::test_me ( )
static

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

186 {
187 $a = new IPopup('popup_tva');
188 $a->set_title('Choix de la tva');
189 echo $a->input();
190 $tva = new ITva_Popup("tva1");
191 $tva->with_button(true);
192 // We can add a label for the code
193 $tva->add_label('code');
194 $tva->js = 'onchange="set_tva_label(this);"';
195 echo $tva->input();
196 echo $tva->dbutton();
197 }

References $a.

◆ with_button()

ITva_Popup::with_button (   $p)

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

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

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.


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