echo dossier::hidden();
    echo $bilan->display_form($filter_year);
    echo '<span class="notice"> ' . _('Attention : si le bilan n\'est pas équilibré.<br> Vérifiez <ul>
       <li>L\'affectation du résultat est fait</li>
       <li>Vos comptes actifs ont  un solde débiteur (sauf les comptes dit inversés)</li>
       <li> les comptes passifs ont un solde créditeur (sauf les comptes dit inversés) </li>
       </ul>
       Utilisez la balance des comptes pour vérifier.') . ' </span>';
    echo HtmlInput::submit('verif', _('Verification comptabilite'));
    echo HtmlInput::get_to_hidden(array('ac', 'exercice'));
    echo '</FORM>';
}
if (isset($_GET['verif'])) {
    $periode = new Periode($cn);
    $date_from = $periode->first_day($bilan->from);
    $date_to = $periode->last_day($bilan->to);
    echo '<h2>' . _('Etape 2 :Impression') . "   " . $date_from . '-' . $date_to . '</h2>';
    $bilan->get_request_get();
    $bilan->verify();
    $url_verify = http_build_query(array('ac' => 'VERIFBIL', 'gDossier' => dossier::id()));
    echo _('Pour une vérification complète, allez dans ') . '<a class="line" TARGET="_blank" href="?' . $url_verify . '"> VERIFBIL</a>';
    echo '<FORM METHOD="GET" ACTION="export.php">';
    echo dossier::hidden();
    echo HtmlInput::get_to_hidden(array('exercice'));
    echo HtmlInput::hidden('b_id', $_GET['b_id']);
    echo HtmlInput::hidden('act', 'OTH:Bilan');
    echo HtmlInput::hidden('from_periode', $bilan->from);
    echo HtmlInput::hidden('to_periode', $bilan->to);
    echo HtmlInput::submit('Impression', 'Impression');
    echo '</form>';
}
Example #2
0
 *   along with NOALYSS; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/**
 * @file
 * @brief show the state of the repository
 *
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
global $cn, $g_parameter, $g_user;
require_once NOALYSS_INCLUDE . '/class_stock.php';
// Show the form
// Get by exercice
// Get type = table or list
$iexercice = new ISelect('state_exercice');
$iexercice->value = $cn->make_array("select  max(p_end) as date_end, p_exercice from parm_periode  group by p_exercice order by 2 desc");
$per = new Periode($cn, $g_user->get_periode());
$per->load();
$date_limit = $per->limit_year($per->p_exercice);
$last_day = $per->last_day($date_limit['end']);
$last_day = format_date($last_day, 'DD.MM.YYYY', 'YYYY-MM-DD');
$iexercice->selected = isset($_GET['state_exercice']) ? $_GET['state_exercice'] : $last_day;
$presentation = new ISelect("present");
$presentation->value = array(array("value" => "T", "label" => "Tableau récapitulatif"), array("value" => "L", "label" => "Liste"));
$presentation->selected = isset($_GET['present']) ? $_GET['present'] : "T";
require_once NOALYSS_INCLUDE . '/template/stock_state_search.php';
$stock = new Stock($cn);
$stock->summary($_GET);
 /**
  *@brief Display the result of the forecast
  *@param $p_periode
  *@return HTML String with the code
  */
 public function display()
 {
     bcscale(4);
     $forecast = new Forecast($this->cn, $this->f_id);
     $forecast->load();
     $str_name = h($forecast->get_parameter('name'));
     $start = $forecast->get_parameter('start_date');
     $end = $forecast->get_parameter('end_date');
     if ($start == '') {
         throw new Exception(_('Période de début non valable'));
     }
     if ($end == '') {
         throw new Exception(_('Période de fin non valable'));
     }
     $per = new Periode($this->cn, $start);
     $str_start = format_date($per->first_day());
     $per = new Periode($this->cn, $end);
     $str_end = format_date($per->last_day());
     $r = "";
     $aCat = $this->cn->get_array('select fc_id,fc_desc from forecast_cat where f_id=$1 order by fc_order', array($this->f_id));
     $aItem = array();
     $aReal = array();
     $poste = new Acc_Account_Ledger($this->cn, 0);
     $fiche = new Fiche($this->cn);
     $aPeriode = $this->cn->get_array("select p_id,to_char(p_start,'MM.YYYY') as myear from parm_periode\n\t                                 where p_start >= (select p_start from parm_periode where p_id={$start})\n                                         and p_end <= (select p_end from parm_periode where p_id={$end})\n\t\t\t\t\t order by p_start;");
     $error = array();
     for ($j = 0; $j < count($aCat); $j++) {
         $aItem[$j] = $this->cn->get_array('select fi_card,fi_account,fi_text,fi_amount,fi_debit from forecast_item where fc_id=$1  and fi_pid=0 order by fi_order ', array($aCat[$j]['fc_id']));
         $aPerMonth[$j] = $this->cn->get_array('select fi_pid,fi_card,fi_account,fi_text,fi_amount,fi_debit from forecast_item where fc_id=$1 and fi_pid !=0 order by fi_order ', array($aCat[$j]['fc_id']));
         /* compute the real amount for periode */
         for ($k = 0; $k < count($aItem[$j]); $k++) {
             /* for each periode */
             for ($l = 0; $l < count($aPeriode); $l++) {
                 if ($aItem[$j][$k]['fi_account'] == '') {
                     $fiche->id = $aItem[$j][$k]['fi_card'];
                     $amount = $fiche->get_solde_detail("j_tech_per = " . $aPeriode[$l]['p_id']);
                     if ($aItem[$j][$k]['fi_debit'] == 'C' && $amount['debit'] > $amount['credit']) {
                         $amount['solde'] = $amount["solde"] * -1;
                     }
                     if ($aItem[$j][$k]['fi_debit'] == 'D' && $amount['debit'] < $amount['credit']) {
                         $amount['solde'] = $amount["solde"] * -1;
                     }
                 } else {
                     $poste->id = $aItem[$j][$k]['fi_account'];
                     $aresult = Impress::parse_formula($this->cn, "OK", $poste->id, $aPeriode[$l]['p_id'], $aPeriode[$l]['p_id']);
                     $tmp_label = $aresult['desc'];
                     $amount['solde'] = $aresult['montant'];
                     if ($tmp_label != 'OK') {
                         $error[] = "<li> " . $aItem[$j][$k]['fi_text'] . $poste->id . '</li>';
                     }
                 }
                 $aReal[$j][$k][$l] = $amount['solde'];
             }
         }
     }
     ob_start();
     require_once NOALYSS_INCLUDE . '/template/forecast_result.php';
     $r .= ob_get_contents();
     ob_end_clean();
     return $r;
 }