예제 #1
0
 function form($p_line = 0)
 {
     $r = "";
     if ($p_line == 0) {
         $p_line = count($this->aAcc_Report_row);
     }
     $r .= dossier::hidden();
     $r .= HtmlInput::hidden('line', $p_line);
     $r .= HtmlInput::hidden('fr_id', $this->id);
     $wForm = new IText();
     $r .= "Nom du rapport : ";
     $r .= $wForm->input('form_nom', $this->name);
     $r .= '<TABLE id="rap1" width="100%">';
     $r .= "<TR>";
     $r .= "<TH> Position </TH>";
     $r .= "<TH> Texte </TH>";
     $r .= "<TH> Formule</TH>";
     $r .= '</TR>';
     $wName = new IText();
     $wName->size = 40;
     $wPos = new IText();
     $wPos->size = 3;
     $wForm = new IText();
     $wForm->size = 35;
     for ($i = 0; $i < $p_line; $i++) {
         $r .= "<TR>";
         $r .= "<TD>";
         $wPos->value = isset($this->aAcc_Report_row[$i]->fo_pos) ? $this->aAcc_Report_row[$i]->fo_pos : $i + 1;
         $r .= $wPos->input("pos" . $i);
         $r .= '</TD>';
         $r .= "<TD>";
         $wName->value = isset($this->aAcc_Report_row[$i]->fo_label) ? $this->aAcc_Report_row[$i]->fo_label : "";
         $r .= $wName->input("text" . $i);
         $r .= '</TD>';
         $r .= '<td>';
         $search = new IPoste("form" . $i);
         $search->size = 50;
         $search->value = isset($this->aAcc_Report_row[$i]->fo_formula) ? $this->aAcc_Report_row[$i]->fo_formula : "";
         $search->label = _("Recherche poste");
         $search->set_attribute('gDossier', dossier::id());
         $search->set_attribute('bracket', 1);
         $search->set_attribute('no_overwrite', 1);
         $search->set_attribute('noquery', 1);
         $search->set_attribute('account', $search->name);
         $search->set_attribute('ipopup', 'ipop_card');
         $r .= $search->input();
         $r .= '</td>';
         $r .= "</TR>";
     }
     $r .= "</TABLE>";
     $wButton = new IButton();
     $wButton->javascript = " rapport_add_row('" . dossier::id() . "')";
     $wButton->label = "Ajout d'une ligne";
     $r .= $wButton->input();
     return $r;
 }
예제 #2
0
 function form()
 {
     $comment = new IText();
     $comment->name = 'p_comment';
     $comment->value = $this->p_comment;
     $comment->size = 45;
     $value = new IPoste();
     $value->name = 'p_value';
     $value->value = $this->p_value;
     $value->size = 7;
     $value->set_attribute('ipopup', 'ipop_account');
     $value->set_attribute('account', 'p_value');
     $poste = new IText();
     $poste->setReadOnly(true);
     $poste->size = strlen($this->p_code) + 1;
     $poste->name = 'p_code';
     $poste->value = $this->p_code;
     $r = "";
     $r .= '<tr>';
     $r .= '<td align="right"> Code </td>';
     $r .= '<TD>' . $poste->input() . '</TD>';
     $r .= '</tr>';
     $r .= '<tr>';
     $r .= '<td align="right"> Commentaire </td>';
     $r .= '<TD>' . $comment->input() . '</TD>';
     $r .= '</tr>';
     $r .= '<tr>';
     $r .= '<td align="right"> Poste comptable </td>';
     $r .= '<TD>' . $value->input();
     $r .= '<span id="p_value_label"></span></td>';
     $r .= '</tr>';
     $r .= Dossier::hidden();
     return $r;
 }
$first_day = $a[0]->first_day();
$last_day = $a[1]->last_day();
// filter on period
$date_from = new IDate('from_periode');
$date_to = new IDate('to_periode');
$year = $g_user->get_exercice();
$date_from->value = isset($_REQUEST['from_periode']) && isDate($_REQUEST['from_periode']) != 0 ? $_REQUEST['from_periode'] : $first_day;
$date_to->value = isset($_REQUEST['to_periode']) && isDate($_REQUEST['to_periode']) != 0 ? $_REQUEST['to_periode'] : $last_day;
echo td(_('Depuis') . $date_from->input());
echo td(_('Jusque ') . $date_to->input());
$letter = new ICheckbox('letter');
$letter->selected = isset($_REQUEST['letter']) ? true : false;
$from_poste = new IPoste('from_poste');
$from_poste->value = HtmlInput::default_value('from_poste', '', $_REQUEST);
$from_poste->set_attribute('account', 'from_poste');
$to_poste = new IPoste('to_poste');
$to_poste->value = HtmlInput::default_value('to_poste', '', $_REQUEST);
$to_poste->set_attribute('account', 'to_poste');
$solded = new ICheckbox('solded');
$solded->selected = isset($_REQUEST['solded']) ? true : false;
echo '<tr>';
echo td(_('Depuis le poste')) . td($from_poste->input());
echo '</tr>';
echo '<tr>';
echo td(_("Jusqu'au poste")) . td($to_poste->input());
echo '</tr>';
echo '<tr>';
echo td(_('Uniquement les opérations non lettrées'));
echo td($letter->input());
echo '</tr>';
echo '<tr>';
예제 #4
0
}
/* * ********************************************************************
 * Ask for a new anticipation (forecast)
 *
 *
 * ******************************************************************** */
if ($sa == 'new') {
    /* Second step : we save the name and category
     * and propose the items we add the item */
    if ($correct == 2 || isset($_POST['step2'])) {
        /* Propose a form for the items
         */
        $anticip = new Anticipation($cn, $a->get_parameter("id"));
        echo '<div class="content">';
        echo ICard::ipopup('ipopcard');
        echo IPoste::ipopup('ipop_account');
        $search_card = new IPopup('ipop_card');
        $search_card->title = _('Recherche de fiche');
        $search_card->value = '';
        echo $search_card->input();
        echo '<form method="post" action="?">';
        echo dossier::hidden();
        echo HtmlInput::hidden('sa', 'new');
        echo HtmlInput::hidden('ac', $_REQUEST['ac']);
        echo HtmlInput::hidden('f_id', $id);
        echo $anticip->form_item();
        echo HtmlInput::submit('step3', _('Sauver'));
        echo '</form>';
        echo '</div>';
    }
    /* First step, the name and the category */
예제 #5
0
// Show the jrn and date
//-----------------------------------------------------
require_once NOALYSS_INCLUDE . '/class_database.php';
require_once NOALYSS_INCLUDE . '/class_ipopup.php';
global $g_user;
//-----------------------------------------------------
// Form
//-----------------------------------------------------
echo '<div class="content">';
echo '<FORM action="?" METHOD="GET">';
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo HtmlInput::hidden('type', 'poste');
echo dossier::hidden();
echo '<TABLE><TR>';
$span = new ISpan();
$w = new IPoste('poste_id');
$w->set_attribute('ipopup', 'ipop_account');
$w->set_attribute('label', 'poste_id_label');
$w->set_attribute('account', 'poste_id');
$w->table = 0;
$w->value = isset($_REQUEST['poste_id']) ? $_REQUEST['poste_id'] : "";
$w->label = "Choisissez le poste";
print td('Choisissez un poste ') . td($w->input());
echo td($span->input('poste_id_label'));
echo '</tr><tr>';
$w_poste = new ICard('f_id');
$w_poste->table = 0;
$w_poste->jrn = 0;
echo td("Ou Choisissez la fiche");
$w_poste->set_attribute('label', 'f_id_label');
$w_poste->set_attribute('ipopup', 'ipop_card');
예제 #6
0
 function input_base()
 {
     $r = "";
     $r .= _('Label');
     $label = new IText('label', $this->label);
     $r .= $label->input();
     $r .= '<br>';
     /* the accounting item */
     $class_base = new IPoste('class_base', $this->class_base);
     $class_base->set_attribute('ipopup', 'ipop_account');
     $class_base->set_attribute('account', 'class_base');
     $class_base->set_attribute('label', 'acc_label');
     $fd_description = new ITextarea('fd_description', $this->fd_description);
     $fd_description->width = 80;
     $fd_description->heigh = 4;
     $fd_description->style = 'class="itextarea" style="margin-left:0px;vertical-align:text-top"';
     $r .= _('Poste Comptable de base') . ' : ';
     $r .= $class_base->input();
     $r .= '<span id="acc_label"></span><br>';
     $r .= '<br/>';
     $r .= " Description " . $fd_description->input();
     /* auto Create */
     $r .= '<br/>';
     $ck = new ICheckBox('create');
     $ck->selected = $this->create_account == 'f' ? false : true;
     $r .= _('Chaque fiche aura automatiquement son propre poste comptable : ');
     $r .= $ck->input();
     return $r;
 }
예제 #7
0
 /**
  * display screen to enter a new ledger
  */
 function input_new()
 {
     $retry = HtmlInput::default_value_post("sa", "");
     //            if ( $retry == "add") {
     $default_type = HtmlInput::default_value_post("p_jrn_type", -1);
     $previous_jrn_def_pj_pref = HtmlInput::default_value_post("jrn_def_pj_pref", "");
     $previous_p_description = HtmlInput::default_value_post("p_description", "");
     $previous_p_jrn_name = HtmlInput::default_value_post('p_jrn_name', '');
     $previous_p_jrn_type = HtmlInput::default_value_post("p_jrn_type", "");
     //            }
     global $g_user;
     $f_add_button = new ISmallButton('add_card');
     $f_add_button->label = _('Créer une nouvelle fiche');
     $f_add_button->tabindex = -1;
     $f_add_button->set_attribute('jrn', -1);
     $f_add_button->javascript = " this.jrn=-1;select_card_type({type_cat:4});";
     $str_add_button = "";
     if ($g_user->check_action(FICADD) == 1) {
         $str_add_button = $f_add_button->input();
     }
     $wSearch = new IPoste();
     $wSearch->table = 3;
     $wSearch->set_attribute('ipopup', 'ipop_account');
     $wSearch->set_attribute('account', 'p_jrn_class_deb');
     $wSearch->set_attribute('no_overwrite', '1');
     $wSearch->set_attribute('noquery', '1');
     $wSearch->name = "p_jrn_class_deb";
     $wSearch->size = 20;
     $search = $wSearch->input();
     // default for ACH
     $default_deb_purchase = $this->get_default_card('ACH', 'D');
     $default_cred_purchase = $this->get_default_card('ACH', 'C');
     // default for VEN
     $default_deb_sale = $this->get_default_card('VEN', 'D');
     $default_cred_sale = $this->get_default_card('VEN', 'C');
     // default for FIN
     $default_fin = $this->get_default_card("FIN", "");
     //default ods
     $default_ods = $this->get_default_card("ODS", "");
     /* construct all the hidden */
     $hidden = HtmlInput::hidden('p_jrn', -1);
     $hidden .= HtmlInput::hidden('p_action', 'jrn');
     $hidden .= HtmlInput::hidden('sa', 'add');
     $hidden .= dossier::hidden();
     $hidden .= HtmlInput::hidden('p_jrn_deb_max_line', 10);
     $hidden .= HtmlInput::hidden('p_ech_lib', 'echeance');
     /* properties of the ledger */
     $name = $previous_p_jrn_name;
     $code = "";
     $wType = new ISelect();
     $a_jrn = $this->db->make_array("select '-1',' -- " . _("choix du type de journal") . " -- ' union select jrn_type_id,jrn_desc from jrn_type");
     $wType->selected = '-1';
     $wType->value = $a_jrn;
     $wType->name = "p_jrn_type";
     $wType->id = "p_jrn_type_select_id";
     $wType->javascript = ' onchange="show_ledger_div()"';
     $wType->selected = $default_type;
     $type = $wType->input();
     $rcred = $rdeb = array();
     $wPjPref = new IText();
     $wPjPref->name = 'jrn_def_pj_pref';
     $wPjPref->value = $previous_jrn_def_pj_pref;
     $pj_pref = $wPjPref->input();
     $pj_seq = '';
     $last_seq = 0;
     $new = 1;
     $description = new ITextarea('p_description');
     $description->style = 'class="itextarea" style="margin:0px;"';
     $description->value = $previous_p_description;
     $str_description = $description->input();
     /* bank card */
     $qcode_bank = '';
     /* Numbering (only FIN) */
     $num_op = new ICheckBox('numb_operation');
     echo dossier::hidden();
     echo HtmlInput::hidden('ac', $_REQUEST['ac']);
     echo $hidden;
     $cn = $this->db;
     $min_row = new INum("min_row", MAX_ARTICLE);
     $min_row->prec = 0;
     require_once NOALYSS_INCLUDE . '/template/param_jrn.php';
 }
예제 #8
0
if (HtmlInput::default_value('unsold', false, $_GET) !== false) {
    $unsold->selected = true;
}
// previous exercice if checked
$previous_exc = new ICheckBox('previous_exc');
if (HtmlInput::default_value('previous_exc', false, $_GET) !== false) {
    $previous_exc->selected = true;
}
$from_poste = new IPoste();
$from_poste->name = "from_poste";
$from_poste->set_attribute('ipopup', 'ipop_account');
$from_poste->set_attribute('label', 'from_poste_label');
$from_poste->set_attribute('account', 'from_poste');
$from_poste->value = isset($_GET['from_poste']) ? $_GET['from_poste'] : "";
$from_span = new ISpan("from_poste_label", "");
$to_poste = new IPoste();
$to_poste->name = "to_poste";
$to_poste->set_attribute('ipopup', 'ipop_account');
$to_poste->set_attribute('label', 'to_poste_label');
$to_poste->set_attribute('account', 'to_poste');
$to_poste->value = isset($_GET['to_poste']) ? $_GET['to_poste'] : "";
$to_span = new ISpan("to_poste_label", "");
echo "<div>";
echo _("Plage de postes") . " :" . $from_poste->input();
echo $from_span->input();
echo " " . _("jusque") . " :" . $to_poste->input();
echo $to_span->input();
echo "</div>";
echo '<div>';
echo '<p>';
echo _("Uniquement comptes non soldés") . " " . $unsold->input();
예제 #9
0
         case FICHE_TYPE_CONTACT:
             $msg = _(' de contacts');
             $base = '';
             break;
         case FICHE_TYPE_FIN:
             $msg = _(' Banque');
             $base = $cn->get_value("select p_value from parm_code where p_code='BANQUE'");
             break;
         case FICHE_TYPE_EMPL:
             $msg = _(' Employé ou administrateur');
             $base = '';
             break;
     }
     $html = '';
     /*  show the form */
     $search = new IPoste("class_base");
     $search->size = 40;
     $search->value = $base;
     $search->label = _("Recherche poste");
     $search->set_attribute('gDossier', dossier::id());
     $search->set_attribute('account', $search->name);
     $search->set_attribute('ipopup', 'ipop_account');
     $nom_mod = new IText("nom_mod");
     $str_poste = $search->input();
     $submit = HtmlInput::submit('save', _('Sauve'));
     ob_start();
     require 'template/category_of_card.php';
     $html .= ob_get_contents();
     ob_end_clean();
 } else {
     $html = alert(_('Action interdite'), true);
예제 #10
0
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*!\file
 * \brief show the lettering by account
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
require_once NOALYSS_INCLUDE . '/class_lettering.php';
echo '<div class="content">';
echo '<div id="search">';
echo '<FORM METHOD="GET">';
echo dossier::hidden();
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo HtmlInput::hidden('sa', 'poste');
$poste = new IPoste();
$poste->name = "acc";
$poste->table = 0;
$poste->set_attribute('jrn', 0);
$poste->set_attribute('gDossier', dossier::id());
$poste->set_attribute('ipopup', 'ipop_account');
$poste->set_attribute('label', 'account_label');
$poste->set_attribute('account', 'acc');
$acc_lib = "";
if (isset($_GET['acc'])) {
    $poste->value = $_GET['acc'];
    $acc_lib = $cn->get_value('select pcm_lib from tmp_pcmn where pcm_val=upper($1)', array($poste->value));
}
$poste_span = new ISpan('account_label');
$poste_span->value = $acc_lib;
$r = td(_('Lettrage pour le poste comptable ')) . td($poste->input()) . td($poste_span->input());
예제 #11
0
 function display($p_array)
 {
     global $g_parameter, $g_user;
     require_once NOALYSS_INCLUDE . '/class_acc_ledger.php';
     $legder = new Acc_Ledger($this->db, $this->jrn_def_id);
     $legder->nb = $legder->get_min_row();
     if ($p_array != null) {
         extract($p_array);
     }
     $add_js = "";
     $ret = "";
     if ($g_user->check_action(FICADD) == 1) {
         /* Add button */
         $f_add_button = new IButton('add_card');
         $f_add_button->label = _('Créer une nouvelle fiche');
         $f_add_button->set_attribute('ipopup', 'ipop_newcard');
         $f_add_button->set_attribute('jrn', $legder->id);
         $f_add_button->javascript = " this.jrn=\$('p_jrn').value;select_card_type(this);";
         $f_add_button->input();
     }
     $nb_row = isset($nb_item) ? $nb_item : $legder->nb;
     $ret .= HtmlInput::hidden('nb_item', $nb_row);
     $ret .= HtmlInput::hidden('p_jrn', $this->jrn_def_id);
     $ret .= dossier::hidden();
     $ret .= dossier::hidden();
     $ret .= HtmlInput::hidden('jrn_type', $legder->get_type());
     $info = HtmlInput::infobulle(0);
     $info_poste = HtmlInput::infobulle(9);
     if ($g_user->check_action(FICADD) == 1) {
         $ret .= $f_add_button->input();
     }
     $ret .= '<table id="quick_item" style="width:100%">';
     $ret .= '<tr>' . '<th style="text-align:left">Quickcode' . $info . '</th>' . '<th style="text-align:left">' . _('Poste') . $info_poste . '</th>' . '<th style="text-align:left">' . _('Libellé') . '</th>' . '<th style="text-align:left">' . _('Montant') . '</th>' . '<th style="text-align:left">' . _('Débit') . '</th>' . '</tr>';
     for ($i = 0; $i < $nb_row; $i++) {
         // Quick Code
         $quick_code = new ICard('qc_' . $i);
         $quick_code->set_dblclick("fill_ipopcard(this);");
         $quick_code->set_attribute('ipopup', 'ipopcard');
         // name of the field to update with the name of the card
         $quick_code->set_attribute('label', "ld" . $i);
         $quick_code->set_attribute('jrn', $legder->id);
         // name of the field to update with the name of the card
         $quick_code->set_attribute('typecard', 'filter');
         // Add the callback function to filter the card on the jrn
         $quick_code->set_callback('filter_card');
         $quick_code->set_function('fill_data');
         $quick_code->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $quick_code->name);
         $quick_code->jrn = $legder->id;
         $quick_code->value = isset(${'qc_' . $i}) ? ${'qc_' . $i} : "";
         $label = '';
         if ($quick_code->value != '') {
             $Fiche = new Fiche($legder->db);
             $Fiche->get_by_qcode($quick_code->value);
             $label = $Fiche->strAttribut(ATTR_DEF_NAME);
         }
         // Account
         $poste = new IPoste();
         $poste->name = 'poste' . $i;
         $poste->set_attribute('jrn', $legder->id);
         $poste->set_attribute('ipopup', 'ipop_account');
         $poste->set_attribute('label', 'ld' . $i);
         $poste->set_attribute('account', 'poste' . $i);
         $poste->set_attribute('dossier', Dossier::id());
         $poste->value = isset(${'poste' . $i}) ? ${"poste" . $i} : '';
         $poste->dbl_click_history();
         if ($poste->value != '') {
             $Poste = new Acc_Account($legder->db);
             $Poste->set_parameter('value', $poste->value);
             $label = $Poste->get_lib();
         }
         // Description of the line
         $line_desc = new IText();
         $line_desc->name = 'ld' . $i;
         $line_desc->size = 30;
         $line_desc->value = isset(${"ld" . $i}) ? ${"ld" . $i} : $label;
         // Amount
         $amount = new INum();
         $amount->size = 10;
         $amount->name = 'amount' . $i;
         $amount->value = isset(${'amount' . $i}) ? ${"amount" . $i} : '';
         $amount->javascript = ' onChange="format_number(this);checkTotalDirect()"';
         // D/C
         $deb = new ICheckBox();
         $deb->name = 'ck' . $i;
         $deb->selected = isset(${'ck' . $i}) ? true : false;
         $deb->javascript = ' onChange="checkTotalDirect()"';
         $ret .= '<tr>';
         $ret .= '<td>' . $quick_code->input() . $quick_code->search() . '</td>';
         $ret .= '<td>' . $poste->input() . '<script> document.getElementById(\'poste' . $i . '\').onblur=function(){ if (trim(this.value) !=\'\') {document.getElementById(\'qc_' . $i . '\').value="";}}</script>' . '</td>';
         $ret .= '<td>' . $line_desc->input() . '</td>';
         $ret .= '<td>' . $amount->input() . '</td>';
         $ret .= '<td>' . $deb->input() . '</td>';
         $ret .= '</tr>';
         // If readonly == 1 then show CA
     }
     $ret .= '</table>';
     return $ret;
 }
예제 #12
0
 /**
  *@brief display a form for modifying or add a forecast
  *@return HTML code
  */
 public function form_item()
 {
     $forecast = new Forecast($this->cn, $this->f_id);
     $forecast->load();
     $str_name = $forecast->get_parameter('name');
     $str_start = $forecast->get_parameter('start_date');
     $str_end = $forecast->get_parameter('end_date');
     $r = "";
     $str_action = _("Elements");
     $cat = new Forecast_Cat($this->cn);
     $array = $cat->make_array($this->f_id);
     $periode = new Periode($this->cn);
     $aPeriode = $this->cn->make_array("select p_id,to_char(p_start,'MM.YYYY') as label from parm_periode\n                                  where p_start >= (select p_start from parm_periode where p_id={$str_start})\n                                   and p_end <= (select p_end from parm_periode where p_id={$str_end})\n\t\t\t\t   order by p_start");
     $aPeriode[] = array('value' => 0, 'label' => 'Mensuel');
     $value = $this->cn->get_array("select fi_id,fi_text,fi_account,fi_card,fc_id,fi_amount,fi_debit,fi_pid " . " from forecast_item " . " \twhere fc_id in (select fc_id from forecast_cat where f_id = \$1)", array($this->f_id));
     $max = count($value) < MAX_FORECAST_ITEM ? MAX_FORECAST_ITEM : count($value);
     $r .= HtmlInput::hidden('nbrow', $max);
     for ($i = 0; $i < $max; $i++) {
         if (isset($value[$i]['fi_id'])) {
             $r .= HtmlInput::hidden('fi_id' . $i, $value[$i]['fi_id']);
         }
         /* category*/
         $category = new ISelect();
         $category->name = 'an_cat' . $i;
         $category->value = $array;
         $category->selected = isset($value[$i]["fc_id"]) ? $value[$i]["fc_id"] : -1;
         $aCat[$i]['cat'] = $category->input();
         /* amount 	 */
         $amount = new INum('an_cat_amount' . $i);
         $amount->value = isset($value[$i]["fi_amount"]) ? $value[$i]["fi_amount"] : 0;
         $aCat[$i]['amount'] = $amount->input();
         /* Accounting*/
         $account = new IPoste('an_cat_acc' . $i);
         $account->set_attribute('ipopup', 'ipop_account');
         //            $account->set_attribute('label','an_label'.$i);
         $account->set_attribute('account', 'an_cat_acc' . $i);
         $account->set_attribute('bracket', 1);
         $account->set_attribute('no_overwrite', 1);
         $account->set_attribute('noquery', 1);
         $account->css_size = "85%";
         $account->value = isset($value[$i]["fi_account"]) ? $value[$i]["fi_account"] : "";
         $aCat[$i]['account'] = $account->input();
         /*Quick Code */
         $qc = new ICard('an_qc' . $i);
         // If double click call the javascript fill_ipopcard
         $qc->set_dblclick("fill_ipopcard(this);");
         // This attribute is mandatory, it is the name of the IPopup
         $qc->set_attribute('ipopup', 'ipopcard');
         // name of the field to update with the name of the card
         $qc->set_attribute('label', 'an_label' . $i);
         // Type of card : all
         $qc->set_attribute('typecard', 'all');
         $qc->set_attribute('jrn', 0);
         $qc->extra = 'all';
         // when value selected in the autcomplete
         $qc->set_function('fill_data');
         if (isset($value[$i]["fi_card"])) {
             $f = new Fiche($this->cn, $value[$i]["fi_card"]);
             $qc->value = $f->strAttribut(ATTR_DEF_QUICKCODE);
         }
         $aCat[$i]['qc'] = $qc->search() . $qc->input();
         /* Label */
         $label = new IText('an_label' . $i);
         $label->value = isset($value[$i]["fi_text"]) ? $value[$i]["fi_text"] : "";
         $aCat[$i]['name'] = $label->input();
         //Deb or Cred
         $deb = new ISelect('an_deb' . $i);
         $deb->selected = isset($value[$i]["fi_debit"]) ? $value[$i]["fi_debit"] : -1;
         $deb->value = array(array('value' => 'D', 'label' => _('Débit')), array('value' => 'C', 'label' => _('Crédit')));
         $aCat[$i]['deb'] = $deb->input();
         //Periode
         $isPeriode = new ISelect('month' . $i);
         $isPeriode->value = $aPeriode;
         $isPeriode->selected = isset($value[$i]["fi_pid"]) ? $value[$i]["fi_pid"] : 0;
         $aCat[$i]['per'] = $isPeriode->input();
     }
     $add_row = new IButton('add_row');
     $add_row->label = _('Ajouter une ligne');
     $add_row->javascript = 'for_add_row(\'fortable\')';
     $f_add_row = $add_row->input();
     ob_start();
     require_once NOALYSS_INCLUDE . '/template/forecast-detail.php';
     $r .= ob_get_contents();
     ob_end_clean();
     return $r;
 }
예제 #13
0
 function Display($p_readonly)
 {
     $this->GetAttribut();
     $attr = $this->attribut;
     /* show card type here */
     $type_card = $this->cn->get_value('select fd_label ' . ' from fiche_def join fiche using (fd_id) where f_id=$1', array($this->id));
     $ret = "";
     $ret .= h2(_("Catégorie") . " " . $type_card, 'style="display:inline"');
     $ret .= '<span style="font-weight:bolder;margin-right:5px;float:right">' . _('id fiche') . ':' . $this->id . "</span>";
     $ret .= "<table style=\"width:98%;margin:1%\">";
     if (empty($attr)) {
         return 'FNT';
     }
     /* for each attribute */
     foreach ($attr as $r) {
         $msg = "";
         $bulle = "";
         if ($p_readonly) {
             $w = new IText();
             $w->table = 1;
             $w->readOnly = true;
             $w->css_size = "100%";
         }
         if ($p_readonly == false) {
             if ($r->ad_id == ATTR_DEF_ACCOUNT) {
                 $w = new IPoste("av_text" . $r->ad_id);
                 $w->set_attribute('ipopup', 'ipop_account');
                 $w->set_attribute('account', "av_text" . $r->ad_id);
                 $w->dbl_click_history();
                 //  account created automatically
                 $w->table = 0;
                 $w->value = $r->av_text;
                 //  account created automatically
                 $sql = "select account_auto({$this->fiche_def})";
                 $ret_sql = $this->cn->exec_sql($sql);
                 $a = Database::fetch_array($ret_sql, 0);
                 $bulle = HtmlInput::infobulle(10);
                 if ($a['account_auto'] == 't') {
                     $bulle .= HtmlInput::warnbulle(11);
                 }
             } elseif ($r->ad_id == ATTR_DEF_TVA) {
                 $w = new ITva_Popup('popup_tva');
                 $w->table = 1;
                 $w->value = $r->av_text;
             } else {
                 switch ($r->ad_type) {
                     case 'text':
                         $w = new IText('av_text' . $r->ad_id);
                         $w->css_size = "100%";
                         $w->value = $r->av_text;
                         break;
                     case 'numeric':
                         $w = new INum('av_text' . $r->ad_id);
                         $w->size = $r->ad_size;
                         $w->prec = $r->ad_extra == "" ? 2 : $r->ad_extra;
                         $w->value = $r->av_text;
                         break;
                     case 'date':
                         $w = new IDate('av_text' . $r->ad_id);
                         $w->value = $r->av_text;
                         break;
                     case 'zone':
                         $w = new ITextArea('av_text' . $r->ad_id);
                         $w->style = ' class="itextarea" style="margin:0px;width:100%"';
                         $w->value = $r->av_text;
                         break;
                     case 'poste':
                         $w = new IPoste("av_text" . $r->ad_id);
                         $w->set_attribute('ipopup', 'ipop_account');
                         $w->set_attribute('account', "av_text" . $r->ad_id);
                         $w->dbl_click_history();
                         $w->width = $r->ad_size;
                         $w->table = 0;
                         $bulle = HtmlInput::infobulle(14);
                         $w->value = $r->av_text;
                         break;
                     case 'card':
                         $uniq = rand(0, 1000);
                         $w = new ICard("av_text" . $r->ad_id);
                         $w->id = "card_" . $this->id . $uniq;
                         // filter on ad_extra
                         $filter = $r->ad_extra;
                         $w->width = $r->ad_size;
                         $w->extra = $filter;
                         $w->extra2 = 0;
                         $label = new ISpan();
                         $label->name = "av_text" . $uniq . $r->ad_id . "_label";
                         $fiche = new Fiche($this->cn);
                         $fiche->get_by_qcode($r->av_text);
                         if ($fiche->id == 0) {
                             $label->value = trim($r->av_text) == '' ? "" : " " . _("Fiche non trouvée") . " ";
                             $r->av_text = "";
                         } else {
                             $label->value = $fiche->strAttribut(ATTR_DEF_NAME) . " " . $fiche->strAttribut(ATTR_DEF_FIRST_NAME, 0);
                         }
                         $w->set_attribute('ipopup', 'ipopcard');
                         $w->set_attribute('typecard', $filter);
                         $w->set_attribute('inp', "av_text" . $r->ad_id);
                         $w->set_attribute('label', $label->name);
                         $w->autocomplete = 0;
                         $w->dblclick = "fill_ipopcard(this);";
                         $msg = $w->search();
                         $msg .= $label->input();
                         $w->value = $r->av_text;
                         break;
                     case 'select':
                         $w = new ISelect();
                         $w->value = $this->cn->make_array($r->ad_extra);
                         $w->selected = $r->av_text;
                         $w->style = ' style="width:100%" ';
                         break;
                     default:
                         var_dump($r);
                         throw new Exception("Type invalide");
                 }
                 $w->table = 0;
             }
         } else {
             switch ($r->ad_type) {
                 case 'select':
                     $x = new ISelect();
                     $x->value = $this->cn->make_array($r->ad_extra);
                     $x->selected = $r->av_text;
                     $value = $x->display();
                     $w->value = $value;
                     break;
                 default:
                     $w->value = $r->av_text;
             }
         }
         $w->name = "av_text" . $r->ad_id;
         $w->readOnly = $p_readonly;
         if ($r->ad_id == 21 || $r->ad_id == 22 || $r->ad_id == 20 || $r->ad_id == 31) {
             $bulle = HtmlInput::infobulle(21);
         }
         $ret .= "<TR>" . td(_($r->ad_text) . $bulle) . td($w->input() . " " . $msg) . " </TR>";
     }
     $ret .= "</table>";
     return $ret;
 }