示例#1
0
 /**
  * Retourne le(s) ID(s) du type de la semaine correspondant à la date en parametre dans un tableau
  */
 public static function getIdType($date)
 {
     $isHoliday = Periode::isHoliday($date);
     $day = Periode::getDay($date);
     $types = TypeSemaine::all();
     $results = [];
     // Si le jour n'est pas dimanche
     if ($day != "0") {
         $day--;
         // On diminue de 1 pour correspondre à la position de la valeur dans nature
     } else {
         $day = "6";
         // La position dans nature est de 6
     }
     // Parcourir tous les types de semaine
     foreach ($types as $type) {
         // Initialisation des variables à chaque itération
         $isDayOk = false;
         $isPeriodOk = false;
         $found = false;
         // Vérification du "1" à la place du jour de la date (-1 puisque provenant de getdate())
         if ($type->nature[$day] == "1") {
             $isDayOk = true;
         }
         // Vérification de V / S / T en fonction de la période (vacances ou non)
         if ($isHoliday) {
             if ($type->nature[7] == "V" || $type->nature[7] == "T") {
                 $isPeriodOk = true;
             }
         } else {
             if ($type->nature[7] == "S" || $type->nature[7] == "T") {
                 $isPeriodOk = true;
             }
         }
         // Si une période correspond
         if ($isDayOk && $isPeriodOk) {
             // Trouvé à vrai et on remplit le tableau de résultas
             $found = true;
             array_push($results, $type->idTypeSemaine);
         }
     }
     if ($found) {
         return $results;
     } else {
         // Retourne faux si aucune période ne correspond
         return false;
     }
 }
示例#2
0
 /**
  * Retourne true si la période en param est pdt les vacs sinon false
  */
 public static function isHoliday($date)
 {
     $isHoliday = false;
     $periodes = Periode::all();
     $stampDateInput = strtotime($date);
     // Parcoure toutes les périodes
     foreach ($periodes as $periode) {
         $stampDateDebut = strtotime($periode->dateDebut);
         $stampDateFin = strtotime($periode->dateFin);
         // Si la date entrée est comprise entre le début et la fin de la période parcourue
         if ($stampDateInput > $stampDateDebut && $stampDateInput < $stampDateFin) {
             $isHoliday = true;
         }
     }
     return $isHoliday;
 }
示例#3
0
 static function test_me()
 {
     $cn = new Database(dossier::id());
     $obj = new Periode($cn);
     $obj->set_jrn(1);
     $obj->display_form_periode();
 }
 function html_table($p_from)
 {
     if ($p_from == "") {
         $from = "";
         $to = "";
     } else {
         $p = new Periode($this->db);
         list($from, $to) = $p->get_date_limit($p_from);
     }
     $array = $this->get_list($from, $to);
     if (empty($array)) {
         return "Pas d'enregistrement trouv&eacute;";
     }
     // navigation_bar
     $step = $_SESSION['g_pagesize'];
     $page = isset($_GET['offset']) ? $_GET['page'] : 1;
     $offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
     $bar = navigation_bar($offset + 1, count($array), $step, $page);
     if ($step != -1) {
         $view = array_splice($array, $offset, $step);
     } else {
         $view = $array;
     }
     $gDossier = dossier::id();
     $ret = "";
     $ret .= $bar;
     $count = 0;
     $group = 0;
     $oldgroup = 0;
     $oldjrid = 0;
     foreach ($view as $row) {
         $group = $row['oa_group'];
         if ($group != $oldgroup) {
             if ($oldgroup != 0) {
                 $efface = new IButton();
                 $efface->javascript = "anc_remove_operation(" . $gDossier . "," . $oldgroup . ")";
                 $efface->name = "Efface";
                 $efface->label = "Efface";
                 $ret .= "<td>" . $efface->input() . "</td>";
                 $this->oa_group = $oldgroup;
                 $jr_id = $this->get_jrid();
                 if ($jr_id != 0) {
                     // get the old jr_id
                     $detail = new IButton();
                     $detail->javascript = "viewOperation({$jr_id},{$gDossier})";
                     $detail->name = "Detail";
                     $detail->label = "Detail";
                     $ret .= "<td>" . $detail->input() . "</td>";
                 }
                 $ret .= '</table>';
             }
             $ret .= '<table id="' . $row['oa_group'] . '" class="result">';
             $ret .= "<tr class=\"highlight\">" . td($row['oa_date']) . "<td>" . HtmlInput::detail_op($row['jr_id'], h($row['oa_description'] . " " . $row['jr_pj_number'])) . "</td>" . td();
             $ret .= "<td>" . "Groupe id : " . $row['oa_group'] . "</td>" . ($oldgroup = $group);
         }
         $class = $count % 2 == 0 ? "odd" : "even";
         $count++;
         $cred = $row['oa_debit'] == 'f' ? "CREDIT" : "DEBIT";
         $ret .= "<tr class=\"{$class}\">";
         $ret .= "<td>" . h($row['po_name']) . "</td>";
         $ret .= td(h($row['po_description']));
         $ret .= '<td class="num">' . nbm($row['oa_amount']) . "</td>" . "<td>" . $cred . "</td>" . "</tr>";
     }
     $efface = new IButton();
     $efface->javascript = "anc_remove_operation(" . "{$gDossier}," . $oldgroup . ")";
     $efface->name = "Efface";
     $efface->label = "Efface";
     $ret .= "<td>" . $efface->input() . "</td>";
     // get the old jr_id
     $this->oa_group = $oldgroup;
     $jr_id = $this->get_jrid();
     if ($jr_id != 0) {
         $detail = new IButton();
         $detail->javascript = "modifyOperation({$jr_id},'" . $gDossier . "')";
         $detail->name = "Detail";
         $detail->label = "Detail";
         $ret .= "<td>" . $detail->input() . "</td>";
     }
     $ret .= '</table>';
     $ret .= $bar;
     return $ret;
 }
示例#5
0
$cn = new Database($gDossier);
global $g_user, $g_failed;
/**
 * Show first the form
 */
/* category */
$categorie = new ISelect('cat');
$categorie->value = $cn->make_array('select fd_id,fd_label from fiche_def order by fd_label');
$categorie->selected = isset($_GET['cat']) ? $_GET['cat'] : 0;
$str_categorie = $categorie->input();
$icall = new ICheckBox("allcard", 1);
$icall->selected = isset($_GET['allcard']) ? 1 : 0;
$str_icall = $icall->input();
/* periode */
$exercice = $g_user->get_exercice();
$iperiode = new Periode($cn);
list($first, $last) = $iperiode->get_limit($exercice);
$periode_start = new IDate('start');
$periode_end = new IDate('end');
$periode_start->value = isset($_GET['start']) ? $_GET['start'] : $first->first_day();
$periode_end->value = isset($_GET['end']) ? $_GET['end'] : $last->last_day();
$str_start = $periode_start->input();
$str_end = $periode_end->input();
/* histo ou summary */
$histo = new ISelect('histo');
$histo->value = array(array('value' => -1, 'label' => _('Liste')), array('value' => 0, 'label' => _('Historique')), array('value' => 1, 'label' => _('Historique Lettré')), array('value' => 6, 'label' => _('Historique Lettré et montants différents')), array('value' => 2, 'label' => _('Historique non Lettré')), array('value' => 3, 'label' => _('Résumé')), array('value' => 4, 'label' => _('Balance')), array('value' => 6, 'label' => _('Balance âgée')), array('value' => 7, 'label' => _('Balance âgée en-cours')), array('value' => 5, 'label' => _('Balance non soldée')));
$histo->javascript = 'onchange="if (this.value==3 || this.value==-1) {
                   g(&quot;trstart&quot;).style.display=&quot;none&quot;;g(&quot;trend&quot;).style.display=&quot;none&quot;;g(&quot;allcard&quot;).style.display=&quot;none&quot;;}
                   else  {g(&quot;trstart&quot;).style.display=&quot;&quot;;g(&quot;trend&quot;).style.display=&quot;&quot;;g(&quot;allcard&quot;).style.display=&quot;&quot;;}"';
$histo->selected = isset($_GET['histo']) ? $_GET['histo'] : -1;
$str_histo = $histo->input();
示例#6
0
function sql_filter_per($p_cn, $p_from, $p_to, $p_form = 'p_id', $p_field = 'jr_tech_per')
{
    if ($p_form != 'p_id' && $p_form != 'date') {
        echo_error(__FILE__, __LINE__, 'Mauvais parametres ');
        exit(-1);
    }
    if ($p_form == 'p_id') {
        // retrieve the date
        $pPeriode = new Periode($p_cn);
        $a_start = $pPeriode->get_date_limit($p_from);
        $a_end = $pPeriode->get_date_limit($p_to);
        if ($a_start == null || $a_end == null) {
            throw new Exception(__FILE__ . __LINE__ . sprintf(_('Attention periode 
		     non trouvee periode p_from= %s p_to_periode = %s'), $p_from, $p_to));
        }
        $p_from = $a_start['p_start'];
        $p_to = $a_end['p_end'];
    }
    if ($p_from == $p_to) {
        $periode = " {$p_field} = (select p_id from parm_periode " . " where " . " p_start = to_date('{$p_from}','DD.MM.YYYY')) ";
    } else {
        $periode = "{$p_field} in (select p_id from parm_periode " . " where p_start >= to_date('{$p_from}','DD.MM.YYYY') and p_end <= to_date('{$p_to}','DD.MM.YYYY')) ";
    }
    return $periode;
}
示例#7
0
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   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
 *
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
global $g_user, $cn, $g_parameter;
require_once NOALYSS_INCLUDE . '/class_stock.php';
require_once NOALYSS_INCLUDE . '/class_periode.php';
$stock = new Stock($cn);
$array = $_GET;
if (!isset($array['wdate_start']) || !isset($array['wdate_end'])) {
    // Date start / end
    $exercice = $g_user->get_exercice();
    $periode = new Periode($cn);
    list($periode_start, $periode_end) = $periode->get_limit($exercice);
    $array['wdate_start'] = $periode_start->first_day();
    $array['wdate_end'] = $periode_end->last_day();
}
$stock->history($array);
示例#8
0
 function build_tmp_table($p_array)
 {
     global $cn, $g_user;
     // exercice
     if (isset($p_array['state_exercice'])) {
         $periode = new Periode($cn);
         $date = format_date($p_array['state_exercice'], 'YYYY-MM-DD');
         $periode->find_periode($date);
     } else {
         $periode_id = $g_user->get_periode();
         $periode = new Periode($cn, $periode_id);
     }
     $periode->load();
     $tmp_id = $cn->get_next_seq("public.tmp_stockgood_s_id_seq");
     $cn->exec_sql("delete from tmp_stockgood where s_date < now() - interval '2 days' ");
     $cn->exec_sql("insert into tmp_stockgood(s_id) values (\$1)", array($tmp_id));
     // get all readable repository
     $a_repository = $g_user->get_available_repository('R');
     // From ACH : IN
     $sql_repo_detail = "\n\t\t\tinsert into tmp_stockgood_detail(s_id,sg_code,s_qin,r_id,f_id)\n\t\t\t\tselect {$tmp_id},trim(sg_code), coalesce(sum(sg_quantity),0) as qin,r_id,f_id\n\t\t\t\tfrom stock_goods\n\t\t\t\twhere\n\t\t\t\t\tsg_type='d'\n\t\t\t\t\tand j_id is not null\n\t\t\t\t\tand j_id in (select j_id from jrnx where  j_tech_per in (select p_id from parm_periode where p_exercice=\$2))\n\t\t\t\t\tand r_id  in (select r_id from profile_sec_repository where p_id=\$1)\n\t\t\t\t\tgroup by r_id,trim(sg_code),f_id\n\t\t\t";
     // From VEN : out
     $cn->exec_sql($sql_repo_detail, array($g_user->get_profile(), $periode->p_exercice));
     $sql_repo_detail = "\n\t\t\t\tinsert into tmp_stockgood_detail(s_id,sg_code,s_qout,r_id,f_id)\n\t\t\t\tselect {$tmp_id},trim(sg_code) , coalesce(sum(sg_quantity),0) as qout,r_id,f_id\n\t\t\t\tfrom stock_goods as sg\n\t\t\t\twhere\n\t\t\t\t\tsg_type='c'\n\t\t\t\t\tand sg.j_id is not null\n\t\t\t\t\tand sg.j_id in (select j_id from jrnx where  j_tech_per in (select p_id from parm_periode where p_exercice=\$2))\n\t\t\t\t\tand sg.r_id  in (select r_id from profile_sec_repository where p_id=\$1)\n\t\t\t\t\tgroup by r_id,trim(sg_code),f_id\n\t\t\t";
     $cn->exec_sql($sql_repo_detail, array($g_user->get_profile(), $periode->p_exercice));
     // From INV  IN
     $sql_repo_detail = "\n\t\t\tinsert into tmp_stockgood_detail(s_id,sg_code,s_qin,r_id,f_id)\n\t\t\t\tselect {$tmp_id},trim(sg_code) , coalesce(sum(sg_quantity),0) as qin,r_id,f_id\n\t\t\t\tfrom stock_goods as sg\n\t\t\t\twhere\n\t\t\t\t\tsg_type='d'\n\t\t\t\t\tand j_id is null\n\t\t\t\t\tand sg_date >= ( select min(p_start) from parm_periode where p_exercice=\$2)\n\t\t\t\t\tand sg_date <= ( select max(p_end) from parm_periode where p_exercice=\$2)\n\t\t\t\t\t and sg.r_id  in (select r_id from profile_sec_repository where p_id=\$1)\n\t\t\t\t\tgroup by r_id,trim(sg_code),f_id\n\t\t\t";
     // From INV: OUT
     $cn->exec_sql($sql_repo_detail, array($g_user->get_profile(), $periode->p_exercice));
     $sql_repo_detail = "\n\t\t\t\tinsert into tmp_stockgood_detail(s_id,sg_code,s_qout,r_id,f_id)\n\t\t\t\tselect {$tmp_id},trim(sg_code), coalesce(sum(sg_quantity),0) as qout,r_id,f_id\n\t\t\t\tfrom stock_goods\n\t\t\t\twhere\n\t\t\t\t\tsg_type='c'\n\t\t\t\t\tand j_id is null\n\t\t\t\t\t and r_id  in (select r_id from profile_sec_repository where p_id=\$1)\n                                        and sg_date >= ( select min(p_start) from parm_periode where p_exercice=\$2)\n\t\t\t\t\tand sg_date <= ( select max(p_end) from parm_periode where p_exercice=\$2)\t\t\t\t\t\n                                        group by r_id,trim(sg_code),f_id\n\t\t\t";
     $cn->exec_sql($sql_repo_detail, array($g_user->get_profile(), $periode->p_exercice));
     return $tmp_id;
 }
示例#9
0

switch ($_GET['action']) {
	case 'CarnetLiaison' :
		echo json_encode(CarnetLiaison::getById($_GET['idCarnetLiaison'])->toArray());
		break;
	case 'Evaluation':
		echo json_encode(Evaluation::getById($_GET['idEvaluation'])->toArray());
		break;
    case 'Matiere' :
        echo json_encode(Matiere::getById($_GET['idMatiere'])->toArray());
        break;
    case 'Module' :
        echo json_encode(Module::getById($_GET['idModule'])->toArray());
        break;
    case 'Niveau' :
        echo json_encode(Niveau::getById($_GET['idNiveau'])->toArray());
        break;
    case 'NiveauCpt' :
        echo json_encode(NiveauCpt::getById($_GET['idNiveauCpt'])->toArray());
        break;
	case 'Periode':
		echo json_encode(Periode::getById($_GET['idPeriode'])->toArray());
		break;
	case 'Trimestre':
		echo json_encode(Trimestre::getById($_GET['idTrimestre'])->toArray());
		break;
    case 'Utilisateur' :
        echo json_encode(Utilisateur::getById($_GET['idUtilisateur'])->toArray());
        break;
}
示例#10
0
 /**
  * Return an array, used by Stock_Goods::input 
  * @global type $cn
  * @param type $p_array
  * @throws Exception
  */
 function take_last_inventory($p_array)
 {
     global $cn;
     $year = HtmlInput::default_value("p_exercice", "", $p_array);
     $depot = HtmlInput::default_value("p_depot", "", $p_array);
     if ($year == "") {
         throw new Exception(_('Inventaire invalide'), 10);
     }
     if ($depot == "") {
         throw new Exception(_('Dépôt invalide'), 20);
     }
     // compute state_exercice
     $periode = new Periode($cn);
     $periode->p_id = $cn->get_value("select min(p_id) from parm_periode where p_exercice=\$1", array($year));
     $first_day = $periode->first_day();
     // compute array for stock
     $array['state_exercice'] = $first_day;
     $stock = new Stock($cn);
     $rowid = $stock->build_tmp_table($array);
     // compute first day of the next year
     $next_year = $year + 1;
     $periode = new Periode($cn);
     $periode->p_id = $cn->get_value("select min(p_id) from parm_periode where p_exercice=\$1", array($next_year));
     if ($periode->p_id == "") {
         $array['p_date'] = "";
     } else {
         $array['p_date'] = $periode->first_day();
     }
     // Compute an array compatible with Stock_Goods::input
     $array['p_motif'] = _('Inventaire ') . $year;
     $array['p_depot'] = $depot;
     $result = $cn->get_array("\n                select sg_code,sum(coalesce(s_qin,0)-coalesce(s_qout,0)) tot_\n                from tmp_stockgood_detail \n                where \n                s_id=\$1 and r_id=\$2 \n                group by sg_code", array($rowid, $depot));
     for ($e = 0; $e < count($result); $e++) {
         $array['sg_code' . $e] = $result[$e]['sg_code'];
         $array['sg_quantity' . $e] = $result[$e]['tot_'];
     }
     $array['row'] = $e;
     return $array;
 }
示例#11
0
        $html = ob_get_contents();
        ob_end_clean();
    }
}
///////////////////////////////////////////////////////////////////////////
// for an account
///////////////////////////////////////////////////////////////////////////
if (isset($_REQUEST['pcm_val'])) {
    $poste = new Acc_Account_Ledger($cn, $_REQUEST['pcm_val']);
    $year = $g_user->get_exercice();
    if ($year == 0) {
        $html = _("erreur aucune période par défaut, allez dans préférence pour en choisir une");
    } else {
        $exercice = new Exercice($cn);
        $old = '';
        $per = new Periode($cn);
        $limit_periode = $per->get_limit($year);
        $array['from_periode'] = $limit_periode[0]->first_day();
        $array['to_periode'] = $limit_periode[1]->last_day();
        if (isset($_GET['ex'])) {
            $limit_periode = $per->get_limit($_GET['ex']);
            if ($_GET['ex'] < $year) {
                $array['from_periode'] = $limit_periode[0]->first_day();
            } else {
                $array['to_periode'] = $limit_periode[1]->last_day();
            }
        }
        /*
         * Add button to select another year
         */
        if ($exercice->count() > 1) {
示例#12
0
    echo '<FORM  METHOD="GET">';
    echo HtmlInput::hidden('type', 'bilan');
    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');
示例#13
0
            $bal->filter_cat($_GET['r_cat']);
        }
        break;
}
$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;
$array = $bal->get_row($from_periode, $to_periode, $previous);
$previous = isset($array[0]['sum_cred_previous']) ? 1 : 0;
if (sizeof($array) == 0) {
    exit;
}
$pPeriode = new Periode($cn);
$a = $pPeriode->get_date_limit($from_periode);
$b = $pPeriode->get_date_limit($to_periode);
$per_text = "  du " . $a['p_start'] . " au " . $b['p_end'];
if ($previous == 1) {
    $pdf = new PDFLand($cn);
} else {
    $pdf = new PDF($cn);
}
$pdf->setDossierInfo(" Balance  " . $per_text);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetAuthor('NOALYSS');
$pdf->SetFont('DejaVuCond', '', 7);
$pdf->setTitle("Balance comptable", true);
$pdf->Cell(30, 6, 'poste');
示例#14
0
 /**
  *@brief Display a form for adding an new anticipation
  *@return html string with the form
  */
 private function form_cat_new()
 {
     global $g_user;
     $r = "";
     $str_action = _('Nouveau');
     $name = new IText('an_name');
     $str_name = $name->input();
     $start_date = new IPeriod('start_date');
     $start_date->type = ALL;
     $start_date->cn = $this->cn;
     $start_date->show_end_date = false;
     $start_date->show_start_date = true;
     $start_date->user = $g_user;
     $start_date->filter_year = false;
     $end_date = new IPeriod('end_date');
     $end_date->type = ALL;
     $end_date->cn = $this->cn;
     $end_date->show_end_date = true;
     $end_date->show_start_date = false;
     $end_date->user = $g_user;
     $end_date->filter_year = false;
     $period = $g_user->get_periode();
     $per = new Periode($this->cn, $period);
     $year = $per->get_exercice();
     list($per_start, $per_end) = $per->get_limit($year);
     $start_date->value = $per_start->p_id;
     $end_date->value = $per_end->p_id;
     $str_start_date = $start_date->input();
     $str_end_date = $end_date->input();
     $aLabel = array(_('Ventes'), _('Dépense'), _('Banque'));
     $aCat = array();
     for ($i = 0; $i < MAX_CAT; $i++) {
         /* category name */
         $name = new IText('fr_cat' . $i);
         $name->value = isset($aLabel[$i]) ? $aLabel[$i] : '';
         $aCat[$i]['name'] = $name->input();
         /* category order */
         $order = new IText('fr_order' . $i);
         $order->value = $i + 1;
         $aCat[$i]['order'] = $order->input();
     }
     ob_start();
     require_once NOALYSS_INCLUDE . '/template/forecast_cat.php';
     $r .= ob_get_contents();
     ob_end_clean();
     return $r;
 }
示例#15
0
    $choose = "yes";
}
if ($action == 'reopen') {
    $jrn_def_id = isset($_GET['jrn_def_id']) ? $_GET['jrn_def_id'] : 0;
    $per = new Periode($cn);
    $jrn_def_id = isset($_GET['jrn_def_id']) ? $_GET['jrn_def_id'] : 0;
    $per->set_jrn($jrn_def_id);
    $per->set_periode($_GET['p_per']);
    $per->reopen();
    $choose = "yes";
}
if ($choose == "yes") {
    echo '<p>';
    echo HtmlInput::button_anchor('Autre Journal ?', '?choose=no&ac=' . $_REQUEST['ac'] . '&gDossier=' . dossier::id());
    echo '</p>';
    $per = new Periode($cn);
    $jrn = isset($_GET['jrn_def_id']) ? $_GET['jrn_def_id'] : 0;
    $per->set_jrn($jrn);
    $per->display_form_periode();
    $nb_exercice = new ISelect("nb_exercice");
    $nb_exercice->value = array(array('value' => 12, 'label' => "12 périodes"), array('value' => 13, 'label' => "13 périodes"));
    require_once NOALYSS_INCLUDE . '/template/periode_add_exercice.php';
} else {
    echo '<form method="GET" >';
    echo dossier::hidden();
    $sel_jrn = $cn->make_array("select jrn_def_id, jrn_def_name from " . " jrn_def order by jrn_def_name");
    $sel_jrn[] = array('value' => 0, 'label' => 'Global : periode pour tous les journaux');
    $wSel = new ISelect();
    $wSel->value = $sel_jrn;
    $wSel->name = 'jrn_def_id';
    echo "Choisissez global ou uniquement le journal à fermer" . $wSel->input();
示例#16
0
 /**
  * @brief return the first date and the last date of the current exercice for the current user
  * @return and array ([0] => start_date,[1] => end_date)
  */
 function get_limit_current_exercice()
 {
     $current_exercice = $this->get_exercice();
     $periode = new Periode($this->db);
     list($per_start, $per_end) = $periode->get_limit($current_exercice);
     $start = $per_start->first_day();
     $end = $per_end->last_day();
     return array($start, $end);
 }
    NoAccess();
    exit - 1;
}
$Ledger->id = $p_jrn;
echo $Ledger->display_search_form();
//------------------------------
// UPdate the payment
//------------------------------
if (isset($_GET['paid'])) {
    $Ledger->update_paid($_GET);
}
$msg = "";
/* by default we should use the default period */
if (!isset($p_array['date_start'])) {
    $period = $g_user->get_periode();
    $per = new Periode($cn, $period);
    list($date_start, $date_end) = $per->get_date_limit();
    $p_array['date_start'] = $date_start;
    $p_array['date_end'] = $date_end;
    $msg = '<h2 class="info2">' . _("Période ") . $date_start . _(" au ") . $date_end . '</h2>';
} else {
    $msg = '<h2 class="info2">' . _("Période ") . $_GET['date_start'] . _(" au ") . $_GET['date_end'] . '</h2>';
}
/*  compute the sql stmt */
list($sql, $where) = $Ledger->build_search_sql($p_array);
$max_line = $cn->count_sql($sql);
$step = $_SESSION['g_pagesize'];
$page = isset($_GET['offset']) ? $_GET['page'] : 1;
$offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
$bar = navigation_bar($offset, $max_line, $step, $page);
echo $msg;
    die('Appel direct ne sont pas permis');
}
require_once NOALYSS_INCLUDE . '/class_lettering.php';
global $g_user;
echo '<div class="content">';
echo '<div id="search">';
echo '<FORM METHOD="GET">';
echo dossier::hidden();
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo HtmlInput::hidden('sb', $_REQUEST['sb']);
echo HtmlInput::hidden('sc', $_REQUEST['sc']);
echo HtmlInput::hidden('f_id', $_REQUEST['f_id']);
echo '<table width="50%">';
// limit of the year
$exercice = $g_user->get_exercice();
$periode = new Periode($cn);
list($first_per, $last_per) = $periode->get_limit($exercice);
$start = new IDate('start');
$start->value = isset($_GET['start']) ? $_GET['start'] : $first_per->first_day();
$r = td(_('Date début'));
$r .= td($start->input());
echo tr($r);
$end = new IDate('end');
$end->value = isset($_GET['end']) ? $_GET['end'] : $last_per->last_day();
$r = td(_('Date fin'));
$r .= td($end->input());
echo tr($r);
// type of lettering : all, lettered, not lettered
$sel = new ISelect('type_let');
$sel->value = array(array('value' => 0, 'label' => _('Toutes opérations')), array('value' => 1, 'label' => _('Opérations lettrées')), array('value' => 2, 'label' => _('Opérations NON lettrées')));
if (isset($_GET['type_let'])) {
示例#19
0
 function get_row($p_from_periode, $p_to_periode, $p_previous_exc = 0)
 {
     global $g_user;
     // filter on requested periode
     $per_sql = sql_filter_per($this->db, $p_from_periode, $p_to_periode, 'p_id', 'j_tech_per');
     $and = "";
     $jrn = "";
     $from_poste = "";
     $to_poste = "";
     /* if several ledgers are asked then we filter here  */
     if ($this->jrn !== null) {
         /**
          *@file
          *@bug the get_ledger here is not valid and useless we just need a list of the 
          * asked ledgers
          */
         $jrn = "  j_jrn_def in (";
         $comma = '';
         for ($e = 0; $e < count($this->jrn); $e++) {
             $jrn .= $comma . $this->jrn[$e];
             $comma = ',';
         }
         $jrn .= ')';
         $and = " and ";
     }
     if (strlen(trim($this->from_poste)) != 0 && $this->from_poste != -1) {
         $from_poste = " {$and} j_poste::text >= '" . $this->from_poste . "'";
         $and = " and ";
     }
     if (strlen(trim($this->to_poste)) != 0 && $this->to_poste != -1) {
         $to_poste = " {$and} j_poste::text <= '" . $this->to_poste . "'";
         $and = " and ";
     }
     $filter_sql = $g_user->get_ledger_sql('ALL', 3);
     switch ($p_previous_exc) {
         case 0:
             // build query
             $sql = "select j_poste as poste,sum(deb) as sum_deb, sum(cred) as sum_cred from\n                     ( select j_poste,\n                     case when j_debit='t' then j_montant else 0 end as deb,\n                     case when j_debit='f' then j_montant else 0 end as cred\n                     from jrnx join tmp_pcmn on (j_poste=pcm_val)\n                     left join parm_periode on (j_tech_per = p_id)\n                     join jrn_def on (j_jrn_def=jrn_def_id)\n                     where\n                     {$jrn} {$from_poste} {$to_poste}\n                     {$and} {$filter_sql}\n                     and\n                     {$per_sql} ) as m group by 1 order by 1";
             break;
         case 1:
             /*
              * retrieve balance previous exercice
              */
             $periode = new Periode($this->db);
             $previous_exc = $periode->get_exercice($p_from_periode) - 1;
             try {
                 list($previous_start, $previous_end) = $periode->get_limit($previous_exc);
                 $per_sql_previous = sql_filter_per($this->db, $previous_start->p_id, $previous_end->p_id, 'p_id', 'j_tech_per');
                 $sql = "\n                            with m as \n                                ( select j_poste,sum(deb) as sdeb,sum(cred) as scred\n                                from \n                                (select j_poste, \n                                    case when j_debit='t' then j_montant else 0 end as deb, \n                                    case when j_debit='f' then j_montant else 0 end as cred \n                                    from jrnx \n                                    join tmp_pcmn on (j_poste=pcm_val) \n                                    left join parm_periode on (j_tech_per = p_id) \n                                    join jrn_def on (j_jrn_def=jrn_def_id) \n                                    where\n                                                             {$jrn} {$from_poste} {$to_poste}\n                                    {$and} {$filter_sql} and {$per_sql}\n                                    ) as sub_m group by j_poste order by j_poste ) , \n                            p as ( select j_poste,sum(deb) as sdeb,sum(cred) as scred \n                                from \n                                    (select j_poste, \n                                        case when j_debit='t' then j_montant else 0 end as deb, \n                                        case when j_debit='f' then j_montant else 0 end as cred \n                                        from jrnx join tmp_pcmn on (j_poste=pcm_val) \n                                        left join parm_periode on (j_tech_per = p_id) \n                                        join jrn_def on (j_jrn_def=jrn_def_id) \n                                        where \n                                       {$jrn} {$from_poste} {$to_poste}\n                                    {$and} {$filter_sql} and {$per_sql_previous})  as sub_p group by j_poste order by j_poste)\n                            select coalesce(m.j_poste,p.j_poste) as poste\n                                                                ,coalesce(m.sdeb,0) as sum_deb\n                                                                , coalesce(m.scred,0) as sum_cred \n                                                                ,coalesce(p.sdeb,0) as sum_deb_previous\n                                                                , coalesce(p.scred,0) as sum_cred_previous from m full join p on (p.j_poste=m.j_poste)\n                                             order by poste";
             } catch (Exception $exc) {
                 $p_previous_exc = 0;
                 /*
                  * no previous exercice
                  */
                 $sql = "select upper(j_poste::text) as poste,sum(deb) as sum_deb, sum(cred) as sum_cred from\n                     ( select j_poste,\n                     case when j_debit='t' then j_montant else 0 end as deb,\n                     case when j_debit='f' then j_montant else 0 end as cred\n                     from jrnx join tmp_pcmn on (j_poste=pcm_val)\n                     left join parm_periode on (j_tech_per = p_id)\n                     join jrn_def on (j_jrn_def=jrn_def_id)\n                     where\n                     {$jrn} {$from_poste} {$to_poste}\n                     {$and} {$filter_sql}\n                     and\n                     {$per_sql} ) as m group by poste order by poste";
             }
             break;
     }
     $cn = clone $this->db;
     $Res = $this->db->exec_sql($sql);
     $tot_cred = 0.0;
     $tot_deb = 0.0;
     $tot_deb_saldo = 0.0;
     $tot_cred_saldo = 0.0;
     $tot_cred_previous = 0.0;
     $tot_deb_previous = 0.0;
     $tot_deb_saldo_previous = 0.0;
     $tot_cred_saldo_previous = 0.0;
     $M = $this->db->size();
     // Load the array
     for ($i = 0; $i < $M; $i++) {
         $r = $this->db->fetch($i);
         $poste = new Acc_Account($cn, $r['poste']);
         $a['poste'] = $r['poste'];
         $a['label'] = mb_substr($poste->get_lib(), 0, 40);
         $a['sum_deb'] = round($r['sum_deb'], 2);
         $a['sum_cred'] = round($r['sum_cred'], 2);
         $a['solde_deb'] = round($a['sum_deb'] >= $a['sum_cred'] ? $a['sum_deb'] - $a['sum_cred'] : 0, 2);
         $a['solde_cred'] = round($a['sum_deb'] <= $a['sum_cred'] ? $a['sum_cred'] - $a['sum_deb'] : 0, 2);
         if ($p_previous_exc == 1) {
             $a['sum_deb_previous'] = round($r['sum_deb_previous'], 2);
             $a['sum_cred_previous'] = round($r['sum_cred_previous'], 2);
             $a['solde_deb_previous'] = round($a['sum_deb_previous'] >= $a['sum_cred_previous'] ? $a['sum_deb_previous'] - $a['sum_cred_previous'] : 0, 2);
             $a['solde_cred_previous'] = round($a['sum_deb_previous'] <= $a['sum_cred_previous'] ? $a['sum_cred_previous'] - $a['sum_deb_previous'] : 0, 2);
             $tot_cred_previous += $a['sum_cred_previous'];
             $tot_deb_previous += $a['sum_deb_previous'];
             $tot_deb_saldo_previous += $a['solde_deb_previous'];
             $tot_cred_saldo_previous += $a['solde_cred_previous'];
         }
         if ($p_previous_exc == 0 && $this->unsold == true && $a['solde_cred'] == 0 && $a['solde_deb'] == 0) {
             continue;
         }
         if ($p_previous_exc == 1 && $this->unsold == true && $a['solde_cred'] == 0 && $a['solde_deb'] == 0 && $a['solde_cred_previous'] == 0 && $a['solde_deb_previous'] == 0) {
             continue;
         }
         $array[$i] = $a;
         $tot_cred += $a['sum_cred'];
         $tot_deb += $a['sum_deb'];
         $tot_deb_saldo += $a['solde_deb'];
         $tot_cred_saldo += $a['solde_cred'];
     }
     //for i
     // Add the saldo
     $i += 1;
     $a['poste'] = "";
     $a['label'] = "Totaux ";
     $a['sum_deb'] = $tot_deb;
     $a['sum_cred'] = $tot_cred;
     $a['solde_deb'] = $tot_deb_saldo;
     $a['solde_cred'] = $tot_cred_saldo;
     if ($p_previous_exc == 1) {
         $a['sum_deb_previous'] = $tot_deb_previous;
         $a['sum_cred_previous'] = $tot_cred_previous;
         $a['solde_deb_previous'] = $tot_deb_saldo_previous;
         $a['solde_cred_previous'] = $tot_cred_saldo_previous;
     }
     $array[$i] = $a;
     $this->row = $array;
     return $array;
 }
示例#20
0
 static function parse_formula($p_cn, $p_label, $p_formula, $p_start, $p_end, $p_eval = true, $p_type_date = 0, $p_sql = "")
 {
     global $g_user;
     if (Impress::check_formula($p_formula) == false) {
         if ($p_eval == true) {
             return array('desc' => $p_label . '  Erreur Formule!', 'montant' => 0);
         } else {
             return $p_formula;
         }
     }
     if ($p_type_date == 0) {
         $cond = sql_filter_per($p_cn, $p_start, $p_end, 'p_id', 'j_tech_per');
     } else {
         $cond = "( j_date >= to_date('{$p_start}','DD.MM.YYYY') and j_date <= to_date('{$p_end}','DD.MM.YYYY'))";
     }
     include_once "class_acc_account_ledger.php";
     while (preg_match_all("(\\[[0-9]*[A-Z]*%*c*d*s*\\])", $p_formula, $e) == true) {
         // remove the [ ]
         $x = $e[0];
         foreach ($x as $line) {
             $compute = 'all';
             if (strpos($line, 'd') != 0) {
                 $compute = 'deb';
             }
             if (strpos($line, 'c') != 0) {
                 $compute = 'cred';
             }
             if (strpos($line, 's') != 0) {
                 $compute = 'signed';
             }
             $line = str_replace("[", "", $line);
             $line = str_replace("]", "", $line);
             $line = str_replace("d", "", $line);
             $line = str_replace("c", "", $line);
             $line = str_replace("s", "", $line);
             // If there is a FROM clause we must recompute
             // the time cond
             if ($p_type_date == 0 && preg_match("/FROM=[0-9]+\\.[0-9]+/", $p_formula, $afrom) == 1) {
                 // There is a FROM clause
                 // then we must modify the cond for the periode
                 $from = str_replace("FROM=", "", $afrom[0]);
                 // Get the periode
                 /*! \note special value for the clause FROM=00.0000
                  */
                 if ($from == '00.0000') {
                     // retrieve the first month of this periode
                     $user_periode = $g_user->get_periode();
                     $oPeriode = new Periode($p_cn);
                     $periode = $oPeriode->get_exercice($user_periode);
                     list($first, $last) = $oPeriode->get_limit($periode);
                     $ret = $first->get_date_limit();
                     $end_date = $oPeriode->get_date_limit($p_end);
                     if ($ret == null) {
                         throw new Exception('Pas de limite à cette période', 1);
                     }
                     $cond = sql_filter_per($p_cn, $ret['p_start'], $end_date['p_end'], 'date', 'j_tech_per');
                 } else {
                     $oPeriode = new Periode($p_cn);
                     try {
                         $pfrom = $oPeriode->find_periode('01.' . $from);
                         $cond = sql_filter_per($p_cn, $pfrom, $p_end, 'p_id', 'j_tech_per');
                     } catch (Exception $exp) {
                         /* if none periode is found
                               then we take the first periode of the year
                            */
                         $user_periode = $g_user->get_periode();
                         $year = $oPeriode->get_exercice($user_periode);
                         list($first, $last) = $oPeriode->get_limit($year);
                         $ret = $first->get_date_limit();
                         $end_date = $oPeriode->get_date_limit($p_end);
                         if ($ret == null) {
                             throw new Exception('Pas de limite à cette période', 1);
                         }
                         $cond = sql_filter_per($p_cn, $ret['p_start'], $end_date['p_end'], 'date', 'j_tech_per');
                     }
                 }
             }
             if (strpos($p_formula, "FROM") != 0) {
                 // We remove FROM out of the p_formula
                 $p_formula = substr_replace($p_formula, "", strpos($p_formula, "FROM"));
             }
             // Get sum of account
             $P = new Acc_Account_Ledger($p_cn, $line);
             $detail = $P->get_solde_detail($cond . $p_sql);
             if ($compute == 'all') {
                 $i = $detail['solde'];
             }
             if ($compute == 'deb') {
                 $i = $detail['debit'];
             }
             if ($compute == 'cred') {
                 $i = $detail['credit'];
             }
             if ($compute == 'signed') {
                 $i = $detail['debit'] - $detail['credit'];
             }
             $p_formula = str_replace($x[0], $i, $p_formula);
         }
     }
     // $p_eval is true then we eval and returns result
     if ($p_eval == true) {
         $p_formula = "\$result=" . $p_formula . ";";
         eval("{$p_formula}");
         while (preg_match("/\\[([0-9]+)([Tt]*)\\]/", trim($p_label), $e) == 1) {
             $nom = "!!" . $e[1] . "!!";
             if (Impress::check_formula($e[0])) {
                 $nom = $p_cn->get_value("SELECT pcm_lib AS acct_name FROM tmp_pcmn WHERE pcm_val::text LIKE \$1||'%' ORDER BY pcm_val ASC LIMIT 1", array($e[1]));
                 if ($nom) {
                     if ($e[2] == 'T') {
                         $nom = strtoupper($nom);
                     }
                     if ($e[2] == 't') {
                         $nom = strtolower($nom);
                     }
                 }
             }
             $p_label = str_replace($e[0], $nom, $p_label);
         }
         $aret = array('desc' => $p_label, 'montant' => $result);
         return $aret;
     } else {
         // $p_eval is false we returns only the string
         return $p_formula;
     }
 }
示例#21
0
}
$deb = $cn->get_value("select sum (j_montant) from jrnx where j_debit='t' {$sql_year} ");
$cred = $cn->get_value("select sum (j_montant) from jrnx where j_debit='f' {$sql_year} ");
if ($cred == $deb) {
    $result = $g_succeed;
} else {
    $result = $g_failed;
}
$class = $ix % 2 == 0 ? 'odd' : "even";
print tr(td(_('Grand livre')) . td(nbm($deb), ' class="num"') . td(nbm($cred), ' class="num"') . td(nbm($result), ' class="num"') . td($result), "class=\"{$class}\"");
echo '</table>';
echo '</div>';
echo '<hr>';
echo '<div class="myfieldset"><h1 class="legend">' . _('Vérification des comptes') . '</h1>';
$bilan = new Acc_Bilan($cn);
$periode = new Periode($cn);
list($start_periode, $end_periode) = $periode->get_limit($exercice);
$bilan->from = $start_periode->p_id;
$bilan->to = $end_periode->p_id;
$bilan->verify();
echo '</div>';
?>
<hr>
<div class="myfieldset">
    <h1 class="legend">
        <?php 
echo _("Vérification des fiches") . '</legend>';
?>
    </h1>
    <h2>
        <?php 
示例#22
0
 /**
 * @brief retrieve amount of previous periode
 * @param $p_to frmo the start of the exercise until $p_to
 * @return $array with vat, price,other_amount
 * @note
 * @see
  @code
  array
  'price' => string '446.1900' (length=8)
  'vat' => string '21.7600' (length=7)
  'priv' => string '0.0000' (length=6)
  'tva_nd_recup' => string '0.0000' (length=6)
  'tva' =>
  array
  0 =>
  array
  'sum_vat' => string '13.7200' (length=7)
  'tva_id' => string '1' (length=1)
  1 =>
  array
  'sum_vat' => string '8.0400' (length=6)
  'tva_id' => string '3' (length=1)
  2 =>
  array
  'sum_vat' => string '0.0000' (length=6)
  'tva_id' => string '4' (length=1)
 
  @endcode
 */
 function previous_amount($p_to)
 {
     /* get the first periode of exercise */
     $periode = new Periode($this->db, $p_to);
     $exercise = $periode->get_exercice();
     list($min, $max) = $periode->get_limit($exercise);
     // transform min into date
     $min_date = $min->first_day();
     // transform $p_to  into date
     $periode_max = new Periode($this->db, $p_to);
     $max_date = $periode_max->first_day();
     bcscale(2);
     // min periode
     if ($this->type == 'ACH') {
         /*  get all amount exclude vat */
         $sql = "select coalesce(sum(qp_price),0) as price" . " ,coalesce(sum(qp_vat),0) as vat " . ',coalesce(sum(qp_dep_priv),0) as priv' . ',coalesce(sum(qp_vat_sided),0) as reversed' . ',coalesce(sum(qp_nd_tva_recup),0)+coalesce(sum(qp_nd_tva),0) as tva_nd' . ',coalesce(sum(qp_vat_sided),0) as tva_np' . '  from quant_purchase join jrnx using(j_id) ' . " where j_date >= to_date(\$1,'DD.MM.YYYY') and j_date < to_date(\$2,'DD.MM.YYYY') " . ' and j_jrn_def = $3';
         $array = $this->db->get_array($sql, array($min_date, $max_date, $this->id));
         $ret = $array[0];
         /* retrieve all vat code */
         $array = $this->db->get_array("select coalesce(sum(qp_vat),0) as sum_vat,tva_id\n                                        from quant_purchase as p right join tva_rate on (qp_vat_code=tva_id)  join jrnx using(j_id)\n                                        where tva_rate !=0 and  j_date >= to_date(\$1,'DD.MM.YYYY') and j_date < to_date(\$2,'DD.MM.YYYY') \n                                        and j_jrn_def = \$3\n                                        group by tva_id", array($min_date, $max_date, $this->id));
         $ret['tva'] = $array;
     }
     if ($this->type == 'VEN') {
         /*  get all amount exclude vat */
         $sql = "select coalesce(sum(qs_price),0) as price" . " ,coalesce(sum(qs_vat),0) as vat " . ',0 as priv' . ',0 as tva_nd' . ',coalesce(sum(qs_vat_sided),0) as tva_np' . '  from quant_sold join jrnx using(j_id) ' . " where j_date >= to_date(\$1,'DD.MM.YYYY') and j_date < to_date(\$2,'DD.MM.YYYY') " . ' and j_jrn_def = $3';
         $array = $this->db->get_array($sql, array($min_date, $max_date, $this->id));
         $ret = $array[0];
         /* retrieve all vat code */
         $array = $this->db->get_array("select coalesce(sum(qs_vat),0) as sum_vat,tva_id\n                                        from quant_sold as p right join tva_rate on (qs_vat_code=tva_id)  join jrnx using(j_id)\n                                        where tva_rate !=0 and\n                                        j_date >= to_date(\$1,'DD.MM.YYYY') and j_date < to_date(\$2,'DD.MM.YYYY') \n                                        and j_jrn_def = \$3\n                                        group by tva_id", array($min_date, $max_date, $this->id));
         $ret['tva'] = $array;
     }
     if ($this->type == "FIN") {
         /* find the quick code of this ledger */
         $ledger = new Acc_Ledger_Fin($this->db, $this->id);
         $qcode = $ledger->get_bank();
         $bank_card = new Fiche($this->db, $qcode);
         /*add the amount from Opening Writing                  */
         $cond = sprintf(" j_jrn_def <> %d  and j_date >= to_date('%s','DD.MM.YYYY') and j_date < to_date('%s','DD.MM.YYYY') ", $this->id, $min_date, $max_date);
         $saldo = $bank_card->get_bk_balance($cond);
         $ret['amount'] = bcsub($saldo['debit'], $saldo['credit']);
     }
     return $ret;
 }
