Exemplo n.º 1
0
 function myList()
 {
     $s = dossier::get();
     $sql = "select md_id,md_name,md_affect,dt_value from document_modele join document_type on(dt_id=md_type) order by md_name";
     $Res = $this->cn->exec_sql($sql);
     $all = Database::fetch_all($Res);
     $r = '';
     if (Database::num_row($Res) != 0) {
         $r .= '<p><form method="post">';
         $r .= dossier::hidden();
         $r .= "<table>";
         $r .= "<tr> ";
         $r .= th(_('Nom'));
         $r .= th(_('Catégorie'));
         $r .= th(_('Affect.'));
         $r .= th(_('Fichier'));
         $r .= th(_('Effacer'));
         $r .= "</tr>";
         foreach ($all as $row) {
             $r .= "<tr>";
             $r .= "<td>";
             $r .= h($row['md_name']);
             $r .= "</td>";
             $r .= "<td>";
             $r .= $row['dt_value'];
             $r .= "</td>";
             $r .= td(h($row['md_affect']));
             $r .= "<td>";
             $r .= '<A HREF="show_document_modele.php?md_id=' . $row['md_id'] . '&' . $s . '">Document</a>';
             $r .= "</td>";
             $r .= "<TD>";
             $c = new ICheckBox();
             $c->name = "dm_remove_" . $row['md_id'];
             $r .= $c->input();
             $r .= "</td>";
             $r .= td(HtmlInput::detail_modele_document($row['md_id'], 'Modifier'));
             $r .= "</tr>";
         }
         $r .= "</table>";
         // need hidden parameter for subaction
         $a = new IHidden();
         $a->name = "sa";
         $a->value = "rm_template";
         $r .= $a->input();
         $r .= HtmlInput::submit("rm_template", "Effacer la sélection");
     }
     $b = new IButton('show');
     $b->label = "Ajout d'un document";
     $b->javascript = "\$('add_modele').style.display='block';new Draggable('add_modele',{starteffect:function(){\n                      new Effect.Highlight(obj.id,{scroll:window,queue:'end'});}});";
     $r .= $b->input();
     $r .= "</form></p>";
     return $r;
 }
Exemplo n.º 2
0
 function anchor()
 {
     if ($this->d_id == 0) {
         return '';
     }
     $image = '<IMG SRC="image/insert_table.gif" title="' . $this->d_filename . '" border="0">';
     $r = "";
     $r = '<A class="mtitle" HREF="show_document.php?d_id=' . $this->d_id . '&' . dossier::get() . '">' . $image . '</A>';
     return $r;
 }
Exemplo n.º 3
0
<?php

//This file is part of NOALYSS and is under GPL
//see licence.txt
/**
 *@brief  show an iframe, the iframe contains either
 * - a input type to save a file
 * - a file name (which can be opened or removed
 */
$str = '?' . dossier::get() . "&div={$div}&act=file&jr_id={$jr_id}";
if (isset($_REQUEST['ajax'])) {
    $str .= "&ajax=1";
}
?>

<div id="document_operation_div<?php 
echo $div;
?>
" class="myfieldset noprint" style="display:<?php 
echo $a_tab['document_operation_div']['display'];
?>
">
<iframe frameborder=0 scrolling="no" style="margin:0px;padding: 0px;border:0px;width:100%;height:90px;overflow:hidden" src="<?php 
echo 'ajax_ledger.php' . $str;
?>
"></iframe>
</div>
Exemplo n.º 4
0
/*!\file
 * \brief this file is used for the follow up of the customer (mail, meeting...)
 *  - sb = detail
 *  - sc = sv
 *  - sd = this parameter is used here
 *  - $cn = database connection
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
require_once NOALYSS_INCLUDE . '/class_follow_up.php';
/**
 *\note problem with ShowActionList, this function is local
 * to the file action.inc.php. And this function must different for each
 *  suivi
 */
$sub_action = isset($_REQUEST['sa']) ? $_REQUEST['sa'] : "list";
$ag_id = isset($_REQUEST['ag_id']) ? $_REQUEST['ag_id'] : 0;
if (!isset($_GET['submit_query'])) {
    $_REQUEST['closed_action'] = 1;
    $_GET['closed_action'] = 1;
}
$p_action = $_REQUEST['ac'];
$base = "ac={$p_action}&sc=sv&sb=detail&f_id=" . $_REQUEST['f_id'] . "&" . HtmlInput::request_to_string(array("closed_action", "remind_date_end", "remind_date", "sag_ref", "only_internal", "state", "gDossier", "qcode", "ag_dest", "query", "tdoc", "date_start", "date_end", "hsstate", "searchtag", "sb", "sc"), "");
$retour = HtmlInput::button_anchor('Retour', '?' . dossier::get() . '&' . $base);
$fiche = new Fiche($cn, $_REQUEST['f_id']);
$_GET['qcode'] = $fiche->get_quick_code();
$_REQUEST['qcode'] = $fiche->get_quick_code();
echo '<div class="content">';
require_once NOALYSS_INCLUDE . '/action.common.inc.php';
echo '</div>';
Exemplo n.º 5
0
    echo h($array[$i]['jrn_def_name']);
    ?>

		 </td>
		 <td style="text-align:center">
			 <?php 
    echo h($array[$i]['fd_label']);
    ?>

		 </td>
		 <td style="text-align:center">
			 <?php 
    echo h($array[$i]['jrn_target']);
    ?>
		 </td>
		 <td style="text-align:center">
			 <?php 
    echo h($array[$i]['vw_name']);
    ?>
		 </td>

<?php 
    echo $td . HtmlInput::button_anchor(_('Modifie'), '?ac=' . $_REQUEST['ac'] . '&sa=mp&sb=change&' . dossier::get() . '&id=' . $array[$i]['mp_id'], "", "", "smallbutton");
    ?>

	 </tr>
<?php 
}
?>

</table>
Exemplo n.º 6
0
<?php 
$waffect = new ISelect();
$waffect->name = 'md_affect';
$waffect->value = array(array('value' => 'ACH', 'label' => _('Uniquement journaux achat')), array('value' => 'VEN', 'label' => _('Uniquement journaux vente')), array('value' => 'GES', 'label' => _('Partie gestion')));
$waffect->selected = $doc->md_affect;
echo $waffect->input();
?>
</td>
</tr>
<tr>

<tr>
<td>
<?php 
echo _("Fichier");
$s = dossier::get();
echo '<A HREF="show_document_modele.php?md_id=' . $doc->md_id . '&' . $s . '">(fichier actuel)</a>';
?>
</td>
<td>
<?php 
$file = new IFile('doc');
echo $file->input();
?>
</td>
</tr>

