get_exercice(); echo '
'; /* * Let you change the exercice */ echo '
'._('Exercice').'';; echo '
'; echo _('Choisissez un autre exercice')." : "; $ex=new Exercice($cn); $wex=$ex->select('exercice',$exercice,' onchange="submit(this)"'); echo $wex->input(); echo dossier::hidden(); echo HtmlInput::get_to_hidden(array('ac','type')); echo '
'; echo '
'; // Show the form for period echo '
'; echo HtmlInput::get_to_hidden(array('ac')); echo HtmlInput::hidden('type','bal'); echo HtmlInput::get_to_hidden(array('exercice')); echo dossier::hidden(); // filter on the current year $from=HtmlInput::default_value_get("from_periode", ""); $input_from=new IPeriod("from_periode",$from,$exercice); $input_from->show_end_date=false; $input_from->type=ALL; $input_from->cn=$cn; $input_from->filter_year=true; $input_from->user=$g_user; echo _('Depuis').' :'.$input_from->input(); // filter on the current year $to=HtmlInput::default_value_get("to_periode", ""); $input_to=new IPeriod("to_periode",$to,$exercice); $input_to->show_start_date=false; $input_to->filter_year=true; $input_to->type=ALL; $input_to->cn=$cn; $input_to->user=$g_user; echo " "._('jusque').' :'.$input_to->input(); echo '
'; echo HtmlInput::button_action(_('Avancé'), " if (\$('balance_advanced_div').style.display=='none') { \$('balance_advanced_div').show();} else { \$('balance_advanced_div').hide();}"); //------------------------------------------------- echo ''; echo HtmlInput::submit("view",_("Visualisation")); echo '
'; echo '
'; //----------------------------------------------------- // Form //----------------------------------------------------- // Show the export button if ( isset ($_GET['view'] ) ) { $hid=new IHidden(); echo ""; echo ''; echo '"; echo '"; echo ''; echo ""; echo "
'. dossier::hidden(). HtmlInput::submit('bt_pdf',"Export PDF"). HtmlInput::hidden("ac",$_REQUEST['ac']). HtmlInput::hidden("act","PDF:balance"). HtmlInput::hidden("from_periode",$_GET['from_periode']). HtmlInput::hidden("to_periode",$_GET['to_periode']); echo HtmlInput::hidden('p_filter',$_GET['p_filter']); for ($e=0;$e
'. HtmlInput::submit('bt_csv',"Export CSV"). dossier::hidden(). HtmlInput::hidden("act","CSV:balance"). HtmlInput::hidden("from_periode",$_GET['from_periode']). HtmlInput::hidden("to_periode",$_GET['to_periode']); echo HtmlInput::get_to_hidden(array('ac')); echo HtmlInput::hidden('p_filter',$_GET['p_filter']); for ($e=0;$e'; echo HtmlInput::print_window(); echo '
"; } //----------------------------------------------------- // Display result //----------------------------------------------------- if ( isset($_GET['view'] ) ) { $bal=new Acc_Balance($cn); if ( $_GET['p_filter']==1) { for ($e=0;$ejrn[]=$selected[$e]; } if ( $_GET['p_filter'] == 0 ) { $bal->jrn=null; } if ( $_GET['p_filter'] == 2 && isset ($_GET['r_cat'])) { $bal->filter_cat($_GET['r_cat']); } $bal->from_poste=$_GET['from_poste']; $bal->to_poste=$_GET['to_poste']; if ( isset($_GET['unsold'])) $bal->unsold=true; $previous=(isset($_GET['previous_exc']))?1:0; $row=$bal->get_row($_GET['from_periode'], $_GET['to_periode'], $previous); $previous= (isset ($row[0]['sum_cred_previous']))?1:0; $periode=new Periode($cn); $a=$periode->get_date_limit($_GET['from_periode']); $b=$periode->get_date_limit($_GET['to_periode']); echo "

période du ".$a['p_start']." au ".$b['p_end']."