示例#23
0
		    </td>
		    <td>
			<?php 
echo $style->input();
?>
		    </td>
		</tr>

		<?php 
if ($inside_dossier) {
    $l_user_per = $g_user->get_periode();
    if ($l_user_per == "") {
        $l_user_per = $cn->get_value("select min(p_id) from parm_periode where p_closed='f'");
    }
    // if periode is closed then warns the users
    $period = new Periode($cn, $l_user_per);
    $period->p_id = $l_user_per;
    $period->jrn_def_id = 0;
    if ($period->is_closed($l_user_per) == 1) {
        $msg = _('Attention cette période est fermée, vous ne pourrez rien modifier dans le module comptable');
        $msg = '<h2 class="notice">' . $msg . '</h2>';
    }
    $period = new IPeriod("period");
    $period->user = $g_user;
    $period->cn = $cn;
    $period->filter_year = false;
    $period->value = $l_user_per;
    $period->type = ALL;
    $l_form_per = $period->input();
    ?>
    		<tr><td><?php 
示例#24
0
require_once NOALYSS_INCLUDE . '/class_html_input.php';
require_once NOALYSS_INCLUDE . '/class_dossier.php';
require_once NOALYSS_INCLUDE . '/class_database.php';
require_once NOALYSS_INCLUDE . '/class_user.php';
require_once NOALYSS_INCLUDE . '/class_periode.php';
html_page_start($_SESSION['g_theme']);
echo '<div style="float:left;">';
global $g_user;
if (basename($_GET['ajax']) == 'ajax_history.php') {
    $href = dossier::get();
    $cn = new Database(dossier::id());
    /* current year  */
    $g_user = new User($cn);
    $exercice = $g_user->get_exercice();
    /* get date limit */
    $periode = new Periode($cn);
    $limit = $periode->get_limit($exercice);
    $from_periode = 'from_periode=' . format_date($limit[0]->p_start);
    $to_periode = 'to_periode=' . format_date($limit[1]->p_end);
    if (isset($_GET['ex'])) {
        if ($exercice > $_GET['ex']) {
            $limit_periode = $periode->get_limit($_GET['ex']);
            $from_periode = 'from_periode=' . format_date($limit_periode[0]->p_start);
        } else {
            $limit_periode = $periode->get_limit($_GET['ex']);
            $to_periode = 'to_periode=' . format_date($limit_periode[1]->p_end);
        }
    }
    if (isset($_GET['pcm_val'])) {
        $href_csv = "export.php?" . $href . '&poste_id=' . $_GET['pcm_val'] . '&ople=0&type=poste&' . $from_periode . '&' . $to_periode . "&act=CSV:postedetail";
        $href_pdf = "export.php?" . $href . '&poste_id=' . $_GET['pcm_val'] . '&ople=0&type=poste&' . $from_periode . '&' . $to_periode . "&act=PDF:postedetail";
//-----------------------------------------------------
// Show the jrn and date
//-----------------------------------------------------
require_once NOALYSS_INCLUDE . '/class_database.php';
global $g_user;
//-----------------------------------------------------
// Form
//-----------------------------------------------------
echo '<div class="content">';
echo '<FORM action="?" METHOD="GET">';
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo HtmlInput::hidden('type', 'gl_comptes');
echo dossier::hidden();
echo '<TABLE><TR>';
$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');
示例#26
0
 }
 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 "<h2 class=\"info\"> période du " . $a['p_start'] . " au " . $b['p_end'] . "</h2>";
 echo '<span style="display:block">';
 echo _('Filtre') . HtmlInput::infobulle(24);
 echo HtmlInput::filter_table("t_balance", "0,1", "1");
 echo '</span>';
 echo '<table id="t_balance" width="100%">';
 echo '<th>Poste Comptable</th>';
 echo '<th>Libell&eacute;</th>';
 if ($previous == 1) {
     echo '<th>D&eacute;bit N-1</th>';
     echo '<th>Cr&eacute;dit N-1</th>';
     echo '<th>Solde D&eacute;biteur N-1</th>';
     echo '<th>Solde Cr&eacute;diteur N-1</th>';
示例#27
0
$report = $g_user->get_mini_report();
$rapport = new Acc_Report($cn);
$rapport->id = $report;
if ($rapport->exist() == false) {
    $g_user->set_mini_report(0);
    $report = 0;
}
if ($report != 0) {
    ?>
<div id="report_div" class="box"><?php 
    echo HtmlInput::title_box($rapport->get_name(), 'report_div', 'none');
    $exercice = $g_user->get_exercice();
    if ($exercice == 0) {
        alert(_('Aucune periode par defaut'));
    } else {
        $periode = new Periode($cn);
        $limit = $periode->limit_year($exercice);
        $result = $rapport->get_row($limit['start'], $limit['end'], 'periode');
        $ix = 0;
        if (count($result) > 0) {
            echo '<table border="0" width="100%">';
            foreach ($result as $row) {
                $ix++;
                $class = $ix % 2 == 0 ? ' class="even" ' : ' class="odd" ';
                echo '<tr ' . $class . '>';
                echo '<td> ' . $row['desc'] . '</td>' . '<td style="text-align:right">' . nbm($row['montant']) . " &euro;</td>";
                echo '</tr>';
            }
            echo '</table>';
        } else {
            echo _('Aucun résultat');
示例#28
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);
} else {
    echo HtmlInput::hidden('p_jrn', $oLedger->id);
}
?>

<?php 
/**
 * if you can write
 */
if ($access == 'W') {
    echo HtmlInput::submit('save', _('Sauver'), 'onClick="return verify_ca(\'popup\');"');
    $owner = new Own($cn);
    if ($owner->MY_ANALYTIC != 'nu') {
        echo '<input type="button" class="smallbutton" value="' . _('verifie CA') . '" onClick="verify_ca(\'' . $div . '\');">';
    }
    $per = new Periode($cn, $obj->det->jr_tech_per);
    if ($per->is_closed() == 0 && $owner->MY_STRICT == 'N' && $g_user->check_action(RMOPER) == 1) {
        $remove = new IButton('Effacer');
        $remove->label = _('Effacer');
        $remove->javascript = "return confirm_box(null,'Vous confirmez effacement ?',function () {removeOperation('" . $obj->det->jr_id . "'," . dossier::id() . ",'" . $div . "')})";
        echo $remove->input();
    }
    $reverse = new IButton('bext' . $div);
    $reverse->label = _('Extourner');
    $reverse->javascript = "g('ext" . $div . "').style.display='block'";
    echo $reverse->input();
    echo '</p>';
    echo '</form>';
    echo '<div id="ext' . $div . '" class="inner_box" style="position:relative;top:-150px;display:none">';
    $date = new IDate('ext_date');
    $r = "<form id=\"form_" . $div . "\" onsubmit=\"return false;\">";
示例#30
0
 public function getPeriode(){
     return Periode::getById($this->getIdPeriode());
 }