function Input() { $r = ""; $h = new IHidden(); $r .= '<li>Id :' . $h->input('frd_id', $this->frd_id) . $this->frd_id . "</li>"; $w = new IText(); $r .= '<li>' . _('Commentaire ') . ' :' . $w->input('frd_text', $this->frd_text) . "</li>"; $t = new IText(); $r .= '<li>' . _('Poste de base') . ':' . $t->input('frd_class_base', $this->frd_class_base) . "</li>"; return $r; }
echo HtmlInput::submit('mod', 'modifie'); echo '</FORM>'; echo '</TD>'; echo "</TR>"; } echo "</table>"; echo "</div>"; //----------------------------------------------------- // modifie if (isset($_POST['mod'])) { echo '<div style="float:left;">'; echo IPoste::ipopup('ipop_account'); echo '<fieldset>'; echo "<legend>Voulez-vous vraiment modifier ?</legend>"; echo '<FORM METHOD="POST">'; echo "<TABLE>"; $id = $_POST['id']; echo $all[$id]->form(); echo "</TABLE>"; $h = new IHidden(); $h->name = 'p_action'; $h->value = 'divers'; echo $h->input(); echo HtmlInput::hidden('sa', 'poste'); echo HtmlInput::submit('confirm_mod', 'Confirme'); echo HtmlInput::submit('no', 'Cancel'); echo "</FORM>"; echo '</fieldset>'; echo "</div>"; } echo '</div>';
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 = " "; //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 Show all the operation * @param$sql is the sql stmt, normally created by build_search_sql * @param$offset the offset * @param$p_paid if we want to see info about payment \code // Example // Build the sql list($sql,$where)=$Ledger->build_search_sql($_GET); // Count nb of line $max_line=$cn->count_sql($sql); $step=$_SESSION['g_pagesize']; $page=(isset($_GET['offset']))?$_GET['page']:1; $offset=(isset($_GET['offset']))?$_GET['offset']:0; // create the nav. bar $bar=navigation_bar($offset,$max_line,$step,$page); // show a part list($count,$html)= $Ledger->list_operation($sql,$offset,0); echo $html; // show nav bar echo $bar; \endcode * \see build_search_sql * \see display_search_form * \see search_form * \return HTML string */ public function list_operation($sql, $offset, $p_paid = 0) { global $g_parameter, $g_user; bcscale(2); $table = new Sort_Table(); $gDossier = dossier::id(); $amount_paid = 0.0; $amount_unpaid = 0.0; $limit = $_SESSION['g_pagesize'] != -1 ? " LIMIT " . $_SESSION['g_pagesize'] : ""; $offset = $_SESSION['g_pagesize'] != -1 ? " OFFSET " . Database::escape_string($offset) : ""; $order = " order by jr_date_order asc,jr_internal asc"; // Sort $url = "?" . CleanUrl(); $str_dossier = dossier::get(); $table->add(_("Date"), $url, 'order by jr_date asc,substring(jr_pj_number,\'[0-9]+$\')::numeric asc', 'order by jr_date desc,substring(jr_pj_number,\'[0-9]+$\')::numeric desc', "da", "dd"); $table->add(_('Echeance'), $url, " order by jr_ech asc", " order by jr_ech desc", 'ea', 'ed'); $table->add(_('Paiement'), $url, " order by jr_date_paid asc", " order by jr_date_paid desc", 'eap', 'edp'); $table->add(_('Pièce'), $url, ' order by substring(jr_pj_number,\'[0-9]+$\')::numeric asc ', ' order by substring(jr_pj_number,\'[0-9]+$\')::numeric desc ', "pja", "pjd"); $table->add(_('Tiers'), $url, " order by name asc", " order by name desc", 'na', 'nd'); $table->add(_('Montant'), $url, " order by jr_montant asc", " order by jr_montant desc", "ma", "md"); $table->add(_("Description"), $url, "order by jr_comment asc", "order by jr_comment desc", "ca", "cd"); $ord = !isset($_GET['ord']) ? 'da' : $_GET['ord']; $order = $table->get_sql_order($ord); // Count $count = $this->db->count_sql($sql); // Add the limit $sql .= $order . $limit . $offset; // Execute SQL stmt $Res = $this->db->exec_sql($sql); //starting from here we can refactor, so that instead of returning the generated HTML, //this function returns a tree structure. $r = ""; $Max = Database::num_row($Res); if ($Max == 0) { return array(0, _("Aucun enregistrement trouvé")); } $r .= '<table class="result">'; $r .= "<tr >"; $r .= "<th>" . _("n° interne") . "</th>"; if ($this->type == 'ALL') { $r .= th('Journal'); } $r .= '<th>' . $table->get_header(0) . '</th>'; if ($p_paid != 0) { $r .= '<th>' . $table->get_header(1) . '</td>'; } if ($p_paid != 0) { $r .= '<th>' . $table->get_header(2) . '</th>'; } $r .= '<th>' . $table->get_header(3) . '</th>'; $r .= '<th>' . $table->get_header(4) . '</th>'; $r .= '<th>' . $table->get_header(6) . '</th>'; $r .= th('Notes', ' style="width:15%"'); $r .= '<th>' . $table->get_header(5) . '</th>'; // if $p_paid is not equal to 0 then we have a paid column if ($p_paid != 0) { $r .= "<th> " . _('Payé') . "</th>"; } $r .= "<th>" . _('Concerne') . "</th>"; $r .= "<th>" . _('Document') . "</th>"; $r .= "</tr>"; // Total Amount $tot = 0.0; $gDossier = dossier::id(); for ($i = 0; $i < $Max; $i++) { $row = Database::fetch_array($Res, $i); if ($i % 2 == 0) { $tr = '<TR class="odd">'; } else { $tr = '<TR class="even">'; } $r .= $tr; //internal code // button modify $r .= "<TD>"; // If url contains // $href = basename($_SERVER['PHP_SELF']); $r .= sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:modifyOperation(\'%s\',\'%s\')" >%s </A>', $row['jr_id'], $gDossier, $row['jr_internal']); $r .= "</TD>"; if ($this->type == 'ALL') { $r .= td($row['jrn_def_name']); } // date $r .= "<TD>"; $r .= $row['str_jr_date']; $r .= "</TD>"; // echeance if ($p_paid != 0) { $r .= "<TD>"; $r .= $row['str_jr_ech']; $r .= "</TD>"; $r .= "<TD>"; $r .= $row['str_jr_date_paid']; $r .= "</TD>"; } // pj $r .= "<TD>"; $r .= $row['jr_pj_number']; $r .= "</TD>"; // Tiers $other = $row['quick_code'] != '' ? '[' . $row['quick_code'] . '] ' . $row['name'] . ' ' . $row['first_name'] : ''; $r .= td($other); // comment $r .= "<TD>"; $tmp_jr_comment = h($row['jr_comment']); $r .= $tmp_jr_comment; $r .= "</TD>"; $r .= td(h($row['n_text']), ' style="font-size:0.87em%"'); // Amount // If the ledger is financial : // the credit must be negative and written in red $positive = 0; // Check ledger type : if ($row['jrn_def_type'] == 'FIN') { $positive = $this->db->get_value("select qf_amount from quant_fin where jr_id=\$1", array($row['jr_id'])); if ($this->db->count() != 0) { $positive = $positive < 0 ? 1 : 0; } } $r .= "<TD align=\"right\">"; $t_amount = $row['jr_montant']; if ($row['total_invoice'] != null && $row['total_invoice'] != $row['jr_montant']) { $t_amount = $row['total_invoice']; } $tot = $positive != 0 ? bcsub($tot, $t_amount) : bcadd($tot, $t_amount); //STAN $positive always == 0 if ($row['jrn_def_type'] == 'FIN') { $r .= $positive != 0 ? "<font color=\"red\"> - " . nbm($t_amount) . "</font>" : nbm($t_amount); } else { $r .= $t_amount < 0 ? "<font color=\"red\"> " . nbm($t_amount) . "</font>" : nbm($t_amount); } $r .= "</TD>"; // Show the paid column if p_paid is not null if ($p_paid != 0) { $w = new ICheckBox(); $w->name = "rd_paid" . $row['jr_id']; $w->selected = $row['jr_rapt'] == 'paid' ? true : false; // if p_paid == 2 then readonly $w->readonly = $p_paid == 2 ? true : false; $h = new IHidden(); $h->name = "set_jr_id" . $row['jr_id']; $r .= '<TD>' . $w->input() . $h->input() . '</TD>'; if ($row['jr_rapt'] == 'paid') { $amount_paid = bcadd($amount_paid, $t_amount); } else { $amount_unpaid = bcadd($amount_unpaid, $t_amount); } } // Rapprochement $rec = new Acc_Reconciliation($this->db); $rec->set_jr_id($row['jr_id']); $a = $rec->get(); $r .= "<TD>"; if ($a != null) { foreach ($a as $key => $element) { $operation = new Acc_Operation($this->db); $operation->jr_id = $element; $l_amount = $this->db->get_value("select jr_montant from jrn " . " where jr_id={$element}"); $r .= "<A class=\"detail\" HREF=\"javascript:modifyOperation('" . $element . "'," . $gDossier . ")\" > " . $operation->get_internal() . "[" . nbm($l_amount) . "]</A>"; } //for } // if ( $a != null ) { $r .= "</TD>"; if ($row['jr_valid'] == 'f') { $r .= "<TD>" . _("Opération annulée") . "</TD>"; } else { } // else //document if ($row['jr_pj_name'] != "") { $r .= '<td>' . HtmlInput::show_receipt_document($row['jr_id']) . '</td>'; } else { $r .= "<TD></TD>"; } // end row $r .= "</tr>"; } $amount_paid = round($amount_paid, 4); $amount_unpaid = round($amount_unpaid, 4); $tot = round($tot, 4); $r .= "<TR>"; $r .= '<TD COLSPAN="5">Total</TD>'; $r .= '<TD ALIGN="RIGHT">' . nbm($tot) . "</TD>"; $r .= "</tr>"; if ($p_paid != 0) { $r .= "<TR>"; $r .= '<TD COLSPAN="5">' . _("Payé") . '</TD>'; $r .= '<TD ALIGN="RIGHT">' . nbm($amount_paid) . "</TD>"; $r .= "</tr>"; $r .= "<TR>"; $r .= '<TD COLSPAN="5">' . _("Non payé") . '</TD>'; $r .= '<TD ALIGN="RIGHT">' . nbm($amount_unpaid) . "</TD>"; $r .= "</tr>"; } $r .= "</table>"; return array($count, $r); }
// record the operation and exit // and exit //----------------------------- echo '<div class="redcontent" >' . _('Opération sauvée'); $a = new Anc_Group_Operation($cn); $a->get_from_array($_POST); $a->save(); echo $a->show(); echo '</div>'; return; } if (isset($_GET['new'])) { //show the form for entering a new Anc_Operation //------------------------------------------ $a = new Anc_Group_Operation($cn); $wSubmit = new IHidden("p_action", "ca_od"); $wSubmit->table = 0; echo '<div class="redcontent" >'; echo '<form method="post">'; echo dossier::hidden(); echo $wSubmit->input(); echo $a->form(); echo HtmlInput::submit("save", _("Sauver")); echo '</form>'; echo '<div class="info">'; echo _('Débit') . ' = <span id="totalDeb"></span>'; echo _('Crédit') . ' = <span id="totalCred"></span>'; echo _('Difference') . ' = <span id="totalDiff"></span> </div> '; echo '</div>';
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>"; }
function HtmlTableHeader($p_array = null) { if ($p_array == null) { $p_array = $_REQUEST; } $hid = new IHidden(); echo '<div class="noprint">'; echo "<table >"; echo '<TR>'; echo '<TD><form method="GET" ACTION="">' . HtmlInput::submit('bt_other', "Autre poste") . HtmlInput::array_to_hidden(array('gDossier', 'ac'), $_REQUEST) . dossier::hidden() . $hid->input("type", "poste") . $hid->input('p_action', 'impress') . "</form></TD>"; $str_ople = isset($_REQUEST['ople']) ? HtmlInput::hidden('ople', $_REQUEST['ople']) : ''; echo '<TD><form method="GET" ACTION="export.php">' . HtmlInput::submit('bt_pdf', _("Export PDF")) . dossier::hidden() . $str_ople . HtmlInput::hidden('act', 'PDF:fichedetail') . $hid->input("type", "poste") . $hid->input('p_action', 'impress') . $hid->input("f_id", $this->id) . dossier::hidden() . $hid->input("from_periode", $p_array['from_periode']) . $hid->input("to_periode", $p_array['to_periode']); if (isset($p_array['oper_detail'])) { echo $hid->input('oper_detail', 'on'); } echo "</form></TD>"; echo '<TD><form method="GET" ACTION="export.php">' . HtmlInput::submit('bt_csv', _("Export CSV")) . HtmlInput::hidden('act', 'CSV:fichedetail') . dossier::hidden() . $str_ople . $hid->input("type", "poste") . $hid->input('p_action', 'impress') . $hid->input("f_id", $this->id) . $hid->input("from_periode", $p_array['from_periode']) . $hid->input("to_periode", $p_array['to_periode']); if (isset($p_array['oper_detail'])) { echo $hid->input('oper_detail', 'on'); } echo "</form></TD>"; echo "</form></TD>"; echo '<td style="vertical-align:top">'; echo HtmlInput::print_window(); echo '</td>'; echo "</table>"; echo '</div>'; }
//echo $w->input($sa,'sa'); echo "</form>"; echo "</TD>"; echo '</TR>'; } echo "</table>"; // modify input if (isset($_POST['mod'])) { extract($_POST); echo '<div style="float:left;padding:2%">'; echo _("Voulez-vous modifier ?"); echo "<br><font color=\"red\"> "; echo _("Attention, ne changer pas la signification de ce poste."); echo hi(_("par exemple ne pas changer Client par fournisseur")) . "<br>"; echo _("sinon le programme fonctionnera mal, " . "utiliser uniquement des chiffres pour la classe de base ou rien") . "</font>"; $mod = new Fiche_Def_Ref($cn); $mod->frd_id = $idx; $mod->Get(); echo '<form method="post">'; echo '<ul style="list-style-type:none"'; echo $mod->Input(); echo "</ul>"; $w = new IHidden(); echo $w->input('ac', $_REQUEST['ac']); // echo $w->input('sa',$sa); echo HtmlInput::submit('confirm_mod', 'Confirme'); echo HtmlInput::submit('no', 'Cancel'); echo '</form>'; echo '</div>'; } echo '</div>';
/** * \brief Display the object, the tags for the FORM * are in the caller. It will be used for adding and updating * action * \note If ag_id is not equal to zero then it is an update otherwise * it is a new document * * \param $p_view form will be in readonly mode (value: READ, UPD or NEW ) * \param $p_gen true we show the tag for generating a doc (value : true or false) and adding files * \param $p_base is the ac parameter * \param $retour is the html code for the return button * \note update the reference number or the document type is not allowed * * * \return string containing the html code */ function Display($p_view, $p_gen, $p_base, $retour = "") { global $g_user; if ($p_view == 'UPD') { $upd = true; $readonly = false; } elseif ($p_view == "NEW") { $upd = false; $readonly = false; $this->ag_ref = _("Nouveau"); } elseif ($p_view == 'READ') { $upd = true; $readonly = true; } else { throw new Exception('class_action' . __LINE__ . 'Follow_Up::Display error unknown parameter' . $p_view); } // Compute the widget // Date $date = new IDate(); $date->readOnly = $readonly; $date->name = "ag_timestamp"; $date->id = "ag_timestamp"; $date->value = $this->ag_timestamp; $remind_date = new IDate(); $remind_date->readOnly = $readonly; $remind_date->name = "ag_remind_date"; $remind_date->id = "ag_remind_date"; $remind_date->value = $this->ag_remind_date; // Doc Type $doc_type = new ISelect(); $doc_type->name = "dt_id"; $doc_type->value = $this->db->make_array("select dt_id,dt_value from document_type order by dt_value", 1); $doc_type->selected = $this->dt_id; $doc_type->readOnly = $readonly; $str_doc_type = $doc_type->input(); // Description $desc = new ITextArea(); $desc->style = ' class="itextarea" style="width:80%;margin-left:0px"'; $desc->name = "ag_comment"; $desc->readOnly = $readonly; $acomment = $this->db->get_array("SELECT agc_id, ag_id, to_char(agc_date,'DD.MM.YYYY HH24:MI') as str_agc_date, agc_comment, tech_user\n\t\t\t\t FROM action_gestion_comment where ag_id=\$1 order by agc_id;", array($this->ag_id)); // List opération liées $operation = $this->db->get_array("select ago_id,j.jr_id,j.jr_internal,j.jr_comment,to_char(j.jr_date,'DD.MM.YY') as str_date\n\t\t\tfrom jrn as j join action_gestion_operation as ago on (j.jr_id=ago.jr_id)\n\t\t\twhere ag_id=\$1 order by jr_date", array($this->ag_id)); $iconcerned = new IConcerned('operation'); // List related action $action = $this->db->get_array("\n\t\t\tselect ag_id,ag_ref,substr(ag_title,1,40) as sub_title,to_char(ag_timestamp,'DD.MM.YY') as str_date ,\n\t\t\t\tag_timestamp,dt_value\n\t\t\t\t\tfrom action_gestion\n\t\t\t\t\t join document_type on (ag_type=dt_id)\n\t\t\t\twhere\n\t\t\t\tag_id in (select aga_greatest from action_gestion_related where aga_least =\$1)\n\t\t\t\tor\n\t\t\t\tag_id in (select aga_least from action_gestion_related where aga_greatest =\$1)\n\t\t\t\torder by ag_timestamp", array($this->ag_id)); $iaction = new IRelated_Action('action'); $iaction->value = isset($this->action) ? $this->action : ""; // state // Retrieve the value $a = $this->db->make_array("select s_id,s_value from document_state "); $state = new ISelect(); $state->readOnly = $readonly; $state->name = "ag_state"; $state->value = $a; $state->selected = $this->ag_state; $str_state = $state->input(); // Retrieve the value if there is an attached doc $doc_ref = ""; // Document id $h2 = new IHidden(); $h2->name = "d_id"; $h2->value = $this->d_id; if ($this->d_id != 0 && $this->d_id != "") { $h2->readonly = $p_view == 'NEW' ? false : true; $doc = new Document($this->db, $this->d_id); $doc->get(); if (strlen(trim($doc->d_lob)) != 0) { $d_id = new IHidden(); $doc_ref = "<p> Document " . $doc->anchor() . '</p>'; $doc_ref .= $h2->input() . $d_id->input('d_id', $this->d_id); } } // title $title = new IText(); $title->readOnly = $readonly; $title->name = "ag_title"; $title->value = $this->ag_title; $title->size = 60; // Priority of the ag_priority $ag_priority = new ISelect(); $ag_priority->readOnly = $readonly; $ag_priority->name = "ag_priority"; $ag_priority->selected = $this->ag_priority; $ag_priority->value = array(array('value' => 1, 'label' => 'Haute'), array('value' => 2, 'label' => 'Moyenne'), array('value' => 3, 'label' => 'Basse')); $str_ag_priority = $ag_priority->input(); // hour of the action (meeting) ag_hour $ag_hour = new IText(); $ag_hour->readOnly = $readonly; $ag_hour->name = "ag_hour"; $ag_hour->value = $this->ag_hour; $ag_hour->size = 6; $ag_hour->javascript = " onblur=check_hour('ag_hour');"; $str_ag_hour = $ag_hour->input(); // Profile in charged of the action $ag_dest = new ISelect(); $ag_dest->readOnly = $readonly; $ag_dest->name = "ag_dest"; // select profile $aAg_dest = $this->db->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"); $ag_dest->value = $aAg_dest; $ag_dest->selected = $this->ag_dest; $str_ag_dest = $ag_dest->input(); // ag_ref // Always false for update $client_label = new ISpan(); /* 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'); $filter = $this->db->make_list('select fd_id from fiche_def '); $f_add_button->set_attribute('filter', $filter); $f_add_button->javascript = " select_card_type(this);"; $str_add_button = $f_add_button->input(); // f_id_dest sender if ($this->qcode_dest != NOTFOUND && strlen(trim($this->qcode_dest)) != 0) { $tiers = new Fiche($this->db); $tiers->get_by_qcode($this->qcode_dest); $qcode_dest_label = $tiers->strAttribut(1); $this->f_id_dest = $tiers->id; } else { $qcode_dest_label = $this->f_id_dest == 0 || trim($this->qcode_dest) == "" ? 'Interne ' : 'Error'; } $h_ag_id = new IHidden(); // if concerns another action : show the link otherwise nothing // // sender $w = new ICard(); $w->readOnly = $readonly; $w->jrn = 0; $w->name = 'qcode_dest'; $w->value = $this->f_id_dest != 0 ? $this->qcode_dest : ""; $w->label = ""; $list_recipient = $this->db->make_list('select fd_id from fiche_def where frd_id in (14,25,8,9,16)'); $w->extra = $list_recipient; $w->set_attribute('typecard', $list_recipient); $w->set_dblclick("fill_ipopcard(this);"); $w->set_attribute('ipopup', 'ipopcard'); // name of the field to update with the name of the card $w->set_attribute('label', 'qcode_dest_label'); // name of the field to update with the name of the card $w->set_attribute('typecard', $w->extra); $w->set_function('fill_data'); $w->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $w->name); $sp = new ISpan(); $sp->name = 'qcode_dest_label'; $sp->value = $qcode_dest_label; // autre - a refaire pour avoir plusieurs fiches // Sur le modèle des tags $ag_contact = new ICard(); $ag_contact->readOnly = $readonly; $ag_contact->jrn = 0; $ag_contact->name = 'ag_contact'; $ag_contact->value = ''; $ag_contact->set_attribute('ipopup', 'ipopcard'); if ($this->ag_contact != 0) { $contact = new Fiche($this->db, $this->ag_contact); $ag_contact->value = $contact->get_quick_code(); } $ag_contact->label = ""; $list_contact = $this->db->make_list('select fd_id from fiche_def where frd_id=16'); $ag_contact->extra = $list_contact; $ag_contact->set_dblclick("fill_ipopcard(this);"); // name of the field to update with the name of the card $ag_contact->set_attribute('label', 'ag_contact_label'); // name of the field to update with the name of the card $ag_contact->set_attribute('typecard', $list_contact); $ag_contact->set_function('fill_data'); $ag_contact->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $ag_contact->name); $spcontact = new ISpan(); $spcontact->name = 'ag_contact_label'; $spcontact->value = ''; $fiche_contact = new Fiche($this->db); $fiche_contact->get_by_qcode($this->ag_contact); if ($fiche_contact->id != 0) { $spcontact->value = $fiche_contact->strAttribut(ATTR_DEF_NAME); } $h_agrefid = new IHidden(); $iag_ref = new IText("ag_ref"); $iag_ref->value = $this->ag_ref; $iag_ref->readOnly = $p_view == "NEW" || $p_view == 'READ' ? true : false; $str_ag_ref = $iag_ref->input(); // Preparing the return string $r = ""; /* for new files */ $upload = new IFile(); $upload->name = "file_upload[]"; $upload->readOnly = $readonly; $upload->value = ""; $aAttachedFile = $this->db->get_array('select d_id,d_filename,d_description,d_mimetype,' . '\'show_document.php?' . Dossier::get() . '&d_id=\'||d_id as link' . ' from document where ag_id=$1', array($this->ag_id)); /* create the select for document */ $aDocMod = new ISelect(); $aDocMod->name = 'doc_mod'; $aDocMod->value = $this->db->make_array('select md_id,dt_value||\' : \'||md_name as md_name' . ' from document_modele join document_type on (md_type=dt_id)' . ' order by md_name'); $str_select_doc = $aDocMod->input(); /* if no document then do not show the generate button */ if (empty($aDocMod->value)) { $str_submit_generate = ""; } else { $str_submit_generate = HtmlInput::submit("generate", _("Génére le document")); } $ag_id = $this->ag_id; /* fid = Icard */ $icard = new ICard(); $icard->jrn = 0; $icard->table = 0; $icard->extra2 = 'QuickCode'; $icard->noadd = "no"; $icard->extra = 'all'; /* Text desc */ $text = new IText(); $num = new INum(); /* TVA */ $itva = new ITva_Popup($this->db); $itva->in_table = true; $aCard = array(); /* create aArticle for the detail section */ $article_count = count($this->aAction_detail) == 0 ? MAX_ARTICLE : count($this->aAction_detail); /* Compute total */ $tot_item = 0; $tot_vat = 0; for ($i = 0; $i < $article_count; $i++) { /* fid = Icard */ $icard = new ICard(); $icard->jrn = 0; $icard->table = 0; $icard->noadd = "no"; $icard->extra = 'all'; $icard->name = "e_march" . $i; $tmp_ad = isset($this->aAction_detail[$i]) ? $this->aAction_detail[$i] : false; $icard->readOnly = $readonly; $icard->value = ''; $aCard[$i] = 0; if ($tmp_ad) { $march = new Fiche($this->db); $f = $tmp_ad->get_parameter('qcode'); if ($f != 0) { $march->id = $f; $icard->value = $march->get_quick_code(); $aCard[$i] = $f; } } $icard->set_dblclick("fill_ipopcard(this);"); // name of the field to update with the name of the card $icard->set_attribute('label', "e_march" . $i . "_label"); // name of the field to update with the name of the card $icard->set_attribute('typecard', $icard->extra); $icard->set_attribute('ipopup', 'ipopcard'); $icard->set_function('fill_data'); $icard->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $icard->name); $aArticle[$i]['fid'] = $icard->search() . $icard->input(); $text->javascript = ' onchange="clean_tva(' . $i . ');compute_ledger(' . $i . ')"'; $text->css_size = "100%"; $text->name = "e_march" . $i . "_label"; $text->id = "e_march" . $i . "_label"; $text->size = 40; $text->value = $tmp_ad ? $tmp_ad->get_parameter('text') : ""; $text->readOnly = $readonly; $aArticle[$i]['desc'] = $text->input(); $num->javascript = ' onchange="format_number(this);clean_tva(' . $i . ');compute_ledger(' . $i . ')"'; $num->name = "e_march" . $i . "_price"; $num->id = "e_march" . $i . "_price"; $num->size = 8; $num->readOnly = $readonly; $num->value = $tmp_ad ? $tmp_ad->get_parameter('price_unit') : 0; $aArticle[$i]['pu'] = $num->input(); $num->name = "e_quant" . $i; $num->id = "e_quant" . $i; $num->size = 8; $num->value = $tmp_ad ? $tmp_ad->get_parameter('quantity') : 0; $aArticle[$i]['quant'] = $num->input(); $itva->name = 'e_march' . $i . '_tva_id'; $itva->id = 'e_march' . $i . '_tva_id'; $itva->value = $tmp_ad ? $tmp_ad->get_parameter('tva_id') : 0; $itva->readOnly = $readonly; $itva->js = ' onchange="format_number(this);clean_tva(' . $i . ');compute_ledger(' . $i . ')"'; $itva->set_attribute('compute', $i); $aArticle[$i]['tvaid'] = $itva->input(); $num->name = "e_march" . $i . "_tva_amount"; $num->id = "e_march" . $i . "_tva_amount"; $num->value = $tmp_ad ? $tmp_ad->get_parameter('tva_amount') : 0; $num->javascript = " onchange=\"compute_ledger('" . $i . " ')\""; $num->size = 8; $aArticle[$i]['tva'] = $num->input(); $tot_vat = bcadd($tot_vat, $num->value); $num->name = "tvac_march" . $i; $num->id = "tvac_march" . $i; $num->value = $tmp_ad ? $tmp_ad->get_parameter('total') : 0; $num->size = 8; $aArticle[$i]['tvac'] = $num->input(); $tot_item = bcadd($tot_item, $num->value); $aArticle[$i]['hidden_htva'] = HtmlInput::hidden('htva_march' . $i, 0); $aArticle[$i]['hidden_tva'] = HtmlInput::hidden('tva_march' . $i, 0); $aArticle[$i]['ad_id'] = $tmp_ad ? HtmlInput::hidden('ad_id' . $i, $tmp_ad->get_parameter('id')) : HtmlInput::hidden('ad_id' . $i, 0); } /* Add the needed hidden values */ $r .= dossier::hidden(); /* add the number of item */ $Hid = new IHidden(); $r .= $Hid->input("nb_item", $article_count); $r .= HtmlInput::request_to_hidden(array("closed_action", "remind_date_end", "remind_date", "sag_ref", "only_internal", "state", "qcode", "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", "hsstate", "searchtag")); $a_tag = $this->tag_get(); $menu = new Default_Menu(); /* get template */ ob_start(); require 'template/detail-action.php'; $content = ob_get_contents(); ob_end_clean(); $r .= $content; //hidden $r .= "<p>"; $r .= $h2->input(); $r .= $h_ag_id->input('ag_id', $this->ag_id); $hidden2 = new IHidden(); $r .= $hidden2->input('f_id_dest', $this->f_id_dest); $r .= "</p>"; return $r; }
$exercice = isset($_GET['exercice']) ? $_GET['exercice'] : $g_user->get_exercice(); /* * Let you change the exercice */ echo '<fieldset><legend>' . _('Exercice') . '</legend>'; echo '<form method="GET">'; echo 'Choisissez un autre exercice :'; $ex = new Exercice($cn); $wex = $ex->select('exercice', $exercice, ' onchange="submit(this)"'); echo $wex->input(); echo dossier::hidden(); echo HtmlInput::get_to_hidden(array('ac', 'type')); echo '</form>'; echo '</fieldset>'; echo '<FORM METHOD="GET">'; $hidden = new IHidden(); echo $hidden->input("ac", $_GET['ac']); echo $hidden->input("type", "rapport"); echo dossier::hidden(); echo '<TABLE><TR>'; $w = new ISelect(); $w->table = 1; print td(_("Choisissez le rapport")); print $w->input("form_id", $ret); print '</TR>'; //-- calendrier ou periode comptable $aCal = array(array('value' => 0, 'label' => _('Période comptable')), array('value' => 1, 'label' => _('Calendrier'))); $w->javascript = ' onchange=enable_type_periode();'; $w->id = 'type_periode'; echo '<tr>'; print td('Type de date : ');
switch ($_GET['p_simple']) { case "0": $Row = $Jrn->get_row($_GET['from_periode'], $_GET['to_periode']); break; case "1": $Row = $Jrn->get_rowSimple($_GET['from_periode'], $_GET['to_periode']); break; case "2": $Row = $Jrn->get_rowSimple($_GET['from_periode'], $_GET['to_periode']); break; default: var_dump($_GET['p_simple']); die(__FILE__ . ":" . __LINE__ . " error unknown style "); } $rep = ""; $hid = new IHidden(); echo '<div class="content">'; echo '<h2 class="info">' . h($Jrn->name) . '</h2>'; echo "<table>"; echo '<TR>'; echo '<TD><form method="GET" ACTION="?">' . dossier::hidden() . $hid->input("type", "jrn") . $hid->input('p_action', 'impress') . "</form></TD>"; echo '<TD><form method="GET" ACTION="export.php">' . dossier::hidden() . HtmlInput::submit('bt_pdf', "Export PDF") . HtmlInput::hidden('act', 'PDF:ledger') . $hid->input("type", "jrn") . $hid->input("jrn_id", $Jrn->id) . $hid->input("from_periode", $_GET['from_periode']) . $hid->input("to_periode", $_GET['to_periode']); echo $hid->input("p_simple", $_GET['p_simple']); echo HtmlInput::get_to_hidden(array('ac', 'type')); echo "</form></TD>"; echo '<TD><form method="GET" ACTION="export.php">' . dossier::hidden() . HtmlInput::submit('bt_csv', "Export CSV") . HtmlInput::hidden('act', 'CSV:ledger') . $hid->input("type", "jrn") . $hid->input("jrn_id", $Jrn->id) . $hid->input("from_periode", $_GET['from_periode']) . $hid->input("to_periode", $_GET['to_periode']); echo $hid->input("p_simple", $_GET['p_simple']); echo HtmlInput::get_to_hidden(array('ac', 'type')); echo "</form></TD>"; echo '<td style="vertical-align:top">'; echo HtmlInput::print_window();
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 = " "; //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; }
static function HtmlTableHeader($actiontarget = "poste") { switch ($actiontarget) { case 'poste': $action_csv = 'CSV:postedetail'; $action_pdf = 'PDF:postedetail'; break; case 'gl_comptes': $action_csv = 'CSV:glcompte'; $action_pdf = 'PDF:glcompte'; break; default: throw new Exception(" Fonction HtmlTableHeader argument actiontarget invalid"); } $hid = new IHidden(); echo "<table >"; echo '<TR>'; $str_ople = isset($_REQUEST['ople']) ? HtmlInput::hidden('ople', $_REQUEST['ople']) : ''; if ($actiontarget == 'poste') { echo '<TD><form method="GET" ACTION="">' . dossier::hidden() . HtmlInput::submit('bt_other', "Autre poste") . $hid->input("type", "poste") . $hid->input('ac', $_REQUEST['ac']) . "</form></TD>"; } echo '<TD><form method="GET" ACTION="export.php">' . dossier::hidden() . HtmlInput::submit('bt_pdf', "Export PDF") . HtmlInput::hidden('act', $action_pdf) . $hid->input("type", "poste") . $str_ople . $hid->input('p_action', 'impress') . $hid->input("from_periode", $_REQUEST['from_periode']) . $hid->input("to_periode", $_REQUEST['to_periode']); if (isset($_REQUEST['letter'])) { echo HtmlInput::hidden('letter', '2'); } if (isset($_REQUEST['solded'])) { echo HtmlInput::hidden('solded', '1'); } if (isset($_REQUEST['from_poste'])) { echo HtmlInput::hidden('from_poste', $_REQUEST['from_poste']); } if (isset($_REQUEST['to_poste'])) { echo HtmlInput::hidden('to_poste', $_REQUEST['to_poste']); } if (isset($_REQUEST['poste_id'])) { echo HtmlInput::hidden("poste_id", $_REQUEST['poste_id']); } if (isset($_REQUEST['poste_fille'])) { echo $hid->input('poste_fille', 'on'); } if (isset($_REQUEST['oper_detail'])) { echo $hid->input('oper_detail', 'on'); } echo "</form></TD>"; echo '<TD><form method="GET" ACTION="export.php">' . dossier::hidden() . HtmlInput::submit('bt_csv', "Export CSV") . HtmlInput::hidden('act', $action_csv) . $hid->input("type", "poste") . $str_ople . $hid->input('p_action', 'impress') . $hid->input("from_periode", $_REQUEST['from_periode']) . $hid->input("to_periode", $_REQUEST['to_periode']); if (isset($_REQUEST['from_poste'])) { echo HtmlInput::hidden('from_poste', $_REQUEST['from_poste']); } if (isset($_REQUEST['to_poste'])) { echo HtmlInput::hidden('to_poste', $_REQUEST['to_poste']); } if (isset($_REQUEST['poste_id'])) { echo HtmlInput::hidden("poste_id", $_REQUEST['poste_id']); } if (isset($_REQUEST['letter'])) { echo HtmlInput::hidden('letter', '2'); } if (isset($_REQUEST['solded'])) { echo HtmlInput::hidden('solded', '1'); } if (isset($_REQUEST['poste_fille'])) { echo $hid->input('poste_fille', 'on'); } if (isset($_REQUEST['oper_detail'])) { echo $hid->input('oper_detail', 'on'); } if (isset($_REQUEST['poste_id'])) { echo $hid->input("poste_id", $_REQUEST['poste_id']); } echo "</form></TD>"; echo "</form></TD>"; echo '<td style="vertical-align:top">'; echo HtmlInput::print_window(); echo '</td>'; echo '</tr>'; echo "</table>"; }
function display_form($p_hidden = "") { /* if there is no analytic plan return */ $pa = new Anc_Plan($this->db); if ($pa->count() == 0) { echo '<div class="content">'; echo '<h2 class="error">' . _('Aucun plan défini') . '</h2>'; echo '</div>'; return; } $from = new IDate('from', 'from'); $from->size = 10; $from->value = $this->from; $to = new IDate('to', 'to'); $to->value = $this->to; $to->size = 10; $from_poste = new IAncCard('from_poste', 'from_poste'); $from_poste->size = 10; $from_poste->plan_ctl = 'pa_id'; $from_poste->value = $this->from_poste; $to_poste = new IAncCard('to_poste', 'to_poste'); $to_poste->value = $this->to_poste; $to_poste->size = 10; $hidden = new IHidden(); $r = dossier::hidden(); $r .= $hidden->input("result", "1"); $r .= HtmlInput::request_to_hidden(array('ac')); $r .= $p_hidden; $plan = new Anc_Plan($this->db); $plan_id = new ISelect("pa_id"); $plan_id->value = $this->db->make_array("select pa_id, pa_name from plan_analytique order by pa_name"); $plan_id->selected = $this->pa_id; $choose_from = new IButton(); $choose_from->name = _("Choix Poste"); $choose_from->label = _("Recherche"); $choose_from->javascript = "onClick=search_ca(" . dossier::id() . ",'from_poste','pa_id')"; $choose_to = new IButton(); $choose_to->name = _("Choix Poste"); $choose_to->label = _("Recherche"); $choose_to->javascript = "onClick=search_ca(" . dossier::id() . ",'to_poste','pa_id')"; $r .= HtmlInput::request_to_hidden(array('ac')); ob_start(); ?> <table> <tr> <td> <?php echo _('Depuis'); echo HtmlInput::infobulle(37); ?> </td> <td> <?php echo $from->input(); ?> </td> </tr> <tr> <td> <?php echo _('Jusque'); echo HtmlInput::infobulle(37); ?> </td> <td> <?php echo $to->input(); ?> </td> </tr> </table> <span style="padding:5px;margin:5px;display:block;"> <?php echo _("Plan Analytique :") . $plan_id->input(); echo HtmlInput::infobulle(42); ?> </span> <?php $r .= ob_get_clean(); $r .= _("Entre l'activité ") . $from_poste->input(); $r .= $choose_from->input(); $r .= _(" et l'activité ") . $to_poste->input(); $r .= $choose_to->input(); $r .= '</span>'; return $r; }
echo "<TD>"; $str_msg = $row['tva_both_side'] == 1 ? 'Employé au crédit et débit' : 'normal'; echo $str_msg; echo "</TD>"; echo "<TD>"; echo HtmlInput::submit("rm", "Efface"); echo HtmlInput::submit("mod", "Modifie"); $w = new IHidden(); $w->name = "tva_id"; $w->value = $row['tva_id']; echo $w->input(); $w = new IHidden(); $w->name = "p_action"; $w->value = "divers"; echo $w->input(); $w = new IHidden(); $w->name = "sa"; $w->value = "tva"; echo $w->input(); echo "</TD>"; echo '</FORM>'; echo "</TR>"; } ?> </TABLE> <?php // if we add / remove or modify a vat we don't show this button if (!isset($_POST['add']) && !isset($_POST['mod']) && !isset($_POST['rm'])) { ?> <form method="post"> <input type="submit" class="button" name="add" value="Ajouter un taux de tva">
echo '<hr>' . $bar; return; } /* * ********************************************************************************************************************************* * Summary * * ******************************************************************************************************************************** */ if ($_GET['histo'] == 3) { $cat_card = new Fiche_Def($cn); $cat_card->id = $_GET['cat']; $aHeading = $cat_card->getAttribut(); if ($allcard == 0) { echo $str_add_card; } require_once NOALYSS_INCLUDE . '/template/result_cat_card_summary.php'; $hid = new IHidden(); echo '<form method="GET" ACTION="export.php">' . dossier::hidden() . HtmlInput::submit('bt_csv', "Export CSV") . HtmlInput::hidden('act', "CSV:fiche") . $hid->input("type", "fiche") . $hid->input("ac", $_REQUEST['ac']) . $hid->input("fd_id", $_REQUEST['cat']); echo "</form>"; return; } $export_pdf = '<FORM METHOD="get" ACTION="export.php" style="display:inline">'; $export_pdf .= HtmlInput::hidden('cat', $_GET['cat']); $export_pdf .= HtmlInput::hidden('act', "PDF:fiche_balance") . ($export_pdf .= HtmlInput::hidden('start', $_GET['start'])); $export_pdf .= HtmlInput::hidden('end', $_GET['end']); $export_pdf .= HtmlInput::hidden('histo', $_GET['histo']); $export_pdf .= HtmlInput::request_to_hidden(array('allcard')); $export_pdf .= dossier::hidden(); $export_pdf .= HtmlInput::submit('pdf', 'Export en PDF'); $export_pdf .= '</FORM>'; $export_print = HtmlInput::print_window(); $export_csv = '<FORM METHOD="get" ACTION="export.php" style="display:inline">';
* Value from $_GET or $_REQUEST */ $request_jrn = HtmlInput::default_value_request("jrn", -1); $request_ac = HtmlInput::default_value_request("ac", ""); $request_sa = HtmlInput::default_value_request("sa", ""); $get_jrn = HtmlInput::default_value_get('jrn', -1); echo '<div class="content">'; echo '<form method="GET">'; $sel = new ISelect(); $sel->name = "jrn"; $sel->value = $cn->make_array("select jrn_def_id,jrn_def_name from " . " jrn_def where jrn_def_type in ('VEN','ACH','ODS') order by jrn_def_name"); // Show a list of ledger $sel->selected = $request_jrn; echo 'Choisissez un journal ' . $sel->input(); echo dossier::hidden(); $hid = new IHidden(); echo $hid->input("sa", "jrn"); echo $hid->input("ac", $request_ac); echo '<hr>'; echo HtmlInput::submit('Accepter', 'Accepter'); echo '</form>'; // if $_REQUEST[sa] == del delete the predefined operation if ($request_sa == 'del') { $op = new Pre_operation($cn); $op->od_id = $_REQUEST['od_id']; $op->delete(); $request_sa = 'jrn'; } // if $_REQUEST[sa] == jrn show the predefined operation for this // ledger if ($request_sa == 'jrn') {
function form_get($p_url) { $r = HtmlInput::button_action(_("Modèle d'opérations"), ' $(\'modele_op_div\').style.display=\'block\';$(\'lk_modele_op_tab\').focus();'); $r .= '<div id="modele_op_div" class="noprint">'; $r .= HtmlInput::title_box(_("Modèle d'opérations"), 'modele_op_div', 'hide'); $hid = new IHidden(); $r .= $hid->input("action", "use_opd"); $r .= $hid->input("jrn_type", $this->get("ledger_type")); $r .= $this->show_button($p_url); $r .= '</div>'; return $r; }
/** * @brief show the form for loading a template * @param p_action for the field action = destination url * * * @return string containing the forms */ function form() { $r = '<p class="notice">'; $r .= 'Veuillez introduire les modèles servant à générer vos documents'; $r .= '</p>'; $r .= '<form enctype="multipart/form-data" method="post">'; $r .= dossier::hidden(); // we need to add the sub action as hidden $h = new IHidden(); $h->name = "sa"; $h->value = "add_document"; $r .= $h->input(); $r .= '<table>'; $t = new IText(); $t->name = "md_name"; $r .= "<tr><td> Nom </td><td>" . $t->input() . "</td>"; $r .= "</tr>"; $r .= "<tr><td>Catégorie de document </td>"; $w = new ISelect(); $w->name = "md_type"; $w->value = $this->cn->make_array('select dt_id,dt_value from document_type order by dt_value'); $r .= "<td>" . $w->input() . "</td></tr>"; $r .= '<tr>'; $r .= td(_('Affectation')); $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'))); $r .= td($waffect->input()); $r .= '</tr>'; $f = new IFile(); $f->name = "doc"; $r .= "<tr><td>fichier</td><td> " . $f->input() . "</td></tr>"; $start = new IText(); $start->name = "start_seq"; $start->size = 9; $start->value = "0"; $r .= "<tr><td> Numerotation commence a</td><td> " . $start->input() . "</td>"; $r .= '<td class="notice">Si vous laissez à 0, la numérotation ne changera pas, la prochaine facture sera n+1, n étant le n° que vous avez donné</td>'; $r .= "</tr>"; $r .= '</table>'; $r .= HtmlInput::submit('add_document', 'Ajout'); $r .= "</form></p>"; return $r; }
function display_form_plan($p_array, $p_null, $p_mode, $p_seq, $p_amount, $p_id = '', $p_add_button = true) { if ($p_array != null) { extract($p_array); } $result = ""; $plan = new Anc_Plan($this->db); $a_plan = $plan->get_list(" order by pa_id "); if (empty($a_plan)) { return ""; } $table_id = "t" . $p_seq; $hidden = new IHidden(); $readonly = $p_mode == 1 ? false : true; $result .= $hidden->input('amount_' . $table_id, $p_amount); if ($p_mode == 1) { $result .= '<table id="' . $p_id . $table_id . '">'; } else { $result .= '<table>'; } $result .= "<tr>" . $plan->header() . "<th>montant</th></tr>"; /* compute the number of rows */ $nb_row = isset($val[$p_seq]) ? count($val[$p_seq]) : 1; $count = 0; $remain = abs($p_amount); $ctrl_remain = "remain" . $this->in_div . $table_id; for ($i = 0; $i < $nb_row; $i++) { $result .= '<tr>'; foreach ($a_plan as $r_plan) { $array = $this->db->make_array("select po_id as value," . " html_quote(po_name) as label from poste_analytique " . " where pa_id = " . $r_plan['id'] . " order by po_name", $p_null); $select = new ISelect("hplan[" . $p_seq . "][]", $array); $select->table = 0; // view only or editables if ($p_mode == 1) { // editable $select->readonly = false; if (isset($hplan) && isset($hplan[$p_seq][$count])) { $select->selected = $hplan[$p_seq][$count]; } } else { if (isset($hplan) && isset($hplan[$p_seq][$count])) { $select->selected = $hplan[$p_seq][$count]; } // view only $select->readOnly = true; } if ($p_mode == 1) { $result .= '<td>' . $select->input() . '</td>'; } else { $result .= '<td>' . $select->display() . '</td>'; } $count++; } $value = new INum(); $value->javascript = 'onchange="format_number(this);anc_refresh_remain(\'' . $this->in_div . $table_id . '\',\'' . $p_seq . '\')"'; $value->name = "val[" . $p_seq . "][]"; $value->size = 6; $value->value = isset($val[$p_seq][$i]) ? $val[$p_seq][$i] : abs($p_amount); $value->readOnly = $p_mode == 1 ? false : true; $remain = bcsub($remain, $value->value); $result .= '<td>' . $value->input() . '</td>'; $result .= "</tr>"; } $result .= "</table>"; if ($p_add_button && $p_mode == 1) { $style_remain = $remain == 0 ? 'style="color:green"' : ' style="color:red"'; $result .= " Reste à imputer = " . '<span class="remain" ' . $style_remain . ' id="' . $ctrl_remain . '">' . $remain . '</span>'; // add a button to add a row $button = new IButton(); $button->javascript = "add_row('" . $p_id . "{$table_id}',{$p_seq});"; $button->name = "js" . $p_id . $p_seq; $button->label = _("Nouvelle ligne"); $result .= "<br>" . $button->input(); /** * Add a button for distribution key * */ $ledger = HtmlInput::default_value_post("p_jrn", 0); if ($ledger == 0) { $ledger = $this->db->get_value('select j_jrn_def from jrnx where j_id=$1', array($this->j_id)); } $gDossier = Dossier::id(); $button_key = new IButton(); $button_key->javascript = "anc_key_choice(" . $gDossier . ",'" . $p_id . "{$table_id}',{$p_amount},'" . $ledger . "');"; $button_key->name = "js" . $p_id . $p_seq; $button_key->label = _("Clef"); $result .= $button_key->input(); } return $result; }
require_once NOALYSS_INCLUDE . '/class_database.php'; require_once NOALYSS_INCLUDE . '/ac_common.php'; require_once NOALYSS_INCLUDE . '/class_dossier.php'; require_once NOALYSS_INCLUDE . '/class_anc_account.php'; require_once NOALYSS_INCLUDE . '/class_anc_plan.php'; require_once NOALYSS_INCLUDE . '/function_javascript.php'; echo HtmlInput::title_box(_("Recherche activité"), $ctl); //------------- FORM ---------------------------------- echo '<FORM id="anc_search_form" METHOD="GET" onsubmit="search_anc_form(this);return false">'; echo '<span>' . _('Recherche') . ':'; $texte = new IText('plabel'); $texte->value = HtmlInput::default_value('plabel', "", $_GET); echo $texte->input(); echo '</span>'; echo dossier::hidden(); $hid = new IHidden(); echo $hid->input("c1", $_REQUEST['c1']); echo $hid->input("c2", $_REQUEST['c2']); echo $hid->input("go"); echo HtmlInput::submit("go", _("Recherche")); echo '</form>'; //------------- FORM ---------------------------------- if (isset($_REQUEST['go'])) { $cn = Dossier::connect(); $plan = new Anc_Plan($cn, $_REQUEST['c2']); $plan->pa_id = $_REQUEST['c2']; if ($plan->exist() == false) { exit(_("Ce plan n'existe pas")); } $sql = "select po_name , po_description from poste_analytique " . "where pa_id=\$1 and " . " (po_name ~* \$2 or po_description ~* \$3) order by po_name"; $array = $cn->get_array($sql, array($_REQUEST['c2'], $_REQUEST['plabel'], $_REQUEST['plabel']));