The calc is now in a small div, available everywhere

This commit is contained in:
Dany De Bontridder 2010-08-02 19:14:01 +00:00
parent 1077cb95ac
commit 1bb5bd3fd9
16 changed files with 45 additions and 79 deletions

View file

@ -35,18 +35,20 @@ function cal()
return;
}
try {
Compute();
sub=eval(p_variable);
Compute();
sub=eval(p_variable);
var result=parseFloat(sub);
result=Math.round(result*100)/100;
} catch(exception) {
alert("Mauvaise formule\n"+p_variable);
return false;
}
p_history=p_history+'<hr>'+p_variable;
p_history+="="+sub;
var str_sub="<hr><b><i> Total :"+p_variable+" = "+sub+"<I></b>";
this.document.getElementById("sub_total").innerHTML=str_sub;
this.document.getElementById("listing").innerHTML=p_history;
this.document.getElementById('inp').value="";
p_history+="="+result.toString();
var str_sub="<hr><b><i> Total :"+p_variable+" = "+result.toString()+"<I></b>";
this.document.getElementById("sub_total").innerHTML=str_sub;
this.document.getElementById("listing").innerHTML=p_history;
this.document.getElementById('inp').value="";
}
// Clean
//
@ -62,12 +64,9 @@ function Clean()
function Compute()
{
var tot=0;
var ret="";
tot=eval(p_variable);
ret+="<hr>";
ret+="<b>Total = "+tot+'</b>';
this.document.getElementById('inp').value="";
//this.document.getElementById('result').innerHTML=ret;
this.document.getElementById('inp').focus();
var tot=0;
var ret="";
this.document.getElementById('inp').value="";
this.document.getElementById('inp').focus();
}

View file

@ -81,7 +81,7 @@ function trim(s) {
*/
function g(ID) {
if (document.getElementById) {
return document.getElementById(ID);
return this.document.getElementById(ID);
} else if (document.all) {
return document.all[ID];
} else {
@ -606,4 +606,17 @@ function unselect_checkbox(form_id) {
e.checked=false;
}
}
}
/**
* show the calculator
*/
function show_calc() {
if ( g('calc1')) { this.document.getElementById('inp').value="";return;}
var sid='calc1';
var shtml='';
shtml+='<form name="calc_line" method="GET" onSubmit="cal();return false;" >Cette calculatrice vous permet de calculer, écrivez simplement les opérations que vous voulez puis la touche retour. exemple : 1+2+3*(1/5) <input style="border:solid 1px;" type="text" size="30" id="inp" name="calculator"> <input type="button" value="Efface tout" onClick="Clean();return false;" > <input type="button" value="Fermer" onClick="removeDiv(\'calc1\')" >';
shtml+='</form><span id="result"> </span><br><span id="sub_total"> Taper une formule (ex 20*5.1) puis enter </span><br><span id="listing"> </span>';
var obj={id:sid,html:shtml,drag:true,style:'position:absolute;display:block;top:30px;left:150px;width:250px;border:1px solid black;background-color:#99b1df;font-size:12'};
add_div(obj);
}

View file

@ -187,7 +187,7 @@ function html_page_start($p_theme="",$p_script="",$p_script2="")
<LINK REL=\"stylesheet\" type=\"text/css\" href=\"$style\" media=\"screen\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"style-print.css\" media=\"print\">".
$p_script2. "
<script src=\"js/scripts.js\" type=\"text/javascript\"></script>";
";
echo '<script language="javascript" src="js/calendar.js"></script>
<script type="text/javascript" src="js/lang/calendar-en.js"></script>
<script language="javascript" src="js/calendar-setup.js"></script>

View file

@ -1319,12 +1319,6 @@ jr_comment||' ('||jr_internal||')'||case when jr_pj_number is not null and jr_pj
$f_add_button->set_attribute('jrn',$this->id);
$f_add_button->javascript=" select_card_type(this);";
$ret.=$f_add_button->input();
// show compute
$cal=new IButton('calc');
$cal->label='Calculatrice';
$cal->javascript=" showIPopup('compute') ";
$str_cal_button=$cal->input();
$ret.=$str_cal_button;
// Load the javascript
//

View file

@ -340,11 +340,6 @@ class Acc_Ledger_Fin extends Acc_Ledger {
$wConcerned->extra2='paid';
$array[$i]['concerned']=$wConcerned->input();
}
// show compute
$cal=new IButton('calc');
$cal->label='Calculatrice';
$cal->javascript=" showIPopup('compute') ";
$str_cal_button=$cal->input();
ob_start();
require_once('template/form_ledger_fin.php');

View file

@ -1012,11 +1012,6 @@ array
}
$f_type=_('Fournisseur');
// show compute
$cal=new IButton('calc');
$cal->label='Calculatrice';
$cal->javascript=" showIPopup('compute') ";
$str_cal_button=$cal->input();
ob_start();
require_once('template/form_ledger_detail.php');

View file

@ -1135,11 +1135,6 @@ class Acc_Ledger_Sold extends Acc_Ledger {
}// foreach article
$f_type=_('Client');
// show compute
$cal=new IButton('calc');
$cal->label='Calculatrice';
$cal->javascript=" showIPopup('compute') ";
$str_cal_button=$cal->input();
ob_start();
require_once('template/form_ledger_detail.php');

