Mantis #1596: Dans le plan comptable, fiches non cliquables

Les fiches sont cliquable dans Plan Comptable , PCMNCFG et
dans la liste des postes, en plus on peut obtenir toutes
les fiches d'un poste
This commit is contained in:
Dany De Bontridder 2019-02-02 13:31:35 +01:00
parent e3275e40fb
commit e284a11ea6
9 changed files with 143 additions and 9 deletions

View file

@ -244,7 +244,9 @@ $path = array(
// From FollowUp , update a comment on a file
'update_comment_followUp'=>'ajax_follow_up',
// TVA param
"tva_parameter"=>"ajax_tva_parameter"
"tva_parameter"=>"ajax_tva_parameter",
// Display all cards using an accounting
"display_all_card"=>"ajax_display_all_card"
) ;
if (array_key_exists($op, $path)) {

View file

@ -244,3 +244,28 @@ function pausecomp(millis)
do { curDate = new Date(); }
while(curDate-date < millis);
}
/**
* Display the list of card using a given accounting
* @param dossier
* @param accounting
*
*/
function display_all_card(p_dossier,p_accounting)
{
waiting_box();
var div_dest=add_div({id:'info_card_accounting',cssclass:"inner_box",style:fixed_position(100,250)+";width:auto"});
var action=new Ajax.Request ( 'ajax_misc.php',
{
method:'get',
parameters:{op:"display_all_card",
gDossier:p_dossier,
p_accounting:p_accounting
},
onSuccess:function (req)
{
div_dest.innerHTML=req.responseText;
remove_waiting_box();
}
}
);
}

View file

@ -26,6 +26,10 @@
var ask_reload = 0;
var tag_choose = '';
var aDraggableElement=new Array();
var viewport = document.viewport.getDimensions(); // Gets the viewport as an object literal
var width = viewport.width; // Usable window width
var height = viewport.height;
/**
* callback function when we just need to update a hidden div with an info
* message
@ -1486,6 +1490,9 @@ function calcy(p_sy)
{
sy = document.documentElement.scrollTop + p_sy;
}
if ( width < 801 ) {
sy=sy/2;
}
return sy;
}

View file

@ -0,0 +1,56 @@
<?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 <dany@alchimerys.be>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
/**
* @file
* @brief Display all cards using an accounting
*/
$accounting=$http->get("p_accounting");
$a_card=$cn->get_array("
select f1.f_id,f3.ad_value as qcode, f2.ad_value as name
from fiche_detail as f1
join fiche_detail as f2 on (f1.f_id=f2.f_id and f2.ad_id=1)
join fiche_detail as f3 on (f1.f_id=f3.f_id and f3.ad_id=23)
where
f1.ad_id=5 and f1.ad_value=$1
order by 3", [$accounting]);
$nb_card=count($a_card);
echo HtmlInput::title_box($accounting, "info_card_accounting");
echo '<div class="content">';
echo '<ol>';
for ($i=0; $i<$nb_card; $i++)
{
echo '<li>';
echo HtmlInput::card_detail($a_card[$i]['qcode'], $a_card[$i]['name']);
echo '</li>';
}
echo '</ol>';
echo '<ul class="aligned-block">';
echo '<li>';
echo HtmlInput::button_close("info_card_accounting");
echo '</li>';
echo '</ul>';
echo '</div>';

View file

@ -43,8 +43,9 @@ mb_internal_encoding("UTF-8");
extract($_REQUEST, EXTR_SKIP);
if ($g_user->check_dossier(dossier::id()) == 'X') exit();
$dossier_id=Dossier::id();
if ($g_user->check_dossier($dossier_id) == 'X') exit();
switch ($op2)
{
/*----------------------------------------------------------------------
@ -141,7 +142,7 @@ case "sf":
$array[$i]['javascript']=$str;
}
ob_start();
require_once NOALYSS_TEMPLATE.'/account_result.php';
$r.=ob_get_contents();
ob_end_clean();

View file

@ -195,7 +195,9 @@ class Acc_Bilan
/* debit Actif */
$res=$this->db->execute("sqlAccount",array('ACT','ACTINV'));
$result=Database::fetch_array($res, 0);
$result=Database::fetch_array($res, 0);
/* Show detail */
$debit_actif=($result === false)?0:$result['amount_debit'];
/* Credit Actif */

View file

@ -77,7 +77,7 @@ class Acc_Plan_MTable extends Manage_Table_SQL
$p_row[$this->table->primary_key])
;
$dossier_id=Dossier::id();
$nb_order=count($this->a_order);
for ($i=0; $i<$nb_order; $i++)
{
@ -97,8 +97,25 @@ class Acc_Plan_MTable extends Manage_Table_SQL
elseif ($v == "fiche_qcode") {
$count=$this->table->cn->get_value("select count(*) from fiche_detail where ad_id=5 and ad_value=$1",array($p_row['pcm_val']));
if ($count == 0) echo td("");
elseif ($count == 1 ) { echo td($p_row[$v]) ; }
elseif ($count > 1) { echo td($p_row[$v] . " ($count) ");}
elseif ($count == 1 ) {
echo '<td>';
echo HtmlInput::card_detail($p_row[$v]) ;
echo '</td>';
}
elseif ($count > 1) {
echo '<td>';
$a_code=explode(",",$p_row[$v]);
$nb_code=count($a_code);
for ($xx = 0;$xx < $nb_code;$xx++)
{
echo HtmlInput::card_detail($a_code[$xx]) ;
}
echo " ($count) ";
echo Icon_Action::detail(uniqid(), sprintf("display_all_card('%s','%s')",$dossier_id,$p_row["pcm_val"]));
echo '</td>';
}
}
elseif ($v=="pcm_lib")
{
@ -160,6 +177,16 @@ class Acc_Plan_MTable extends Manage_Table_SQL
return true;
}
/**
* @brief display into a dialog box the datarow in order
* to be appended or modified. Can be override if you need
* a more complex form
*/
function input()
{
parent::input();
$dossier_id=Dossier::id();
echo HtmlInput::button_action(_("Toutes les fiches") , sprintf("display_all_card('%s','%s')",$dossier_id,$this->table->pcm_val));
}
}

View file

@ -229,4 +229,18 @@ class Icon_Action
return $r;
}
static function detail($p_id,$p_javascript)
{
$r=sprintf('<span id="%s" onclick="%s" class="smallicon icon" style="margin-left:5px">&#xe803;</span>',
$p_id,
$p_javascript);
return $r;
}
static function more($p_id,$p_javascript)
{
$r=sprintf('<span id="%s" onclick="%s" class="smallicon icon" style="margin-left:5px">...</span>',
$p_id,
$p_javascript);
return $r;
}
}

View file

@ -42,7 +42,7 @@
$sep=" , ";
}
if ($max < count($det_qcode)) {
echo "...";
echo Icon_Action::detail(uniqid(), sprintf("display_all_card('%s','%s')",$dossier_id,$array[$i]['pcm_val']));
}
} else {
echo HtmlInput::card_detail($array[$i]['acode']);