Printing
======== * Balance * Card (from poste) * Accounting
This commit is contained in:
parent
24cc2ad26a
commit
5c26cd14ba
10 changed files with 152 additions and 126 deletions
|
|
@ -47,18 +47,18 @@ $bal=new Acc_Balance($cn);
|
|||
|
||||
$t_cent="";
|
||||
//$per=join(',',$periode);
|
||||
if ( isset($_POST['central']) ) {
|
||||
if ( isset($_GET['central']) ) {
|
||||
$bal->central='Y';
|
||||
$t_cent="centralisée";
|
||||
}
|
||||
else
|
||||
$bal->central='N';
|
||||
$bal->jrn=$_POST['p_jrn'];
|
||||
$bal->from_poste=$_POST['from_poste'];
|
||||
$bal->to_poste=$_POST['to_poste'];
|
||||
$bal->jrn=$_GET['p_jrn'];
|
||||
$bal->from_poste=$_GET['from_poste'];
|
||||
$bal->to_poste=$_GET['to_poste'];
|
||||
|
||||
$row=$bal->get_row($_POST['from_periode'],
|
||||
$_POST['to_periode']);
|
||||
$row=$bal->get_row($_GET['from_periode'],
|
||||
$_GET['to_periode']);
|
||||
foreach ($row as $r) {
|
||||
|
||||
echo $r['poste'].';'.
|
||||
|
|
|
|||
|
|
@ -27,27 +27,28 @@
|
|||
include_once("class_acc_report.php");
|
||||
include_once("ac_common.php");
|
||||
require_once('class_database.php');
|
||||
include_once("class.ezpdf.php");
|
||||
include_once("impress_inc.php");
|
||||
require_once('class_user.php');
|
||||
require_once ('header_print.php');
|
||||
require_once('class_dossier.php');
|
||||
require_once('class_acc_report.php');
|
||||
require_once('class_pdf.php');
|
||||
|
||||
$gDossier=dossier::id();
|
||||
|
||||
$cn=new Database($gDossier);
|
||||
|
||||
foreach ($_GET as $key=>$element) {
|
||||
${"$key"}=$element;
|
||||
}
|
||||
|
||||
extract($_GET);
|
||||
$ret="";
|
||||
$pdf=new Cezpdf();
|
||||
$pdf->selectFont('./addon/fonts/Helvetica.afm');
|
||||
header_pdf($cn,$pdf);
|
||||
|
||||
$Form=new Acc_Report($cn,$form_id);
|
||||
$Libelle=sprintf("%s ",$Form->get_name());
|
||||
$pdf= new PDF($cn);
|
||||
$pdf->setDossierInfo($Libelle);
|
||||
$pdf->AliasNbPages();
|
||||
$pdf->AddPage();
|
||||
|
||||
|
||||
|
||||
// Step ??
|
||||
//--
|
||||
if ( $_GET['p_step'] == 0 )
|
||||
|
|
@ -68,15 +69,15 @@ if ( $_GET['p_step'] == 0 )
|
|||
{
|
||||
$periode=getPeriodeName($cn,$e);
|
||||
if ( $periode == null ) continue;
|
||||
$array[]=$Form->get_row($e,$e);
|
||||
$array[]=$Form->get_row($e,$e,'periode');
|
||||
$periode_name[]=$periode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$Libelle=utf8_decode(sprintf("(%s) %s ",$Form->id,$Form->get_name()));
|
||||
|
||||
$pdf->ezText($Libelle,30);
|
||||
$pdf->SetFont('DejaVuCond','',8);
|
||||
|
||||
// without step
|
||||
if ( $_GET['p_step'] == 0 )
|
||||
{
|
||||
|
|
@ -90,35 +91,29 @@ if ( $_GET['p_step'] == 0 )
|
|||
} else {
|
||||
$periode=sprintf("Date %s jusque %s",$_GET['from_date'],$_GET['to_date']);
|
||||
}
|
||||
$periode=utf8_decode($periode);
|
||||
$pdf->ezText($periode,25);
|
||||
$pdf->ezTable($array,
|
||||
array ('desc'=>'Description',
|
||||
'montant' => 'Montant'
|
||||
),$Libelle,
|
||||
array('shaded'=>0,'showHeadings'=>1,'width'=>500,
|
||||
'cols'=>array('montant'=> array('justification'=>'right'),
|
||||
)),true);
|
||||
//New page
|
||||
//$pdf->ezNewPage();
|
||||
//}
|
||||
$pdf->Cell(0,7,$periode,'B');$pdf->Ln();
|
||||
for ($i=0;$i<count($array);$i++) {
|
||||
$pdf->Cell(160,6,$array[$i]['desc']);
|
||||
$pdf->Cell(30,6,sprintf('% 12.2f',$array[$i]['montant']),0,0,'R');
|
||||
$pdf->Ln();
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // With Step
|
||||
$a=0;
|
||||
foreach ($array as $e)
|
||||
{
|
||||
$pdf->ezText($periode_name[$a],25);
|
||||
$a++;
|
||||
$pdf->ezTable($e,
|
||||
array ('desc'=>'Description',
|
||||
'montant' => 'Montant'
|
||||
),$Libelle,
|
||||
array('shaded'=>0,'showHeadings'=>1,'width'=>500,
|
||||
'cols'=>array('montant'=> array('justification'=>'right'),
|
||||
)),true);
|
||||
$pdf->Cell(0,7,$periode_name[$a],'B');$pdf->Ln();
|
||||
$a++;
|
||||
for ($i=0;$i<count($e);$i++) {
|
||||
$pdf->Cell(160,6,$e[$i]['desc']);
|
||||
$pdf->Cell(30,6,sprintf('% 12.2f',$e[$i]['montant']),0,0,'R');
|
||||
$pdf->Ln();
|
||||
}
|
||||
}
|
||||
}
|
||||
$pdf->ezStream();
|
||||
|
||||
$fDate=date('dmy-Hi');
|
||||
$pdf->Output('rapport-'.$fDate.'.pdf','I');
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@
|
|||
include_once("class_acc_account_ledger.php");
|
||||
include_once("ac_common.php");
|
||||
require_once('class_database.php');
|
||||
//include_once("class.ezpdf.php");
|
||||
include_once("impress_inc.php");
|
||||
require_once ('header_print.php');
|
||||
require_once('class_dossier.php');
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@
|
|||
|
||||
include_once("ac_common.php");
|
||||
require_once('class_database.php');
|
||||
include_once("class.ezpdf.php");
|
||||
include_once("class_acc_balance.php");
|
||||
require_once ('header_print.php');
|
||||
require_once('class_dossier.php');
|
||||
require_once('class_pdf.php');
|
||||
$gDossier=dossier::id();
|
||||
|
||||
$cn=new Database($gDossier);
|
||||
|
|
@ -50,47 +50,68 @@ $bal=new Acc_Balance($cn);
|
|||
$User->can_request(IMPBAL,1);
|
||||
|
||||
echo_debug('print_balance.php',__LINE__,"imp pdf journaux");
|
||||
foreach ($_POST as $key=>$element) {
|
||||
${"$key"}=$element;
|
||||
echo_debug('print_balance.php',__LINE__,"key => $key element $element");
|
||||
}
|
||||
extract ($_GET);
|
||||
// if centralized
|
||||
$t_cent="";
|
||||
|
||||
if ( isset($central) ) {
|
||||
$bal->central='Y';
|
||||
$t_cent=utf8_decode("centralisée");
|
||||
$t_cent="centralisée";
|
||||
}
|
||||
else
|
||||
$bal->central='N';
|
||||
|
||||
$bal->jrn=$_POST['p_jrn'];
|
||||
$bal->from_poste=$_POST['from_poste'];
|
||||
$bal->to_poste=$_POST['to_poste'];
|
||||
$bal->jrn=$_GET['p_jrn'];
|
||||
$bal->from_poste=$_GET['from_poste'];
|
||||
$bal->to_poste=$_GET['to_poste'];
|
||||
|
||||
$array=$bal->get_row($from_periode,$to_periode);
|
||||
|
||||
if ( sizeof($array) == 0 ) {
|
||||
$pdf= new Cezpdf('a4');
|
||||
$pdf->selectFont('./addon/fonts/Helvetica.afm');
|
||||
$pdf->ezSetCmMargins(2,2,2,2);
|
||||
$pdf->ezText("Balance compte -- vide");
|
||||
$pdf->ezStream();
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
$pPeriode=new Periode($cn);
|
||||
$a=$pPeriode->get_date_limit($from_periode);
|
||||
$b=$pPeriode->get_date_limit($to_periode);
|
||||
$per_text=utf8_decode(" période du ").$a['p_start']." au ".$b['p_end'];
|
||||
$pdf=new Cezpdf('a4');
|
||||
$pdf->selectFont('./addon/fonts/Helvetica.afm');
|
||||
$pdf->ezSetCmMargins(2,2,2,2);
|
||||
header_pdf($cn,$pdf);
|
||||
$pdf->ezTable($array,array('poste'=>'Poste','label'=>utf8_decode('Libellé'),'sum_deb'=>utf8_decode('Total Débit'),
|
||||
'sum_cred'=>utf8_decode('Total crédit'),'solde_deb'=>utf8_decode('Solde débiteur'),
|
||||
'solde_cred'=>utf8_decode('Solde créditeur')),'Balance des comptes '.$t_cent.$per_text,null,true);
|
||||
$pdf->ezStream();
|
||||
$per_text=" du ".$a['p_start']." au ".$b['p_end'];
|
||||
$pdf= new PDF($cn);
|
||||
$pdf->setDossierInfo(" Balance ".$per_text);
|
||||
$pdf->AliasNbPages();
|
||||
$pdf->AddPage();
|
||||
$pdf->SetFont('DejaVuCond','',7);
|
||||
$pdf->Cell(30,6,'poste');
|
||||
$pdf->Cell(80,6,'Libellé');
|
||||
$pdf->Cell(20,6,'Total Débit',0,0,'R');
|
||||
$pdf->Cell(20,6,'Total Crédit',0,0,'R');
|
||||
$pdf->Cell(20,6,'Solde Débiteur',0,0,'R');
|
||||
$pdf->Cell(20,6,'Solde Créditeur',0,0,'R');
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFont('DejaVuCond','',8);
|
||||
|
||||
for ($i=0;$i<count($array);$i++){
|
||||
if ( $i % 2 == 0 ) {
|
||||
$pdf->SetFillColor(220,221,255);
|
||||
$fill=1;
|
||||
} else {
|
||||
$pdf->SetFillColor(0,0,0);
|
||||
$fill=0;
|
||||
}
|
||||
if ( ! isset($array[$i]))continue;
|
||||
$pdf->Cell(30,6,$array[$i]['poste'],0,0,'L',$fill);
|
||||
$pdf->Cell(80,6,$array[$i]['label'],0,0,'L',$fill);
|
||||
$pdf->Cell(20,6,$array[$i]['sum_deb'],0,0,'R',$fill);
|
||||
$pdf->Cell(20,6,$array[$i]['sum_cred'],0,0,'R',$fill);
|
||||
$pdf->Cell(20,6,$array[$i]['solde_deb'],0,0,'R',$fill);
|
||||
$pdf->Cell(20,6,$array[$i]['solde_cred'],0,0,'R',$fill);
|
||||
$pdf->Ln();
|
||||
}
|
||||
|
||||
$fDate=date('dmy-Hi');
|
||||
$pdf->Output('balance-'.$fDate.'.pdf','I');
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ $User->Check();
|
|||
$Fiche=new fiche($cn,$_REQUEST['f_id']);
|
||||
$Fiche->getName();
|
||||
list($array,$tot_deb,$tot_cred)=$Fiche->get_row_date(
|
||||
$_POST['from_periode'],
|
||||
$_POST['to_periode']
|
||||
$_GET['from_periode'],
|
||||
$_GET['to_periode']
|
||||
);
|
||||
if ( count($Fiche->row ) == 0 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,67 +26,91 @@
|
|||
include_once("class_acc_account_ledger.php");
|
||||
include_once("ac_common.php");
|
||||
require_once('class_database.php');
|
||||
include_once("class.ezpdf.php");
|
||||
include_once("impress_inc.php");
|
||||
require_once("class_fiche.php");
|
||||
require_once ('header_print.php');
|
||||
require_once('class_dossier.php');
|
||||
require_once('class_pdf.php');
|
||||
$gDossier=dossier::id();
|
||||
|
||||
$cn=new Database($gDossier);
|
||||
foreach ($_POST as $key=>$element) {
|
||||
${"$key"}=$element;
|
||||
}
|
||||
|
||||
extract($_GET);
|
||||
|
||||
$ret="";
|
||||
$pdf= new Cezpdf();
|
||||
$pdf->selectFont('./addon/fonts/Helvetica.afm');
|
||||
$pdf= new PDF($cn);
|
||||
$pdf->setDossierInfo(" Periode : ".$_GET['from_periode']." - ".$_GET['to_periode']);
|
||||
$pdf->AliasNbPages();
|
||||
$pdf->AddPage();
|
||||
|
||||
|
||||
echo_debug("quick_code_pdf",__LINE__,$f_id);
|
||||
$Fiche=new fiche($cn,$f_id);
|
||||
|
||||
|
||||
list($array,$tot_deb,$tot_cred)=$Fiche->get_row_date($from_periode,$to_periode);
|
||||
// don't print empty account
|
||||
if ( count($array) == 0 ) {
|
||||
continue;
|
||||
exit;
|
||||
}
|
||||
$Libelle=utf8_decode(sprintf("(%s) %s ",$Fiche->id,$Fiche->getName()));
|
||||
header_pdf($cn,$pdf);
|
||||
$size=array(13,25,20,80,12,20,20);
|
||||
$align=array('L','C','C','L','R','R','R');
|
||||
|
||||
$pdf->ezTable($array,
|
||||
array ('jr_internal'=>'Operation',
|
||||
'j_date_fmt' => 'Date',
|
||||
'jrn_name'=>'Journal',
|
||||
'description'=>'Description',
|
||||
'deb_montant'=> 'Montant',
|
||||
'cred_montant'=> 'Montant'
|
||||
),$Libelle,
|
||||
array('shaded'=>0,'showHeadings'=>1,'width'=>500,
|
||||
'cols'=>array('montant'=> array('justification'=>'right'),
|
||||
)),true);
|
||||
$str_debit=utf8_decode(sprintf("Débit % 12.2f",$tot_deb));
|
||||
$str_cred=utf8_decode(sprintf("Crédit % 12.2f",$tot_cred));
|
||||
$diff_solde=$tot_deb-$tot_cred;
|
||||
if ( $diff_solde < 0 ) {
|
||||
$solde=" C ";
|
||||
$diff_solde*=-1;
|
||||
} else
|
||||
{
|
||||
$solde=" D ";
|
||||
}
|
||||
$str_solde=sprintf(" Solde %s %12.2f",$solde,$diff_solde);
|
||||
$Libelle=sprintf("(%s) %s ",$Fiche->id,$Fiche->getName());
|
||||
$pdf->SetFont('DejaVu','',10);
|
||||
$pdf->Cell(0,8,$Libelle,1,0,'C');
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->ezText($str_debit,10,array('justification'=>'right'));
|
||||
$pdf->ezText($str_cred,10,array('justification'=>'right'));
|
||||
$pdf->ezText($str_solde,14,array('justification'=>'right'));
|
||||
|
||||
//New page
|
||||
$pdf->ezNewPage();
|
||||
header_pdf($cn,$pdf);
|
||||
|
||||
$pdf->SetFont('DejaVuCond','',8);
|
||||
$l=0;
|
||||
$pdf->Cell($size[$l],6,'Date',0,0,'L');$l++;
|
||||
$pdf->Cell($size[$l],6,'Ref',0,0,'C');$l++;
|
||||
$pdf->Cell($size[$l],6,'Journal',0,0,'C');$l++;
|
||||
$pdf->Cell($size[$l],6,'Libellé',0,0,'L');$l++;
|
||||
$pdf->Cell($size[$l],6,'Let',0,0,'R');$l++;
|
||||
$pdf->Cell($size[$l],6,'Debit',0,0,'R');$l++;
|
||||
$pdf->Cell($size[$l],6,'Credit',0,0,'R');$l++;
|
||||
$pdf->ln();
|
||||
$tot_deb=0;$tot_cred=0;
|
||||
for ($e=0;$e<count($array);$e++) {
|
||||
$l=0;
|
||||
$row=$array[$e];
|
||||
$date=shrink_date($row['j_date_fmt']);
|
||||
$pdf->Cell($size[$l],6,$date,0,0,$align[$l]);$l++;
|
||||
$pdf->Cell($size[$l],6,$row['jr_internal'],0,0,$align[$l]);$l++;
|
||||
$pdf->Cell($size[$l],6,substr($row['jrn_name'],0,14),0,0,$align[$l]);$l++;
|
||||
$pdf->Cell($size[$l],6,$row['description'],0,0,$align[$l]);$l++;
|
||||
$pdf->Cell($size[$l],6,(($row['letter']!=-1)?$row['letter']:''),0,0,$align[$l]);$l++;
|
||||
$pdf->Cell($size[$l],6,(sprintf('% 12.2f',$row['deb_montant'])),0,0,$align[$l]);$l++;
|
||||
$pdf->Cell($size[$l],6,(sprintf('% 12.2f',$row['cred_montant'])),0,0,$align[$l]);$l++;
|
||||
$pdf->ln();
|
||||
$tot_deb+=$row['deb_montant'];
|
||||
$tot_cred+=$row['cred_montant'];
|
||||
|
||||
}
|
||||
$str_debit=sprintf("% 12.2f €",$tot_deb);
|
||||
$str_credit=sprintf("% 12.2f €",$tot_cred);
|
||||
$diff_solde=$tot_deb-$tot_cred;
|
||||
if ( $diff_solde < 0 ) {
|
||||
$solde=" créditeur ";
|
||||
$diff_solde*=-1;
|
||||
} else
|
||||
{
|
||||
$solde=" débiteur ";
|
||||
}
|
||||
$str_diff_solde=sprintf("%12.2f €",$diff_solde);
|
||||
|
||||
$pdf->SetFont('DejaVu','B',8);
|
||||
|
||||
$pdf->Cell(160,5,'Débit',0,0,'R');
|
||||
$pdf->Cell(30,5,$str_debit,0,0,'R');$pdf->Ln();
|
||||
$pdf->Cell(160,5,'Crédit',0,0,'R');
|
||||
$pdf->Cell(30,5,$str_credit,0,0,'R');$pdf->Ln();
|
||||
$pdf->Cell(160,5,'Solde '.$solde,0,0,'R');
|
||||
$pdf->Cell(30,5,$str_diff_solde,0,0,'R');$pdf->Ln();
|
||||
|
||||
$fDate=date('dmy-Hi');
|
||||
$pdf->Output('fiche-'.$fDate.'.pdf','I');
|
||||
|
||||
$pdf->ezStream();
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ if ( isset ($_POST['view'] ) ) {
|
|||
|
||||
echo "<table>";
|
||||
echo '<TR>';
|
||||
echo '<TD><form method="POST" ACTION="print_balance.php">'.
|
||||
echo '<TD><form method="GET" ACTION="print_balance.php">'.
|
||||
dossier::hidden().
|
||||
HtmlInput::submit('bt_pdf',"Export PDF").
|
||||
HtmlInput::hidden("p_action","impress").
|
||||
|
|
@ -141,7 +141,7 @@ if ( isset ($_POST['view'] ) ) {
|
|||
HtmlInput::hidden("from_poste",$_POST['from_poste']).
|
||||
HtmlInput::hidden("to_poste",$_POST['to_poste']);
|
||||
echo "</form></TD>";
|
||||
echo '<TD><form method="POST" ACTION="bal_csv.php">'.
|
||||
echo '<TD><form method="GET" ACTION="bal_csv.php">'.
|
||||
HtmlInput::submit('bt_csv',"Export CSV").
|
||||
dossier::hidden().
|
||||
HtmlInput::hidden("p_action","impress").
|
||||
|
|
|
|||
|
|
@ -916,7 +916,7 @@ Array
|
|||
"case when j_debit='t' then j_montant else 0 end as deb_montant,".
|
||||
"case when j_debit='f' then j_montant else 0 end as cred_montant,".
|
||||
" jr_comment as description,jrn_def_name as jrn_name,".
|
||||
"j_debit, jr_internal,jr_id ".
|
||||
"j_debit, jr_internal,jr_id,coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter ".
|
||||
" from jrnx left join jrn_def on jrn_def_id=j_jrn_def ".
|
||||
" left join jrn on jr_grpt_id=j_grpt".
|
||||
" where j_qcode=$1 and ".
|
||||
|
|
@ -1088,7 +1088,7 @@ Array
|
|||
dossier::hidden().
|
||||
$hid->input("type","poste").$hid->input('p_action','impress')."</form></TD>";
|
||||
|
||||
echo '<TD><form method="POST" ACTION="quick_code_pdf.php">'.
|
||||
echo '<TD><form method="GET" ACTION="quick_code_pdf.php">'.
|
||||
HtmlInput::submit('bt_pdf',"Export PDF").
|
||||
dossier::hidden().
|
||||
$hid->input("type","poste").
|
||||
|
|
@ -1102,7 +1102,7 @@ Array
|
|||
|
||||
echo "</form></TD>";
|
||||
|
||||
echo '<TD><form method="POST" ACTION="quick_code_csv.php">'.
|
||||
echo '<TD><form method="GET" ACTION="quick_code_csv.php">'.
|
||||
HtmlInput::submit('bt_csv',"Export CSV").
|
||||
dossier::hidden().
|
||||
$hid->input("type","poste").
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class PDF extends SFPDF {
|
|||
|
||||
function Header() {
|
||||
//Arial bold 12
|
||||
$this->SetFont('Arial', 'B', 12);
|
||||
$this->SetFont('DejaVu', 'B', 12);
|
||||
//Title
|
||||
$this->Cell(0,10,$this->dossier, 'B', 0, 'C');
|
||||
//Line break
|
||||
|
|
|
|||
|
|
@ -92,20 +92,7 @@ print td($w_poste->search().$w_poste->input());
|
|||
echo td($span->input('f_id_label'));
|
||||
print '</TR>';
|
||||
print '<TR>';
|
||||
// filter on the current year
|
||||
/*
|
||||
$select=new ISelect();
|
||||
$filter_year=" where p_exercice='".$User->get_exercice()."'";
|
||||
$periode_start=$cn->make_array("select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
|
||||
$select->label="Depuis";
|
||||
$select->selected=(isset($_REQUEST['from_periode']))?$_REQUEST['from_periode']:"";
|
||||
print td($select->input('from_periode',$periode_start));
|
||||
$select->label=" jusqu'à ";
|
||||
$periode_end=$cn->make_array("select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
|
||||
$select->selected=(isset($_REQUEST['to_periode']))?$_REQUEST['to_periode']:"";
|
||||
print td($select->input('to_periode',$periode_end));
|
||||
print "</TR>";
|
||||
*/
|
||||
|
||||
$date_from=new IDate('from_periode');
|
||||
$date_to=new IDate('to_periode');
|
||||
$year=$User->get_exercice();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue