Put a button export CSV & PDF into the inner windows for the history of card and accounting

This commit is contained in:
Dany De Bontridder 2015-10-15 10:37:37 +02:00
parent 24f0d4b90e
commit 25cda2ef7c
3 changed files with 113 additions and 16 deletions

View file

@ -87,7 +87,7 @@ if ( isset($_GET['f_id']))
}
else
{
$old='<form method="get" action="popup.php">';
$old='<form method="get" style="display:inline" action="popup.php">';
$is=$exercice->select('ex',$default,'onchange = "submit(this)"');
$old.=_("Autre exercice")." ".$is->input();
$old.=HtmlInput::hidden('div','popup');
@ -108,7 +108,10 @@ if ( isset($_GET['f_id']))
if ( $fiche->HtmlTable($array,0,$from_div)==-1){
echo h2(_("Aucune opération pour l'exercice courant"),'class="error"');
}
} else {
echo $fiche->button_csv($array['from_periode'],$array['to_periode']);
echo $fiche->button_pdf($array['from_periode'],$array['to_periode']);
}
echo $old;
@ -159,7 +162,7 @@ if ( isset($_REQUEST['pcm_val']))
}
else
{
$old='<form method="get" action="popup.php">';
$old='<form method="get" style="display:inline" action="popup.php">';
$is=$exercice->select('ex',$default,'onchange = "submit(this)"');
$old.=_("Autre exercice")." ".$is->input();
$old.=HtmlInput::hidden('div','popup');
@ -175,12 +178,18 @@ if ( isset($_REQUEST['pcm_val']))
ob_start();
require_once NOALYSS_INCLUDE.'/template/history_top.php';
if ( $poste->HtmlTable($array) == -1)
{
echo h2($poste->id." ".$poste->name,' class="title"');
echo h2(_("Aucune opération pour l'exercice courant"),'class="error"');
}
} else {
echo $poste->button_csv($array['from_periode'],$array['to_periode']);
echo $poste->button_pdf($array['from_periode'],$array['to_periode']);
}
echo $old;
$html=ob_get_contents();

View file

@ -635,17 +635,61 @@ class Acc_Account_Ledger
$sql=substr($sql,0,strlen($sql)-2);
return $sql;
}
/**
* Find the id of the cards which are using the current account
*
* @return an array of f_id
*/
function find_card()
{
$sql="select f_id from fiche_detail where ad_id=$1 and ad_value=$2";
$account=$this->db->get_array($sql,array(ATTR_DEF_ACCOUNT,$this->id));
return $account;
}
/**
* Find the id of the cards which are using the current account
*
* @return an array of f_id
*/
function find_card()
{
$sql="select f_id from fiche_detail where ad_id=$1 and ad_value=$2";
$account=$this->db->get_array($sql,array(ATTR_DEF_ACCOUNT,$this->id));
return $account;
}
/**
* @brief Return a string with the HTML code to display a button to export the
* history in CSV
* @param type $p_from from date (DD.MM.YYYY)
* @param type $p_to to date (DD.MM.YYYY)
* @return HTML string
*/
function button_csv($p_from,$p_to) {
$href="export.php?".http_build_query(
array(
"gDossier"=>Dossier::id(),
"poste_id"=>$this->id,
"ople"=>0,
"type"=>"poste",
"from_periode"=>$p_from,
"to_periode"=>$p_to,
"act"=>"CSV:postedetail"
)
);
return '<a class="smallbutton" style="display:inline" href="'.$href.'">'._("Export CSV").'</a>';
}
/**
* @brief Return a string with the HTML code to display a button to export the
* history in PDF
* @param type $p_from from date (DD.MM.YYYY)
* @param type $p_to to date (DD.MM.YYYY)
* @return HTML string
*/
function button_pdf($p_from,$p_to) {
$href="export.php?".http_build_query(
array(
"gDossier"=>Dossier::id(),
"poste_id"=>$this->id,
"ople"=>0,
"type"=>"poste",
"from_periode"=>$p_from,
"to_periode"=>$p_to,
"act"=>"PDF:postedetail"
)
);
return '<a class="smallbutton" style="display:inline" href="'.$href.'">'._("Export PDF").'</a>';
}
static function test_me()
{
$cn=Dossier::connect();

View file

@ -1987,6 +1987,50 @@ class Fiche
{
}
/**
* @brief Return a string with the HTML code to display a button to export the
* history in CSV
* @param type $p_from from date (DD.MM.YYYY)
* @param type $p_to to date (DD.MM.YYYY)
* @return HTML string
*/
function button_csv($p_from,$p_to) {
$href="export.php?".http_build_query(
array(
"gDossier"=>Dossier::id(),
"f_id"=>$this->id,
"ople"=>0,
"type"=>"poste",
"from_periode"=>$p_from,
"to_periode"=>$p_to,
"act"=>"CSV:fichedetail"
)
);
return '<a class="smallbutton" style="display:inline" href="'.$href.'">'._("Export CSV").'</a>';
}
/**
* @brief Return a string with the HTML code to display a button to export the
* history in PDF
* @param type $p_from from date (DD.MM.YYYY)
* @param type $p_to to date (DD.MM.YYYY)
* @return HTML string
*/
function button_pdf($p_from,$p_to) {
$href="export.php?".http_build_query(
array(
"gDossier"=>Dossier::id(),
"f_id"=>$this->id,
"ople"=>0,
"type"=>"poste",
"from_periode"=>$p_from,
"to_periode"=>$p_to,
"act"=>"PDF:fichedetail"
)
);
return '<a class="smallbutton" style="display:inline" href="'.$href.'">'._("Export PDF").'</a>';
}
}
?>