Currency : show the currency of the ledger when entering info

This commit is contained in:
Dany De Bontridder 2018-11-02 20:04:46 +01:00
parent 7eb4644cf0
commit 2b04571d0f
6 changed files with 36 additions and 8 deletions

View file

@ -627,7 +627,12 @@ EOF;
}
exit();
break;
case 'currencyCode':
$ledger_id=$http->request('ledger',"number");
$code=$cn->get_value("select cr_code_iso from public.currency join jrn_def on (currency.id=jrn_def.currency_id) where jrn_def.jrn_def_id=$1",
[$ledger_id]);
echo $code;
break;
default:
var_dump($_REQUEST);
}

View file

@ -33,9 +33,7 @@ require_once NOALYSS_INCLUDE.'/lib/html_input.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php';
$http=new HttpInput();
mb_internal_encoding("UTF-8");
// if gDossier is not set redirect to form to choose a folder
if ( ! isset($_REQUEST['gDossier']))
{

View file

@ -3514,3 +3514,18 @@ function updatePeriode(p_dossier,p_exercice,p_periode_from,p_periode_to,p_last)
new Ajax.Updater(p_periode_to,"ajax_misc.php",{method:"get",parameters:{op:"periode_change","gDossier":p_dossier,"exercice":exercice,field:p_periode_to,"type":"to","last":p_last}});
remove_waiting_box();
}
/**
*
* @returns {undefined}
*/
function show_ledger_fin_currency()
{
var ledger=$('p_jrn').value;
var dossier=$('gDossier').value;
// $('ledger_currency').
var a=new Ajax.Updater("ledger_currency",
"ajax_misc.php",
{
parameters: {"op":"currencyCode","gDossier":dossier,"ledger":ledger}
});
}

View file

@ -2933,7 +2933,14 @@ class Acc_Ledger extends jrn_def_sql
Dossier::id(),$select->name,$p_currency_code,$p_currency_rate,$p_eur_amount);
return $select;
}
/**
* @brief returns the code iso of the default currency for this ledger
*/
function get_currency()
{
$cr_iso_code=$this->db->get_value("select cr_code_iso from public.currency where id=$1",[$this->currency_id]);
return $cr_iso_code;
}
}
?>

View file

@ -301,7 +301,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
// Ledger (p_jrn)
//--
$onchange="update_bank();ajax_saldo('first_sold');update_name();update_row('fin_item');";
$onchange="update_bank();ajax_saldo('first_sold');update_name();update_row('fin_item');show_ledger_fin_currency();";
if ($g_parameter->MY_DATE_SUGGEST == 'Y')
$onchange .= 'get_last_date();';

View file

@ -13,7 +13,7 @@
array('value'=>2,'label'=>_("Avec date opérations"))
);
$wchdate->selected=(isset($chdate))?$chdate:1;
$wchdate->javascript='onchange="show_fin_chdate(\'chdate\')"';
$wchdate->javascript='onchange="show_fin_chdate(\'chdate\');"';
?>
<?php echo $wchdate->input();?>
<span id="chdate_ext">
@ -22,8 +22,11 @@
<?php echo $f_period?><br>
<?php echo $f_jrn?><br>
<?php echo _('Banque')?><?php echo $f_bank ?>
<?php echo _('Banque')?><?php echo $f_bank ?>&nbsp;
<?php echo _("Devise")?>&nbsp;
<span id="ledger_currency">
<?php echo $this->get_currency();?>
</span>
</fieldset>
<fieldset>