Printing
--------
Convert to FPDF : - anc balance simple
- anc balance double
- security
Update Changelog
This commit is contained in:
parent
39f4699871
commit
2666416bc1
5 changed files with 26501 additions and 2158 deletions
|
|
@ -32,11 +32,7 @@ $cn=new Database(dossier::id());
|
|||
|
||||
$balance=new Anc_Balance_Double($cn);
|
||||
|
||||
|
||||
|
||||
$pdf= new Cezpdf("A4");
|
||||
$pdf->selectFont('./addon/fonts/Helvetica.afm');
|
||||
header_pdf($cn,$pdf);
|
||||
$balance->get_request();
|
||||
|
||||
$balance->display_pdf();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
|
|
@ -28,7 +27,7 @@ require_once('class_dossier.php');
|
|||
$gDossier=dossier::id();
|
||||
include_once("ac_common.php");
|
||||
require_once('class_database.php');
|
||||
include_once("class.ezpdf.php");
|
||||
require_once("class_pdf.php");
|
||||
echo_debug('sec_pdf.php',__LINE__,"imp pdf securité");
|
||||
$cn=new Database($gDossier);
|
||||
//-----------------------------------------------------
|
||||
|
|
@ -53,52 +52,66 @@ $SecUser=new User($rep,$_GET['user_id']);
|
|||
//-----------------------------------------------------
|
||||
// Print result
|
||||
|
||||
$pdf=new Cezpdf("A4");
|
||||
$pdf->selectFont('./addon/fonts/Helvetica.afm');
|
||||
$pdf=new PDF($cn);
|
||||
|
||||
$str_user=sprintf("( %d ) %s %s [ %s ]",
|
||||
$SecUser->id,
|
||||
$SecUser->first_name,
|
||||
$SecUser->name,
|
||||
$SecUser->login);
|
||||
|
||||
$pdf->ezText($str_user,14,array('justification'=>'center'));
|
||||
$pdf->SetFond('DejaVu','B',9);
|
||||
$pdf->Cell(0,7,$str_user,'B',0,'C');
|
||||
|
||||
if ( $SecUser->active==0)
|
||||
$pdf->ezText('Bloqué',12,array('justification'=>'center'));
|
||||
if ( $SecUser->active==0) {
|
||||
$pdf->SetTextColor(255,0,34);
|
||||
$pdf->Cell(0,7,'Bloqué',0,0,'R');
|
||||
$pdf->Ln();
|
||||
}
|
||||
|
||||
if ( $SecUser->admin==1) {
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->setFillColor(239,251,255);
|
||||
$pdf->Cell(40,7,'Administrateur',1,1,'R');
|
||||
$pdf->Ln();
|
||||
}
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
if ( $SecUser->admin==1)
|
||||
$pdf->ezText('Administrateur',12,array('justification'=>'center'));
|
||||
//-----------------------------------------------------
|
||||
// Journal
|
||||
$pdf->Cell(0,7,'Accès journaux',1,0,'C');
|
||||
$pdf->SetFond('DejaVu','',6);
|
||||
$Res=$cn->exec_sql("select jrn_def_id,jrn_def_name from jrn_def ");
|
||||
$SecUser->db=$cn;
|
||||
for ($e=0;$e < Database::num_row($Res);$e++) {
|
||||
$row=Database::fetch_array($Res,$e);
|
||||
$a_jrn[$e]['jrn_name']=utf8_decode($row['jrn_def_name']);
|
||||
$pdf->Cell(40,6,$row['jrn_def_name']);
|
||||
$priv=$SecUser->check_jrn($row['jrn_def_id']);
|
||||
switch($priv) {
|
||||
case 'X':
|
||||
$a_jrn[$e]['priv']=utf8_decode("pas d'accès");
|
||||
$pdf->Cell(30,6,"Pas d'accès");
|
||||
break;
|
||||
case 'R':
|
||||
$a_jrn[$e]['priv']=utf8_decode("lecture");
|
||||
$pdf->Cell(30,6,"Lecture");
|
||||
break;
|
||||
case 'O':
|
||||
$a_jrn[$e]['priv']=utf8_decode("Operation prédéfinie uniquement");
|
||||
/**
|
||||
*@todo uniquement opérations prédéfinies ?? A vérifier
|
||||
*/
|
||||
$pdf->Cell(30,6,"Opérations prédéfinies uniquement");
|
||||
break;
|
||||
case 'W':
|
||||
$a_jrn[$e]['priv']="Ecriture";
|
||||
$pdf->Cell(30,6,'Ecriture');
|
||||
break;
|
||||
}
|
||||
|
||||
$pdf->Ln();
|
||||
}
|
||||
$pdf->ezTable($a_jrn,
|
||||
array ('jrn_name'=>' Journal',
|
||||
'priv'=>utf8_decode('Privilège'))," ",
|
||||
array('shaded'=>0,'showHeadings'=>1,'width'=>500));
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Action
|
||||
$pdf->SetFond('DejaVu','B',9);
|
||||
$pdf->Cell(0,7,'Accès action',1,0,'C');
|
||||
|
||||
$pdf->SetFond('DejaVu','',6);
|
||||
$Res=$cn->exec_sql(
|
||||
"select ac_id, ac_description from action order by ac_description ");
|
||||
|
||||
|
|
@ -106,25 +119,19 @@ $Max=Database::num_row($Res);
|
|||
|
||||
for ( $i =0 ; $i < $Max; $i++ ) {
|
||||
$l_line=Database::fetch_array($Res,$i);
|
||||
$action['lib']=utf8_decode($l_line['ac_description']);
|
||||
$pdf->Cell(50,6,$l_line['ac_description']);
|
||||
$right=$SecUser->check_action($l_line['ac_id']);
|
||||
switch ($right) {
|
||||
case 0:
|
||||
$action['priv']=utf8_decode("Pas d'accès");
|
||||
$pdf->Cell(30,6,"Pas d'accès");
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
$action['priv']=utf8_decode("Accès");
|
||||
$pdf->Cell(30,6,"Pas d'accès");
|
||||
break;
|
||||
}
|
||||
$a_action[$i]=$action;
|
||||
$pdf->Ln();
|
||||
}
|
||||
$pdf->ezTable($a_action ,
|
||||
array ('lib'=>'Description',
|
||||
'priv'=>utf8_decode('Privilège'))," ",
|
||||
array('shaded'=>0,'showHeadings'=>1,'width'=>500));
|
||||
|
||||
|
||||
$pdf->ezStream();
|
||||
|
||||
$fDate=date('dmy-HI');
|
||||
$pdf->Output('security-'.$fDate.'pdf','I');
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ require_once("class_ibutton.php");
|
|||
require_once("class_ihidden.php");
|
||||
require_once ('class_anc_print.php');
|
||||
require_once ('class_anc_plan.php');
|
||||
require_once('class_pdf.php');
|
||||
|
||||
class Anc_Balance_Double extends Anc_Print
|
||||
{
|
||||
|
|
@ -136,87 +137,88 @@ class Anc_Balance_Double extends Anc_Print
|
|||
*/
|
||||
function display_pdf()
|
||||
{
|
||||
$array=$this->load();
|
||||
if (empty($array))return;
|
||||
$offset=0;
|
||||
$page=1;
|
||||
$pagesize=50;
|
||||
$array=$this->load();
|
||||
if (empty($array))return;
|
||||
$pdf=new PDF($this->db);
|
||||
$pdf->AliasNbPages();
|
||||
$pdf->AddPage();
|
||||
|
||||
$count=ceil(count($array)/$pagesize);
|
||||
$pdf= new Cezpdf("A4");
|
||||
$pdf->selectFont('./addon/fonts/Helvetica.afm');
|
||||
$pa=new Anc_Plan($this->db,$this->pa_id);
|
||||
$pa->get();
|
||||
$pb=new Anc_Plan($this->db,$this->pa_id2);
|
||||
$pb->get();
|
||||
$pa=new Anc_Plan($this->db,$this->pa_id);
|
||||
$pa->get();
|
||||
$pb=new Anc_Plan($this->db,$this->pa_id2);
|
||||
$pb->get();
|
||||
$pdf->SetFont('DejaVu','B',9);
|
||||
$pdf->Cell(0,7,sprintf("Balance croise plan %s %s ",
|
||||
$pa->name,
|
||||
$pb->name),1,0,'C');
|
||||
$filtre_date="";
|
||||
$filtre_pa="";
|
||||
$filtre_pb="";
|
||||
|
||||
$titre=sprintf("Balance croise plan %s %s ",
|
||||
$pa->name,
|
||||
$pb->name);
|
||||
$filtre_date="";
|
||||
$filtre_pa="";
|
||||
$filtre_pb="";
|
||||
if ( $this->from !="" ||$this->to !="")
|
||||
$filtre_date=sprintf("Filtre date %s %s",
|
||||
$this->from,
|
||||
$this->to);
|
||||
if ( $this->from_poste !="" ||$this->to_poste !="")
|
||||
$filtre_pa=sprintf("Filtre poste plan1 %s %s",
|
||||
($this->from_poste!="")?"de ".$this->from_poste:" ",
|
||||
($this->to_poste!="")?"jusque ".$this->to_poste:"");
|
||||
|
||||
if ( $this->from !="" ||$this->to !="")
|
||||
$filtre_date=sprintf("Filtre date %s %s",
|
||||
$this->from,
|
||||
$this->to);
|
||||
if ( $this->from_poste !="" ||$this->to_poste !="")
|
||||
$filtre_pa=sprintf("Filtre poste plan1 %s %s",
|
||||
($this->from_poste!="")?"de ".$this->from_poste:" ",
|
||||
($this->to_poste!="")?"jusque ".$this->to_poste:"");
|
||||
if ( $this->from_poste2 !="" ||$this->to_poste2 !="")
|
||||
$filtre_pb=sprintf("Filtre poste plan2 %s %s",
|
||||
($this->from_poste2!="")?"de ".$this->from_poste2:" ",
|
||||
($this->to_poste2!="")?"jusque ".$this->to_poste2:"");
|
||||
|
||||
if ( $this->from_poste2 !="" ||$this->to_poste2 !="")
|
||||
$filtre_pb=sprintf("Filtre poste plan2 %s %s",
|
||||
($this->from_poste2!="")?"de ".$this->from_poste2:" ",
|
||||
($this->to_poste2!="")?"jusque ".$this->to_poste2:"");
|
||||
$pdf->SetFont('DejaVu','',8);
|
||||
$pdf->Cell(50,7,$filtre_date);
|
||||
$pdf->Cell(50,7,$filtre_pa);
|
||||
$pdf->Cell(50,7,$filtre_pb);
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFont('DejaVu','',6);
|
||||
$pdf->Cell(20,7,'id','B');
|
||||
$pdf->Cell(40,7,'Poste Comptable');
|
||||
$pdf->Cell(20,7,'Débit','B',0,'L');
|
||||
$pdf->Cell(20,7,'Crédit','B',0,'L');
|
||||
$pdf->Cell(20,7,'Solde','B',0,'L');
|
||||
$pdf->Cell(20,7,'D/C','B',0,'L');
|
||||
$pdf->Ln();
|
||||
|
||||
for ($i=0;$i<count($array);$i++){
|
||||
$row=$array[$i];
|
||||
$pdf->Cell(20,6,$row['a_po_name'],0,0,'L');
|
||||
$pdf->Cell(40,6,$row['b_po_name'],0,0,'L');
|
||||
$pdf->Cell(20,6,$row['a_d'],0,0,'R');
|
||||
$pdf->Cell(20,6,$row['a_c'],0,0,'R');
|
||||
$pdf->Cell(20,6,$row['solde'],0,0,'R');
|
||||
$pdf->Cell(20,6,$row['solde'],0,0,'R');
|
||||
$pdf->Cell(20,6,$row['a_debit'],0,0,'C');
|
||||
$pdf->Ln();
|
||||
}
|
||||
|
||||
for ($i_loop=0;$i_loop<=$count;$i_loop++) {
|
||||
$sum=$this->show_sum($array);
|
||||
$pdf->Cell(20,7,'Poste');
|
||||
$pdf->Cell(60,7,'Description');
|
||||
$pdf->Cell(20,7,'Débit','B',0,'L');
|
||||
$pdf->Cell(20,7,'Crédit','B',0,'L');
|
||||
$pdf->Cell(20,7,'Solde','B',0,'L');
|
||||
$pdf->Cell(20,7,'D/C','B',0,'L');
|
||||
$pdf->Ln();
|
||||
|
||||
$view=$array;
|
||||
$view=array_splice($view,$offset,$pagesize);
|
||||
header_pdf($this->db,$pdf);
|
||||
$pdf->ezText($filtre_date,'8');
|
||||
$pdf->ezText($filtre_pa,'8');
|
||||
$pdf->ezText($filtre_pb,'8');
|
||||
|
||||
$pdf->ezTable($view,
|
||||
array("a_po_name"=>"id",
|
||||
"b_po_name"=>"Poste Comptable",
|
||||
"a_d"=>"Debit",
|
||||
"a_c"=>"Credit",
|
||||
"a_solde"=>"Solde",
|
||||
"a_debit"=>"Debit/Credit"),
|
||||
$titre,
|
||||
array('shaded'=>1,'showHeadings'=>1,'width'=>500,
|
||||
'cols'=>array('a_d'=> array('justification'=>'right'),
|
||||
'a_solde'=> array('justification'=>'right'),
|
||||
'a_c'=> array('justification'=>'right'))));
|
||||
|
||||
$page++;
|
||||
$pdf->ezNewPage();
|
||||
|
||||
$offset+=$pagesize;
|
||||
}
|
||||
$sum=$this->show_sum($array);
|
||||
$pdf->ezTable($sum,
|
||||
array("poste"=>'Poste',
|
||||
'desc'=>'Description',
|
||||
'debit'=>'Debit',
|
||||
'credit'=>'Credit',
|
||||
'solde'=>'Solde',
|
||||
'dc'=>'D/C'),
|
||||
'Totaux',
|
||||
array('shaded'=>1,'showHeadings'=>1,'cols'=>array
|
||||
('debit'=>array('justification'=>'right'),
|
||||
'credit'=>array('justification'=>'right'),
|
||||
'solde'=>array('justification'=>'right'), )
|
||||
)
|
||||
);
|
||||
$pdf->ezStream();
|
||||
for ($i=0;$i<count($sum);$i++) {
|
||||
$row=$sum[$i];
|
||||
$pdf->Cell(20,6,$row['poste'],0,0,'L');
|
||||
$pdf->Cell(60,6,$row['desc'],0,0,'L');
|
||||
$pdf->Cell(20,6,$row['debit'],0,0,'R');
|
||||
$pdf->Cell(20,6,$row['credit'],0,0,'R');
|
||||
$pdf->Cell(20,6,$row['solde'],0,0,'R');
|
||||
$pdf->Cell(20,6,$row['dc'],0,0,'R');
|
||||
$pdf->Ln();
|
||||
}
|
||||
$fDate=date('dmy-Hi');
|
||||
$pdf->output('crossbalance-'.$fDate.'.pdf');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Compute the csv export
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ require_once("class_ihidden.php");
|
|||
require_once ('class_anc_print.php');
|
||||
require_once ('class_anc_plan.php');
|
||||
require_once ('ac_common.php');
|
||||
include_once("class.ezpdf.php");
|
||||
include_once("class_pdf.php");
|
||||
require_once ('header_print.php');
|
||||
/*! \brief manage the simple balance for CA, inherit from balance_ca
|
||||
*
|
||||
|
|
@ -170,44 +170,42 @@ class Anc_Balance_Simple extends Anc_Print {
|
|||
function display_pdf()
|
||||
{
|
||||
$array=$this->load();
|
||||
$offset=0;
|
||||
$page=1;
|
||||
$pagesize=50;
|
||||
$pdf=new PDF();
|
||||
$pdf->AliasNbPages();
|
||||
$pdf->AddPage();
|
||||
$pdf->SetFont('DejaVu','B',8);
|
||||
|
||||
$count=ceil(count($array)/$pagesize);
|
||||
$pdf= new Cezpdf("A4");
|
||||
$pdf->selectFont('./addon/fonts/Helvetica.afm');
|
||||
$titre=sprintf("Balance simple poste %s %s date %s %s",
|
||||
$this->from_poste,
|
||||
$this->to_poste,
|
||||
$this->from,
|
||||
$this->to);
|
||||
$pdf->Cell(0,7,$titre,1,0,'C');
|
||||
|
||||
for ($i_loop=0;$i_loop<=$count;$i_loop++) {
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('DejaVu','',6);
|
||||
$pdf->Cell(20,7,'id','B');
|
||||
$pdf->Cell(40,7,'Poste Comptable');
|
||||
$pdf->Cell(20,7,'Débit','B',0,'L');
|
||||
$pdf->Cell(20,7,'Crédit','B',0,'L');
|
||||
$pdf->Cell(20,7,'Solde','B',0,'L');
|
||||
$pdf->Cell(20,7,'D/C','B',0,'L');
|
||||
$pdf->Ln();
|
||||
|
||||
|
||||
$view=$array;
|
||||
$view=array_splice($view,$offset,$pagesize);
|
||||
header_pdf($this->db,$pdf);
|
||||
$pdf->ezTable($view,
|
||||
array("po_id"=>"id",
|
||||
"po_name"=>"Poste Comptable",
|
||||
"sum_deb"=>"Debit",
|
||||
"sum_cred"=>"Credit",
|
||||
"solde"=>"Solde",
|
||||
"debit"=>"Debit/Credit"),
|
||||
$titre,
|
||||
array('shaded'=>1,'showHeadings'=>1,'width'=>500,
|
||||
'cols'=>array('sum_deb'=> array('justification'=>'right'),
|
||||
'solde'=> array('justification'=>'right'),
|
||||
'sum_cred'=> array('justification'=>'right'))));
|
||||
|
||||
$page++;
|
||||
$pdf->ezNewPage();
|
||||
|
||||
|
||||
$offset+=$pagesize;
|
||||
for ($i=0;$i<count($array);$i++){
|
||||
$row=$array[$i];
|
||||
$pdf->Cell(20,6,$row['a_od'],0,0,'L');
|
||||
$pdf->Cell(40,6,$row['po_name'],0,0,'L');
|
||||
$pdf->Cell(20,6,$row['sum_deb'],0,0,'R');
|
||||
$pdf->Cell(20,6,$row['sum_cred'],0,0,'R');
|
||||
$pdf->Cell(20,6,$row['solde'],0,0,'R');
|
||||
$pdf->Cell(20,6,$row['debit'],0,0,'R');
|
||||
$pdf->Ln();
|
||||
}
|
||||
$pdf->ezStream();
|
||||
$fDate=date('dmy-Hi');
|
||||
$pdf->output('simple-balance-'.$fDate.'.pdf');
|
||||
|
||||
}
|
||||
/*!
|
||||
* \brief Compute the csv export
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue