Example #1
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>';
    }
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');
$w_poste->set_attribute('gDossier', dossier::id());
$w_poste->set_attribute('typecard', 'all');
$w_poste->set_function('fill_data');
$w_poste->set_dblclick("fill_ipopcard(this);");
$w_poste->value = isset($_REQUEST['f_id']) ? $_REQUEST['f_id'] : "";
print td($w_poste->input() . $w_poste->search());
echo td($span->input('f_id_label'));
print '</TR>';
print '<TR>';
$date_from = new IDate('from_periode');
Example #3
0
</td>
<td>
    <?php 
    echo $num_op->input();
    ?>
</td>
</tr>
<tr id="type_fin2">
<TD>
<?php 
    echo _('Compte en banque');
    ?>
</td>
<TD>
<?php 
    $card = new ICard();
    $card->name = 'bank';
    $card->extra = $cn->make_list('select fd_id from fiche_def where frd_id=4');
    $card->set_dblclick("fill_ipopcard(this);");
    $card->set_function('fill_data');
    $card->set_attribute('ipopup', 'ipop_card');
    $list = $cn->make_list('select fd_id from fiche_def where frd_id=4');
    $card->set_attribute('typecard', $list);
    $card->value = $qcode_bank;
    echo $card->search();
    echo $card->input();
    echo $str_add_button;
    ?>
</td>
<td class="notice">
<?php 
Example #4
0
 /**
  * @brief return a HTML string with the form for the search
  * @param $p_type if the type of ledger possible values=ALL,VEN,ACH,ODS,FIN
  * @param $all_type_ledger
  *       values :
  *         - 1 means all the ledger of this type
  *         - 0 No have the "Tous les journaux" availables
  * @param $div is the div (for reconciliation)
  * @return a HTML String without the tag FORM or DIV
  *
  * @see build_search_sql
  * @see display_search_form
  * @see list_operation
  */
 function search_form($p_type, $all_type_ledger = 1, $div = "")
 {
     global $g_user;
     $r = "";
     $bledger_param = json_encode(array('dossier' => $_REQUEST['gDossier'], 'type' => $p_type, 'all_type' => $all_type_ledger, 'div' => $div));
     $bledger_param = str_replace('"', "'", $bledger_param);
     $bledger = new ISmallButton('l');
     $bledger->label = _("choix des journaux");
     $bledger->javascript = " show_ledger_choice({$bledger_param})";
     $f_ledger = $bledger->input();
     $hid_jrn = "";
     if (isset($_REQUEST[$div . 'nb_jrn'])) {
         for ($i = 0; $i < $_REQUEST[$div . 'nb_jrn']; $i++) {
             if (isset($_REQUEST[$div . "r_jrn"][$i])) {
                 $hid_jrn .= HtmlInput::hidden($div . 'r_jrn[' . $i . ']', $_REQUEST[$div . "r_jrn"][$i]);
             }
         }
         $hid_jrn .= HtmlInput::hidden($div . 'nb_jrn', $_REQUEST[$div . 'nb_jrn']);
     } else {
         $hid_jrn = HtmlInput::hidden($div . 'nb_jrn', 0);
     }
     /* Compute date for exercice */
     $period = $g_user->get_periode();
     $per = new Periode($this->db, $period);
     $exercice = $per->get_exercice();
     list($per_start, $per_end) = $per->get_limit($exercice);
     $date_end = $per_end->last_day();
     $date_start = $per_start->first_day();
     /* widget for date_start */
     $f_date_start = new IDate('date_start');
     /* all periode or only the selected one */
     if (isset($_REQUEST['date_start'])) {
         $f_date_start->value = $_REQUEST['date_start'];
     } else {
         $f_date_start->value = $date_start;
     }
     /* widget for date_end */
     $f_date_end = new IDate('date_end');
     /* all date or only the selected one */
     if (isset($_REQUEST['date_end'])) {
         $f_date_end->value = $_REQUEST['date_end'];
     } else {
         $f_date_end->value = $date_end;
     }
     /* widget for date term */
     $f_date_paid_start = new IDate('date_paid_start');
     $f_date_paid_end = new IDate('date_paid_end');
     $f_date_paid_start->value = isset($_REQUEST['date_paid_start']) ? $_REQUEST['date_paid_start'] : '';
     $f_date_paid_end->value = isset($_REQUEST['date_paid_end']) ? $_REQUEST['date_paid_end'] : '';
     /* widget for desc */
     $f_descript = new IText('desc');
     $f_descript->size = 40;
     if (isset($_REQUEST['desc'])) {
         $f_descript->value = $_REQUEST['desc'];
     }
     /* widget for amount */
     $f_amount_min = new INum('amount_min');
     $f_amount_min->value = isset($_REQUEST['amount_min']) ? abs($_REQUEST['amount_min']) : 0;
     $f_amount_max = new INum('amount_max');
     $f_amount_max->value = isset($_REQUEST['amount_max']) ? abs($_REQUEST['amount_max']) : 0;
     /* input quick code */
     $f_qcode = new ICard('qcode' . $div);
     $f_qcode->set_attribute('typecard', 'all');
     /*        $f_qcode->set_attribute('p_jrn','0');
     
     		  $f_qcode->set_callback('filter_card');
     		 */
     $f_qcode->set_dblclick("fill_ipopcard(this);");
     // Add the callback function to filter the card on the jrn
     //$f_qcode->set_callback('filter_card');
     $f_qcode->set_function('fill_data');
     $f_qcode->javascript = sprintf(' onchange="fill_data_onchange(%s);" ', $f_qcode->name);
     $f_qcode->value = isset($_REQUEST['qcode' . $div]) ? $_REQUEST['qcode' . $div] : '';
     /*        $f_txt_qcode=new IText('qcode');
     		  $f_txt_qcode->value=(isset($_REQUEST['qcode']))?$_REQUEST['qcode']:'';
     		 */
     /* input poste comptable */
     $f_accounting = new IPoste('accounting');
     $f_accounting->value = isset($_REQUEST['accounting']) ? $_REQUEST['accounting'] : '';
     if ($this->id == -1) {
         $jrn = 0;
     } else {
         $jrn = $this->id;
     }
     $f_accounting->set_attribute('jrn', $jrn);
     $f_accounting->set_attribute('ipopup', 'ipop_account');
     $f_accounting->set_attribute('label', 'ld');
     $f_accounting->set_attribute('account', 'accounting');
     $info = HtmlInput::infobulle(13);
     $f_paid = new ICheckbox('unpaid');
     $f_paid->selected = isset($_REQUEST['unpaid']) ? true : false;
     $r .= dossier::hidden();
     $r .= HtmlInput::hidden('ledger_type', $this->type);
     $r .= HtmlInput::hidden('ac', $_REQUEST['ac']);
     ob_start();
     require_once NOALYSS_INCLUDE . '/template/ledger_search.php';
     $r .= ob_get_contents();
     ob_end_clean();
     return $r;
 }
Example #5
0
 function search_box($p_array)
 {
     // Declaration
     global $g_user;
     $wrepo = HtmlInput::select_stock($this->cn, "wrepo", 'R');
     $wrepo->value[] = array('value' => -1, 'label' => 'Tous les dépôts');
     $wdate_start = new IDate('wdate_start');
     $wdate_end = new IDate('wdate_end');
     $wamount_start = new INum('wamount_start');
     $wamount_end = new INum('wamount_end');
     $wcard = new ICard('wcard');
     $wcode_stock = new ICard('wcode_stock');
     $wdirection = new ISelect("wdirection");
     // value
     $wrepo->selected = HtmlInput::default_value("wrepo", -1, $p_array);
     // Date start / end
     $exercice = $g_user->get_exercice();
     $periode = new Periode($this->cn);
     list($periode_start, $periode_end) = $periode->get_limit($exercice);
     $wdate_start->value = HtmlInput::default_value("wdate_start", $periode_start->first_day(), $p_array);
     $wdate_end->value = HtmlInput::default_value("wdate_end", $periode_end->last_day(), $p_array);
     //amounts
     $wamount_start->value = HtmlInput::default_value("wamount_start", 0, $p_array);
     $wamount_end->value = HtmlInput::default_value("wamount_end", 0, $p_array);
     //Card
     $wcard->extra = "all";
     $wcard->set_attribute("typecard", "all");
     $wcard->value = HtmlInput::default_value("wcard", "", $p_array);
     //Card stock
     $wcode_stock->extra = " [sql] fd_id=500000 ";
     $wcode_stock->set_attribute("typecard", "[sql] fd_id=500000");
     $wcode_stock->value = HtmlInput::default_value("wcard", "", $p_array);
     // Repository
     $wcode_stock->value = HtmlInput::default_value("wcode_stock", "", $p_array);
     //Direction
     $wdirection->value = array(array('value' => "-1", 'label' => "Tout"), array('value' => "c", 'label' => "OUT"), array('value' => "d", 'label' => "IN"));
     $wdirection->selected = HtmlInput::default_value("wdirection", "-1", $p_array);
     require_once NOALYSS_INCLUDE . '/template/stock_histo_search.php';
 }
Example #6
0
 function display($p_array)
 {
     require_once NOALYSS_INCLUDE . '/class_acc_ledger_purchase.php';
     global $g_parameter, $g_user;
     extract($p_array);
     $ledger = new Acc_Ledger_Purchase($this->db, $this->jrn_def_id);
     if ($p_array != null) {
         extract($p_array);
     }
     $flag_tva = $g_parameter->MY_TVA_USE;
     /* Add button */
     $f_add_button = new IButton('add_card');
     $f_add_button->label = _('Créer une nouvelle fiche');
     $f_add_button->tabindex = -1;
     $f_add_button->set_attribute('ipopup', 'ipop_newcard');
     $f_add_button->set_attribute('jrn', $this->jrn_def_id);
     $f_add_button->javascript = " this.jrn=\$('p_jrn').value;select_card_type(this);";
     $f_add_button2 = new IButton('add_card2');
     $f_add_button2->tabindex = -1;
     $f_add_button2->label = _('Créer une nouvelle fiche');
     $f_add_button2->set_attribute('ipopup', 'ipop_newcard');
     $f_add_button2->set_attribute('filter', $ledger->get_all_fiche_def());
     //    $f_add_button2->set_attribute('jrn',$ledger->id);
     $f_add_button2->javascript = "  this.jrn=\$('p_jrn').value;select_card_type(this);";
     $str_add_button = "";
     $str_add_button2 = "";
     if ($g_user->check_action(FICADD) == 1) {
         $str_add_button = $f_add_button->input();
         $str_add_button2 = $f_add_button2->input();
     }
     $r = "";
     $r .= dossier::hidden();
     $f_legend = _("En-tête facture fournisseur");
     $f_legend_detail = _("Détail articles acheté");
     // Ledger (p_jrn)
     //--
     /* if we suggest the next pj, then we need a javascript */
     $add_js = "";
     // Display the customer
     //--
     $fiche = 'cred';
     // Save old value and set a new one
     //--
     $e_client = isset($e_client) ? $e_client : "";
     $e_client_label = "&nbsp;";
     //str_pad("",100,".");
     // retrieve e_client_label
     //--
     if (strlen(trim($e_client)) != 0) {
         $fClient = new Fiche($ledger->db);
         $fClient->get_by_qcode($e_client);
         $e_client_label = $fClient->strAttribut(ATTR_DEF_NAME) . ' ' . ' Adresse : ' . $fClient->strAttribut(ATTR_DEF_ADRESS) . ' ' . $fClient->strAttribut(ATTR_DEF_CP) . ' ' . $fClient->strAttribut(ATTR_DEF_CITY) . ' ';
     }
     $W1 = new ICard();
     $W1->label = _("Fournisseur ") . HtmlInput::infobulle(0);
     $W1->name = "e_client";
     $W1->tabindex = 3;
     $W1->value = $e_client;
     $W1->table = 0;
     $W1->set_dblclick("fill_ipopcard(this);");
     $W1->set_attribute('ipopup', 'ipopcard');
     // name of the field to update with the name of the card
     $W1->set_attribute('label', 'e_client_label');
     // name of the field to update with the name of the card
     $W1->set_attribute('typecard', 'cred');
     // Add the callback function to filter the card on the jrn
     $W1->set_callback('filter_card');
     $W1->set_function('fill_data');
     $W1->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $W1->name);
     $f_client_qcode = $W1->input();
     $client_label = new ISpan();
     $client_label->table = 0;
     $f_client = $client_label->input("e_client_label", $e_client_label);
     $f_client_bt = $W1->search();
     // Record the current number of article
     $min = $ledger->get_min_row();
     $p_article = isset($nb_item) ? $nb_item : $min;
     $max = $p_article < $min ? $min : $p_article;
     $e_comment = isset($e_comment) ? $e_comment : "";
     $Hid = new IHidden();
     $r .= $Hid->input("nb_item", $p_article);
     // For each article
     //--
     for ($i = 0; $i < $max; $i++) {
         // Code id, price & vat code
         //--
         $march = isset(${"e_march{$i}"}) ? ${"e_march{$i}"} : "";
         $march_price = isset(${"e_march" . $i . "_price"}) ? ${"e_march" . $i . "_price"} : "";
         /* use vat */
         if ($g_parameter->MY_TVA_USE == 'Y') {
             $march_tva_id = isset(${"e_march{$i}" . "_tva_id"}) ? ${"e_march{$i}" . "_tva_id"} : "";
             $march_tva_amount = isset(${"e_march{$i}" . "_tva_amount"}) ? ${"e_march{$i}" . "_tva_amount"} : "";
         }
         $march_label = isset(${"e_march" . $i . "_label"}) ? ${"e_march" . $i . "_label"} : "";
         // retrieve the tva label and name
         //--
         if (strlen(trim($march)) != 0 && strlen(trim($march_label)) == 0) {
             $fMarch = new Fiche($ledger->db);
             $fMarch->get_by_qcode($march);
             $march_label = $fMarch->strAttribut(ATTR_DEF_NAME);
             /* vat use */
             if (!isset($march_tva_id) && $g_parameter->MY_TVA_USE == 'Y') {
                 $march_tva_id = $fMarch->strAttribut(ATTR_DEF_TVA);
             }
         }
         // Show input
         //--
         $W1 = new ICard();
         $W1->label = "";
         $W1->name = "e_march" . $i;
         $W1->value = $march;
         $W1->table = 1;
         $W1->set_dblclick("fill_ipopcard(this);");
         $W1->set_attribute('ipopup', 'ipopcard');
         $W1->set_attribute('typecard', 'deb');
         // name of the field to update with the name of the card
         $W1->set_attribute('label', 'e_march' . $i . '_label');
         // name of the field with the price
         $W1->set_attribute('purchase', 'e_march' . $i . '_price');
         /* autocomplete */
         $W1->set_attribute('price', 'e_march' . $i . '_price');
         /* via search */
         // name of the field with the TVA_ID
         $W1->set_attribute('tvaid', 'e_march' . $i . '_tva_id');
         // Add the callback function to filter the card on the jrn
         $W1->set_callback('filter_card');
         $W1->set_function('fill_data');
         $W1->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $W1->name);
         $W1->readonly = false;
         $array[$i]['quick_code'] = $W1->input();
         $array[$i]['bt'] = $W1->search();
         $array[$i]['hidden'] = '';
         // For computing we need some hidden field for holding the value
         if ($g_parameter->MY_TVA_USE == 'Y') {
             $array[$i]['hidden'] .= HtmlInput::hidden('tva_march' . $i, 0);
         }
         if ($g_parameter->MY_TVA_USE == 'Y') {
             $tvac = new INum('tvac_march' . $i);
         } else {
             $tvac = new IHidden('tvac_march' . $i);
         }
         $tvac->readOnly = 1;
         $tvac->value = 0;
         $array[$i]['tvac'] = $tvac->input();
         $htva = new INum('htva_march' . $i);
         $htva->readOnly = 1;
         $htva->value = 0;
         $array[$i]['htva'] = $htva->input();
         if ($g_parameter->MY_UPDLAB == 'Y') {
             $Span = new IText("e_march" . $i . "_label");
             $Span->css_size = "100%";
         } else {
             $Span = new ISpan("e_march" . $i . "_label");
         }
         $Span->value = $march_label;
         $Span->setReadOnly(false);
         // card's name, price
         //--
         $array[$i]['denom'] = $Span->input("e_march" . $i . "_label", $march_label);
         // price
         $Price = new INum();
         $Price->setReadOnly(false);
         $Price->size = 9;
         $Price->javascript = "onBlur='format_number(this);clean_tva({$i});compute_ledger({$i})'";
         $array[$i]['pu'] = $Price->input("e_march" . $i . "_price", $march_price);
         if ($g_parameter->MY_TVA_USE == 'Y') {
             // vat label
             //--
             $Tva = new ITva_Popup($ledger->db);
             $Tva->js = "onblur=\"format_number(this);onChange=clean_tva({$i});compute_ledger({$i})\"";
             $Tva->in_table = true;
             $Tva->set_attribute('compute', $i);
             $Tva->value = $march_tva_id;
             $array[$i]['tva'] = $Tva->input("e_march{$i}" . "_tva_id");
             // Tva_amount
             // price
             $Tva_amount = new INum();
             $Tva_amount->setReadOnly(false);
             $Tva_amount->size = 9;
             $Tva_amount->javascript = "onBlur='format_number(this);compute_ledger({$i})'";
             $array[$i]['amount_tva'] = $Tva_amount->input("e_march" . $i . "_tva_amount", $march_tva_amount);
         }
         // quantity
         //--
         $quant = isset(${"e_quant{$i}"}) ? ${"e_quant{$i}"} : "1";
         $Quantity = new INum();
         $Quantity->setReadOnly(false);
         $Quantity->size = 9;
         $Quantity->javascript = "onChange=format_number(this);clean_tva({$i});compute_ledger({$i})";
         $array[$i]['quantity'] = $Quantity->input("e_quant" . $i, $quant);
     }
     $f_type = _('Fournisseur');
     ob_start();
     require_once NOALYSS_INCLUDE . '/template/predf_ledger_detail.php';
     $r .= ob_get_contents();
     ob_end_clean();
     // Set correctly the REQUEST param for jrn_type
     $r .= HtmlInput::hidden('jrn_type', 'ACH');
     $r .= HtmlInput::button('add_item', _('Ajout article'), ' onClick="ledger_add_row()"');
     return $r;
 }
 /**
  *@brief return an html with a form to add a new middle of payment
  */
 public function blank()
 {
     //label
     $lib = new IText('mp_lib');
     $f_lib = $lib->input();
     $ledger_source = new ISelect('jrn_def_id');
     $ledger_source->value = $this->cn->make_array("select jrn_def_id,jrn_Def_name from\n                              jrn_def where jrn_def_type  in ('ACH','VEN') order by jrn_def_name");
     $f_source = $ledger_source->input();
     // type of card
     $tcard = new ISelect('mp_fd_id');
     $tcard->value = $this->cn->make_array('select fd_id,fd_label from fiche_def join fiche_def_ref ' . ' using (frd_id) where frd_id in (25,4) order by fd_label');
     $f_type_fiche = $tcard->input();
     $ledger_record = new ISelect('mp_jrn_def_id');
     $ledger_record->value = $this->cn->make_array("select jrn_def_id,jrn_Def_name from\n                              jrn_def where jrn_def_type  in ('ODS','FIN')");
     $f_ledger_record = $ledger_record->input();
     // the card
     $qcode = new ICard();
     $qcode->noadd = true;
     $qcode->name = 'mp_qcode';
     $list = $this->cn->make_list('select fd_id from fiche_def where frd_id in (25,4)');
     $qcode->typecard = $list;
     $qcode->dblclick = 'fill_ipopcard(this);';
     $f_qcode = $qcode->input();
     $msg = "Ajout d'un nouveau moyen de paiement";
     ob_start();
     require_once NOALYSS_INCLUDE . '/template/new_mod_payment.php';
     $r = ob_get_contents();
     ob_end_clean();
     return $r;
 }
 /**
  *@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;
 }
 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;
 }
$summary = new ITextarea('summary');
$summary->style .= 'class="itextarea" style="padding:0px;margin:0px"';
// Type of document / event
$type = new ISelect("type_event");
$type->name = "type_event";
$type->value = $cn->make_array("select dt_id,dt_value from document_type order by dt_value", 1);
$type->selected = 0;
// Available for the profile
$profile = new ISelect('event_group');
$profile->value = $cn->make_array("select  p_id as value, " . "p_name as label " . " from profile  " . "where " . "p_id in " . " (select p_granted " . "     from user_sec_action_profile " . "     where ua_right='W' and p_id=" . $g_user->get_profile() . ") " . "order by 2");
// priority
$priority = new ISelect('event_priority');
$priority->value = array(array('value' => 1, 'label' => _('Haute')), array('value' => 2, 'label' => _('Moyenne')), array('value' => 3, 'label' => _('Basse')));
$priority->selected = 2;
// Card
$dest = new ICard('dest');
$dest->jrn = 0;
$dest->name = 'dest';
$dest->value = "";
$dest->label = "";
$list_recipient = $cn->make_list('select fd_id from fiche_def where frd_id in (14,25,8,9,16)');
$dest->extra = $list_recipient;
$dest->set_attribute('typecard', $list_recipient);
$dest->set_dblclick("fill_ipopcard(this);");
$dest->set_attribute('ipopup', 'ipopcard');
$dest->style = ' style="vertical-align:0%"';
echo HtmlInput::title_box(_('Nouvel événement'), 'action_add_div');
?>
<span class="notice" style="float:right" id="action_add_frm_info"></span>
<form method="get" id="action_add_frm" onsubmit="action_save_short(<?php 
echo Dossier::id();
Example #11
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;
 }
Example #12
0
 /**
  * Display only a search box for searching an action
  * @param $cn database connx
  */
 static function display_search($cn, $inner = false)
 {
     $a = isset($_GET['action_query']) ? $_GET['action_query'] : "";
     $qcode = isset($_GET['qcode']) ? $_GET['qcode'] : "";
     $supl_hidden = '';
     if (isset($_REQUEST['sc'])) {
         $supl_hidden .= HtmlInput::hidden('sc', $_REQUEST['sc']);
     }
     if (isset($_REQUEST['f_id'])) {
         $supl_hidden .= HtmlInput::hidden('f_id', $_REQUEST['f_id']);
         $f = new Fiche($cn, $_REQUEST['f_id']);
         $supl_hidden .= HtmlInput::hidden('qcode_dest', $f->get_quick_code());
     }
     if (isset($_REQUEST['sb'])) {
         $supl_hidden .= HtmlInput::hidden('sb', $_REQUEST['sb']);
     }
     $supl_hidden .= HtmlInput::hidden('ac', $_REQUEST['ac']);
     /**
      * Show the default button (add action, show search...)
      */
     if (!$inner) {
         require_once NOALYSS_INCLUDE . '/template/action_button.php';
     }
     $w = new ICard();
     $w->name = 'qcode';
     $w->id = $w->generate_id($w->name);
     $w->value = $qcode;
     $w->extra = "all";
     $w->typecard = 'all';
     $w->jrn = 0;
     $w->table = 0;
     $list = $cn->make_list("select fd_id from fiche_def where frd_id in (4,8,9,14,15,16,25)");
     $w->extra = $list;
     /* type of documents */
     $type_doc = new ISelect('tdoc');
     $aTDoc = $cn->make_array('select dt_id,dt_value from document_type order by dt_value');
     $aTDoc[] = array('value' => '-1', 'label' => _('Tous les types'));
     $type_doc->value = $aTDoc;
     $type_doc->selected = isset($_GET['tdoc']) ? $_GET['tdoc'] : -1;
     /* State of documents */
     $type_state = new ISelect('state');
     $aState = $cn->make_array('select s_id,s_value from document_state order by s_value');
     $aState[] = array('value' => '-1', 'label' => _('Tous les Etats'));
     $type_state->value = $aState;
     $type_state->selected = isset($_GET['state']) ? $_GET['state'] : -1;
     /* Except State of documents */
     $hsExcptype_state = new ISelect('hsstate');
     $aExcpState = $cn->make_array('select s_id,s_value from document_state order by s_value');
     $aExcpState[] = array('value' => '-1', 'label' => _('Aucun'));
     $hsExcptype_state->value = $aExcpState;
     $hsExcptype_state->selected = isset($_GET['hsstate']) ? $_GET['hsstate'] : -1;
     // date
     $start = new IDate('date_start');
     $start->value = isset($_GET['date_start']) ? $_GET['date_start'] : "";
     $end = new IDate('date_end');
     $end->value = isset($_GET['date_end']) ? $_GET['date_end'] : "";
     // Closed action
     $closed_action = new ICheckBox('closed_action');
     $closed_action->selected = isset($_GET['closed_action']) ? true : false;
     // Internal
     $only_internal = new ICheckBox('only_internal');
     $only_internal->selected = isset($_GET['only_internal']) ? true : false;
     // select profile
     $aAg_dest = $cn->make_array("select  p_id as value, " . "p_name as label " . " from profile order by 2");
     $aAg_dest[] = array('value' => '-2', 'label' => _('Tous les profiles'));
     $ag_dest = new ISelect();
     $ag_dest->name = "ag_dest_query";
     $ag_dest->value = $aAg_dest;
     $ag_dest->selected = isset($_GET["ag_dest_query"]) ? $_GET["ag_dest_query"] : -2;
     $str_ag_dest = $ag_dest->input();
     $osag_ref = new IText("sag_ref");
     $osag_ref->value = isset($_GET['sag_ref']) ? $_GET['sag_ref'] : "";
     $remind_date = new IDate('remind_date');
     $remind_date->value = isset($_GET['remind_date']) ? $_GET['remind_date'] : "";
     $remind_date_end = new IDate('remind_date_end');
     $remind_date_end->value = isset($_GET['remind_date_end']) ? $_GET['remind_date_end'] : "";
     $otag = new Tag($cn);
     // show the  action in
     require_once NOALYSS_INCLUDE . '/template/action_search.php';
 }
 * \brief show the lettering by account
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
require_once NOALYSS_INCLUDE . '/class_ipopup.php';
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', 'qc');
echo HtmlInput::hidden('p_jrn', '0');
echo '<table width="50%">';
$poste = new ICard('acc');
$poste->name = "acc";
$poste->extra = "all";
$poste->set_attribute('popup', 'ipopcard');
$poste->set_attribute('typecard', 'all');
$poste->set_callback('filter_card');
if (isset($_GET['acc'])) {
    $poste->value = strtoupper(trim($_GET['acc']));
}
$poste_span = new ISpan('account_label');
$r = td(_('Lettrage pour la fiche ')) . td($poste->input() . $poste->search()) . td($poste_span->input());
echo tr($r);
// limit of the year
$exercice = $g_user->get_exercice();
$periode = new Periode($cn);
list($first_per, $last_per) = $periode->get_limit($exercice);
 function input($p_array = null, $p_readonly = 0)
 {
     global $g_parameter, $g_user;
     if ($p_array != null) {
         extract($p_array);
     }
     $flag_tva = $g_parameter->MY_TVA_USE;
     /* Add button */
     $f_add_button = new IButton('add_card');
     $f_add_button->tabindex = -1;
     $f_add_button->label = _('Créer une nouvelle fiche');
     $f_add_button->set_attribute('ipopup', 'ipop_newcard');
     $f_add_button->set_attribute('jrn', $this->id);
     $f_add_button->javascript = "this.jrn=\$('p_jrn').value; select_card_type(this);";
     $f_add_button2 = new IButton('add_card2');
     $f_add_button2->tabindex = -1;
     $f_add_button2->label = _('Créer une nouvelle fiche');
     $f_add_button2->set_attribute('ipopup', 'ipop_newcard');
     $f_add_button2->set_attribute('filter', $this->get_all_fiche_def());
     //    $f_add_button2->set_attribute('jrn',$this->id);
     $f_add_button2->javascript = " this.jrn=\$('p_jrn').value;select_card_type(this);";
     $str_add_button = "";
     $str_add_button2 = "";
     if ($g_user->check_action(FICADD) == 1) {
         $str_add_button = $f_add_button->input();
         $str_add_button2 = $f_add_button2->input();
     }
     // The first day of the periode
     $oPeriode = new Periode($this->db);
     list($l_date_start, $l_date_end) = $oPeriode->get_date_limit($g_user->get_periode());
     if ($g_parameter->MY_DATE_SUGGEST == 'Y') {
         $op_date = !isset($e_date) ? $l_date_start : $e_date;
     } else {
         $op_date = !isset($e_date) ? '' : $e_date;
     }
     $e_ech = isset($e_ech) ? $e_ech : "";
     $e_comm = isset($e_comm) ? $e_comm : "";
     $r = '';
     $r .= dossier::hidden();
     $f_legend = _('Client');
     $Echeance = new IDate();
     $Echeance->setReadOnly(false);
     $Echeance->tabindex = 2;
     $label = HtmlInput::infobulle(4);
     $f_echeance = $Echeance->input('e_ech', $e_ech, _('Echéance') . $label);
     $Date = new IDate();
     $Date->setReadOnly(false);
     $f_date = $Date->input("e_date", $op_date);
     $f_periode = '';
     // Periode
     //--
     if ($this->check_periode() == true) {
         $l_user_per = $g_user->get_periode();
         $def = isset($periode) ? $periode : $l_user_per;
         $period = new IPeriod("period");
         $period->user = $g_user;
         $period->cn = $this->db;
         $period->value = $def;
         $period->type = OPEN;
         try {
             $l_form_per = $period->input();
         } catch (Exception $e) {
             if ($e->getCode() == 1) {
                 throw new Exception(_("Aucune période ouverte"));
             }
         }
         $label = HtmlInput::infobulle(3);
         $f_periode = '<td>' . _("Période comptable") . "</td> <td> {$label} " . $l_form_per . '</td>';
     }
     /* if we suggest the next pj, then we need a javascript */
     $add_js = "";
     if ($g_parameter->MY_PJ_SUGGEST == 'Y') {
         $add_js = "update_pj();";
     }
     if ($g_parameter->MY_DATE_SUGGEST == 'Y') {
         $add_js .= 'get_last_date();';
     }
     $add_js .= 'update_name();';
     $add_js .= 'update_pay_method();';
     $add_js .= 'update_row("sold_item");';
     $wLedger = $this->select_ledger('VEN', 2);
     if ($wLedger == null) {
         throw new Exception(_('Pas de journal disponible'));
     }
     $wLedger->table = 1;
     $wLedger->javascript = "onChange='update_predef(\"ven\",\"f\",\"" . $_REQUEST['ac'] . "\");{$add_js}'";
     $wLedger->label = " Journal " . HtmlInput::infobulle(2);
     $f_jrn = $wLedger->input();
     $Commentaire = new IText();
     $Commentaire->table = 0;
     $Commentaire->setReadOnly(false);
     $Commentaire->size = 60;
     $Commentaire->tabindex = 3;
     $label = HtmlInput::infobulle(1);
     $f_desc = $Commentaire->input("e_comm", h($e_comm));
     // PJ
     //--
     /* suggest PJ ? */
     $default_pj = '';
     if ($g_parameter->MY_PJ_SUGGEST == 'Y') {
         $default_pj = $this->guess_pj();
     }
     $pj = new IText();
     $pj->table = 0;
     $pj->name = "e_pj";
     $pj->size = 10;
     $pj->value = isset($e_pj) ? $e_pj : $default_pj;
     $f_pj = $pj->input() . HtmlInput::hidden('e_pj_suggest', $default_pj);
     // Display the customer
     //--
     $fiche = 'deb';
     // Save old value and set a new one
     //--
     $e_client = isset($e_client) ? $e_client : "";
     $e_client_label = "&nbsp;";
     //str_pad("",100,".");
     // retrieve e_client_label
     //--
     if (strlen(trim($e_client)) != 0) {
         $fClient = new Fiche($this->db);
         $fClient->get_by_qcode($e_client);
         $e_client_label = $fClient->strAttribut(ATTR_DEF_NAME) . ' ' . ' Adresse : ' . $fClient->strAttribut(ATTR_DEF_ADRESS) . ' ' . $fClient->strAttribut(ATTR_DEF_CP) . ' ' . $fClient->strAttribut(ATTR_DEF_CITY) . ' ';
     }
     $W1 = new ICard();
     $W1->label = "Client " . HtmlInput::infobulle(0);
     $W1->name = "e_client";
     $W1->tabindex = 3;
     $W1->value = $e_client;
     $W1->table = 0;
     $W1->set_dblclick("fill_ipopcard(this);");
     $W1->set_attribute('ipopup', 'ipopcard');
     // name of the field to update with the name of the card
     $W1->set_attribute('label', 'e_client_label');
     // name of the field to update with the name of the card
     $W1->set_attribute('typecard', 'deb');
     // Add the callback function to filter the card on the jrn
     $W1->set_callback('filter_card');
     $W1->set_function('fill_data');
     $W1->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $W1->name);
     $f_client_qcode = $W1->input();
     $client_label = new ISpan();
     $client_label->table = 0;
     $f_client = $client_label->input("e_client_label", $e_client_label);
     $f_client_bt = $W1->search();
     // Record the current number of article
     $Hid = new IHidden();
     $p_article = isset($nb_item) ? $nb_item : $this->get_min_row();
     $r .= $Hid->input("nb_item", $p_article);
     $max = $p_article < $this->get_min_row() ? $this->get_min_row() : $p_article;
     $f_legend_detail = _("Détail articles vendus");
     // For each article
     //--
     for ($i = 0; $i < $max; $i++) {
         // Code id, price & vat code
         //--
         $march = isset(${"e_march{$i}"}) ? ${"e_march{$i}"} : "";
         $march_price = isset(${"e_march" . $i . "_price"}) ? ${"e_march" . $i . "_price"} : "";
         if ($flag_tva == 'Y') {
             $march_tva_id = isset(${"e_march{$i}" . "_tva_id"}) ? ${"e_march{$i}" . "_tva_id"} : "";
             $march_tva_amount = isset(${"e_march{$i}" . "_tva_amount"}) ? ${"e_march{$i}" . "_tva_amount"} : "";
         }
         $march_label = isset(${"e_march" . $i . "_label"}) ? ${"e_march" . $i . "_label"} : "";
         // retrieve the tva label and name
         //--
         if (strlen(trim($march)) != 0 && strlen(trim($march_label)) == 0) {
             $fMarch = new Fiche($this->db);
             $fMarch->get_by_qcode($march);
             $march_label = $fMarch->strAttribut(ATTR_DEF_NAME);
             if ($flag_tva == 'Y') {
                 if (!isset(${"e_march{$i}" . "_tva_id"})) {
                     $march_tva_id = $fMarch->strAttribut(ATTR_DEF_TVA);
                 }
             }
         }
         // Show input
         //--
         $W1 = new ICard();
         $W1->label = "";
         $W1->name = "e_march" . $i;
         $W1->value = $march;
         $W1->table = 1;
         $W1->set_attribute('typecard', 'cred');
         $W1->set_dblclick("fill_ipopcard(this);");
         $W1->set_attribute('ipopup', 'ipopcard');
         // name of the field to update with the name of the card
         $W1->set_attribute('label', 'e_march' . $i . '_label');
         // name of the field with the price
         $W1->set_attribute('price', 'e_march' . $i . '_price');
         // name of the field with the TVA_ID
         $W1->set_attribute('tvaid', 'e_march' . $i . '_tva_id');
         // Add the callback function to filter the card on the jrn
         $W1->set_callback('filter_card');
         $W1->set_function('fill_data');
         $W1->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $W1->name);
         $W1->readonly = false;
         $array[$i]['quick_code'] = $W1->input();
         $array[$i]['bt'] = $W1->search();
         // For computing we need some hidden field for holding the value
         $array[$i]['hidden'] = '';
         if ($flag_tva == 'Y') {
             $array[$i]['hidden'] .= HtmlInput::hidden('tva_march' . $i, 0);
         }
         $htva = new INum('htva_march' . $i);
         $htva->readOnly = 1;
         $htva->value = 0;
         $array[$i]['htva'] = $htva->input();
         if ($g_parameter->MY_TVA_USE == 'Y') {
             $tvac = new INum('tvac_march' . $i);
         } else {
             $tvac = new IHidden('tvac_march' . $i);
         }
         $tvac->readOnly = 1;
         $tvac->value = 0;
         $array[$i]['tvac'] = $tvac->input();
         if ($g_parameter->MY_UPDLAB == 'Y') {
             $Span = new IText("e_march" . $i . "_label");
             $Span->css_size = "100%";
         } else {
             $Span = new ISpan("e_march" . $i . "_label");
         }
         $Span->value = $march_label;
         $Span->setReadOnly(false);
         // card's name, price
         //--
         $array[$i]['denom'] = $Span->input("e_march" . $i . "_label", $march_label);
         // price
         $Price = new INum();
         $Price->setReadOnly(false);
         $Price->size = 9;
         $Price->javascript = "onBlur='format_number(this);clean_tva({$i});compute_ledger({$i})'";
         $array[$i]['pu'] = $Price->input("e_march" . $i . "_price", $march_price);
         $array[$i]['tva'] = '';
         $array[$i]['amount_tva'] = '';
         // if tva is not needed then no tva field
         if ($flag_tva == 'Y') {
             // vat label
             //--
             $Tva = new ITva_Popup($this->db);
             $Tva->in_table = true;
             $Tva->set_attribute('compute', $i);
             $Tva->js = 'onblur="format_number(this);clean_tva(' . $i . ');compute_ledger(' . $i . ')"';
             $Tva->value = $march_tva_id;
             $array[$i]['tva'] = $Tva->input("e_march{$i}" . "_tva_id");
             // vat amount
             //--
             $wTva_amount = new INum();
             $wTva_amount->readOnly = false;
             $wTva_amount->size = 6;
             $wTva_amount->javascript = "onBlur='format_number(this);compute_ledger({$i})'";
             $array[$i]['amount_tva'] = $wTva_amount->input("e_march" . $i . "_tva_amount", $march_tva_amount);
         }
         // quantity
         //--
         $quant = isset(${"e_quant{$i}"}) ? ${"e_quant{$i}"} : "1";
         $Quantity = new INum();
         $Quantity->setReadOnly(false);
         $Quantity->size = 8;
         $Quantity->javascript = "onChange='format_number(this);clean_tva({$i});compute_ledger({$i})'";
         $array[$i]['quantity'] = $Quantity->input("e_quant" . $i, $quant);
     }
     // foreach article
     $f_type = _('Client');
     ob_start();
     require_once NOALYSS_INCLUDE . '/template/form_ledger_detail.php';
     $r .= ob_get_contents();
     ob_end_clean();
     // Set correctly the REQUEST param for jrn_type
     $r .= HtmlInput::hidden('jrn_type', 'VEN');
     $r .= HtmlInput::button('add_item', _('Ajout article'), ' onClick="ledger_add_row()"');
     $r .= create_script("\$('" . $Date->id . "').focus()");
     return $r;
 }
 function show_ledger()
 {
     global $g_user;
     echo dossier::hidden();
     $hid = new IHidden();
     $hid->name = "p_action";
     $hid->value = "bank";
     echo $hid->input();
     $hid->name = "sa";
     $hid->value = "l";
     echo $hid->input();
     $w = new ISelect();
     // filter on the current year
     $filter_year = " where p_exercice='" . $g_user->get_exercice() . "'";
     $periode_start = $this->db->make_array("select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode {$filter_year} order by p_start,p_end", 1);
     // User is already set User=new User($this->db);
     $current = isset($_GET['p_periode']) ? $_GET['p_periode'] : -1;
     $w->selected = $current;
     echo '<form>';
     echo 'Période  ' . $w->input("p_periode", $periode_start);
     $wLedger = $this->select_ledger('fin', 3);
     if ($wLedger == null) {
         throw new Exception(_('Pas de journal disponible'));
     }
     if (count($wLedger->value) > 1) {
         $aValue = $wLedger->value;
         $wLedger->value[0] = array('value' => -1, 'label' => _('Tous les journaux financiers'));
         $idx = 1;
         foreach ($aValue as $a) {
             $wLedger->value[$idx] = $a;
             $idx++;
         }
     }
     echo 'Journal ' . $wLedger->input();
     $w = new ICard();
     $w->noadd = 'no';
     $w->jrn = $this->id;
     $qcode = isset($_GET['qcode']) ? $_GET['qcode'] : "";
     echo dossier::hidden();
     echo HtmlInput::hidden('p_action', 'bank');
     echo HtmlInput::hidden('sa', 'l');
     $w->name = 'qcode';
     $w->value = $qcode;
     $w->label = '';
     $this->type = 'FIN';
     $all = $this->get_all_fiche_def();
     $w->extra = $all;
     $w->extra2 = 'QuickCode';
     $sp = new ISpan();
     echo $sp->input("qcode_label", "", $qcode);
     echo $w->input();
     echo HtmlInput::submit('gl_submit', _('Rechercher'));
     echo '</form>';
     // Show list of sell
     // Date - date of payment - Customer - amount
     if ($current != -1) {
         $filter_per = " and jr_tech_per=" . $current;
     } else {
         $filter_per = " and jr_tech_per in (select p_id from parm_periode where p_exercice::integer=" . $g_user->get_exercice() . ")";
     }
     /* security  */
     if ($this->id != -1) {
         $available_ledger = " and jr_def_id= " . $this->id . " and " . $g_user->get_ledger_sql();
     } else {
         $available_ledger = " and " . $g_user->get_ledger_sql();
     }
     // Show list of sell
     // Date - date of payment - Customer - amount
     $sql = SQL_LIST_ALL_INVOICE . $filter_per . " and jr_def_type='FIN'" . " {$available_ledger}";
     $step = $_SESSION['g_pagesize'];
     $page = isset($_GET['offset']) ? $_GET['page'] : 1;
     $offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
     $l = "";
     // check if qcode contains something
     if ($qcode != "") {
         // add a condition to filter on the quick code
         $l = " and jr_grpt_id in (select j_grpt from jrnx where j_qcode=upper('{$qcode}')) ";
     }
     list($max_line, $list) = ListJrn($this->db, "where jrn_def_type='FIN' {$filter_per} {$l} {$available_ledger} ", null, $offset, 0);
     $bar = navigation_bar($offset, $max_line, $step, $page);
     echo "<hr> {$bar}";
     echo $list;
     echo "{$bar} <hr>";
 }
