altocompta/include/class_itva_popup.php
Dany De Bontridder 9c2e1427c2 Merged revisions 3001-3012 via svnmerge from
file:///home/developper/svn/phpcompta/branches/rel500

........
  r3007 | danydb | 2010-04-12 23:31:21 +0200 (Mon, 12 Apr 2010) | 4 lines
  
  
  Use ITva_Select in class_acc_legder_purchase.php
........
  r3008 | danydb | 2010-04-13 00:58:43 +0200 (Tue, 13 Apr 2010) | 8 lines
  
  
  TVA Ipopup
  ==========
  
  Add a new widget which show the tva in a popup and let it select the code you need
  it will replace the obsolete TVA_Select
........
  r3009 | danydb | 2010-04-13 20:15:59 +0200 (Tue, 13 Apr 2010) | 4 lines
  
  
  Todo : add the todo for the use of the new widget Tva_Popup
........
  r3010 | danydb | 2010-04-14 18:58:56 +0200 (Wed, 14 Apr 2010) | 1 line
  
   Add a new function in class periode : last_day
........
  r3011 | danydb | 2010-04-14 19:00:09 +0200 (Wed, 14 Apr 2010) | 1 line
  
   Add a new function in class periode : last_day correct typo
........
2010-04-14 22:15:03 +00:00

83 lines
2.6 KiB
PHP

<?php
/*
* This file is part of PhpCompta.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Revision: 1615 $ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/*!\file
* \brief Html Input
*/
require_once ('class_ipopup.php');
require_once('class_ibutton.php');
class ITva_Popup extends HtmlInput
{
public function __construct($p_name=null) {
$this->name=$p_name;
}
/*!\brief show the html input of the widget*/
public function input($p_name=null,$p_value=null)
{
$this->name=($p_name==null)?$this->name:$p_name;
$this->value=($p_value==null)?$this->value:$p_value;
$this->js=(isset($p_js))?$this->js:"";
if ( $this->readOnly==true) return $this->display();
$str='<input type="TEXT" name="%s" value="%s" id="%s" size="3" "%s">';
$r=sprintf($str,$this->name,$this->value,$this->name,$this->js);
return $r;
}
/**
*@brief 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 scripts.js must be loaded
*@return string with html code
*/
function dbutton() {
if( trim($this->name)=='') throw new Exception (_('Le nom ne peut être vide'));
// button
$bt=new IButton('bt_'.$this->name);
$bt->label=_('tva');
$bt->set_attribute('gDossier',dossier::id());
$bt->set_attribute('ctl',$this->name);
$bt->set_attribute('popup','popup_tva');
$bt->javascript='popup_select_tva(this)';
return $bt->input();
}
/*!\brief print in html the readonly value of the widget*/
public function display()
{
$r='<input text name="%s" value="%s" id="%s" disabled>';
$res=sprinf($r,$this->name,$this->value,$this->name);
return $res;
}
static public function test_me()
{
$a=new IPopup('popup_tva');
$a->set_title('Choix de la tva');
echo $a->input();
$tva=new ITva_Popup("tva1");
echo $tva->input();
echo $tva->dbutton();
}
}