'; echo '
'; echo HtmlInput::hidden('ac',$_REQUEST['ac']); echo HtmlInput::hidden('type','gl_comptes'); echo dossier::hidden(); echo ''; $cn=new Database(dossier::id()); $periode=new Periode($cn); $a=$periode->get_limit($g_user->get_exercice()); // $a is an array $first_day=$a[0]->first_day(); $last_day=$a[1]->last_day(); // filter on period $date_from=new IDate('from_periode'); $date_to=new IDate('to_periode'); $year=$g_user->get_exercice(); $date_from->value=(isset($_REQUEST['from_periode'])&& isDate($_REQUEST['from_periode'])!=0)?$_REQUEST['from_periode']:$first_day; $date_to->value=(isset($_REQUEST['to_periode']) && isDate($_REQUEST['to_periode']) !=0 )?$_REQUEST['to_periode']:$last_day; echo td(_('Depuis').$date_from->input()); echo td(_('Jusque ').$date_to->input()); $letter=new ICheckbox('letter'); $letter->selected=(isset($_REQUEST['letter']))?true:false; $from_poste=new IPoste('from_poste'); $from_poste->value=HtmlInput::default_value('from_poste','',$_REQUEST); $from_poste->set_attribute('account','from_poste'); $to_poste=new IPoste('to_poste'); $to_poste->value=HtmlInput::default_value('to_poste','',$_REQUEST); $to_poste->set_attribute('account','to_poste'); $solded=new ICheckbox('solded'); $solded->selected=(isset($_REQUEST['solded']))?true:false; echo ''; echo td(_('Depuis le poste')).td($from_poste->input()); echo ''; echo ''; echo td(_("Jusqu'au poste")).td($to_poste->input()); echo ''; echo ''; echo td(_('Uniquement les opérations non lettrées')); echo td($letter->input()); echo ''; echo ''; echo td(_('Uniquement les comptes non soldés')); echo td($solded->input()); echo ''; // echo '
'; print HtmlInput::submit('bt_html',_('Visualisation')); echo '
'; echo '
'; echo ''; //----------------------------------------------------- // If print is asked // First time in html // after in pdf or cvs //----------------------------------------------------- if ( isset( $_REQUEST['bt_html'] ) ) { require_once NOALYSS_INCLUDE.'/class_acc_account_ledger.php'; echo '
'; echo Acc_Account_Ledger::HtmlTableHeader("gl_comptes"); echo '
'; $sql='select pcm_val from tmp_pcmn '; $cond_poste=''; if ($from_poste->value != '') { $cond_poste = ' where '; $cond_poste .=' pcm_val >= upper (\''.Database::escape_string($from_poste->value).'\')'; } if ( $to_poste->value != '') { if ( $cond_poste == '') { $cond_poste = ' where pcm_val <= upper (\''.Database::escape_string($to_poste->value).'\')'; } else { $cond_poste.=' and pcm_val <= upper (\''.Database::escape_string($to_poste->value).'\')'; } } $sql=$sql.$cond_poste.' order by pcm_val::text'; $a_poste=$cn->get_array($sql); if ( sizeof($a_poste) == 0 ) { die("Nothing here. Strange."); exit; } if ( isDate($_REQUEST['from_periode'])==null || isDate($_REQUEST['to_periode'])==null) { echo alert('Date malformée, désolée'); return; } echo '
'; echo ''; $l=(isset($_REQUEST['letter']))?2:0; $s=(isset($_REQUEST['solded']))?1:0; foreach ($a_poste as $poste_id ) { $Poste=new Acc_Account_Ledger ($cn, $poste_id['pcm_val']); $Poste->load(); $Poste->get_row_date( $_GET['from_periode'], $_GET['to_periode'],$l,$s); if ( empty($Poste->row)) { continue; } echo ''; echo ''; $solde = 0.0; $solde_d = 0.0; $solde_c = 0.0; bcscale(2); $i=0; $current_exercice=""; foreach ($Poste->row as $detail) { /* * separation per exercice */ if ( $current_exercice == "") $current_exercice=$detail['p_exercice']; if ( $current_exercice != $detail['p_exercice']) { echo ''. ''; /* * reset total and current_exercice */ $current_exercice=$detail['p_exercice']; $solde = 0.0; $solde_d = 0.0; $solde_c = 0.0; } if ($detail['cred_montant'] > 0) { $solde=bcsub($solde, $detail['cred_montant']); $solde_c=bcadd($solde_c,$detail['cred_montant']); } if ($detail['deb_montant'] > 0) { $solde = bcadd($solde,$detail['deb_montant']); $solde_d = bcadd($solde_d,$detail['deb_montant']); } $side=" ".$Poste->get_amount_side($solde); $letter=""; $html_let=""; if ($detail['letter']!=-1) { $letter=strtoupper(base_convert($detail['letter'],10,36)); $html_let = HtmlInput::show_reconcile("", $letter); } $i++; if (($i % 2 ) == 0) $class="odd"; else $class="even"; echo ''; } echo ''. ''; } echo '

'. $poste_id['pcm_val'].' '.h($Poste->label).'

Date Référence Libellé Pièce Débit Crédit Solde Let.
'.$current_exercice.' '.''.' '.'Total du compte '.$poste_id['pcm_val'].' '.''.' '.($solde_d > 0 ? nbm( $solde_d) : '').' '.($solde_c > 0 ? nbm( $solde_c) : '').' '.nbm( abs($solde_c-$solde_d)).' '; if ($solde_c > $solde_d ) echo _("Crédit"); if ($solde_c < $solde_d ) echo _("Débit"); if ($solde_c == $solde_d ) echo "="; echo '
'.$detail['j_date_fmt'].' '.HtmlInput::detail_op($detail['jr_id'],$detail['jr_internal']).' '.$detail['description'].' '.$detail['jr_pj_number'].' '.($detail['deb_montant'] > 0 ? nbm($detail['deb_montant']) : '').' '.($detail['cred_montant'] > 0 ? nbm($detail['cred_montant']) : '').' '.nbm(abs($solde)).$side.' '.$html_let.'
'.$current_exercice.' '.''.' '.''.'Total du compte '.$poste_id['pcm_val'].''.' '.''.' '.''.($solde_d > 0 ? nbm( $solde_d) : '').''.' '.''.($solde_c > 0 ? nbm( $solde_c) : '').''.' '.''.nbm( abs($solde_c-$solde_d)).''.' '; if ($solde_c > $solde_d ) echo "Crédit"; if ($solde_c < $solde_d ) echo "Débit"; if ($solde_c == $solde_d ) echo "="; echo '
'; echo Acc_Account_Ledger::HtmlTableHeader("gl_comptes"); echo "
"; exit; } ?>