'; //----------------------------------------------------- if (!isset($_GET['cat_display'])) return; $fd_id = $_GET['cat']; $array = Fiche::get_fiche_def($cn, $_GET['cat'], 'name_asc'); $h_add_card_b = new IButton('add_card'); $h_add_card_b->label = _('Créer une nouvelle fiche'); $h_add_card_b->javascript = "dis_blank_card({gDossier:$gDossier,fd_id:$fd_id,ref:2})"; $str_add_card = ($g_user->check_action(FICADD) == 1) ? $h_add_card_b->input() : ""; /* * You show now the result */ if ($array == null) { echo '
'._('Aucune fiche trouvée').'
'; echo $str_add_card; echo ''._(" Ces fiches n'ont pas été effacées ").$msg; echo '
'.$bar; return; } /* * ********************************************************************************************************************************* * Summary * * ******************************************************************************************************************************** */ if ($_GET['histo'] == 3) { $cat_card = new Fiche_Def($cn); $cat_card->id = $_GET['cat']; $aHeading = $cat_card->getAttribut(); if ( $allcard == 0) echo $str_add_card; require_once NOALYSS_INCLUDE.'/template/result_cat_card_summary.php'; $hid = new IHidden(); echo '"; return; } $export_pdf = ''; $export_print = HtmlInput::print_window(); $export_csv = ''; /* * Date is important is requested balance */ if (isDate($_REQUEST['start']) == null || isDate($_REQUEST['end']) == null) { echo h2('Date invalide !', 'class="error"'); alert('Date invalide !'); return; } /************************************************************************************************************************* * Balance agée tous /*************************************************************************************************************************/ if ( $_GET['histo'] == 6) { require_once NOALYSS_INCLUDE.'/class_balance_age.php'; $bal=new Balance_Age($cn); $export_csv = ''; if ( $allcard == 0 ) { echo $export_csv; $bal->display_category($_GET['start'],$_GET['cat'],'let'); echo $export_csv; } else { echo $export_csv; $a_cat = $cn->get_array("select fd_id from vw_fiche_def where ad_id=" . ATTR_DEF_ACCOUNT . " order by fd_label asc"); $nb_cat=count($a_cat); for ($i=0;$i < $nb_cat;$i++) { $bal->display_category($_GET['start'],$a_cat[$i]['fd_id'],'let'); } echo $export_csv; } return; } /************************************************************************************************************************* * Balance en-cours /*************************************************************************************************************************/ if ( $_GET['histo'] == 7) { require_once NOALYSS_INCLUDE.'/class_balance_age.php'; $bal=new Balance_Age($cn); $export_csv = ''; if ( $allcard == 0 ) { echo $export_csv; $bal->display_category($_GET['start'],$_GET['cat'],'unlet'); echo $export_csv; } else { echo $export_csv; $a_cat = $cn->get_array("select fd_id from vw_fiche_def where ad_id=" . ATTR_DEF_ACCOUNT . " order by fd_label asc"); $nb_cat=count($a_cat); for ($i=0;$i < $nb_cat;$i++) { $bal->display_category($_GET['start'],$a_cat[$i]['fd_id'],'unlet'); } echo $export_csv; } return; } /******************************************************************************************************************************** * Balance * **********************************************************************************************************************************/ if ($_GET['histo'] == 4 || $_GET['histo'] == 5) { if ( $allcard == 0 ) echo $str_add_card; echo $export_pdf; echo $export_csv; echo $export_print; $fd = new Fiche_Def($cn, $_REQUEST['cat']); if ($allcard == 0 && $fd->hasAttribute(ATTR_DEF_ACCOUNT) == false) { echo alert(_("Cette catégorie n'ayant pas de poste comptable n'a pas de balance")); return; } // all card if ($allcard == 1) { $afiche = $cn->get_array("select fd_id from vw_fiche_def where ad_id=" . ATTR_DEF_ACCOUNT . " order by fd_label asc"); } else { $afiche[0] = array('fd_id' => $_REQUEST['cat']); } for ($e = 0; $e < count($afiche); $e++) { $ret = $cn->exec_sql("select f_id,ad_value from fiche join fiche_detail using(f_id) where fd_id=$1 and ad_id=1 order by 2 ", array($afiche[$e]['fd_id'])); if ($cn->count() == 0) { if ($allcard == 0) { echo _("Aucune fiche trouvée"); return; } else continue; } echo '
' . $cn->get_value("select fd_label from fiche_def where fd_id=$1", array($afiche[$e]['fd_id'])) . '
'; $id="table_".$afiche[$e]['fd_id']."_id"; echo _('Filtre rapide:').HtmlInput::filter_table($id, '0,1,2', '1'); echo 'Poste'.HtmlInput::infobulle(27).' | '. th('Débit', 'style="text-align:right"') . th('Crédit', 'style="text-align:right"') . th('Solde', 'style="text-align:right"') . th('D/C', 'style="text-align:right"') ); $idx = 0;$sum_deb=0;$sum_cred=0;$sum_solde=0;bcscale(4); for ($i = 0; $i < Database::num_row($ret); $i++) { $filter = " (j_date >= to_date('" . $_REQUEST['start'] . "','DD.MM.YYYY') " . " and j_date <= to_date('" . $_REQUEST['end'] . "','DD.MM.YYYY')) "; $aCard = Database::fetch_array($ret, $i); $oCard = new Fiche($cn, $aCard['f_id']); $solde = $oCard->get_solde_detail($filter); if ($solde['debit'] == 0 && $solde['credit'] == 0) continue; /* only not purged card */ if ($_GET['histo'] == 5 && $solde['debit'] == $solde['credit']) continue; $class =($idx % 2 == 0) ? 'class="odd"':'class="even"'; $idx++; $sum_cred=bcadd($sum_cred,$solde['credit']); $sum_deb=bcadd($sum_deb,$solde['debit']); $sum_solde=bcsub($sum_deb,$sum_cred); echo tr( td(HtmlInput::history_card($oCard->id, $oCard->strAttribut(ATTR_DEF_QUICKCODE))) . td($oCard->strAttribut(ATTR_DEF_NAME)) . td(HtmlInput::history_account($oCard->strAttribut(ATTR_DEF_ACCOUNT),$oCard->strAttribut(ATTR_DEF_ACCOUNT))). td(nbm($solde['debit']), 'class="sorttable_numeric" sorttable_customkey="'.$solde['debit'].'" style="text-align:right"') . td(nbm($solde['credit']), 'class="sorttable_numeric" sorttable_customkey="'.$solde['debit'].'" style="text-align:right"') . td(nbm(abs($solde['solde'])), 'class="sorttable_numeric" sorttable_customkey="'.$solde['solde'].'" style="text-align:right"') . td((($solde['debit'] < $solde['credit']) ? 'C' : 'D'), 'style="text-align:right"'), $class ); } echo ''; echo tr( td(''). td(_('Totaux')). td(''). td(nbm($sum_deb), 'style="text-align:right"'). td(nbm($sum_cred), 'style="text-align:right"'). td(nbm(abs($sum_solde)), 'style="text-align:right"'). td((($sum_deb < $sum_cred) ? 'C' : 'D'), 'style="text-align:right"'),' class="highlight"'); echo ''; echo '
---|
' . $detail_card ; echo "poste " . ":".HtmlInput::history_account($row->strAttribut(ATTR_DEF_ACCOUNT),$row->strAttribut(ATTR_DEF_ACCOUNT),'display:inline').HtmlInput::infobulle(27).'
'; echo ''.HtmlInput::show_reconcile("", $html_letter,$span_error).' | '; } else echo td(''); echo '