function get_array_card($p_type, $p_extra = "") { switch ($p_type) { case 'X': $this->afiche = $this->cn->get_array("\n with m as (select distinct qp_supplier as f_id from quant_purchase union select qs_client from quant_sold)\n select distinct fiche.f_id as f_id ,f1.ad_value as name, f3.ad_value as first_name,f2.ad_value as quick_code \n from fiche \n join m on (fiche.f_id=m.f_id)\n join fiche_detail as f1 on (fiche.f_id=f1.f_id and f1.ad_id=1) \n join fiche_detail as f2 on (fiche.f_id=f2.f_id and f2.ad_id=23) \n left join fiche_detail as f3 on (fiche.f_id=f3.f_id and f3.ad_id=32)\n where \n fiche.fd_id=\$1\n order by f1.ad_value\n ", array($p_extra)); break; case 'U': $fiche = new Fiche($this->cn, $p_extra); $this->afiche[0]['f_id'] = $fiche->id; $this->afiche[0]['quick_code'] = $fiche->get_quick_code(); $this->afiche[0]['name'] = $fiche->strAttribut(ATTR_DEF_NAME, 0); $this->afiche[0]['first_name'] = $fiche->strAttribut(ATTR_DEF_FIRST_NAME, 0); break; case 'F': $this->afiche = $this->cn->get_array("\n select distinct qp_supplier as f_id ,f1.ad_value as name, f3.ad_value as first_name,f2.ad_value as quick_code \n from quant_purchase join \n fiche_detail as f1 on (qp_supplier=f1.f_id and f1.ad_id=1) \n join fiche_detail as f2 on (qp_supplier=f2.f_id and f2.ad_id=23) \n left join fiche_detail as f3 on (qp_supplier=f3.f_id and f3.ad_id=32)\n order by f1.ad_value\n "); break; case 'C': $this->afiche = $this->cn->get_array("\n select distinct qs_client as f_id ,f1.ad_value as name, f3.ad_value as first_name,f2.ad_value as quick_code \n from quant_sold join \n fiche_detail as f1 on (qs_client=f1.f_id and f1.ad_id=1) \n join fiche_detail as f2 on (qs_client=f2.f_id and f2.ad_id=23) \n left join fiche_detail as f3 on (qs_client=f3.f_id and f3.ad_id=32)\n order by f1.ad_value\n "); break; default: throw new Exception('Type invalide'); } }
?> </td> <td> <?php $date_paid = new IDate('p_date_paid'); $date_paid->value = format_date($obj->det->jr_date_paid); echo $date_paid->input(); ?> </td> </tr> <tr><td> <?php $bk = new Fiche($cn, $obj->det->array[0]['qp_supplier']); echo td(_('Fournisseur')); $view_card_detail = HtmlInput::card_detail($bk->get_quick_code(), h($bk->getName()), ' class="line" '); echo td($view_card_detail); ?> </td> </tr> <tr> <td> <?php $itext = new IText('npj'); $itext->value = strip_tags($obj->det->jr_pj_number); echo td(_('Pièce')) . td($itext->input()); ?> </td> <tr> <td> <?php
$op = new Acc_Operation($cn); $op->jr_id = $detail['jr_id']; $op->poste = $_GET['poste_id']; echo $op->display_jrnx_detail(1); } echo '</table>'; echo Acc_Account_Ledger::HtmlTableHeader(); } echo "</div>"; exit; } // A QuickCode is given if ($go == 2) { if (!isset($_REQUEST['oper_detail'])) { echo '<div class="content">'; echo '<h2 class="info"> ' . '(' . $fiche->id . ')' . $fiche->getName() . ' ' . ' [ ' . $fiche->get_quick_code() . ' ] ' . '</h2>'; $fiche->HtmlTableHeader(); $fiche->HtmlTable(null, $_GET['ople']); $fiche->HtmlTableHeader(); echo "</div>"; } else { // Detail // echo '<div class="content">'; echo '<h2 class="info"> ' . '(' . $fiche->id . ')' . $fiche->getName() . ' ' . ' [ ' . $fiche->get_quick_code() . ' ] ' . '<h2>'; $fiche->HtmlTableHeader(); $fiche->HtmlTableDetail(); $fiche->HtmlTableHeader(); echo "</div>"; } exit; }
/** *@brief retrieve the client name and quick_code *@param $p_jr_id jrn.jr_id *@param $p_jrn_type ledger type ACH VEN FIN *@return array (0=>qcode,1=>name) or for FIN 0=>customer qc 1=>customer name 2=>bank qc 3=>bank name *@see class_print_ledger_simple, class_print_ledger_simple_without_vat */ function get_tiers($p_jr_id, $p_jrn_type) { if ($p_jrn_type == 'ACH') { $array = $this->cn->get_array('SELECT jrnx.j_grpt, quant_purchase.qp_supplier, quant_purchase.qp_internal, jrn.jr_internal FROM public.quant_purchase, public.jrnx, public.jrn WHERE quant_purchase.j_id = jrnx.j_id AND jrnx.j_grpt = jrn.jr_grpt_id and jr_id=$1', array($p_jr_id)); if (count($array) == 0) { return array("ERREUR {$p_jr_id}", ''); } $customer_id = $array[0]['qp_supplier']; $fiche = new Fiche($this->cn, $customer_id); $customer_qc = $fiche->get_quick_code($customer_id); $customer_name = $fiche->getName(); return array($customer_qc, $customer_name); } if ($p_jrn_type == 'VEN') { $array = $this->cn->get_array('SELECT quant_sold.qs_client FROM public.quant_sold, public.jrnx, public.jrn WHERE quant_sold.j_id = jrnx.j_id AND jrnx.j_grpt = jrn.jr_grpt_id and jr_id=$1', array($p_jr_id)); if (count($array) == 0) { return array("ERREUR {$p_jr_id}", ''); } $customer_id = $array[0]['qs_client']; $fiche = new Fiche($this->cn, $customer_id); $customer_qc = $fiche->get_quick_code($customer_id); $customer_name = $fiche->getName(); return array($customer_qc, $customer_name); } if ($p_jrn_type == 'FIN') { $array = $this->cn->get_array('SELECT qf_other,qf_bank FROM public.quant_fin WHERE quant_fin.jr_id =$1', array($p_jr_id)); if (count($array) == 0) { return array("ERREUR {$p_jr_id}", '', '', ''); } $customer_id = $array[0]['qf_other']; $fiche = new Fiche($this->cn, $customer_id); $customer_qc = $fiche->get_quick_code($customer_id); $customer_name = $fiche->getName(); $bank_id = $array[0]['qf_bank']; $fiche = new Fiche($this->cn, $bank_id); $bank_qc = $fiche->get_quick_code($bank_id); $bank_name = $fiche->getName(); return array($customer_qc, $customer_name, $bank_qc, $bank_name); } }
/*!\file * \brief this file is used for the follow up of the customer (mail, meeting...) * - sb = detail * - sc = sv * - sd = this parameter is used here * - $cn = database connection */ if (!defined('ALLOWED')) { die('Appel direct ne sont pas permis'); } require_once NOALYSS_INCLUDE . '/class_follow_up.php'; /** *\note problem with ShowActionList, this function is local * to the file action.inc.php. And this function must different for each * suivi */ $sub_action = isset($_REQUEST['sa']) ? $_REQUEST['sa'] : "list"; $ag_id = isset($_REQUEST['ag_id']) ? $_REQUEST['ag_id'] : 0; if (!isset($_GET['submit_query'])) { $_REQUEST['closed_action'] = 1; $_GET['closed_action'] = 1; } $p_action = $_REQUEST['ac']; $base = "ac={$p_action}&sc=sv&sb=detail&f_id=" . $_REQUEST['f_id'] . "&" . HtmlInput::request_to_string(array("closed_action", "remind_date_end", "remind_date", "sag_ref", "only_internal", "state", "gDossier", "qcode", "ag_dest", "query", "tdoc", "date_start", "date_end", "hsstate", "searchtag", "sb", "sc"), ""); $retour = HtmlInput::button_anchor('Retour', '?' . dossier::get() . '&' . $base); $fiche = new Fiche($cn, $_REQUEST['f_id']); $_GET['qcode'] = $fiche->get_quick_code(); $_REQUEST['qcode'] = $fiche->get_quick_code(); echo '<div class="content">'; require_once NOALYSS_INCLUDE . '/action.common.inc.php'; echo '</div>';
if (!defined('ALLOWED')) { die('Appel direct ne sont pas permis'); } include_once "ac_common.php"; require_once NOALYSS_INCLUDE . '/class_database.php'; require_once NOALYSS_INCLUDE . '/class_fiche.php'; $f_id = HtmlInput::default_value_request("f_id", "-"); if ($f_id == "-") { throw new Exception('Invalid parameter'); } require_once NOALYSS_INCLUDE . '/class_dossier.php'; $gDossier = dossier::id(); /* Admin. Dossier */ $cn = new Database($gDossier); $Fiche = new Fiche($cn, $f_id); $qcode = $Fiche->get_quick_code(); header('Content-type: application/csv'); header('Pragma: public'); header('Content-Disposition: attachment;filename="fiche-' . $qcode . '.csv"', FALSE); $Fiche->getName(); list($array, $tot_deb, $tot_cred) = $Fiche->get_row_date($_GET['from_periode'], $_GET['to_periode'], $_GET['ople']); if (count($Fiche->row) == 0) { echo "Aucune donnée"; return; } if (!isset($_REQUEST['oper_detail'])) { echo '"Qcode";' . "\"Date\";" . "\"n° pièce\";" . "\"Code interne\";" . '"Code journal";' . '"Nom journal";' . "\"Description\";" . "\"Débit\";" . "\"Crédit\";" . "\"Prog.\";" . "\"Let.\""; printf("\n"); $progress = 0; $current_exercice = ""; $tot_deb = 0;
/** * display detail of a ledger * */ function display_ledger() { if ($this->load() == -1) { throw new Exception(_("Journal n'existe pas"), -1); } $type = $this->jrn_def_type; $name = $this->jrn_def_name; $code = $this->jrn_def_code; $str_add_button = ""; /* widget for searching an account */ $wSearch = new IPoste(); $wSearch->set_attribute('ipopup', 'ipop_account'); $wSearch->set_attribute('account', 'p_jrn_class_deb'); $wSearch->set_attribute('no_overwrite', '1'); $wSearch->set_attribute('noquery', '1'); $wSearch->table = 3; $wSearch->name = "p_jrn_class_deb"; $wSearch->size = 20; $wSearch->value = $this->jrn_def_class_deb; $search = $wSearch->input(); $wPjPref = new IText(); $wPjPref->name = 'jrn_def_pj_pref'; $wPjPref->value = $this->jrn_def_pj_pref; $pj_pref = $wPjPref->input(); $wPjSeq = new INum(); $wPjSeq->value = 0; $wPjSeq->name = 'jrn_def_pj_seq'; $pj_seq = $wPjSeq->input(); $last_seq = $this->get_last_pj(); $name = $this->jrn_def_name; $hidden = HtmlInput::hidden('p_jrn', $this->id); $hidden .= HtmlInput::hidden('sa', 'detail'); $hidden .= dossier::hidden(); $hidden .= HtmlInput::hidden('p_jrn_deb_max_line', 10); $hidden .= HtmlInput::hidden('p_ech_lib', 'echeance'); $hidden .= HtmlInput::hidden('p_jrn_type', $type); $min_row = new INum("min_row", $this->jrn_deb_max_line); $min_row->prec = 0; $description = new ITextarea('p_description'); $description->style = 'class="itextarea" style="margin:0px;"'; $description->value = $this->jrn_def_description; $str_description = $description->input(); /* Load the card */ $card = $this->get_fiche_def(); $rdeb = explode(',', $card['deb']); $rcred = explode(',', $card['cred']); /* Numbering (only FIN) */ $num_op = new ICheckBox('numb_operation'); if ($this->jrn_def_num_op == 1) { $num_op->selected = true; } /* bank card */ $qcode_bank = ''; if ($type == 'FIN') { $f_id = $this->jrn_def_bank; if (isNumber($f_id) == 1) { $fBank = new Fiche($this->db, $f_id); $qcode_bank = $fBank->get_quick_code(); } } $new = 0; $cn = $this->db; echo $hidden; require_once NOALYSS_INCLUDE . '/template/param_jrn.php'; }
if (isset($_POST['record'])) { $letter = new Lettering_Account($cn); $letter->save($_POST); } //-------------------------------------------------------------------------------- // Show the result //-------------------------------------------------------------------------------- if (isset($_GET['start']) && isset($_GET['end'])) { if (isDate($_GET['start']) == null || isDate($_GET['end']) == null) { echo alert(_('Date malformée, désolé')); return; } } echo '<div id="list">'; $fiche = new Fiche($cn, $_REQUEST['f_id']); $quick_code = $fiche->get_quick_code(); $letter = new Lettering_Card($cn); $letter->set_parameter('quick_code', $quick_code); $letter->set_parameter('start', $start->value); $letter->set_parameter('end', $end->value); if ($sel->selected == 0) { echo $letter->show_list('all'); } if ($sel->selected == 1) { echo $letter->show_list('letter'); } if ($sel->selected == 2) { echo $letter->show_list('unletter'); } echo '</div>'; echo '<div id="detail" style="display:none">';
/** * Display the other concerned (tiers, supplier...) * @return string */ function display_linked() { $a_linked = $this->db->get_array('select ap_id,f_id from action_person where ag_id=$1', array($this->ag_id)); if (count($a_linked) == 0) { return ""; } for ($i = 0; $i < count($a_linked); $i++) { $fiche = new Fiche($this->db, $a_linked[$i]['f_id']); $qc = $fiche->get_quick_code(); $js_remove = sprintf("onclick=\"action_remove_concerned('%s','%s','%s')\"", dossier::id(), $a_linked[$i]['f_id'], $this->ag_id); echo '<span style="border:1px solid black;margin-right:5px;">'; echo $qc; echo HtmlInput::anchor(SMALLX, "javascript:void(0)", $js_remove, ' class="smallbutton" style="padding:0px;display:inline" '); echo '</span>'; echo ' '; echo ' '; } }
$ret = ""; $pdf = new PDF($cn); $pdf->setDossierInfo(" Periode : " . $_GET['from_periode'] . " - " . $_GET['to_periode']); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetAuthor('NOALYSS'); $pdf->setTitle("Détail fiche", true); $Fiche = new Fiche($cn, $f_id); list($array, $tot_deb, $tot_cred) = $Fiche->get_row_date($from_periode, $to_periode, $_GET['ople']); // don't print empty account if (count($array) == 0) { exit; } $size = array(13, 25, 20, 60, 12, 20, 20, 20); $align = array('L', 'C', 'C', 'L', 'R', 'R', 'R', 'R'); $Libelle = sprintf("(%s) %s [ %s ]", $Fiche->id, $Fiche->getName(), $Fiche->get_quick_code()); $pdf->SetFont('DejaVu', '', 10); $pdf->Cell(0, 8, $Libelle, 1, 0, 'C'); $pdf->Ln(); $pdf->SetFont('DejaVuCond', '', 8); $l = 0; $pdf->Cell($size[$l], 6, 'Date', 0, 0, 'L'); $l++; $pdf->Cell($size[$l], 6, 'Ref', 0, 0, 'C'); $l++; $pdf->Cell($size[$l], 6, 'Journal', 0, 0, 'C'); $l++; $pdf->Cell($size[$l], 6, 'Libellé', 0, 0, 'L'); $l++; $pdf->Cell($size[$l], 6, 'Let', 0, 0, 'R'); $l++;
* * NOALYSS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NOALYSS; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // Copyright Author Dany De Bontridder danydb@aevalys.eu /*!\file * \brief show all the operation for a customer * the variable inherited are * - $cn database connexion * - $_REQUEST['f_id'] the f_id of the card * - $p_action * - $sub_action * - $ss_action */ if (!defined('ALLOWED')) { die('Appel direct ne sont pas permis'); } require_once NOALYSS_INCLUDE . '/class_acc_ledger.php'; $f = new Fiche($cn, $_REQUEST['f_id']); $qcode = $f->get_quick_code(); $_GET['qcode'] = $qcode; $_REQUEST['qcode'] = $qcode; $var_array = compute_variable('ledger_type=ALL'); put_global($var_array); require_once NOALYSS_INCLUDE . '/history_operation.inc.php';
/*------------------------------------------------------------------------- * Ageing Balance of the card *-------------------------------------------------------------------------*/ if ($ss_action == 'balag') { require_once NOALYSS_INCLUDE . '/balance_card_ageing.inc.php'; } /*---------------------------------------------------------------------- * All the contact * *----------------------------------------------------------------------*/ if ($ss_action == 'cn') { echo '<div class="content">'; echo dossier::hidden(); $f = new Fiche($cn, $_REQUEST['f_id']); $contact = new Contact($cn); $contact->company = $f->get_quick_code(); echo $contact->summary(""); $sql = ' select fd_id from fiche_def where frd_id=' . FICHE_TYPE_CONTACT; $filter = $cn->make_list($sql); if (empty($filter)) { echo '<span class="notice">'; $url = "do.php?" . http_build_query(array('gDossier' => Dossier::id(), 'ac' => 'CFGCARD')); echo '<a class="line" href="' . $url . '" targer="_blank">'; echo _("Vous devez aller dans fiche et créer une catégorie pour les contacts"); echo '</a>'; echo '</span>'; return; } /* Add button */ $f_add_button = new IButton('add_card'); $f_add_button->label = _('Créer une nouvelle fiche');