[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 111/323: History of analytic account the same
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 111/323: History of analytic account the same way as the history for card or accounting |
Date: |
Wed, 14 Mar 2018 17:38:34 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit d150ad79e14368a00266d0876014163570e349c8
Author: Dany De Bontridder <address@hidden>
Date: Thu Feb 1 23:59:15 2018 +0100
History of analytic account the same way as the history
for card or accounting
---
html/ajax_misc.php | 2 +
html/js/acc_ledger.js | 32 ++++++++++++++
include/ajax/ajax_history_anc_account.php | 69 +++++++++++++++++++++++++++++++
include/class/anc_grandlivre.class.php | 4 +-
include/class/anc_listing.class.php | 2 +-
include/class/anc_operation.class.php | 53 ++++++++++++------------
include/lib/html_input.class.php | 24 +++++++++++
include/lib/impress.class.php | 44 +++++++++++---------
8 files changed, 181 insertions(+), 49 deletions(-)
diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index c4bcbe9..38e2332 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -208,6 +208,8 @@ $path = array(
"accounting"=>"ajax_accounting",
// Show detail of an ANC operation
"anc_detail_op"=>"ajax_anc_detail_operation",
+ // show history of an analytic account
+ "history_anc_account"=>"ajax_history_anc_account",
// Display the list of filter saved
"display_search_filter"=>"ajax_search_filter",
// Save search filter
diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js
index 9df198f..3bbe150 100644
--- a/html/js/acc_ledger.js
+++ b/html/js/acc_ledger.js
@@ -683,6 +683,38 @@ function view_history_account(p_value, dossier,p_exercice)
}
/**
+ * @brief View the history of an account
+ * @param {type} p_value
+ * @param {type} dossier
+ * @returns {undefined}
+ */
+function view_history_anc_account(p_value, dossier,p_exercice)
+{
+ layer++;
+ var idbox = 'det' + layer;
+ var popup = {'id': idbox, 'cssclass': 'inner_box', 'html': loading(),
'drag': false};
+
+ var
querystring={'gDossier':dossier,'op':'history_anc_account','po_id':p_value,'div':idbox,'l':layer,'act':'history','exercice':p_exercice};
+ waiting_box();
+
+ var action = new Ajax.Request(
+ "ajax_misc.php",
+ {
+ method: 'get',
+ parameters: querystring,
+ onFailure: error_box,
+ onSuccess: function (req, xml)
+ {
+ remove_waiting_box();
+ add_div(popup);
+ $(idbox).innerHTML=req.responseText;
+ $(idbox).style.top = calcy(140 + (layer * 3)) + "px";
+ }
+ }
+ );
+
+}
+/**
* @brief Change the view of account history
* @param {type} obj
* @returns {Boolean}
diff --git a/include/ajax/ajax_history_anc_account.php
b/include/ajax/ajax_history_anc_account.php
new file mode 100644
index 0000000..73036ae
--- /dev/null
+++ b/include/ajax/ajax_history_anc_account.php
@@ -0,0 +1,69 @@
+<?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 the history of an analytic account.
+ * Receives the parameters GET:
+ - gDossier integer
+ - act history_anc_account
+ - po_id integer poste_analytic.po_id
+ - div DOM ID of the box
+ - op history
+ - exercice integer
+ */
+require_once NOALYSS_INCLUDE."/class/anc_grandlivre.class.php";
+
+try {
+ $po_id=$http->get("po_id","number");
+ $exercice=$http->get("exercice","number");
+ $div=$http->get("div");
+} catch (Exception $ex) {
+ echo $ex->getTraceAsString();
+ throw $ex;
+}
+$poste_analytic=new Poste_analytique_SQL($cn, $po_id);
+
+$anc_grandlivre=new Anc_GrandLivre($cn);
+
+$anc_grandlivre->from_poste=$poste_analytic->po_name;
+$anc_grandlivre->to_poste=$poste_analytic->po_name;
+
+// Find the first and last periode
+$periode=new Periode($cn);
+$a_periode_limit=$periode->limit_year($exercice);
+
+// Find the first day
+$first_day=$periode->first_day($a_periode_limit['start']);
+
+// find the last day
+$last_day=$periode->last_day($a_periode_limit['end']);
+
+$anc_grandlivre->from=$first_day;
+$anc_grandlivre->to=$last_day;
+
+echo HtmlInput::title_box($poste_analytic->getp("po_name"), $div, "close", "",
"n");
+
+echo $anc_grandlivre->display_html(0);
+$anc_grandlivre->pa_id=$poste_analytic->pa_id;
+echo $anc_grandlivre->show_button();
\ No newline at end of file
diff --git a/include/class/anc_grandlivre.class.php
b/include/class/anc_grandlivre.class.php
index 4139b97..fdefa13 100644
--- a/include/class/anc_grandlivre.class.php
+++ b/include/class/anc_grandlivre.class.php
@@ -179,7 +179,7 @@ class Anc_GrandLivre extends Anc_Print
* \return string
*/
- function display_html()
+ function display_html($p_with_ck=1)
{
$r = "";
//---Html
@@ -250,7 +250,7 @@ class Anc_GrandLivre extends Anc_Print
*/
$str_ck = "";
$str_document = "";
- if ($row['jr_id'] != null)
+ if ($row['jr_id'] != null && $p_with_ck==1)
{
/*
* Get receipt info
diff --git a/include/class/anc_listing.class.php
b/include/class/anc_listing.class.php
index ff2869b..999c2fc 100644
--- a/include/class/anc_listing.class.php
+++ b/include/class/anc_listing.class.php
@@ -97,7 +97,7 @@ class Anc_Listing extends Anc_Print
'<td>'.$row['oa_date'].'</td>'.
td($post_detail).
td($card_detail).
- '<td>'.h($row['po_name']).'</td>'.
+
'<td>'.HtmlInput::history_anc_account($row['po_id'],h($row['po_name'])).'</td>'.
'<td>'.h($row['oa_description']).'</td>'.
td($row['jr_comment']).
'<td>'.$detail.'</td>'.
diff --git a/include/class/anc_operation.class.php
b/include/class/anc_operation.class.php
index 1bbddc2..22df728 100644
--- a/include/class/anc_operation.class.php
+++ b/include/class/anc_operation.class.php
@@ -213,32 +213,33 @@ class Anc_Operation
$pa_id_cond= "pa_id=".$this->pa_id." and";
$sql="
- select oa_id,
- po_name,
- oa_description,
- po_description,
- oa_debit,
- (case when jr_date is not null then to_char(jr_date,'DD.MM.YYYY') else
to_char(oa_date,'DD.MM.YYYY') end ) as oa_date,
- oa_amount,
- oa_group,
- j_id ,
- jr_internal,
- jr_id,
- coalesce(jr_comment,b.oa_description) as jr_comment,
- case when j_poste is null and b.f_id is not null then
- (select ad_value from fiche_detail where fiche_detail.f_id=b.f_id and
ad_id=".ATTR_DEF_ACCOUNT.")
- when j_poste is not null then
- j_poste
- end as j_poste
- ,
- coalesce(jrnx.f_id,b.f_id) as f_id,
- case when jrnx.f_id is not null then
- (select ad_value from fiche_Detail where f_id=jrnx.f_id and
ad_id=23)
- when b.f_id is not null then
- (select ad_value from fiche_Detail where f_id=b.f_id and
ad_id=23)
- end
- as qcode,
- jr_pj_number
+ select B.po_id as po_id,
+ oa_id,
+ po_name,
+ oa_description,
+ po_description,
+ oa_debit,
+ (case when jr_date is not null then to_char(jr_date,'DD.MM.YYYY')
else to_char(oa_date,'DD.MM.YYYY') end ) as oa_date,
+ oa_amount,
+ oa_group,
+ j_id ,
+ jr_internal,
+ jr_id,
+ coalesce(jr_comment,b.oa_description) as jr_comment,
+ case when j_poste is null and b.f_id is not null then
+ (select ad_value from fiche_detail where fiche_detail.f_id=b.f_id
and ad_id=".ATTR_DEF_ACCOUNT.")
+ when j_poste is not null then
+ j_poste
+ end as j_poste
+ ,
+ coalesce(jrnx.f_id,b.f_id) as f_id,
+ case when jrnx.f_id is not null then
+ (select ad_value from fiche_Detail where f_id=jrnx.f_id
and ad_id=23)
+ when b.f_id is not null then
+ (select ad_value from fiche_Detail where f_id=b.f_id and
ad_id=23)
+ end
+ as qcode,
+ jr_pj_number
from operation_analytique as B join poste_analytique using(po_id)
left join jrnx using (j_id)
left join jrn on (j_grpt=jr_grpt_id)
diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php
index f7a0e1a..efb6187 100755
--- a/include/lib/html_input.class.php
+++ b/include/lib/html_input.class.php
@@ -321,6 +321,9 @@ class HtmlInput
/**
* display a div with the history of the card
+ * @param int $f_id fiche.f_id
+ * @param string $p_mesg string to display
+ * @param int $p_exercice exercice of the history
*/
static function history_card_button($f_id, $p_mesg,$p_exercice="")
{
@@ -338,6 +341,10 @@ class HtmlInput
/**
* display a div with the history of the account
+ * @param string $p_account accounting
+ * @param string $p_mesg string to display
+ * @param string $p_style extra code for HTML
+ * @param int $p_exercice exercice of the history
*/
static function history_account($p_account, $p_mesg,
$p_style="",$p_exercice="")
{
@@ -349,6 +356,23 @@ class HtmlInput
$p_style, $p_account, dossier::id(),$p_exercice, $p_mesg);
return $view_history;
}
+ /**
+ * display a div with the history of the analytic account
+ * @param int $p_account po_id
+ * @param string $p_mesg string to display
+ * @param string $p_style extra code for HTML
+ * @param int $p_exercice exercice of the history
+ */
+ static function history_anc_account($p_account, $p_mesg,
$p_style="",$p_exercice="")
+ {
+ global $g_user;
+ if ( $p_exercice=="") {
+ $p_exercice=$g_user->get_exercice();
+ }
+ $view_history=sprintf('<A class="detail"
style="text-decoration:underline;%s"
HREF="javascript:view_history_anc_account(\'%s\',\'%s\',\'%s\')" >%s</A>',
+ $p_style, $p_account, dossier::id(),$p_exercice, $p_mesg);
+ return $view_history;
+ }
/**
* create a hidden plus button to select the cat of ledger
diff --git a/include/lib/impress.class.php b/include/lib/impress.class.php
index d9f59b6..ea413a2 100644
--- a/include/lib/impress.class.php
+++ b/include/lib/impress.class.php
@@ -251,41 +251,45 @@ class Impress
* @param type $aheader double array, each item of the array contains
* a key type (num) and a key title
*/
- static function array_to_csv($array,$aheader,$p_filename)
+ static function array_to_csv($array, $aheader, $p_filename)
{
$file_csv=new Noalyss_Csv($p_filename);
- for ($i=0;$i<count($aheader);$i++)
+ for ($i=0; $i<count($aheader); $i++)
{
- $file_csv->add($aheader[$i]['title']);
+ $file_csv->add($aheader[$i]['title']);
}
$file_csv->write();
// fetch all the rows
- for ($i=0;$i<count($array);$i++)
+ for ($i=0; $i<count($array); $i++)
{
$row=$array[$i];
$e=0;
// for each rows, for each value
- foreach ($array[$i] as $key=>$value)
+ foreach ($array[$i] as $key=> $value)
{
- if ($e > count($aheader)) $e=0;
+ if ($e>count($aheader))
+ continue;
- if ( isset ($aheader[$e]['type']))
- {
- switch ($aheader[$e]['type'])
- {
- case 'num':
- $file_csv->add($value,
"number");
- break;
- default:
- $file_csv->add($value);
- }
- } else {
- $file->add($value);
- }
+ if (isset($aheader[$e]['type']))
+ {
+ switch ($aheader[$e]['type'])
+ {
+ case 'num':
+ $file_csv->add($value, "number");
+ break;
+ default:
+ $file_csv->add($value);
+ }
+ }
+ else
+ {
+ $file_csv->add($value);
+ }
+ $e++;
}
$file_csv->write();
- $e++;
}
}
+
}
\ No newline at end of file
- [Noalyss-commit] [noalyss] 106/323: fix: cannot create new folder due to a typo error, (continued)
- [Noalyss-commit] [noalyss] 106/323: fix: cannot create new folder due to a typo error, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 91/323: FollowUp : improve esthetic, use inplace_edit for commenting on files, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 112/323: Change theme : corner for menu2 , no more border-radius for menu1, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 110/323: Correction couleur pour Inswitch_place Correction couleur pour Module sécurité, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 116/323: Improve progress_bar : add a blocking div, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 115/323: translate, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 119/323: Missing lib, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 118/323: Progress Bar : use GET , which is faster than POST, use 2 decimal in progress because if the step is < 1 , it doesn't work, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 117/323: Export PDF from ANC , add a progress_bar, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 16/323: Bug 1516 : réécriture du module période, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 111/323: History of analytic account the same way as the history for card or accounting,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 120/323: New LOGO, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 122/323: cosmetic menu level2, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 124/323: Fix : logo and new style by default, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 125/323: fix : managetable correct position, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 114/323: New : code for progress bar, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 129/323: Small bug : new structure for table version, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 126/323: fix : typo default theme Classic7, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 121/323: use icon_action::icon_magnify instead of icon, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 128/323: Improve CSS, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 109/323: update account_repository (to review), Dany De Bontridder, 2018/03/14