Example #16
0
    public static function test_me()
    {
        require_once NOALYSS_INCLUDE . '/class_itext.php';
        $_SESSION['isValid'] = 1;
        $a = new ICard('testme');
        $a->extra = "all";
        $a->set_attribute('label', 'ctl_label');
        $a->set_attribute('tvaid', 'ctl_tvaid');
        $a->set_attribute('price', 'ctl_price');
        $a->set_attribute('purchase', 'ctl_purchase');
        $a->set_attribute('type', 'all');
        echo <<<EOF
\t  <div id="debug" style="border:solid 1px black;overflow:auto"></div>
\t  <script type="text/javascript" language="javascript"  src="js/prototype.js">
\t  </script>
\t  <script type="text/javascript" language="javascript"  src="js/scriptaculous.js">
\t  </script>
\t  <script type="text/javascript" language="javascript"  src="js/effects.js">
\t  </script>
\t  <script type="text/javascript" language="javascript"  src="js/controls.js">
\t  </script>
\t  <script type="text/javascript" language="javascript"  src="js/ajax_fid.js">
\t  </script>
\t  <script type="text/javascript" language="javascript"  >
\t  function test_value(text,li)
\t  {
\t    alert("premier"+li.id);

\t    str="";
\t    str=text.id+'<hr>';
\t    if ( text.js_attr1)
\t      {
\t\tstr+=text.js_attr1;
\t\tstr+='<hr>';
\t      }
\t    if ( text.js_attr2)
\t      {
\t\tstr+=text.js_attr2;
\t\tstr+='<hr>';
\t      }
\t    if ( text.js_attr3)
\t      {
\t\tstr+=text.js_attr3;
\t\tstr+='<hr>';
\t      }
\t    for (var i in text)
\t      {
\t\tstr+=i+'<br>';
\t      }

\t    // \$('debug').innerHTML=str;
\t    ajaxFid(text);
\t  }
\t</script>

EOF;
        echo "<form>";
        $l = new IText('ctl_label');
        $t = new IText('ctl_tvaid');
        $p = new IText('ctl_price');
        $b = new IText('ctl_purchase');
        echo "Label " . $l->input() . '<br>';
        echo "Tva id  " . $t->input() . '<br>';
        echo "Price " . $p->input() . '<br>';
        echo "Purchase " . $b->input() . '<br>';
        if (isset($_REQUEST['test_select'])) {
            echo HtmlInput::hidden('test_select', $_REQUEST['test_select']);
        }
        $a->set_function('test_value');
        $a->javascript = ' onchange="alert(\'onchange\');" onblur="alert(\'onblur\');" ';
        echo $a->input();
        echo dossier::hidden();
        echo HtmlInput::submit('Entree', 'entree');
        echo '</form>';
        echo <<<EOF
EOF;
    }