noalyss Version-9
acc_ledger_history_financial.class.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * PhpCompta is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * NOALYSS is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with PhpCompta; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
21
22
23/**
24 * @file
25 * @brief display financial operations in HTML , PDF or CSV
26 *
27 */
28/**
29 * @class Acc_Ledger_History_Financial
30 * @brief display financial operations in HTML , PDF or CSV
31 *
32 */
34{
35 function __construct(Database $cn, $pa_ledger, $p_from, $p_to, $p_mode)
36 {
37 parent::__construct($cn, $pa_ledger, $p_from, $p_to, $p_mode);
38 $this->ledger_type='FIN';
39 }
40 /**
41 * @brief display the accounting
42 */
43 public function export_accounting_html()
44 {
45 $ledger_history=new Acc_Ledger_History_Generic($this->db,
46 $this->ma_ledger, $this->m_from, $this->m_to, $this->m_mode);
47 $ledger_history->export_accounting_html();
48 }
49
50 public function export_detail_html()
51 {
52 $this->export_oneline_html();
53 }
54
55 public function export_extended_html()
56 {
57 $ledger_history=new Acc_Ledger_History_Generic($this->db,
58 $this->ma_ledger, $this->m_from, $this->m_to, $this->m_mode);
59 $ledger_history->export_accounting_html();
60 }
61
62 /**
63 * @brief display in HTML following the mode
64 */
65 function export_html()
66 {
67 switch ($this->m_mode)
68 {
69 case "E":
71 break;
72 case "D":
73 $this->export_oneline_html();
74 break;
75 case "L":
76 $this->export_oneline_html();
77 break;
78 case "A":
80 break;
81 default:
82 break;
83 }
84 }
85
86 /**
87 * display in HTML one operation by line
88 */
89 public function export_oneline_html()
90 {
91 $this->get_row();
92
94 require_once NOALYSS_TEMPLATE.'/acc_ledger_history_financial_oneline.php';
95
96 }
97
98 /**
99 * Get the rows from jrnx and quant* tables
100 * @param int $p_limit max of rows to returns
101 * @param int $p_offset the number of rows to skip
102 */
103 public function get_row($p_limit=-1, $p_offset="")
104 {
105 $periode=sql_filter_per($this->db, $this->m_from, $this->m_to, 'p_id',
106 'jr_tech_per');
107
108 $cond_limite=($p_limit!=-1)?" limit ".$p_limit." offset ".$p_offset:"";
109
110 $ledger_list=join(",", $this->ma_ledger);
111 $sql="
112 with detail as (
113 select x.f_id as f_id,
114 (select ad_value from fiche_detail where ad_id=1 and f_id=x.f_id) as name,
115 (select ad_value from fiche_detail where ad_id=32 and f_id=x.f_id) as first_name,
116 (select ad_value from fiche_detail where ad_id=23 and f_id=x.f_id) as qcode
117 from
118 fiche as x)
119 select
120 bk.f_id as bk_f_id,
121 bk.name as bk_name,
122 bk.first_name as bk_first_name,
123 bk.qcode as bk_qcode,
124 tiers.f_id as tiers_f_id,
125 tiers.name as tiers_name,
126 tiers.first_name as tiers_first_name,
127 tiers.qcode as tiers_qcode,
128 jr_id,
129 jr_pj_number,
130 to_char(jr_date,'DD.MM.YYYY') as str_date,
131 to_char(jr_date_paid,'DD.MM.YYYY') as str_date_paid,
132 jr_internal,
133 jrn.jr_comment,
134 jr_pj_name,
135 qf_amount,
136 currency_id,
137 currency_rate,
138 currency_rate_ref,
139 oc_amount,
140 oc_vat_amount,
141 currency.cr_code_iso
142 from
143 jrn
144 join quant_fin using (jr_id)
145 join detail as tiers on (tiers.f_id=qf_other)
146 join detail as bk on (bk.f_id=qf_bank)
147 left join operation_currency using(j_id)
148 join currency on (currency.id=jrn.currency_id)
149 where
150 jr_def_id in ({$ledger_list})
151 and {$periode}
152 {$cond_limite}
153 order by jr_date, substring(jr_pj_number,'[0-9]+$')::numeric ";
154 $this->data=$this->db->get_array($sql);
155 }
156 /**
157 * To get data
158 * @return array of rows
159 */
160 function get_data()
161 {
162 return $this->data;
163 }
164
165}
sql_filter_per($p_cn, $p_from, $p_to, $p_form='p_id', $p_field='jr_tech_per')
Create the condition to filter on the j_tech_per thanks a from and to date.
Definition: ac_common.php:682
display financial operations in HTML , PDF or CSV
export_extended_html()
display extended details of operation m_mode=E
export_html()
display in HTML following the mode
export_oneline_html()
display in HTML one operation by line
export_detail_html()
display detail of operations m_mode=D
__construct(Database $cn, $pa_ledger, $p_from, $p_to, $p_mode)
get_row($p_limit=-1, $p_offset="")
Get the rows from jrnx and quant* tables.
manage the list of operation when we need several ledger with a different type or from Misceleaneous ...
Display history of operation.
prepare_reconcile_date()
Prepare the query for fetching the linked operation @staticvar int $prepare.
contains the class for connecting to Noalyss
$SecUser db