<tr>
<td>
<?php 
echo _("Dernier numéro utilisé pour ce type de document");
Exemplo n.º 7
0
        echo $anc->form_cat();
        echo HtmlInput::submit('mod_cat_save', _('Sauver'));
        echo '</form>';
        echo '</div>';
    }
}
/* * ********************************************************************
 * Display menu
 *
 *
 * ******************************************************************** */
// display button add and list of forecast to display
if ($sa == 'list') {
    $aForecast = Forecast::load_all($cn);
    $menu = array();
    $get_dossier = dossier::get();
    echo '<div class="content">';
    echo _('Filtre') . " " . HtmlInput::filter_table("forecast_table_id", '0', 1);
    echo '<TABLE id="forecast_table_id" class="vert_mtitle">';
    $href = "?ac=" . $_REQUEST['ac'] . "&sa=new&" . $get_dossier;
    echo '<TR><TD class="first"><A HREF="' . $href . '">' . _("Ajout d'une prévision") . '</A></TD></TR>';
    $def = isset($_REQUEST['f_id']) ? $_REQUEST['f_id'] : -1;
    for ($i = 0; $i < count($aForecast); $i++) {
        $href = "?ac=" . $_REQUEST['ac'] . "&sa=vw&" . $get_dossier . '&f_id=' . $aForecast[$i]['f_id'];
        $name = h($aForecast[$i]['f_name']);
        $menu[] = array($href, $name, $name, $aForecast[$i]['f_id']);
        echo '<TR><TD><A HREF="' . $href . '">' . h($name) . '</A></TD></TR>';
    }
    echo "</TABLE>";
    echo '</div>';
    return;
Exemplo n.º 8
0
 * \brief manage all the export to CSV or PDF
 *   act can be
 *
 */
define('ALLOWED', 1);
require_once '../include/constant.php';
global $g_user, $cn, $g_parameter;
require_once NOALYSS_INCLUDE . '/class_database.php';
require_once NOALYSS_INCLUDE . '/class_user.php';
$gDossier = dossier::id();
$cn = new Database($gDossier);
mb_internal_encoding("UTF-8");
$g_user = new User($cn);
$g_user->Check();
$action = $g_user->check_dossier($gDossier);
set_language();
if ($action == 'X' || !isset($_GET['act']) || $g_user->check_print($_GET['act']) == 0) {
    echo alert(_('Accès interdit'));
    redirect("do.php?" . dossier::get());
    exit;
}
// get file and execute it
$action = HtmlInput::default_value_get('act', null);
if ($action == null) {
    die(_('Appel invalide'));
}
$prfile = $cn->get_value("select me_file from menu_ref where me_code=\$1", array($action));
if ($prfile == "") {
    die(_('Export impossible'));
}
require_once $prfile;
Exemplo n.º 9
0
/*!\file
 * \brief file included to manage all the sold operation
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
require_once NOALYSS_INCLUDE . '/class_icheckbox.php';
require_once NOALYSS_INCLUDE . '/class_acc_ledger_sold.php';
require_once NOALYSS_INCLUDE . '/class_pre_op_ven.php';
require_once NOALYSS_INCLUDE . '/class_document.php';
require_once NOALYSS_INCLUDE . '/class_acc_ledger_info.php';
require_once NOALYSS_INCLUDE . '/class_ipopup.php';
$gDossier = dossier::id();
$cn = new Database(dossier::id());
//menu = show a list of ledger
$str_dossier = dossier::get();
$ac = "ac=" . $_REQUEST['ac'];
global $g_parameter;
$p_msg = "";
//----------------------------------------------------------------------
// Encode a new invoice
// empty form for encoding
//----------------------------------------------------------------------
$Ledger = new Acc_Ledger_Sold($cn, 0);
// Check privilege
if (isset($_REQUEST['p_jrn']) && $g_user->check_jrn($_REQUEST['p_jrn']) != 'W') {
    NoAccess();
    exit - 1;
}
/* if a new invoice is encoded, we display a form for confirmation */
if (isset($_POST['view_invoice'])) {
Exemplo n.º 10
0
 function display_form_periode()
 {
     $str_dossier = dossier::get();
     if ($this->jrn_def_id == 0) {
         $Res = $this->cn->exec_sql("select p_id,to_char(p_start,'DD.MM.YYYY') as date_start,to_char(p_end,'DD.MM.YYYY') as date_end,p_central,p_closed,p_exercice,\n                                     (select count(jr_id) as count_op from jrn where jr_tech_per = p_id) as count_op\n                                     from parm_periode\n                                     order by p_start,p_end");
         $Max = Database::num_row($Res);
         echo '<form id="periode_frm" method="POST" onsubmit="return confirm_box(this,\'Confirmez-vous la fermeture des périodes choisies ?\')" >';
         echo HtmlInput::array_to_hidden(array('ac', 'gDossier', 'jrn_def_id', 'choose'), $_REQUEST);
         echo '<TABLE ALIGN="CENTER">';
         echo "</TR>";
         echo '<th>' . ICheckBox::toggle_checkbox("per_toggle", "periode_frm") . "</th>";
         echo '<TH> Date d&eacute;but </TH>';
         echo '<TH> Date fin </TH>';
         echo '<TH> Exercice </TH>';
         echo "</TR>";
         for ($i = 0; $i < $Max; $i++) {
             $l_line = Database::fetch_array($Res, $i);
             $class = "even";
             if ($i % 2 == 0) {
                 $class = "odd";
             }
             $style = '';
             if ($l_line['p_closed'] == 't') {
                 $style = "color:red";
             }
             echo '<TR class="' . $class . '" style="' . $style . '">';
             echo '<td>';
             if ($l_line['p_closed'] == 'f') {
                 $per_to_close = new ICheckBox('sel_per_close[]');
                 $per_to_close->value = $l_line['p_id'];
                 echo $per_to_close->input();
             }
             echo '</td>';
             echo '<TD ALIGN="CENTER"> ' . $l_line['date_start'] . '</TD>';
             echo '<TD  ALIGN="CENTER"> ' . $l_line['date_end'] . '</TD>';
             echo '<TD  ALIGN="CENTER"> ' . $l_line['p_exercice'] . '</TD>';
             if ($l_line['p_closed'] == 't') {
                 $closed = $l_line['p_central'] == 't' ? '<TD>Centralis&eacute;e</TD>' : '<TD>Ferm&eacute;e</TD>';
                 $change = '<TD></TD>';
                 $remove = sprintf(_('Nombre opérations %d'), $l_line['count_op']);
                 $remove = td($remove, ' class="mtitle" ');
                 $change = td('<A class="mtitle" HREF="javascript:void(0)"' . ' onclick="return confirm_box(null,\'' . _('Confirmez Réouverture') . ' ?\',function() {window.location=\'do.php?ac=' . $_REQUEST['ac'] . '&action=reopen&p_per=' . $l_line['p_id'] . '&' . $str_dossier . '\';} )"> Réouverture</A>', ' class="mtitle"');
             } else {
                 if ($l_line['count_op'] == 0) {
                     $change = HtmlInput::display_periode($l_line['p_id']);
                 } else {
                     $change = "Non modifiable";
                 }
                 $change = td($change, ' class="mtitle" ');
                 $reopen = td("");
                 $remove = '<TD class="mtitle">';
                 if ($l_line['count_op'] == 0) {
                     $go = 'do.php?' . http_build_query(array('ac' => $_REQUEST['ac'], 'action' => 'delete_per', 'p_per' => $l_line['p_id'], 'gDossier' => Dossier::id()));
                     $remove .= '<A class="mtitle" HREF="javascript:void(0)" ' . 'onclick="return confirm_box (null,\'' . _('Confirmez effacement ?') . '\',function() { window.location=\'' . $go . '\'});" >' . ' Efface</A>';
                 } else {
                     $remove .= sprintf(_('Nombre opérations %d'), $l_line['count_op']);
                 }
                 $remove .= '</td>';
             }
             echo $change;
             echo $remove;
             echo '</TR>';
         }
         echo '</table>';
         echo '<p style="text-align:center">';
         echo HtmlInput::hidden("close_per", 1);
         echo HtmlInput::submit('close_per_bt', 'Fermeture des périodes sélectionnées');
         echo '</p>';
         echo '</form>';
         $but = new IButton('show_per_add', 'Ajout d\'une période');
         $but->javascript = "\$('periode_add_div').show();";
         echo $but->input();
         echo '<div class="inner_box" style="width:40%;" id="periode_add_div">';
         echo HtmlInput::title_box("Ajout d'une période", "periode_add_div", "hide");
         echo '<FORM  METHOD="POST">';
         echo dossier::hidden();
         $istart = new IDate('p_date_start');
         $iend = new IDate('p_date_end');
         $iexercice = new INum('p_exercice');
         $iexercice->size = 5;
         echo '<table>';
         echo '<TR> ';
         echo td('Date de début');
         echo td($istart->input());
         echo '</tr><tr>';
         echo td('Date de fin');
         echo td($iend->input());
         echo '</tr><tr>';
         echo td('Exercice');
         echo td($iexercice->input());
         echo '</TABLE>';
         echo HtmlInput::submit('add_per', 'Valider');
         echo '</FORM>';
         echo '</div>';
         echo create_script("\$('periode_add_div').hide();new Draggable('periode_add_div',{starteffect:function()\n                                  {\n                                     new Effect.Highlight(obj.id,{scroll:window,queue:'end'});\n                                  }}\n                         );");
     } else {
         $Res = $this->cn->exec_sql("select p_id,to_char(p_start,'DD.MM.YYYY') as date_start,to_char(p_end,'DD.MM.YYYY') as date_end,status,p_exercice\n                                     from parm_periode join jrn_periode using (p_id) where jrn_def_id=" . $this->jrn_def_id . "\n                                     order by p_start,p_end");
         $Max = Database::num_row($Res);
         $r = $this->cn->exec_sql('select jrn_Def_name from jrn_Def where jrn_Def_id=' . $this->jrn_def_id);
         $jrn_name = Database::fetch_result($r, 0, 0);
         echo '<h2> Journal ' . $jrn_name . '</h2>';
         echo '<form id="periode_frm" method="POST" onsubmit="return confirm_box(this,\'Confirmez-vous la fermeture des périodes choisies ?\')" >';
         echo HtmlInput::array_to_hidden(array('ac', 'gDossier', 'jrn_def_id', 'choose'), $_REQUEST);
         echo '<TABLE ALIGN="CENTER">';
         echo "</TR>";
         echo '<th>' . ICheckBox::toggle_checkbox("per_toggle", "periode_frm") . "</th>";
         echo '<TH> Date d&eacute;but </TH>';
         echo '<TH> Date fin </TH>';
         echo '<TH> Exercice </TH>';
         echo "</TR>";
         for ($i = 0; $i < $Max; $i++) {
             $l_line = Database::fetch_array($Res, $i);
             if ($l_line['status'] != 'OP') {
                 echo '<TR style="COLOR:RED">';
             } else {
                 echo '<TR>';
             }
             echo '<td>';
             if ($l_line['status'] == 'OP') {
                 $per_to_close = new ICheckBox('sel_per_close[]');
                 $per_to_close->value = $l_line['p_id'];
                 echo $per_to_close->input();
             }
             echo '</td>';
             echo '<TD ALIGN="CENTER"> ' . $l_line['date_start'] . '</TD>';
             echo '<TD  ALIGN="CENTER"> ' . $l_line['date_end'] . '</TD>';
             echo '<TD  ALIGN="CENTER"> ' . $l_line['p_exercice'] . '</TD>';
             $closed = "";
             if ($l_line['status'] != 'OP') {
                 $go = 'do.php?' . http_build_query(array('ac' => $_REQUEST['ac'], 'action' => 'reopen', 'p_per' => $l_line['p_id'], 'gDossier' => Dossier::id(), 'jrn_def_id' => $this->jrn_def_id));
                 $closed = td('<A class="mtitle" HREF="javascript:void(0)" ' . 'onclick="return confirm_box(null,\'' . _('Confirmez Réouverture') . ' ?\',function() {window.location=\'' . $go . '\';} );"> Réouverture</A>', ' class="mtitle"');
             }
             echo "{$closed}";
             echo '</TR>';
         }
         echo '</TABLE>';
         echo '<p style="text-align:center">';
         echo HtmlInput::submit('close_per', 'Fermeture des périodes sélectionnées');
         echo '</p>';
         echo '</form>';
     }
 }
Exemplo n.º 11
0
    $row->from_array($_POST);
    $row->insert();
    $sb = "list";
}
//---------------------------------------------------------------------------
// Show form to enter a new one
//---------------------------------------------------------------------------
if ($sb == 'ins') {
    $mp = new Acc_Payment($cn);
    $r = $mp->blank();
    echo '<form method="POST" id="payment_frm" onsubmit="return confirm_box(this,\'Vous confirmez ?\')">';
    echo dossier::hidden();
    echo HtmlInput::hidden('ac', $_REQUEST['ac']), HtmlInput::hidden('insert', 0);
    echo $r;
    echo HtmlInput::submit('insertsub', _('Enregistre'));
    echo HtmlInput::button_anchor(_('Retour sans sauver'), '?p_action=divers&sa=mp&' . dossier::get() . "&ac=" . $_REQUEST['ac'], "", "", "smallbutton");
    echo '</form>';
    return;
}
//--------------------------------------------------------------------------------
//LIST
//--------------------------------------------------------------------------------
/* Get the data from database */
$header = new Sort_Table();
$base_url = $_SERVER['PHP_SELF'] . "?" . Dossier::get() . "&ac=" . $_REQUEST['ac'];
$header->add(_("Libelle"), $base_url, "order by mp_lib asc", "order by mp_lib desc", 'la', 'ld');
$header->add(_("Pour le journal"), $base_url, "order by jrn_def_name asc", "order by jrn_def_name  desc", 'ja', 'jd');
$header->add(_("Type de fiche"), $base_url, "order by fd_label asc", "order by fd_label desc", 'tc', 'td');
$header->add(_("Enregistré dans le journal"), $base_url, "order by jrn_target asc", "order by jrn_target desc", 'jta', 'jtd');
$header->add(_("Avec la fiche"), $base_url, "order by vw_name asc", "order by vw_name desc", 'na', 'nd');
$order = isset($_REQUEST['ord']) ? $_REQUEST['ord'] : 'la';
Exemplo n.º 12
0
        $array[$i]['value'] = $r['dos_id'];
        $array[$i]['label'] = $r['dos_name'];
        $i++;
    }
    $wAvail->value = $array;
    echo 'Choix du dossier :' . $wAvail->input('f');
    echo HtmlInput::submit('ok', 'Continuer');
    echo '</form>';
    echo '</div>';
    echo '</div>';
    return;
}
/* --------------------------------------------------
 * Step 2 choose now the exercice of this folder
 */
$back = 'do.php?ac=' . $_REQUEST['ac'] . '&' . dossier::get();
if ($sa == 'step2') {
    echo '<div class="content">' . '<div><h1 class="legend">Etape 2</h1>' . '<h2 class="info">' . dossier::name($_REQUEST['f']) . '</h2>' . '<form class="print" method="post">' . ' Choisissez l\'exercice du dossier ';
    echo dossier::hidden();
    echo HtmlInput::hidden('ac', $_REQUEST['ac']);
    echo HtmlInput::hidden('sa', 'step3');
    echo HtmlInput::hidden('f', $_REQUEST['f']);
    $cn = new Database($_REQUEST['f']);
    $periode = $cn->make_array("select distinct p_exercice,p_exercice from parm_periode order by p_exercice");
    $w = new ISelect();
    $w->table = 0;
    $w->label = 'Periode';
    $w->readonly = false;
    $w->value = $periode;
    $w->name = "p_periode";
    echo 'P&eacute;riode : ' . $w->input();
Exemplo n.º 13
0
 public function input($p_name = null, $p_value = null)
 {
     if ($p_name == null && $this->name == "") {
         throw new Exception('Le nom d une icard doit être donne');
     }
     $this->value = $p_value == null ? $this->value : $p_value;
     if ($this->readOnly == true) {
         return $this->display();
     }
     $this->id = $this->id == "" ? $this->name : $this->id;
     $label = '';
     if ($this->dblclick != '') {
         $e = sprintf(' ondblclick="%s" ', $this->dblclick);
         $this->dblclick = $e;
     }
     $input = sprintf('<INPUT TYPE="Text"  class="input_text"  ' . ' NAME="%s" ID="%s" VALUE="%s" SIZE="%d" %s %s>', $this->name, $this->name, $this->value, $this->size, $this->dblclick, $this->javascript);
     $div = sprintf('<div id="%s_choices"  class="autocomplete"></div>', $this->name);
     $query = "op=autoanc&" . dossier::get();
     // add parameter to search into a plan (pa_id) or get the value from
     // a HtmlObject
     if ($this->plan != 0) {
         $query .= "&pa_id=" . $this->plan;
     } elseif ($this->plan_ctl != '') {
         $this->set_attribute("plan_ctl", $this->plan_ctl);
     }
     $attr = $this->get_js_attr();
     $javascript = sprintf('try { new Ajax.Autocompleter("%s","%s_choices","ajax_misc.php?%s",' . '{paramName:"anccard",minChars:1,indicator:null, ' . 'callback:%s, ' . ' afterUpdateElement:%s});} catch (e){alert(e.message);};', $this->name, $this->name, $query, $this->callback, $this->fct);
     $javascript = create_script($javascript . $this->dblclick);
     $r = $label . $input . $attr . $div . $javascript;
     if ($this->table == 1) {
         $r = td($r);
     }
     return $r;
 }
Exemplo n.º 14
0
 public function insert($p_array = null)
 {
     global $g_parameter;
     extract($p_array);
     $this->verify($p_array);
     $group = $this->db->get_next_seq("s_oa_group");
     /* for analytic */
     $seq = $this->db->get_next_seq('s_grpt');
     $this->id = $p_jrn;
     $internal = $this->compute_internal_code($seq);
     $this->internal = $internal;
     $oPeriode = new Periode($this->db);
     $check_periode = $this->check_periode();
     if ($check_periode == true) {
         $tperiode = $period;
     } else {
         $tperiode = $oPeriode->find_periode($e_date);
     }
     $cust = new Fiche($this->db);
     $cust->get_by_qcode($e_client);
     $sposte = $cust->strAttribut(ATTR_DEF_ACCOUNT);
     // if 2 accounts, take only the debit one for the customer
     //
     if (strpos($sposte, ',') != 0) {
         $array = explode(',', $sposte);
         $poste = $array[0];
     } else {
         $poste = $sposte;
     }
     bcscale(4);
     try {
         $tot_amount = 0;
         $tot_tva = 0;
         $tot_debit = 0;
         $this->db->start();
         $tva = array();
         /* Save all the items without vat */
         for ($i = 0; $i < $nb_item; $i++) {
             $n_both = 0;
             if (strlen(trim(${'e_march' . $i})) == 0) {
                 continue;
             }
             /* First we save all the items without vat */
             $fiche = new Fiche($this->db);
             $fiche->get_by_qcode(${"e_march" . $i});
             $amount = bcmul(${'e_march' . $i . '_price'}, ${'e_quant' . $i});
             $tot_amount = round(bcadd($tot_amount, $amount), 2);
             $acc_operation = new Acc_Operation($this->db);
             $acc_operation->date = $e_date;
             $sposte = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
             // if 2 accounts, take only the credit one
             if (strpos($sposte, ',') != 0) {
                 $array = explode(',', $sposte);
                 $poste_val = $array[1];
             } else {
                 $poste_val = $sposte;
             }
             $acc_operation->poste = $poste_val;
             $acc_operation->amount = $amount;
             $acc_operation->grpt = $seq;
             $acc_operation->jrn = $p_jrn;
             $acc_operation->type = 'c';
             $acc_operation->periode = $tperiode;
             if ($g_parameter->MY_UPDLAB == 'Y') {
                 $acc_operation->desc = strip_tags(${"e_march" . $i . "_label"});
             } else {
                 $acc_operation->desc = null;
             }
             $acc_operation->qcode = ${"e_march" . $i};
             if ($amount < 0) {
                 $tot_debit = bcadd($tot_debit, abs($amount));
             }
             $j_id = $acc_operation->insert_jrnx();
             if ($g_parameter->MY_TVA_USE == 'Y') {
                 /* Compute sum vat */
                 $oTva = new Acc_Tva($this->db);
                 $idx_tva = ${'e_march' . $i . '_tva_id'};
                 $tva_item = ${'e_march' . $i . '_tva_amount'};
                 $oTva->set_parameter("id", $idx_tva);
                 $oTva->load();
                 /* if empty then we need to compute it */
                 if (trim($tva_item) == '' || ${'e_march' . $i . '_tva_amount'} == 0) {
                     /* retrieve tva */
                     $l = new Acc_Tva($this->db, $idx_tva);
                     $l->load();
                     $tva_item = bcmul($amount, $l->get_parameter('rate'));
                 }
                 if (isset($tva[$idx_tva])) {
                     $tva[$idx_tva] += $tva_item;
                 } else {
                     $tva[$idx_tva] = $tva_item;
                 }
                 if ($oTva->get_parameter("both_side") == 0) {
                     $tot_tva = round(bcadd($tva_item, $tot_tva), 2);
                 } else {
                     $n_both = $tva_item;
                     if ($n_both < 0) {
                         $tot_debit = bcadd($tot_debit, abs($n_both));
                     }
                 }
             }
             /* Save the stock */
             /* if the quantity is < 0 then the stock increase (return of
              *  material)
              */
             $nNeg = ${"e_quant" . $i} < 0 ? -1 : 1;
             // always save quantity but in withStock we can find
             // what card need a stock management
             if ($g_parameter->MY_STOCK = 'Y' && isset($repo)) {
                 $dir = ${'e_quant' . $i} < 0 ? 'd' : 'c';
                 Stock_Goods::insert_goods($this->db, array('j_id' => $j_id, 'goods' => ${'e_march' . $i}, 'quant' => $nNeg * ${'e_quant' . $i}, 'dir' => $dir, 'repo' => $repo));
             }
             if ($g_parameter->MY_ANALYTIC != "nu") {
                 // for each item, insert into operation_analytique */
                 $op = new Anc_Operation($this->db);
                 $op->oa_group = $group;
                 $op->j_id = $j_id;
                 $op->oa_date = $e_date;
                 $op->oa_debit = 'f';
                 $op->oa_description = sql_string($e_comm);
                 $op->save_form_plan($_POST, $i, $j_id);
             }
             if ($g_parameter->MY_TVA_USE == 'Y') {
                 /* save into quant_sold */
                 $r = $this->db->exec_sql("select insert_quant_sold (\$1,\$2,\$3,\$4,\$5,\$6,\$7,\$8,\$9)", array(null, $j_id, ${'e_march' . $i}, ${'e_quant' . $i}, round($amount, 2), $tva_item, $idx_tva, $e_client, $n_both));
             } else {
                 $r = $this->db->exec_sql("select insert_quant_sold (\$1,\$2,\$3,\$4,\$5,\$6,\$7,\$8,\$9) ", array(null, $j_id, ${'e_march' . $i}, ${'e_quant' . $i}, $amount, 0, null, $e_client, 0));
             }
             // if ( $g_parameter->MY_TVA_USE=='Y') {
         }
         // end loop : save all items
         /*  save total customer */
         $cust_amount = bcadd($tot_amount, $tot_tva);
         $acc_operation = new Acc_Operation($this->db);
         $acc_operation->date = $e_date;
         $acc_operation->poste = $poste;
         $acc_operation->amount = $cust_amount;
         $acc_operation->grpt = $seq;
         $acc_operation->jrn = $p_jrn;
         $acc_operation->type = 'd';
         $acc_operation->periode = $tperiode;
         $acc_operation->qcode = ${"e_client"};
         if ($cust_amount > 0) {
             $tot_debit = bcadd($tot_debit, $cust_amount);
         }
         $let_tiers = $acc_operation->insert_jrnx();
         /** save all vat
          * $i contains the tva_id and value contains the vat amount
          * if if ($g_parameter->MY_TVA_USE == 'Y' )
          */
         if ($g_parameter->MY_TVA_USE == 'Y') {
             foreach ($tva as $i => $value) {
                 $oTva = new Acc_Tva($this->db);
                 $oTva->set_parameter('id', $i);
                 $oTva->load();
                 $poste_vat = $oTva->get_side('c');
                 $cust_amount = bcadd($tot_amount, $tot_tva);
                 $acc_operation = new Acc_Operation($this->db);
                 $acc_operation->date = $e_date;
                 $acc_operation->poste = $poste_vat;
                 $acc_operation->amount = $value;
                 $acc_operation->grpt = $seq;
                 $acc_operation->jrn = $p_jrn;
                 $acc_operation->type = 'c';
                 $acc_operation->periode = $tperiode;
                 if ($value < 0) {
                     $tot_debit = bcadd($tot_debit, abs($value));
                 }
                 $acc_operation->insert_jrnx();
                 // if TVA is on both side, we deduce it immediately
                 if ($oTva->get_parameter("both_side") == 1) {
                     $poste_vat = $oTva->get_side('d');
                     $cust_amount = bcadd($tot_amount, $tot_tva);
                     $acc_operation = new Acc_Operation($this->db);
                     $acc_operation->date = $e_date;
                     $acc_operation->poste = $poste_vat;
                     $acc_operation->amount = $value;
                     $acc_operation->grpt = $seq;
                     $acc_operation->jrn = $p_jrn;
                     $acc_operation->type = 'd';
                     $acc_operation->periode = $tperiode;
                     $acc_operation->insert_jrnx();
                     $tot_debit = bcadd($tot_debit, $value);
                     $n_both = $value;
                 }
             }
         }
         // if ($g_parameter->MY_TVA_USE=='Y')
         /* insert into jrn */
         $acc_operation = new Acc_Operation($this->db);
         $acc_operation->date = $e_date;
         $acc_operation->echeance = $e_ech;
         $acc_operation->amount = abs(round($tot_debit, 2));
         $acc_operation->desc = $e_comm;
         $acc_operation->grpt = $seq;
         $acc_operation->jrn = $p_jrn;
         $acc_operation->periode = $tperiode;
         $acc_operation->pj = $e_pj;
         $acc_operation->mt = $mt;
         $this->jr_id = $acc_operation->insert_jrn();
         $this->pj = $acc_operation->set_pj();
         /*             * = e_pj then do not increment sequence */
         /* and e_pj is not null */
         if (strcmp($e_pj, $e_pj_suggest) == 0 && strlen(trim($e_pj)) != 0) {
             $this->inc_seq_pj();
         }
         $this->db->exec_sql("update jrn set jr_internal='" . $internal . "' where " . " jr_grpt_id = " . $seq);
         /* update quant_sold */
         $this->db->exec_sql('update quant_sold set qs_internal = $1 where j_id in (select j_id from jrnx where j_grpt=$2)', array($internal, $seq));
         /* Save the attachment or generate doc */
         if (isset($_FILES['pj'])) {
             if (strlen(trim($_FILES['pj']['name'])) != 0) {
                 $this->db->save_upload_document($seq);
             } else {
                 /* Generate an invoice and save it into the database */
                 if (isset($_POST['gen_invoice'])) {
                     $file = $this->create_document($internal, $p_array);
                     $this->doc = '<A class="line" HREF="show_pj.php?' . dossier::get() . '&jr_grpt_id=' . $seq . '&jrn=' . $this->id . '">' . $file . '</A>';
                 }
             }
         }
         //----------------------------------------
         // Save the payer
         //----------------------------------------
         if ($e_mp != 0) {
             /* mp */
             $mp = new Acc_Payment($this->db, $e_mp);
             $mp->load();
             /* fiche */
             $fqcode = ${'e_mp_qcode_' . $e_mp};
             $acfiche = new Fiche($this->db);
             $acfiche->get_by_qcode($fqcode);
             /* jrnx */
             $acseq = $this->db->get_next_seq('s_grpt');
             $acjrn = new Acc_Ledger($this->db, $mp->get_parameter('ledger_target'));
             $acinternal = $acjrn->compute_internal_code($acseq);
             /* Insert paid by  */
             $acc_pay = new Acc_Operation($this->db);
             $acc_pay->date = $e_date;
             /* get the account and explode if necessary */
             $sposte = $acfiche->strAttribut(ATTR_DEF_ACCOUNT);
             // if 2 accounts, take only the debit one for customer
             if (strpos($sposte, ',') != 0) {
                 $array = explode(',', $sposte);
                 $poste_val = $array[0];
             } else {
                 $poste_val = $sposte;
             }
             $famount = bcsub($cust_amount, $acompte);
             $acc_pay->poste = $poste_val;
             $acc_pay->qcode = $fqcode;
             $acc_pay->amount = abs(round($famount, 2));
             $acc_pay->desc = null;
             $acc_pay->grpt = $acseq;
             $acc_pay->jrn = $mp->get_parameter('ledger_target');
             $acc_pay->periode = $tperiode;
             $acc_pay->type = $famount >= 0 ? 'd' : 'c';
             $acc_pay->insert_jrnx();
             /* Insert supplier  */
             $acc_pay = new Acc_Operation($this->db);
             $acc_pay->date = $e_date;
             $acc_pay->poste = $poste;
             $acc_pay->qcode = $e_client;
             $acc_pay->amount = abs(round($famount, 2));
             $acc_pay->desc = null;
             $acc_pay->grpt = $acseq;
             $acc_pay->jrn = $mp->get_parameter('ledger_target');
             $acc_pay->periode = $tperiode;
             $acc_pay->type = $famount >= 0 ? 'c' : 'd';
             $let_other = $acc_pay->insert_jrnx();
             /* insert into jrn */
             $acc_pay->mt = $mt;
             $acjrn->grpt_id = $acseq;
             $acc_pay->desc = !isset($e_comm_paiement) || strlen(trim($e_comm_paiement)) == 0 ? $e_comm : $e_comm_paiement;
             $mp_jr_id = $acc_pay->insert_jrn();
             $acjrn->update_internal_code($acinternal);
             $r1 = $this->get_id($internal);
             $r2 = $this->get_id($acinternal);
             /*
              * add lettering
              */
             $oletter = new Lettering($this->db);
             $oletter->insert_couple($let_tiers, $let_other);
             /* set the flag paid */
             $Res = $this->db->exec_sql("update jrn set jr_rapt='paid' where jr_id=\$1", array($r1));
             /* Reconcialiation */
             $rec = new Acc_Reconciliation($this->db);
             $rec->set_jr_id($r1);
             $rec->insert($r2);
             /*
              * save also into quant_fin
              */
             /* get ledger property */
             $ledger = new Acc_Ledger_Fin($this->db, $acc_pay->jrn);
             $prop = $ledger->get_propertie();
             /* if ledger is FIN then insert into quant_fin */
             if ($prop['jrn_def_type'] == 'FIN') {
                 $ledger->insert_quant_fin($acfiche->id, $mp_jr_id, $cust->id, bcmul($famount, 1));
             }
         }
     } catch (Exception $e) {
         echo '<span class="error">' . 'Erreur dans l\'enregistrement ' . __FILE__ . ':' . __LINE__ . ' ' . $e->getMessage();
         echo $e->getTrace();
         $this->db->rollback();
         throw new Exception($e);
     }
     $this->db->commit();
     return $internal;
 }
Exemplo n.º 15
0
 function myList()
 {
     $this->get();
     echo '<H2 class="info">' . $this->id . " " . $this->label . '</H2>';
     $step = $_SESSION['g_pagesize'];
     $sql_limit = "";
     $sql_offset = "";
     $bar = "";
     if ($step != -1) {
         $page = isset($_GET['page']) ? $_GET['page'] : 1;
         $offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
         $max_line = $this->cn->count_sql("select f_id,ad_value  from\n                                           fiche join fiche_detail using (f_id)\n                                           where fd_id='" . $this->id . "' and ad_id=" . ATTR_DEF_NAME . " order by f_id");
         $sql_limit = " limit " . $step;
         $sql_offset = " offset " . $offset;
         $bar = navigation_bar($offset, $max_line, $step, $page);
     }
     // Get all name the cards of the select category
     // 1 for attr_def.ad_id is always the name
     $Res = $this->cn->exec_sql("select f_id,vw_name,quick_code  from " . " vw_fiche_attr " . " where fd_id='" . $this->id . "' order by f_id {$sql_offset} {$sql_limit} ");
     $Max = Database::num_row($Res);
     echo $bar;
     $str = "";
     // save the url
     // with offet &offset=15&step=15&page=2&size=15
     if ($_SESSION['g_pagesize'] != -1) {
         $str = sprintf("&offset=%s&step=%s&page=%s&size=%s", $offset, $step, $page, $max_line);
     }
     echo '<FORM METHOD="POST" action="?p_action=fiche&action=vue' . $str . '">';
     echo HtmlInput::hidden('ac', $_REQUEST['ac']);
     echo dossier::hidden();
     echo HtmlInput::hidden("fiche", $this->id);
     echo HtmlInput::submit('add', 'Ajout fiche');
     echo '</FORM>';
     $str_dossier = dossier::get();
     echo '<table>';
     for ($i = 0; $i < $Max; $i++) {
         $l_line = Database::fetch_array($Res, $i);
         if ($i % 2 == 0) {
             echo '<TR class="odd">';
         } else {
             echo '<TR class="even">';
         }
         $span_mod = '<TD><A href="?p_action=fiche&' . $str_dossier . '&action=detail&fiche_id=' . $l_line['f_id'] . $str . '&fiche=' . $_REQUEST['fiche'] . '&ac=' . $_REQUEST['ac'] . '">' . $l_line['quick_code'] . '</A></TD>';
         echo $span_mod . '<TD>' . h($l_line['vw_name']) . "</TD>";
         echo '</tr>';
     }
     echo '</table>';
     echo '<FORM METHOD="POST" action="?p_action=fiche&action=vue' . $str . '">';
     echo HtmlInput::hidden('ac', $_REQUEST['ac']);
     echo dossier::hidden();
     echo HtmlInput::hidden("fiche", $this->id);
     echo HtmlInput::submit('add', 'Ajout fiche');
     echo '</FORM>';
     echo $bar;
 }
Exemplo n.º 16
0
function menu_acc_plan($p_start = 1)
{
    $base = "?ac=" . $_REQUEST['ac'];
    $str_dossier = "&" . dossier::get();
    for ($i = 0; $i < 10; $i++) {
        $class[$i] = "tabs";
    }
    $class[$p_start] = "tabs_selected";
    $idx = 0;
    ?>
    <ul class="tabs">
    <li class="<?php 
    echo $class[$idx];
    $idx++;
    ?>
"><A HREF="<?php 
    echo $base . '&p_start=0' . $str_dossier;
    ?>
">0 <?php 
    echo _(' Hors Bilan');
    ?>
</A></li>
    <li class="<?php 
    echo $class[$idx];
    $idx++;
    ?>
"><A HREF="<?php 
    echo $base . '&p_start=1' . $str_dossier;
    ?>
">1 <?php 
    echo _(' Immobilisé');
    ?>
</A></li>
    <li class="<?php 
    echo $class[$idx];
    $idx++;
    ?>
"><A HREF="<?php 
    echo $base . '&p_start=2' . $str_dossier;
    ?>
">2 <?php 
    echo _('Actif a un an au plus');
    ?>
</A></li>
    <li class="<?php 
    echo $class[$idx];
    $idx++;
    ?>
"><A HREF="<?php 
    echo $base . '&p_start=3' . $str_dossier;
    ?>
">3 <?php 
    echo _('Stock et commande');
    ?>
</A></li>
    <li class="<?php 
    echo $class[$idx];
    $idx++;
    ?>
"><A HREF="<?php 
    echo $base . '&p_start=4' . $str_dossier;
    ?>
">4 <?php 
    echo _('Compte tiers');
    ?>
</A></li>
    <li class="<?php 
    echo $class[$idx];
    $idx++;
    ?>
"><A HREF="<?php 
    echo $base . '&p_start=5' . $str_dossier;
    ?>
">5 <?php 
    echo _('Financier');
    ?>
</A></li>
    <li class="<?php 
    echo $class[$idx];
    $idx++;
    ?>
"><A HREF="<?php 
    echo $base . '&p_start=6' . $str_dossier;
    ?>
">6 <?php 
    echo _('Charges');
    ?>
</A></li>
    <li class="<?php 
    echo $class[$idx];
    $idx++;
    ?>
"><A HREF="<?php 
    echo $base . '&p_start=7' . $str_dossier;
    ?>
">7 <?php 
    echo _('Produits');
    ?>
</A></li>
    <li class="<?php 
    echo $class[$idx];
    $idx++;
    ?>
"><A HREF="<?php 
    echo $base . '&p_start=8' . $str_dossier;
    ?>
">8 <?php 
    echo _('Hors Comptabilité');
    ?>
</A></li>
    <li class="<?php 
    echo $class[$idx];
    $idx++;
    ?>
"><A HREF="<?php 
    echo $base . '&p_start=9' . $str_dossier;
    ?>
">9 <?php 
    echo _('Hors Comptabilité');
    ?>
</A></li>
    </ul>
<?php 
}
Exemplo n.º 17
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 this file is to be included to handle the financial ledger
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
require_once NOALYSS_INCLUDE . '/class_acc_ledger_fin.php';
require_once NOALYSS_INCLUDE . '/class_ipopup.php';
global $g_user, $g_parameter;
$gDossier = dossier::id();
$cn = new Database(dossier::id());
$menu_action = "?ledger_type=fin&ac=" . $_REQUEST['ac'] . "&" . dossier::get();
$Ledger = new Acc_Ledger_Fin($cn, 0);
//--------------------------------------------------------------------------------
// Encode a new financial operation
//--------------------------------------------------------------------------------
if (isset($_REQUEST['p_jrn'])) {
    $Ledger->id = $_REQUEST['p_jrn'];
} else {
    $def_ledger = $Ledger->get_first('fin');
    if (empty($def_ledger)) {
        exit('Pas de journal disponible');
    }
    $Ledger->id = $def_ledger['jrn_def_id'];
}
$jrn_priv = $g_user->get_ledger_access($Ledger->id);
// Check privilege
Exemplo n.º 18
0
            if ($_POST[$priv] == 0) {
                $cn->exec_sql('delete from user_sec_act  where ua_login=$1 and ua_act_id=$2', array($sec_User->login, $id));
            }
        }
        $cn->commit();
    } catch (Exception $e) {
        echo_warning($e->getTraceAsString());
        $cn->rollback();
    }
}
//--------------------------------------------------------------------------------
// Action == View detail for users
//--------------------------------------------------------------------------------
if ($action == "view") {
    $l_Db = sprintf("dossier%d", $gDossier);
    $return = HtmlInput::button_anchor('Retour à la liste', '?&ac=' . $_REQUEST['ac'] . '&' . dossier::get(), 'retour');
    $repo = new Database();
    $User = new User($repo, $_GET['user_id']);
    $admin = 0;
    $access = $User->get_folder_access($gDossier);
    $str = "Aucun accès";
    if ($access == 'R') {
        $str = ' Utilisateur normal';
    }
    if ($User->admin == 1) {
        $str = ' Administrateur';
        $admin = 1;
    }
    echo '<h2>' . h($User->first_name) . ' ' . h($User->name) . ' ' . hi($User->login) . "({$str})</h2>";
    if ($_GET['user_id'] == 1) {
        echo '<h2 class="notice"> Cet utilisateur est administrateur, il a tous les droits</h2>';
Exemplo n.º 19
0
 /**
  * @brief listing of all ledgers
  * @return HTML string
  */
 function listing()
 {
     $str_dossier = dossier::get();
     $base_url = "?" . dossier::get() . "&ac=" . $_REQUEST['ac'];
     $r = "";
     $r .= _('Filtre') . " " . HtmlInput::filter_table("cfgledger_table_id", "0", "1");
     $r .= '<TABLE id="cfgledger_table_id" class="vert_mtitle">';
     $r .= '<TR><TD class="first"><A HREF="' . $base_url . '&sa=add">' . _('Ajout journal') . ' </A></TD></TR>';
     $ret = $this->db->exec_sql("select distinct jrn_def_id,jrn_def_name,\n                       jrn_def_class_deb,jrn_def_class_cred,jrn_def_type\n                       from jrn_def order by jrn_def_name");
     $Max = Database::num_row($ret);
     for ($i = 0; $i < $Max; $i++) {
         $l_line = Database::fetch_array($ret, $i);
         $url = $base_url . "&sa=detail&p_jrn=" . $l_line['jrn_def_id'];
         $r .= sprintf('<TR><TD><A HREF="%s">%s</A></TD></TR>', $url, h($l_line['jrn_def_name']) . ' (' . $l_line['jrn_def_type'] . ')');
     }
     $r .= "</TABLE>";
     return $r;
 }
Exemplo n.º 20
0
// Save Follow_Up
// Stage 2 : Save a NEW action + Files and generate eventually a document
//--------------------------------------------------------------------------------
if ($sub_action == "save_action_st2") {
    $act = new Follow_Up($cn);
    $act->fromArray($_POST);
    try {
        $act->d_id = 0;
        $act->md_id = isset($_POST['gen_doc']) ? $_POST['gen_doc'] : 0;
        $act->verify();
        // insert into action_gestion
        echo $act->save();
        $url = "?{$base}&sa=detail&ag_id=" . $act->ag_id . '&' . dossier::get();
        echo '<p><a class="mtitle" href="' . $url . '">' . hb(_('Evènement Sauvée') . '  : ' . $act->ag_ref) . '</a></p>';
        Follow_Up::show_action_list($cn, $base);
        $url = "?{$base}&sa=detail&ag_id=" . $act->ag_id . '&' . dossier::get();
        echo '<p><a class="mtitle" href="' . $url . '">' . hb(_('Evènement Sauvée') . '  : ' . $act->ag_ref) . '</a></p>';
    } catch (Exception $e) {
        echo '<span class="notice">';
        echo _("Erreur") . " " . $e->getMessage();
        echo '</span>';
        $sub_action = "add_action";
        $error_id = $e->getCode();
    }
}
//--------------------------------------------------------------------------------
// Add an action
if ($sub_action == "add_action") {
    $act = new Follow_Up($cn);
    $act->fromArray($_POST);
    $act->ag_id = 0;
Exemplo n.º 21
0
 *   along with NOALYSS; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
require_once '../include/constant.php';
require_once NOALYSS_INCLUDE . '/ac_common.php';
require_once NOALYSS_INCLUDE . '/function_javascript.php';
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']);
Exemplo n.º 22
0
include_once NOALYSS_INCLUDE . '/ac_common.php';
require_once NOALYSS_INCLUDE . '/class_acc_ledger.php';
html_page_start($_SESSION['g_theme']);
load_all_script();
$gDossier = dossier::id();
require_once NOALYSS_INCLUDE . '/class_database.php';
/* Admin. Dossier */
$cn = new Database($gDossier);
include_once NOALYSS_INCLUDE . '/class_user.php';
global $g_user;
$g_user = new User($cn);
$g_user->Check();
$act = $g_user->check_dossier($gDossier);
// AC CODE = SEARCH
if ($act == 'P') {
    redirect("extension.php?" . dossier::get(), 0);
    exit;
}
if ($act == 'X') {
    alert(_('Accès interdit'));
    exit;
}
// display a search box
$ledger = new Acc_Ledger($cn, 0);
$ledger->type = 'ALL';
$search_box = $ledger->search_form('ALL', 1);
echo '<div class="content">';
echo '<form method="GET">';
echo $search_box;
echo HtmlInput::submit("viewsearch", _("Recherche"));
?>
Exemplo n.º 23
0
 public function input($p_name = null, $p_value = null)
 {
     if ($p_name == null && $this->name == "") {
         throw new Exception('Le nom d une icard doit être donne');
     }
     $this->value = $p_value == null ? $this->value : $p_value;
     if ($this->readOnly == true) {
         return $this->display();
     }
     $this->id = $this->id == "" ? $this->name : $this->id;
     $this->choice = $this->choice == null ? sprintf("%s_choices", $this->id) : $this->choice;
     $this->indicator = $this->indicator == null ? sprintf("%s_ind", $this->id) : $this->indicator;
     $attr = $this->get_js_attr();
     $label = '';
     if ($this->dblclick != '') {
         $e = sprintf(' ondblclick="%s" ', $this->dblclick);
         $this->dblclick = $e;
     }
     $input = sprintf('<INPUT TYPE="Text"  class="input_text"  ' . ' NAME="%s" ID="%s" VALUE="%s" SIZE="%d" %s %s  %s>', $this->name, $this->id, $this->value, $this->size, $this->dblclick, $this->javascript, $this->style);
     if ($this->autocomplete == 1) {
         $this->indicator = "ind_" . $this->id;
         $ind = sprintf('<span id="%s" class="autocomplete" style="position:absolute;display:none">Un instant... <img src="image/loading.gif" alt="Chargement..."/>' . '</span>', $this->indicator);
         $this->indicator = "null";
         $div = $this->choice_create == 1 ? sprintf('<div id="%s"  class="autocomplete"></div>', $this->choice) : "";
         $query = dossier::get() . '&e=' . urlencode($this->typecard);
         $javascript = sprintf('try { new Ajax.Autocompleter("%s","%s","fid_card.php?%s",' . '{paramName:"FID",minChars:1,indicator:%s, ' . 'callback:%s, ' . ' afterUpdateElement:%s});} catch (e){alert(e.message);};', $this->id, $this->choice, $query, $this->indicator, $this->callback, $this->fct);
         $javascript = create_script($javascript . $this->dblclick);
         $r = $label . $input . $attr . $ind . $div . $javascript;
     } else {
         $r = $label . $input;
     }
     if ($this->table == 1) {
         $r = td($r);
     }
     return $r;
 }