// require_once '.php'; if (!defined('ALLOWED')) { die('Appel direct ne sont pas permis'); } ob_start(); $ag_id = HtmlInput::default_value_get("ag_id", "0"); if ($ag_id == 0) { throw new Exception('ag_id is null'); } require_once 'class_acc_ledger.php'; $r = HtmlInput::title_box(_("Détail fiche"), 'search_card'); $r .= '<form id="search_card1_frm" method="GET" onsubmit="action_add_concerned_card(this);return false;">'; $q = new IText('query'); $q->value = isset($query) ? $query : ''; $r .= '<span style="margin-left:50px">'; $r .= _('Fiche contenant') . HtmlInput::infobulle(19); $r .= $q->input(); $r .= HtmlInput::submit('fs', _('Recherche'), "", "smallbutton"); $r .= '</span>'; $r .= dossier::hidden() . HtmlInput::hidden('op', 'add_concerned_card'); $r .= HtmlInput::request_to_hidden(array('ag_id')); $r .= '</form>'; $query = HtmlInput::default_value_get("query", ""); $sql_array['query'] = $query; $sql_array['typecard'] = 'all'; $fiche = new Fiche($cn); /* Build the SQL and show result */ $sql = $fiche->build_sql($sql_array); /* We limit the search to MAX_SEARCH_CARD records */ $sql = $sql . ' order by vw_name limit ' . MAX_SEARCH_CARD; $a = $cn->get_array($sql);
$nend_extrait->value = $_POST['end_extrait']; } echo "Extrait / relevé :" . $iextrait->input(); echo 'solde Début' . $nstart_extrait->input(); echo 'solde Fin' . $nend_extrait->input(); echo IButton::tooggle_checkbox('rec1'); echo '</p>'; echo '<p>'; echo _('Filtre') . HtmlInput::infobulle(25); echo HtmlInput::filter_table("t_rec_bk", "0,1,2,3", "1"); echo '</p>'; echo HtmlInput::submit('save', 'Mettre à jour le n° de relevé bancaire'); echo '<span style="display:block">'; echo '</span>'; echo '<table id="t_rec_bk" class="sortable" style="width:90%;margin-left:5%">'; $r = '<th class=" sorttable_sorted_reverse">' . 'Date ' . HtmlInput::infobulle(17) . '<span id="sorttable_sortrevind"> ▴</span>' . '</th>'; $r .= th('Libellé'); $r .= th('N° interne'); $r .= th('Montant', ' style="text-align:right"'); $r .= th('Selection', ' style="text-align:center" '); echo tr($r); $iradio = new ICheckBox('op[]'); $tot_not_reconcilied = 0; $diff = 0; for ($i = 0; $i < count($operation); $i++) { $row = $operation[$i]; $r = ''; $js = HtmlInput::detail_op($row['jr_id'], $row['jr_internal']); $r .= '<td sorttable_customkey="' . $row['raw_date'] . '">' . $row['fmt_date'] . '</td>'; $r .= td($row['jr_comment']); $r .= td($js);
function input($p_array = null, $notused = 0) { global $g_parameter, $g_user; if ($p_array != null) { extract($p_array); } $pview_only = false; $min_article = $this->get_min_row(); $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', $this->id); $f_add_button->javascript = " this.jrn=\$('p_jrn').value;select_card_type(this);"; $str_add_button = $g_user->check_action(FICADD) == 1 ? $f_add_button->input() : ""; // The first day of the periode $pPeriode = new Periode($this->db); list($l_date_start, $l_date_end) = $pPeriode->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; } $r = ""; $r .= dossier::hidden(); $f_legend = 'Banque, caisse'; // Date //-- $Date = new IDate("e_date", $op_date); $Date->setReadOnly($pview_only); $f_date = $Date->input(); $f_period = ''; if ($this->check_periode() == true) { // Periode //-- $l_user_per = isset($periode) ? $periode : $g_user->get_periode(); $period = new IPeriod(); $period->cn = $this->db; $period->type = OPEN; $period->value = $l_user_per; $period->user = $g_user; $period->name = 'periode'; 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_period = "Période comptable {$label}" . $l_form_per; } // Ledger (p_jrn) //-- $onchange = "update_bank();ajax_saldo('first_sold');update_name();update_row('fin_item');"; if ($g_parameter->MY_DATE_SUGGEST == 'Y') { $onchange .= 'get_last_date();'; } if ($g_parameter->MY_PJ_SUGGEST == 'Y') { $onchange .= 'update_pj();'; } $add_js = 'onchange="' . $onchange . '"'; $wLedger = $this->select_ledger('FIN', 2); if ($wLedger == null) { throw new Exception(_('Pas de journal disponible')); } $wLedger->javascript = $add_js; $label = " Journal " . HtmlInput::infobulle(2); $f_jrn = $label . $wLedger->input(); // retrieve bank name, code and account from the jrn_def.jrn_def_bank $f_bank = '<span id="bkname">' . $this->get_bank_name() . '</span>'; if ($this->bank_id == "") { echo h2("Journal de banque non configuré " . $this->get_name(), ' class="error"'); echo '<span class="error"> vous devez donner à ce journal un compte en banque (fiche), modifiez dans CFGLED</span>'; alert("Journal de banque non configuré " . $this->get_name()); } $f_legend_detail = 'Opérations financières'; //-------------------------------------------------- // Saldo begin end //------------------------------------------------- // Extrait $default_pj = ''; if ($g_parameter->MY_PJ_SUGGEST == 'Y') { $default_pj = $this->guess_pj(); } $wPJ = new IText('e_pj'); $wPJ->readonly = false; $wPJ->size = 10; $wPJ->value = isset($e_pj) ? $e_pj : $default_pj; $f_extrait = $wPJ->input() . HtmlInput::hidden('e_pj_suggest', $default_pj); $label = HtmlInput::infobulle(7); $first_sold = isset($first_sold) ? $first_sold : ""; $wFirst = new INum('first_sold', $first_sold); $last_sold = isset($last_sold) ? $last_sold : ""; $wLast = new INum('last_sold', $last_sold); $max = isset($nb_item) ? $nb_item : $min_article; $r .= HtmlInput::hidden('nb_item', $max); //-------------------------------------------------- // financial operation //------------------------------------------------- $array = array(); // Parse each " tiers" for ($i = 0; $i < $max; $i++) { $tiers = isset(${"e_other" . $i}) ? ${"e_other" . $i} : ""; $tiers_amount = isset(${"e_other{$i}" . "_amount"}) ? round(${"e_other{$i}" . "_amount"}, 2) : 0; $tiers_comment = isset(${"e_other{$i}" . "_comment"}) ? ${"e_other{$i}" . "_comment"} : ""; $operation_date = new IDate("dateop" . $i); $operation_date->value = isset(${'dateop' . $i}) ? ${'dateop' . $i} : ""; $array[$i]['dateop'] = $operation_date->input(); ${"e_other{$i}" . "_amount"} = isset(${"e_other{$i}" . "_amount"}) ? ${"e_other{$i}" . "_amount"} : 0; $W1 = new ICard(); $W1->label = ""; $W1->name = "e_other" . $i; $W1->id = "e_other" . $i; $W1->value = $tiers; $W1->extra = 'deb'; // credits $W1->typecard = 'deb'; $W1->style = ' style = "vertical-align:65%"'; $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_other_name' . $i); // name of the field to update with the name of the card $W1->set_attribute('typecard', 'filter'); // 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 = $pview_only; $array[$i]['qcode'] = $W1->input(); $array[$i]['search'] = $W1->search(); // Card name // $card_name = ""; if ($tiers != "") { $fiche = new Fiche($this->db); $fiche->get_by_qcode($tiers); $card_name = $this->db->get_value("Select ad_value from fiche_detail where ad_id=\$1 and f_id=\$2", array(ATTR_DEF_NAME, $fiche->id)); } $wcard_name = new IText("e_other_name" . $i, $card_name); $wcard_name->id = $wcard_name->name; $wcard_name->readOnly = true; $array[$i]['cname'] = $wcard_name->input(); // Comment $wComment = new IText("e_other{$i}" . "_comment", $tiers_comment); $wComment->size = 35; $wComment->setReadOnly($pview_only); $array[$i]['comment'] = $wComment->input(); // amount $wAmount = new INum("e_other{$i}" . "_amount", $tiers_amount); $wAmount->size = 7; $wAmount->setReadOnly($pview_only); $array[$i]['amount'] = $wAmount->input(); // concerned ${"e_concerned" . $i} = isset(${"e_concerned" . $i}) ? ${"e_concerned" . $i} : ""; $wConcerned = new IConcerned("e_concerned" . $i, ${"e_concerned" . $i}); $wConcerned->tiers = "e_other" . $i; $wConcerned->setReadOnly($pview_only); $wConcerned->amount_id = "e_other" . $i . "_amount"; $wConcerned->paid = 'paid'; $array[$i]['concerned'] = $wConcerned->input(); } ob_start(); require_once NOALYSS_INCLUDE . '/template/form_ledger_fin.php'; $r .= ob_get_contents(); ob_end_clean(); $r .= create_script("\$('" . $Date->id . "').focus()"); return $r; }
/** * @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; }
$letter->get_letter(); } // unlettered if ($_GET['histo'] == 2) { $letter->get_unletter(); } if ($_GET['histo'] == 6) { $letter->get_letter_diff(); } /* skip if nothing to display */ if (count($letter->content) == 0) { continue; } $detail_card = HtmlInput::card_detail($row->strAttribut(ATTR_DEF_QUICKCODE), $row->strAttribut(ATTR_DEF_NAME)); echo '<h2>' . $detail_card; echo "poste " . ":" . HtmlInput::history_account($row->strAttribut(ATTR_DEF_ACCOUNT), $row->strAttribut(ATTR_DEF_ACCOUNT), 'display:inline') . HtmlInput::infobulle(27) . '</h2>'; echo '<table class="result">'; echo '<tr>'; echo th(_('Date')); echo th(_('ref')); echo th(_('Interne')); echo th(_('Comm')); echo th(_('Montant'), 'style="width:auto" colspan="2"'); echo th(_('Prog.')); echo th(_('Let.')); echo '</tr>'; $amount_deb = 0; $amount_cred = 0; $prog = 0; bcscale(2); for ($i = 0; $i < count($letter->content); $i++) {
/******************************************************/ // Detail of a user /******************************************************/ $compteur = 0; $header = new Sort_Table(); $url = basename($_SERVER['PHP_SELF']) . "?action=" . $_REQUEST['action']; $header->add(_("Login"), $url, " order by use_login asc", "order by use_login desc", "la", "ld"); $header->add(_("Nom"), $url, " order by use_name asc,use_first_name asc", "order by use_name desc,use_first_name desc", "na", "nd"); $header->add(_('Dossier'), $url, ' order by ag_dossier asc', 'order by ag_dossier desc', 'da', 'dd'); $header->add(_("Actif"), $url, " order by use_active asc", "order by use_active desc", "aa", "ad"); $ord = isset($_REQUEST['ord']) ? $_REQUEST['ord'] : 'la'; $sql = $header->get_sql_order($ord); $a_user = $repo->get_user_folder($sql); if (!empty($a_user)) { echo '<span style="display:block">'; echo _('Filtre') . HtmlInput::infobulle(22); echo HtmlInput::filter_table("user", "0,1,2,5", "1"); echo '</span>'; echo '<table id="user" class="result">'; echo '<tr>'; echo '<th>' . $header->get_header(0) . '</th>'; echo '<th>' . $header->get_header(1) . '</th>'; echo th(_("Prénom")); echo '<th>' . $header->get_header(3) . '</th>'; echo "<th>" . _('Type') . "</th>"; echo '<th>' . $header->get_header(2) . '</th>'; echo '</tr>'; foreach ($a_user as $r_user) { $compteur++; $class = $compteur % 2 == 0 ? "odd" : "even"; echo "<tr class=\"{$class}\">";
for ($i = 0; $i < count($plan); $i++) { ?> <th> <?php echo $plan[$i]['pa_name']; ?> </th> <?php } ?> <th style="text-align: right"> <?php echo _('Pourcentage'); ?> <?php echo HtmlInput::infobulle(41); ?> </th> </tr> <?php $count_row = count($a_row); if ($count_row == 0) { $a_row[0]['ke_row'] = 1; $a_row[0]['ke_percent'] = 0; $a_row[0]['ke_id'] = -1; } $tot_key = 0; for ($j = 0; $j < count($a_row); $j++) { ?> <tr> <td>
} echo _('Filtre'); ?> <?php echo HtmlInput::infobulle(26); echo HtmlInput::filter_table("tb_fiche", "0,1,2,3,4,5", 1); ?> : <table id="tb_fiche" class="sorttable" style="width:100%"> <tr> <th> <?php echo _("Quick Code"); ?> <?php echo HtmlInput::infobulle(17); ?> </th> <th class=" sorttable_sorted"> Nom <span id="sorttable_sortfwdind"> ▾</span> </th> <th> <?php echo _("Categorie"); ?> </th> <th> <?php echo _("Description"); ?>
$filter_year = " where p_exercice='" . sql_string($exercice) . "'"; $periode_start = $cn->make_array("select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode {$filter_year} order by p_start,p_end"); $w->selected = isset($_GET['from_periode']) ? $_GET['from_periode'] : ''; print td('Depuis') . $w->input('from_periode', $periode_start); print '</TR>'; print '<TR>'; $periode_end = $cn->make_array("select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode {$filter_year} order by p_start,p_end"); $w->selected = isset($_GET['to_periode']) ? $_GET['to_periode'] : ''; print td('Jusque ') . $w->input('to_periode', $periode_end); print "</TR><TR>"; $a = array(array('value' => 0, 'label' => 'Ecriture comptable'), array('value' => 1, 'label' => 'Liste opérations'), array('value' => 2, 'label' => 'Avec Détails opérations ')); $w->selected = 1; print '</TR>'; print '<TR>'; $w->selected = isset($_GET['p_simple']) ? $_GET['p_simple'] : ''; echo '<td>Style d\'impression ' . HtmlInput::infobulle(32) . '</td>' . $w->input('p_simple', $a); print "</TR>"; echo '</TABLE>'; print HtmlInput::submit('bt_html', 'Visualisation'); echo '</FORM>'; echo '<hr>'; //----------------------------------------------------- // If print is asked // First time in html // after in pdf or cvs //----------------------------------------------------- if (isset($_REQUEST['bt_html'])) { require_once NOALYSS_INCLUDE . '/class_acc_ledger.php'; $d = var_export($_GET, true); $Jrn = new Acc_Ledger($cn, $_GET['jrn_id']); $Jrn->get_name();
function Summary($p_search = "", $p_action = "", $p_sql = "", $p_amount = false) { global $g_user; $bank = new Acc_Parm_Code($this->cn, 'BANQUE'); $cash = new Acc_Parm_Code($this->cn, 'CAISSE'); $cc = new Acc_Parm_Code($this->cn, 'COMPTE_COURANT'); bcscale(4); $gDossier = dossier::id(); $p_search = sql_string($p_search); $script = $_SERVER['PHP_SELF']; // Creation of the nav bar // Get the max numberRow $filter_amount = ''; global $g_user; $filter_year = " j_tech_per in (select p_id from parm_periode " . "where p_exercice='" . $g_user->get_exercice() . "')"; if ($p_amount) { $filter_amount = ' and f_id in (select f_id from jrnx where ' . $filter_year . ')'; } $all_tiers = $this->count_by_modele($this->fiche_def_ref, "", $p_sql . $filter_amount); // Get offset and page variable $offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0; $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1; $bar = navigation_bar($offset, $all_tiers, $_SESSION['g_pagesize'], $page); // set a filter ? $search = $p_sql; $exercice = $g_user->get_exercice(); $tPeriode = new Periode($this->cn); list($max, $min) = $tPeriode->get_limit($exercice); if (trim($p_search) != "") { $search .= " and f_id in\n (select distinct f_id from fiche_detail\n where\n ad_id in (1,32,30,23,18,13) and ad_value ~* '{$p_search}')"; } // Get The result Array $step_tiers = $this->get_by_category($offset, $search . $filter_amount, 'name'); if ($all_tiers == 0 || count($step_tiers) == 0) { return ""; } $r = ""; $r .= _("Filtre rapide ") . HtmlInput::filter_table("tiers_tb", '0,1,2', 1); $r .= $bar; $r .= '<table id="tiers_tb" class="sortable" style="width:90%;margin-left:5%"> <TR > <TH>' . _('Quick Code') . HtmlInput::infobulle(17) . '</TH>' . '<th>' . _('Poste comptable') . '</th>' . '<th class="sorttable_sorted_reverse">' . _('Nom') . '<span id="sorttable_sortrevind"> ▴</span>' . '</th> <th>' . _('Adresse') . '</th> <th style="text-align:right">' . _('Total débit') . '</th> <th style="text-align:right">' . _('Total crédit') . '</th> <th style="text-align:right">' . _('Solde') . '</th>'; $r .= '</TR>'; if (sizeof($step_tiers) == 0) { return $r; } $i = 0; $deb = 0; $cred = 0; foreach ($step_tiers as $tiers) { $i++; /* Filter on the default year */ $amount = $tiers->get_solde_detail($filter_year); /* skip the tiers without operation */ if ($p_amount && $amount['debit'] == 0 && $amount['credit'] == 0 && $amount['solde'] == 0) { continue; } $odd = ""; $odd = $i % 2 == 0 ? ' odd ' : ' even '; $accounting = $tiers->strAttribut(ATTR_DEF_ACCOUNT); if ($p_action == 'bank' && $amount['debit'] < $amount['credit']) { if (strpos($accounting, $bank->p_value) === 0 || strpos($accounting, $cash->p_value) === 0 || strpos($accounting, $cc->p_value) === 0) { //put in red if c>d $odd .= " notice "; } } $odd = ' class="' . $odd . '"'; $r .= "<TR {$odd}>"; $url_detail = $script . '?' . http_build_query(array('sb' => 'detail', 'sc' => 'sv', 'ac' => $_REQUEST['ac'], 'f_id' => $tiers->id, 'gDossier' => $gDossier)); $e = sprintf('<A HREF="%s" title="Détail" class="line"> ', $url_detail); $r .= "<TD> {$e}" . $tiers->strAttribut(ATTR_DEF_QUICKCODE) . "</A></TD>"; $r .= "<TD> {$e}" . $accounting . "</TD>"; $r .= "<TD>" . h($tiers->strAttribut(ATTR_DEF_NAME)) . "</TD>"; $r .= "<TD>" . h($tiers->strAttribut(ATTR_DEF_ADRESS) . " " . $tiers->strAttribut(ATTR_DEF_CP) . " " . $tiers->strAttribut(ATTR_DEF_PAYS)) . "</TD>"; $str_deb = $amount['debit'] == 0 ? 0 : nbm($amount['debit']); $str_cred = $amount['credit'] == 0 ? 0 : nbm($amount['credit']); $str_solde = nbm($amount['solde']); $r .= '<TD sorttable_customkey="' . $amount['debit'] . '" align="right"> ' . $str_deb . '</TD>'; $r .= '<TD sorttable_customkey="' . $amount['credit'] . '" align="right"> ' . $str_cred . '</TD>'; $side = $amount['debit'] > $amount['credit'] ? 'D' : 'C'; $side = $amount['debit'] == $amount['credit'] ? '=' : $side; $red = ""; if ($p_action == 'customer' && $amount['debit'] < $amount['credit']) { //put in red if d>c $red = " notice "; } if ($p_action == 'supplier' && $amount['debit'] > $amount['credit']) { //put in red if c>d $red = " notice "; } $r .= '<TD class="' . $red . '" sorttable_customkey="' . $amount['solde'] . '" align="right"> ' . $str_solde . "{$side} </TD>"; $deb = bcadd($deb, $amount['debit']); $cred = bcadd($cred, $amount['credit']); $r .= "</TR>"; } $r .= "<tfoot >"; $solde = abs(bcsub($deb, $cred)); $side = $deb > $cred ? 'Débit' : 'Crédit'; $r .= '<tr class="highlight">'; $r .= td("") . td("") . td("") . td("Totaux") . td(nbm($deb), 'class="num"') . td(nbm($cred), 'class="num"') . td(" {$side} " . nbm($solde), 'class="num"'); $r .= '</tr>'; $r .= "</tfoot>"; $r .= "</TABLE>"; $r .= $bar; return $r; }
* * \brief show bank saldo * */ if (!defined('ALLOWED')) { die('Appel direct ne sont pas permis'); } require_once NOALYSS_INCLUDE . '/class_acc_parm_code.php'; echo '<div class="content">'; $fiche = new Fiche($cn); $array = $fiche->get_bk_account(); echo '<div class="content">'; echo dossier::hidden(); echo _('Filtre :') . HtmlInput::filter_table("fin_saldo_tb", '0,1,2,3', '1'); echo '<table class="sortable" style="margin-left:10%;width:80%" class="result" id="fin_saldo_tb">'; echo tr(th('Quick Code', ' class=" sorttable_sorted_reverse"', HtmlInput::infobulle(17) . '<span id="sorttable_sortrevind"> ▴</span>') . th('Compte en banque', ' style="text-align:left"') . th('Journal', ' style="text-align:center"') . th('Description', ' style="text-align:center"') . th('solde opération', ' style="text-align:right" class="sorttable_numeric"') . th('solde extrait/relevé', ' style="text-align:right" class="sorttable_numeric"') . th('différence', ' style="text-align:right" class="sorttable_numeric"')); // Filter the saldo // on the current year $filter_year = " j_tech_per in (select p_id from parm_periode where p_exercice='" . $g_user->get_exercice() . "')"; // for highligting tje line $idx = 0; bcscale(2); $tot_extrait = 0; $tot_diff = 0; $tot_operation = 0; // for each account for ($i = 0; $i < count($array); $i++) { if ($array[$i]->id == 0) { echo '<tr >'; echo td(h2("Journal mal configuré", ' class="error" '), ' colspan="5" style="width:auto" '); echo '</tr>';
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; }
<td> <?php echo $f_date_start->input(); ?> <?php echo _('et'); ?> <?php echo $f_date_end->input(); ?> </td> </tr> <tr> <td style="text-align:right;width:30em"> <?php echo _('Et paiement compris entre les date ') . HtmlInput::infobulle(36); ?> </td> <td> <?php echo $f_date_paid_start->input(); ?> <?php echo _('et'); ?> <?php echo $f_date_paid_end->input(); ?> </td> </tr>
?> </form> <?php echo _('Filtre'), HtmlInput::filter_table('menu_tb', '0,1,2,4', '1'); ?> </fieldset> <?php $gDossier = Dossier::id(); echo HtmlInput::button("Add_plugin", _("Ajout d'un plugin"), "onclick=add_plugin({$gDossier})"); echo HtmlInput::button("Add_menu", _("Ajout d'un menu"), "onclick=create_menu({$gDossier})"); echo '<table class="result" id="menu_tb">'; echo '<tr>'; echo '<th>' . $table->get_header(0) . '</th>'; echo '<th>' . $table->get_header(1) . '</th>'; echo '<th>' . $table->get_header(2) . '</th>'; echo '<th>' . $table->get_header(3) . HtmlInput::infobulle(33) . '</th>'; echo '<th>' . $table->get_header(4) . '</th>'; echo '<th>' . $table->get_header(5) . '</th>'; echo '<th>' . $table->get_header(6) . '</th>'; echo '<th>' . $table->get_header(7) . '</th>'; echo '</tr>'; for ($i = 0; $i < Database::num_row($ret); $i++) { $row = $menu->get_object($ret, $i); $js = $row->me_code; switch ($row->me_type) { case 'PL': $js = sprintf('<A class="line" href="javascript:void(0)" onclick="mod_plugin(\'%s\',\'%s\')">%s</A>', $gDossier, $row->me_code, $row->me_code); break; case 'ME': $js = sprintf('<A class="line" href="javascript:void(0)" onclick="modify_menu(\'%s\',\'%s\')">%s</A>', $gDossier, $row->me_code, $row->me_code); break;
$cn->exec_sql('drop database ' . $name); exit; } $new_cn = new Database($id, 'mod'); $new_cn->apply_patch($name, 0); echo '<span class="error">' . _('Ne pas recharger la page, sinon votre base de données sera restaurée une fois de plus') . '</span>'; echo $retour; echo '</div>'; } } else { echo '<div class="content" style="width:80%;margin-left:10%">'; echo '<form method="POST" action="admin_repo.php" enctype="multipart/form-data" >'; echo HtmlInput::hidden('action', 'restore'); echo HtmlInput::hidden('sa', 'r'); echo '<table>'; echo '<tr><td>' . _("Nom de la base de donnée") . HtmlInput::infobulle(29) . '</td>'; $wNom = new IText(); $wNom->name = "database"; $wNom->size = 30; echo '<td>' . $wNom->input() . '</td></tr>'; echo '<tr><td>' . _("Type de backup") . " :" . '</td>'; $chk = new IRadio(); $chk->name = "t"; $chk->value = "d"; echo '<td> ' . $chk->input() . _("Dossier") . '</td>'; echo '</tr><tr><td></td>'; $chk->name = "t"; $chk->value = "m"; echo '<td>' . $chk->input() . _("Modele") . '</td>'; echo '<tr>'; $file = new IFile();
echo HtmlInput::infobulle(40); ?> </TD> <TD> <?php echo $last_seq; ?> </TD> </TR> <tr> <TD><?php echo _('N° pièce justificative'); ?> <?php echo HtmlInput::infobulle(38); ?> </TD> <TD> <?php echo $pj_seq; ?> </TD> </tr> <?php } ?> <tr> <td style="width: 200px"> <?php
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; }
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; }
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; }
echo HtmlInput::infobulle(207); ?> </td> <td><?php echo $smulti->input(); ?> </td> </tr> <tr id="div_db" style="visibility:hidden"> <td> Nom base de donnée </td> <td> <?php echo $icdbname->input(); echo HtmlInput::infobulle(206); ?> </td> </tr> </table> </div> <div class="notice"> <?php if ($os == 1) { ?> Attention : si vous installez sous windows n'utilisez pas le \ mais plutôt le / dans les nom de répertoire (càd les chemins ou path) <?php } ?> </div>
<?php echo $str_add_button; ?> <fieldset><legend><?php echo _('Opérations'); ?> </legend> <table id="fin_item" width="100%" border="0"> <tr> <th id="thdate" style="display:none;text-align: left"><?php echo _('Date'); echo HtmlInput::infobulle(16); ?> </TH> <th style="text-align: left;width: auto">code<?php HtmlInput::infobulle(0); ?> </TH> <th style="text-align: left"><?php echo _('Fiche'); ?> </TH> <th style="text-align: left"><?php echo _('Commentaire'); ?> </TH> <th style="text-align: left"><?php echo _('Montant'); ?> </TH> <th style="text-align: left;width:auto"colspan="2"> <?php
<table> <tr> <td><?php echo _(" Bon de commande"); ?> :</td><td> <?php echo HtmlInput::infobulle(31) . " " . $cmd->input(); ?> </td> </tr> <tr> <td> <?php echo _("Autre information"); ?> : </td><td><?php echo HtmlInput::infobulle(30) . " " . $other->input(); ?> </td> </tr> </table> </div> <div id="linked_operation_div<?php echo $div; ?> " style="display:<?php echo $a_tab['linked_operation_div']['display']; ?> " class="myfieldset"> <?php // display title only in popup if ($div == 'popup') {
function confirm($p_array, $p_summary = false) { global $g_parameter; extract($p_array); // we don't need to verify if we need only a feedback if (!$p_summary) { $this->verify($p_array); } $anc = null; // to show a select list for the analytic // if analytic is op (optionnel) there is a blank line bcscale(4); $client = new Fiche($this->db); $client->get_by_qcode($e_client, true); $client_name = h($client->getName() . ' ' . $client->strAttribut(ATTR_DEF_ADRESS) . ' ' . $client->strAttribut(ATTR_DEF_CP) . ' ' . $client->strAttribut(ATTR_DEF_CITY)); $lPeriode = new Periode($this->db); if ($this->check_periode() == true) { $lPeriode->p_id = $period; } else { $lPeriode->find_periode($e_date); } $date_limit = $lPeriode->get_date_limit(); $r = ""; $r .= '<TABLE>'; if ($p_summary) { $jr_id = $this->db->get_value('select jr_id from jrn where jr_internal=$1', array($this->internal)); $r .= "<tr>"; $r .= '<td>'; $r .= _('Détail opération '); $r .= '</td>'; $r .= '<td>'; $r .= sprintf('<a class="line" style="display:inline" href="javascript:modifyOperation(%d,%d)">%s</a>', $jr_id, dossier::id(), $this->internal); $r .= '</td>'; $r .= "</tr>"; } $r .= '<tr>'; if (!$p_summary) { $r .= '<td>' . _('Numéro Pièce') . '</td><td>' . hb($e_pj) . '</td>'; } else { if (strcmp($this->pj, $e_pj) != 0) { $r .= '<td>' . _('Numéro Pièce') . '</td><td>' . hb($this->pj) . '<span class="notice"> ' . _('Attention numéro pièce existante, elle a du être adaptée') . '</span></td>'; } else { $r .= '<td>' . _('Numéro Pièce') . '</td><td>' . hb($this->pj) . '</td>'; } } $r .= '</tr>'; $r .= '<td> ' . _('Date') . '</td><td> ' . hb($e_date) . '</td>'; $r .= '</tr>'; $r .= '<tr>'; $r .= '<td>' . _('Echeance') . '</td><td> ' . hb($e_ech) . '</td>'; $r .= '</tr>'; $r .= '<tr>'; $r .= '<td> ' . _('Période Comptable') . '</td><td> ' . hb($date_limit['p_start'] . '-' . $date_limit['p_end']) . '</td>'; $r .= '</tr>'; $r .= '<tr>'; $r .= '<td> ' . _('Journal') . '</td><td> ' . hb($this->get_name()) . '</td>'; $r .= '</tr>'; $r .= '<tr>'; $r .= '<td> ' . _('Libellé') . '</td><td> ' . hb($e_comm) . '</td>'; $r .= '</tr>'; $r .= '<tr>'; $r .= '<tr>'; $r .= '<td> ' . _('Fournisseur') . '</td><td> ' . hb($e_client . ':' . $client_name) . '</td>'; $r .= '</tr>'; $r .= '</table>'; $r .= '<h2>' . _('Détail articles achetés') . '</h2>'; $r .= '<p class="decale">'; $r .= '<table class="result" >'; $r .= '<TR>'; $r .= "<th>" . _('Code') . "</th>"; $r .= "<th>" . _('Dénomination') . "</th>"; $r .= "<th style=\"text-align:right\">" . _('prix') . "</th>"; $r .= "<th style=\"text-align:right\">" . _('quantité') . "</th>"; if ($g_parameter->MY_TVA_USE == 'Y') { $r .= "<th style=\"text-align:right\">" . _('tva') . "</th>"; $r .= '<th style="text-align:right"> ' . _('Montant TVA') . '</th>'; $r .= '<th style="text-align:right">' . _('Montant HTVA') . '</th>'; $r .= '<th style="text-align:right">' . _('Montant TVAC') . '</th>'; } else { $r .= '<th style="text-align:right">' . _('Montant') . '</th>'; } /* if we use the AC */ if ($g_parameter->MY_ANALYTIC != 'nu') { $anc = new Anc_Plan($this->db); $a_anc = $anc->get_list(); $x = count($a_anc); /* set the width of the col */ $r .= '<th colspan="' . $x . '">' . _('Compt. Analytique') . '</th>'; /* add hidden variables pa[] to hold the value of pa_id */ $r .= Anc_Plan::hidden($a_anc); } $r .= '</tr>'; $tot_amount = 0.0; $tot_tva = 0.0; //-- // For each item //-- for ($i = 0; $i < $nb_item; $i++) { $tot_row = 0; if (strlen(trim(${"e_march" . $i})) == 0) { continue; } /* retrieve information for card */ $fiche = new Fiche($this->db); $fiche->get_by_qcode(${"e_march" . $i}); if ($g_parameter->MY_UPDLAB == 'Y') { $fiche_name = h(${"e_march" . $i . "_label"}); } else { $fiche_name = $fiche->strAttribut(ATTR_DEF_NAME); } $amount = bcmul(${"e_march" . $i . "_price"}, ${'e_quant' . $i}); if ($g_parameter->MY_TVA_USE == 'Y') { $idx_tva = ${"e_march" . $i . "_tva_id"}; $oTva = new Acc_Tva($this->db); $oTva->set_parameter('id', $idx_tva); $oTva->load(); $op = new Acc_Compute(); $op->set_parameter("amount", $amount); $op->set_parameter('amount_vat_rate', $oTva->get_parameter('rate')); $op->compute_vat(); $tva_computed = $op->get_parameter('amount_vat'); //----- if tva_amount is not given we compute the vat ---- if (strlen(trim(${'e_march' . $i . '_tva_amount'})) == 0) { $tva_item = $op->get_parameter('amount_vat'); } else { $tva_item = round(${'e_march' . $i . '_tva_amount'}, 2); } if (isset($tva[$idx_tva])) { $tva[$idx_tva] = bcadd($tva_item, $tva[$idx_tva]); } else { $tva[$idx_tva] = $tva_item; } } $tot_amount = round(bcadd($tot_amount, $amount), 2); $tot_row = round(bcadd($tot_row, $amount), 2); $r .= '<tr>'; $r .= '<td>'; $r .= ${"e_march" . $i}; $r .= '</td>'; $r .= '<TD style="border-bottom:1px dotted grey;">'; $r .= $fiche_name; $r .= '</td>'; $r .= '<td class="num">'; $r .= nbm(${"e_march" . $i . "_price"}); $r .= '</td>'; $r .= '<td class="num">'; $r .= nbm(${"e_quant" . $i}); $r .= '</td>'; $both_side = 0; if ($g_parameter->MY_TVA_USE == 'Y') { $r .= '<td class="num">'; $r .= $oTva->get_parameter('label'); $both_side = $oTva->get_parameter("both_side"); if ($both_side == 0) { $tot_row = bcadd($tot_row, $tva_item); $tot_tva = round(bcadd($tva_item, $tot_tva), 2); } $r .= '</td>'; /* warning if tva_computed and given are not the same */ $css_void_tva = $both_side == 1 ? 'style="text-decoration:line-through"' : ''; if (bcsub($tva_item, $tva_computed) != 0 && !($tva_item == 0 && $both_side == 1)) { $r .= '<td style="background-color:red" class="num" ' . $css_void_tva . '>'; $r .= HtmlInput::infobulle(28); $r .= '<a href="#" class="error" style="display:inline" title="' . _("Attention Différence entre TVA calculée et donnée") . '">' . nbm($tva_item) . '<a>'; } else { $r .= '<td class="num" ' . $css_void_tva . '>'; $r .= nbm($tva_item); } $r .= '</td>'; $r .= '<td class="num"> '; $r .= nbm(round($amount, 2)); $r .= '</td>'; } $r .= '<td class="num">'; $r .= nbm(round($tot_row, 2)); $r .= '</td>'; // encode the pa if ($g_parameter->MY_ANALYTIC != 'nu') { // show form $anc_op = new Anc_Operation($this->db); $null = $g_parameter->MY_ANALYTIC == 'op' ? 1 : 0; $r .= '<td>'; $p_mode = $p_summary == false ? 1 : 0; $p_array['pa_id'] = $a_anc; /* op is the operation it contains either a sequence or a jrnx.j_id */ $r .= HtmlInput::hidden('op[]=', $i); $r .= $anc_op->display_form_plan($p_array, $null, $p_mode, $i, $amount); $r .= '</td>'; } $r .= '</tr>'; } // Add the sum $decalage = $g_parameter->MY_TVA_USE == 'Y' ? '<td></td><td></td><td></td><td></td>' : '<td></td>'; $tot = round(bcadd($tot_amount, $tot_tva), 2); $tot_tva = nbm($tot_tva); $tot = nbm($tot); $str_tot = _('Totaux'); $tot_amount = nbm($tot_amount); $r .= <<<EOF <tr class="highlight"> {$decalage} <td> {$str_tot} </td> <td class="num"> {$tot_tva} </td> <td class="num"> {$tot_amount} </td> <td class="num"> {$tot} </td> EOF; $r .= '</table>'; $r .= '</p>'; if ($g_parameter->MY_ANALYTIC != 'nu' && !$p_summary) { // use of AA $r .= '<input type="button" class="button" value="' . _('Vérifiez imputation analytique') . '" onClick="verify_ca(\'\');">'; } $r .= !$p_summary ? '<div id="total_div_id" >' : '<div>'; $r .= '<h2>Totaux</h2>'; /* use VAT */ if ($g_parameter->MY_TVA_USE == 'Y') { $r .= '<table>'; $r .= '<tr><td>Total HTVA</td>'; $r .= td(hb($tot_amount), 'class="num"'); foreach ($tva as $i => $value) { $oTva->set_parameter('id', $i); $oTva->load(); $r .= '<tr><td> TVA ' . $oTva->get_parameter('label') . '</td>'; $r .= td(hb(nbm($tva[$i])), 'class="num"'); } $r .= '<tr>' . td(_('Total TVA')) . td(hb($tot_tva), 'class="num"'); $r .= '<tr>' . td(_('Total TVAC')) . td(hb($tot), 'class="num"'); $r .= '</table>'; } else { $r .= '<br>Total ' . hb($tot); } $r .= '</div>'; /* Add hidden */ $r .= HtmlInput::hidden('e_client', $e_client); $r .= HtmlInput::hidden('nb_item', $nb_item); $r .= HtmlInput::hidden('p_jrn', $p_jrn); if (isset($period)) { $r .= HtmlInput::hidden('period', $period); } $r .= HtmlInput::hidden('e_comm', $e_comm); $r .= HtmlInput::hidden('e_date', $e_date); $r .= HtmlInput::hidden('e_ech', $e_ech); $r .= HtmlInput::hidden('jrn_type', $jrn_type); $r .= HtmlInput::hidden('e_pj', $e_pj); $r .= HtmlInput::hidden('e_pj_suggest', $e_pj_suggest); $mt = microtime(true); $r .= HtmlInput::hidden('mt', $mt); $e_mp = isset($e_mp) ? $e_mp : 0; $r .= HtmlInput::hidden('e_mp', $e_mp); /* Paid by */ /* if the paymethod is not 0 and if a quick code is given */ for ($i = 0; $i < $nb_item; $i++) { $r .= HtmlInput::hidden("e_march" . $i, ${"e_march" . $i}); if (isset(${"e_march" . $i . "_label"})) { $r .= HtmlInput::hidden("e_march" . $i . "_label", ${"e_march" . $i . "_label"}); } $r .= HtmlInput::hidden("e_march" . $i . "_price", ${"e_march" . $i . "_price"}); if ($g_parameter->MY_TVA_USE == 'Y') { $r .= HtmlInput::hidden("e_march" . $i . "_tva_id", ${"e_march" . $i . "_tva_id"}); $r .= HtmlInput::hidden('e_march' . $i . '_tva_amount', ${'e_march' . $i . '_tva_amount'}); } $r .= HtmlInput::hidden("e_quant" . $i, ${"e_quant" . $i}); } /** * */ if ($e_mp != 0 && strlen(trim(${'e_mp_qcode_' . $e_mp})) != 0) { $r .= HtmlInput::hidden('e_mp_qcode_' . $e_mp, ${'e_mp_qcode_' . $e_mp}); $r .= HtmlInput::hidden('acompte', $acompte); $r .= HtmlInput::hidden('e_comm_paiement', $e_comm_paiement); /* needed for generating a invoice */ $r .= HtmlInput::hidden('qcode_benef', ${'e_mp_qcode_' . $e_mp}); $fname = new Fiche($this->db); $fname->get_by_qcode(${'e_mp_qcode_' . $e_mp}); $r .= '<h2>' . _("Payé par") . " " . ${'e_mp_qcode_' . $e_mp} . " " . $fname->getName() . '</h2> ' . '<p class="decale">' . _('Déduction acompte ') . h($acompte) . '</p>' . _('Libellé :') . h($e_comm_paiement); $r .= '<br>'; $r .= '<br>'; } // check for upload piece return $r; }