"; echo ''; echo _('Filtre').HtmlInput::infobulle(24); echo HtmlInput::filter_table("t_balance", "0,1","1"); echo ''; echo ''; echo ''; echo ''; if ( $previous == 1 ){ echo ''; echo ''; echo ''; echo ''; if ( isset($_GET['lvl1']) || isset($_GET['lvl2']) || isset($_GET['lvl3'])) echo ''; } echo ''; echo ''; echo ''; echo ''; if ( isset($_GET['lvl1']) || isset($_GET['lvl2']) || isset($_GET['lvl3'])) echo ''; $i=0; if ( $previous == 1) { $a_sum=array('sum_cred','sum_deb','solde_deb','solde_cred','sum_cred_previous','sum_deb_previous','solde_deb_previous','solde_cred_previous'); } else { $a_sum=array('sum_cred','sum_deb','solde_deb','solde_cred') ; } foreach($a_sum as $a) { $lvl1[$a]=0; $lvl2[$a]=0; $lvl3[$a]=0; } $lvl1_old=''; $lvl2_old=''; $lvl3_old=''; bcscale(2); foreach ($row as $r) { $i++; if ( $i%2 == 0 ) $tr="even"; else $tr="odd"; $view_history= sprintf('%s', $r['poste'], $gDossier, $r['poste']); /* * level x */ foreach (array(3,2,1) as $ind) { if ( ! isset($_GET['lvl'.$ind]))continue; if (${'lvl'.$ind.'_old'} == '') ${'lvl'.$ind.'_old'}=mb_substr($r['poste'],0,$ind); if ( ${'lvl'.$ind.'_old'} != mb_substr($r['poste'],0,$ind)) { echo ''; echo td(${'lvl'.$ind.'_old'},'style="font-weight:bold;"'); echo td(${'lvl'.$ind.'_old'}." "._("Total niveau")." ".$ind,'style="font-weight:bold;"'); if ($previous==1) { echo td(nbm(${'lvl'.$ind}['sum_deb_previous']),'class="previous_year" style="font-weight:bold;"'); echo td(nbm(${'lvl'.$ind}['sum_cred_previous']),' class="previous_year" style="font-weight:bold;" '); echo td(nbm(${'lvl'.$ind}['solde_deb_previous']),'class="previous_year" style="font-weight:bold;"'); echo td(nbm(${'lvl'.$ind}['solde_cred_previous']),'class="previous_year" style="font-weight:bold;"'); $delta_previous=bcsub(${'lvl'.$ind}['solde_cred_previous'],${'lvl'.$ind}['solde_deb_previous']); $side_previous=($delta_previous > 0 ) ? "C":"D"; echo td(nbm(abs($delta_previous))." $side_previous",'class="previous_year" style="text-align:right;font-weight:bold;" '); } echo td(nbm(${'lvl'.$ind}['sum_deb']),'style="text-align:right;font-weight:bold;" '); echo td(nbm(${'lvl'.$ind}['sum_cred']),'style="text-align:right;font-weight:bold;"'); echo td(nbm(${'lvl'.$ind}['solde_deb']),'style="text-align:right;font-weight:bold;"'); echo td(nbm(${'lvl'.$ind}['solde_cred']),'style="text-align:right;font-weight:bold;"'); $delta=bcsub(${'lvl'.$ind}['solde_cred'],${'lvl'.$ind}['solde_deb']); $side=($delta > 0 ) ? "C":"D"; echo td(nbm(abs($delta))." $side",'style="text-align:right;font-weight:bold;" '); echo ''; ${'lvl'.$ind.'_old'}=mb_substr($r['poste'],0,$ind); foreach($a_sum as $a) { ${'lvl'.$ind}[$a]=0; } } } foreach($a_sum as $a) { $lvl1[$a]=bcadd($lvl1[$a],$r[$a]); $lvl2[$a]=bcadd($lvl2[$a],$r[$a]); $lvl3[$a]=bcadd($lvl3[$a],$r[$a]); } echo ''; echo td($view_history); echo td(h($r['label'])); if ($previous == 1 ) { echo td(nbm($r['sum_deb_previous']),' class="previous_year"'); echo td(nbm($r['sum_cred_previous']),' class="previous_year" '); echo td(nbm($r['solde_deb_previous']),' class="previous_year"'); echo td(nbm($r['solde_cred_previous']),'class="previous_year" '); if ( isset($_GET['lvl1']) || isset($_GET['lvl2']) || isset($_GET['lvl3'])) echo ''; } echo td(nbm($r['sum_deb']),'style="text-align:right;"'); echo td(nbm($r['sum_cred']),'style="text-align:right;"'); echo td(nbm($r['solde_deb']),'style="text-align:right;"'); echo td(nbm($r['solde_cred']),'style="text-align:right;"'); if ( isset($_GET['lvl1']) || isset($_GET['lvl2']) || isset($_GET['lvl3'])) echo ''; echo ''; } echo '
Poste ComptableLibelléDébit N-1Crédit N-1Solde Débiteur N-1Solde Créditeur N-1Solde N-1DébitCréditSolde Débiteur Solde CréditeurSolde
'; }// end submit echo "
"; ?>