View file

@ -68,6 +68,13 @@ require_once('class_html_input.php');
$select_all->javascript="unselect_checkbox($p_form)";
return $select_all->input();
}
static function show_calc() {
$calc=new IButton('shcalc');
$calc->label=_('Calculatrice');
$calc->javascript="show_calc()";
return $calc->input();
}
static public function test_me()
{

View file

@ -40,16 +40,6 @@ $pop_tva->title=_('Choix TVA');
$pop_tva->value='';
echo $pop_tva->input();
$p_action=(isset($_REQUEST['p_action']))?$_REQUEST['p_action']:'';
//----------------------------------------------------------------------
// create compute button
require_once ('class_ipopup.php');
$compute=new IPopup('compute');
$compute->value=JS_CALC_LINE;
$compute->drag=true; $compute->blocking=false;
$compute->title="Calculatrice";
$compute->set_height("350");
$compute->set_width("500");
echo $compute->input();
$cn=new Database(dossier::id());
//menu = show a list of ledger

View file

@ -41,15 +41,6 @@ $search_card->title=_('Recherche de fiche');
$search_card->value='';
echo $search_card->input();
$compute=new IPopup('compute');
$compute->value=JS_CALC_LINE;
$compute->drag=true; $compute->blocking=false;
$compute->title="Calculatrice";
$compute->set_height("350");
$compute->set_width("500");
echo $compute->input();
$cn=new Database(dossier::id());
$menu_action="?p_action=fin&".dossier::get();
$menu=array(

View file

@ -41,16 +41,6 @@ $pop_tva=new IPopup('popup_tva');
$pop_tva->title=_('Choix TVA');
$pop_tva->value='';
echo $pop_tva->input();
//----------------------------------------------------------------------
// create compute button
$compute=new IPopup('compute');
$compute->value=JS_CALC_LINE;
//$compute->title="Calculatrice";
$compute->drag=true;
$compute->blocking=false;
$compute->set_height("350");
$compute->set_width("500");
echo $compute->input();
$p_action=(isset($_REQUEST['p_action']))?$_REQUEST['p_action']:'';
$gDossier=dossier::id();
@ -328,7 +318,7 @@ if ( $def == 2 ) {
echo $html;
echo $bar;
echo '<p>'.HtmlInput::submit('paid',_('Mise à jour paiement')).IButton::select_checkbox('fpaidv').IButton::unselect_checkbox('fpaidv').'</p>';
echo IButton::select_checkbox('fpaid');
echo '</form>';
echo '</div>';

View file

@ -825,7 +825,6 @@ function load_all_script()
echo js_include('dragdrop.js');
echo js_include('controls.js');
echo js_include('slider.js');
echo js_include('acc_ledger.js');
echo js_include('accounting_item.js');
echo js_include('acc_report.js');

View file

@ -47,13 +47,6 @@ $pop_tva->title=_('Choix TVA');
$pop_tva->value='';
echo $pop_tva->input();
$compute=new IPopup('compute');
$compute->value=JS_CALC_LINE;
$compute->drag=true; $compute->blocking=false;
$compute->title="Calculatrice";
$compute->set_height("350");
$compute->set_width("500");
echo $compute->input();
$cn=new Database(dossier::id());
$id=(isset ($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:-1;

View file

@ -16,7 +16,7 @@
<?=$f_type?><?=$f_client_qcode?><?=$f_client_bt?> <?=$f_client?><br>
<?=_('Libellé')?> <?=$f_desc?>
<?=_('Num Pj')?> <?=$f_pj?><br>
<?=$str_add_button?><?=$str_cal_button?>
<?=$str_add_button?>
</fieldset>
<fieldset>

View file

@ -13,7 +13,7 @@
<?=_('Solde début') ?> <?=$wFirst->input();?>
<?=_('Solde Fin')?> <?=$wLast->input();?>
</fieldset>
<?=$str_add_button?><?=$str_cal_button?>
<?=$str_add_button?>
<fieldset><legend><?=_('Opérations')?></legend>
<table id="fin_item" width="100%" border="0">
<tr>

View file

@ -431,6 +431,8 @@ function menu_tool($p_from) {
$r.= '<div class="u_tool">';
$r.= '<div class="name">';
$r.= "<H2 class=\"dossier\"> Dossier : ".h(dossier::name())."</h2> ";
$r.=IButton::show_calc();
$r.= '</div>';
$r.= '<div class="acces_direct">';
if ( $p_from == 'compta') $view='E';
@ -451,7 +453,9 @@ function menu_tool($p_from) {
) ;
$gDossier=dossier::id();
$r.= '<table>';
$r.= '<table>';
$r.='<tr>';
foreach($amodule as $col ) {
$url=$col['value'].'?'.dossier::get();
if ( $p_from==$col['value']) {
@ -477,6 +481,7 @@ function menu_tool($p_from) {
$r.= '</table>';
$r.= '</div>';
$r.= '</div>';
$r.= '</div>';
return $r;