[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 68/323: Task #0001530: Réécriture PRINTJRN A
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 68/323: Task #0001530: Réécriture PRINTJRN Add Financial Ledger Adapt test file |
Date: |
Wed, 14 Mar 2018 17:38:20 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit f88ea644fc1cd5f53c0a8b0f3db79b2dede68707
Author: Dany De Bontridder <address@hidden>
Date: Sun Jan 21 17:47:54 2018 +0100
Task #0001530: Réécriture PRINTJRN
Add Financial Ledger
Adapt test file
---
include/class/acc_ledger_history.class.php | 1 +
.../class/acc_ledger_history_financial.class.php | 118 ++++++++++++++++++++-
.../class/acc_ledger_history_purchase.class.php | 4 +-
.../acc_ledger_history_financial_oneline.php | 81 ++++++++++++++
scenario/acc_ledger_historyTest.php | 14 +++
5 files changed, 213 insertions(+), 5 deletions(-)
diff --git a/include/class/acc_ledger_history.class.php
b/include/class/acc_ledger_history.class.php
index 30b25da..8cfc254 100644
--- a/include/class/acc_ledger_history.class.php
+++ b/include/class/acc_ledger_history.class.php
@@ -27,6 +27,7 @@
require_once NOALYSS_INCLUDE."/class/acc_ledger_history_generic.class.php";
require_once NOALYSS_INCLUDE."/class/acc_ledger_history_sale.class.php";
require_once NOALYSS_INCLUDE."/class/acc_ledger_history_purchase.class.php";
+require_once NOALYSS_INCLUDE."/class/acc_ledger_history_financial.class.php";
/**
* @brief Display history of operation
*/
diff --git a/include/class/acc_ledger_history_financial.class.php
b/include/class/acc_ledger_history_financial.class.php
index 07e0ec1..2895835 100644
--- a/include/class/acc_ledger_history_financial.class.php
+++ b/include/class/acc_ledger_history_financial.class.php
@@ -22,7 +22,119 @@
/**
* @file
- * @brief
- * @param type $name Descriptionara
+ * @brief displya financial operations
+ *
*/
-?>
+require_once NOALYSS_INCLUDE."/class/acc_ledger_history.class.php";
+
+class Acc_Ledger_History_Financial extends Acc_Ledger_History
+{
+
+ /**
+ * @brief display the accounting
+ */
+ public function export_accounting_html()
+ {
+ $ledger_history=new Acc_Ledger_History_Generic($this->db,
+ $this->ma_ledger, $this->m_from, $this->m_to, $this->m_mode);
+ $ledger_history->export_accounting_html();
+ }
+
+ public function export_detail_html()
+ {
+ $this->export_oneline_html();
+ }
+
+ public function export_extended_html()
+ {
+ $ledger_history=new Acc_Ledger_History_Generic($this->db,
+ $this->ma_ledger, $this->m_from, $this->m_to, $this->m_mode);
+ $ledger_history->export_accounting_html();
+ }
+
+ /**
+ * @brief display in HTML following the mode
+ */
+ function export_html()
+ {
+ switch ($this->m_mode)
+ {
+ case "E":
+ $this->export_accounting_html();
+ break;
+ case "D":
+ $this->export_oneline_html();
+ break;
+ case "L":
+ $this->export_oneline_html();
+ break;
+ case "A":
+ $this->export_accounting_html();
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * display in HTML one operation by line
+ */
+ public function export_oneline_html()
+ {
+ $this->get_row();
+ $this->prepare_reconcile_date();
+ require_once
NOALYSS_TEMPLATE.'/acc_ledger_history_financial_oneline.php';
+
+ }
+
+ /**
+ * Get the rows from jrnx and quant* tables
+ * @param int $p_limit max of rows to returns
+ * @param int $p_offset the number of rows to skip
+ */
+ public function get_row($p_limit=-1, $p_offset="")
+ {
+ $periode=sql_filter_per($this->db, $this->m_from, $this->m_to, 'p_id',
+ 'jr_tech_per');
+
+ $cond_limite=($p_limit!=-1)?" limit ".$p_limit." offset ".$p_offset:"";
+
+ $ledger_list=join(",", $this->ma_ledger);
+ $sql="
+ with detail as (
+ select x.f_id as f_id,
+ (select ad_value from fiche_detail where ad_id=1 and
f_id=x.f_id) as name,
+ (select ad_value from fiche_detail where ad_id=32 and
f_id=x.f_id) as first_name,
+ (select ad_value from fiche_detail where ad_id=23 and
f_id=x.f_id) as qcode
+ from
+ fiche as x)
+ select
+ bk.f_id as bk_f_id,
+ bk.name as bk_name,
+ bk.first_name as bk_first_name,
+ bk.qcode as bk_qcode,
+ tiers.f_id as tiers_f_id,
+ tiers.name as tiers_name,
+ tiers.first_name as tiers_first_name,
+ tiers.qcode as tiers_qcode,
+ jr_id,
+ jr_pj_number,
+ jr_date,
+ jr_date_paid,
+ jr_internal,
+ jrn.jr_comment,
+ jr_pj_name,
+ qf_amount
+ from
+ jrn
+ join quant_fin using (jr_id)
+ join detail as tiers on (tiers.f_id=qf_other)
+ join detail as bk on (bk.f_id=qf_bank)
+ where
+ jr_def_id in ({$ledger_list})
+ and {$periode}
+ {$cond_limite}";
+ $this->data=$this->db->get_array($sql);
+ }
+
+}
diff --git a/include/class/acc_ledger_history_purchase.class.php
b/include/class/acc_ledger_history_purchase.class.php
index 715ffa0..72eeb41 100644
--- a/include/class/acc_ledger_history_purchase.class.php
+++ b/include/class/acc_ledger_history_purchase.class.php
@@ -116,7 +116,7 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
$ledger_list=join(",", $this->ma_ledger);
$sql="
- with row_sale as
+ with row_purchase as
(select qp_internal,
qp_supplier,sum(qp_price) as novat,
sum(qp_vat) as vat ,
@@ -154,7 +154,7 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
novat+vat-tva_sided as tvac
from
jrn
- join row_sale on (qp_internal=jr_internal)
+ join row_purchase on (qp_internal=jr_internal)
join supplier_detail on (qp_supplier=f_id)
where
jr_def_id in ({$ledger_list})
diff --git a/include/template/acc_ledger_history_financial_oneline.php
b/include/template/acc_ledger_history_financial_oneline.php
new file mode 100644
index 0000000..6792971
--- /dev/null
+++ b/include/template/acc_ledger_history_financial_oneline.php
@@ -0,0 +1,81 @@
+<?php
+/*
+ * This file is part of NOALYSS.
+ *
+ * PhpCompta is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * PhpCompta 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 PhpCompta; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+// Copyright (2018) Author Dany De Bontridder <address@hidden>
+
+if (!defined('ALLOWED'))
+ die('Appel direct ne sont pas permis');
+
+/**
+ * @file
+ * @brief display Financial operation , simple and detailled
+ */
+?>
+<table class="result">
+ <tr>
+ <th><?= _('Banque') ?></th>
+ <th><?= _("Tiers") ?></th>
+ <th><?= _("Libellé") ?></th>
+ <th><?= _("Montant") ?></th>
+ <th><?= _("Opérations rapprochées") ?></th>
+ </tr>
+ <?php
+ $nb_data=count($this->data);
+ $tot_amount=0;
+ for ($i=0; $i<$nb_data; $i++):
+ $class=($i%2==0)?' class="even" ':' class="odd" ';
+ ?>
+ <tr <?= $class ?> >
+ <td>
+ <?= $this->data[$i]['bk_qcode']; ?>
+ </td>
+ <td>
+ <?php
+ echo HtmlInput::history_card($this->data[$i]['tiers_f_id'],
+
h($this->data[$i]['tiers_first_name'].$this->data[$i]['tiers_name']."[{$this->data[$i]['tiers_qcode']}]"));
+ ?>
+ </td>
+ <td>
+ <?= h($this->data[$i]['jr_comment']) ?>
+ </td>
+ <td>
+ <?= nbm($this->data[$i]['qf_amount']) ?>
+ </td>
+ <td>
+ <?php
+ $ret_reconcile=$this->db->execute('reconcile_date',
+ array($this->data[$i]['jr_id']));
+ $max=Database::num_row($ret_reconcile);
+ if ($max>0)
+ {
+ $sep="";
+ for ($e=0; $e<$max; $e++)
+ {
+ $row=Database::fetch_array($ret_reconcile, $e);
+ echo $sep.HtmlInput::detail_op($row['jr_id'],
+ $row['jr_date'].' '.$row['jr_internal']);
+ $sep=' ,';
+ }
+ }
+ ?>
+ </td>
+
+ <?php
+endfor;
+?>
+</table>
\ No newline at end of file
diff --git a/scenario/acc_ledger_historyTest.php
b/scenario/acc_ledger_historyTest.php
index 361fef4..7337b8c 100644
--- a/scenario/acc_ledger_historyTest.php
+++ b/scenario/acc_ledger_historyTest.php
@@ -78,3 +78,17 @@ $ledger_history->export_html();
echo h2("Ach Extended");
$ledger_history->set_m_mode("E");
$ledger_history->export_html();
+
+echo h1("FIN from Acc_Ledger_History_Financial");
+echo h2("Detailled accouting");
+$ledger_history=new Acc_Ledger_History_Financial($cn,[11,16],216,217,"A");
+$ledger_history->export_html();
+echo h2("FIN one line");
+$ledger_history->set_m_mode("L");
+$ledger_history->export_html();
+echo h2(">FIN Detail");
+$ledger_history->set_m_mode("D");
+$ledger_history->export_html();
+echo h2("FIN Extended");
+$ledger_history->set_m_mode("E");
+$ledger_history->export_html();
- [Noalyss-commit] [noalyss] 77/323: Small bug in clean card, (continued)
- [Noalyss-commit] [noalyss] 77/323: Small bug in clean card, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 69/323: Task #0001530: Réécriture PRINTJRN : export PDF, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 80/323: before deleting a card , check if it is not used as an attribute in another card, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 78/323: esthetic, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 70/323: Task #0001530: Réécriture PRINTJRN : export CSV : Purchase List (L), Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 73/323: Missing import of icon_action, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 75/323: Merge branch 'rewrite-printjrn', Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 76/323: Small bug in save_card, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 71/323: task #1531: Historique poste et fiche d'après exercice opération, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 83/323: Esthétique Recherche action, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 68/323: Task #0001530: Réécriture PRINTJRN Add Financial Ledger Adapt test file,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 61/323: Fix some issues with PRINTJRN, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 79/323: before deleting a card , check if it is not used as an attribute in another card, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 04/323: Improve Doxygen documentation, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 60/323: remove deprecated theme, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 56/323: Task #0001527: Effacement du champ code fiche : bouton, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 43/323: Rewriting Change class Own by Noalyss_Parameter_Folder, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 84/323: Doc, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 81/323: task #1531: Historique poste et fiche d'après exercice opération Fait aussi pour le bouton historique, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 85/323: cosmetique, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 82/323: Esthétique Recherche action, Dany De Bontridder, 2018/03/14