diff --git a/html/category_pdf.php b/html/category_pdf.php index 4789506fd..7613a322e 100644 --- a/html/category_pdf.php +++ b/html/category_pdf.php @@ -47,7 +47,7 @@ $pdf->AliasNbPages(); $pdf->AddPage(); $array=Fiche::get_fiche_def($cn,$_GET['cat']); $name=$cn->get_value('select fd_label from fiche_def where fd_id=$1',array($_GET['cat'])); -$pdf->SetFont('Arial','BI',14); +$pdf->SetFont('DejaVu','BI',14); $pdf->Cell(0,8,$name,0,1,'C'); $pdf->SetTitle($name,1); $pdf->SetAuthor('Phpcompta'); @@ -84,7 +84,7 @@ foreach($array as $row) { } /* skip if nothing to display */ if (count($letter->content) == 0 ) continue; - $pdf->SetFont('Arial','',10); + $pdf->SetFont('DejaVu','',10); $pdf->Cell(0,7,$row->strAttribut(ATTR_DEF_NAME),1,1,'C'); @@ -105,7 +105,7 @@ foreach($array as $row) { $pdf->SetFillColor(0,0,0); $fill=0; } - $pdf->SetFont('Arial','',8); + $pdf->SetFont('DejaVuCond','',8); $row=$letter->content[$i]; $str_date=shrink_date($row['j_date_fmt']); @@ -125,7 +125,7 @@ foreach($array as $row) { $pdf->Ln(); } $pdf->SetFillColor(0,0,0); - $pdf->SetFont('Arial','B',8); + $pdf->SetFont('DejaVuCond','B',8); $debit =sprintf('Debit : % 12.2f',$amount_deb); $credit=sprintf('Credit : % 12.2f',$amount_cred); if ( $amount_deb>$amount_cred) $s='solde débiteur'; else $s='solde crediteur'; @@ -139,4 +139,5 @@ foreach($array as $row) { } //Save PDF to file -$pdf->Output("category.pdf", 'I');exit; \ No newline at end of file +$fDate=date('dmy-Hi'); +$pdf->Output("category-$fDate.pdf", 'I');exit; \ No newline at end of file diff --git a/html/index.php b/html/index.php index 8e5d411f0..4268a0df4 100644 --- a/html/index.php +++ b/html/index.php @@ -141,21 +141,24 @@ BODY { } .button { - font-size:12; + font-size:10; color:black; text-decoration:none; - font-family: arial,sans-serif; - background-color:lightblue; - border-color: grey ; - border-width:1 1 2 1; + font-family: helvetica,arial,sans-serif; + background-color:#DFDFDF; +/* border-style: outset ;*/ + border-color: blue ; + border-width:1; padding:2 4 2 4; cursor:pointer; margin:1 2 1 2; + -moz-border-radius:2 2; } -.button:hover{ +.button:hover { cursor:pointer; background-color:white; +/* border-style: inset ;*/ font-color:blue; margin:1 2 1 2; } diff --git a/html/jrn_pdf.php b/html/jrn_pdf.php index 61587f440..9af3e96f8 100644 --- a/html/jrn_pdf.php +++ b/html/jrn_pdf.php @@ -1,57 +1,51 @@ can_request(IMPJRN,0); // Security if ( $_GET['jrn_id']!=0 && $User->check_jrn($_GET['jrn_id']) == 'X' ){ - /* Cannot Access */ - NoAccess(); - } + /* Cannot Access */ + NoAccess(); +} $ret=""; // filter : 0 for Grand Livre otherwise 1 $filter=( $Jrn->id == 0)?0:1; $jrn_type=$Jrn->get_type(); -echo_debug('jrn_pdf',__LINE__,'Jrn type '.$jrn_type); -echo_debug('jrn_pdf',__LINE__,'p_simple = '.$_REQUEST['p_simple']); + //---------------------------------------------------------------------- // Detailled Printing //--------------------------------------------------------------------- if ( $Jrn->id==0 || $jrn_type=='FIN' || $jrn_type=='ODS' || $_REQUEST['p_simple']== 0 ) -{ - $pdf= new Cezpdf("A4"); - $pdf->selectFont('./addon/fonts/Helvetica.afm'); - header_pdf($cn,$pdf); - // detailled printing - $offset=0;$limit=22;$step=22; - $rap_deb=0;$rap_cred=0; - while (1) { - $a=0; - list ($a_jrn,$tot_deb,$tot_cred)=$Jrn->get_row($_GET['from_periode'], - $_GET['to_periode'], - $_GET['central'], - $limit,$offset); - echo_debug('jrn_pdf.php',__LINE__,"Total debit $tot_deb,credit $tot_cred"); - - if ( $a_jrn==null) break; - $offset+=$step; - $first_id=$a_jrn[0]['int_j_id']; - $Exercice=$periode->get_exercice($a_jrn[0]['periode']); - + { + $pdf=new PDF($cn); + $pdf->setDossierInfo($Jrn->name); + $pdf->AliasNbPages(); + $pdf->AddPage(); - list($rap_deb,$rap_cred)=get_rappel($cn,$first_id,$Jrn->id,$Exercice,FIRST, - $filter, - $l_centr - ); - $pdf->ezText(utf8_decode($Jrn->name),30); - - if ( $l_centr == 1 ) { - // si centralisé montre les montants de rappel - $str_debit=utf8_decode(sprintf( "report Débit % 10.2f",$rap_deb)); - $str_credit=utf8_decode(sprintf("report Crédit % 10.2f",$rap_cred)); - $pdf->ezText($str_debit,12,array('justification'=>'right')); - $pdf->ezText($str_credit,12,array('justification'=>'right')); - } - $pdf->ezTable($a_jrn, - array ('j_id'=>utf8_decode(' Numéro'), - 'j_date' => 'Date', - 'poste'=>'Poste', - 'description' => 'Description', - 'deb_montant'=>utf8_decode( 'Débit'), - 'cred_montant'=>utf8_decode('Crédit')), - " ", - array('shaded'=>0,'showHeadings'=>1,'width'=>500, - 'cols'=>array('deb_montant'=> array('justification'=>'right'), - 'cred_montant'=> array('justification'=>'right'))), - true); - $a=1; - // Total Page - $apage=array(array('deb'=>sprintf("%8.2f",$tot_deb),'cred'=>$tot_cred)); - foreach ($apage as $key=>$element) echo_debug('jrn_pdf.php',__LINE__,"apage $key => $element"); - $pdf->ezTable($apage, - array ( - 'deb'=>utf8_decode( 'Total Débit'), - 'cred'=>utf8_decode('Total Crédit'))," ", - array('shaded'=>0,'showHeadings'=>1,'width'=>200, - 'xPos'=>'right','xOrientation'=>'left', - 'cols'=>array('deb'=> array('justification'=>'right'), - 'cred'=> array('justification'=>'right'))),true); + // detailled printing + $rap_deb=0;$rap_cred=0; + // take all operations from jrn or centralized + $array=$Jrn->get_operation($_GET['from_periode'],$_GET['to_periode'],$l_centr); - $count=count($a_jrn)-1; - $last_id=$a_jrn[$count]['int_j_id']; - $Exercice=$periode->get_exercice($a_jrn[$count]['periode']); - if ( $l_centr == 1) { - // Montant de rappel si centralisé - list($rap_deb,$rap_cred)=get_rappel($cn,$last_id,$Jrn->id,$Exercice,LAST,$filter,$l_centr); - $str_debit=utf8_decode(sprintf( "à reporter Débit % 10.2f",$rap_deb)); - $str_credit=utf8_decode(sprintf("à reporter Crédit % 10.2f",$rap_cred)); - $pdf->ezText($str_debit,12,array('justification'=>'right')); - $pdf->ezText($str_credit,12,array('justification'=>'right')); - } - //New page - $pdf->ezNewPage(); - header_pdf($cn,$pdf); + $pdf->SetFont('DejaVu','BI',7); + $pdf->Cell(160,7,'report Débit',0,0,'R'); + $pdf->Cell(30,7,sprintf('%10.2f',$rap_deb),0,0,'R');$pdf->Ln(4); + $pdf->Cell(160,7,'report Crédit',0,0,'R'); + $pdf->Cell(30,7,sprintf('%10.2f',$rap_cred),0,0,'R');$pdf->Ln(4); - } - if ( $a == 1 ) { - $apage=array('deb'=>$tot_deb,'cred'=>$tot_cred); - $pdf->ezTable($apage, - array ( - 'deb'=>utf8_decode( 'Total Débit'), - 'cred'=>utf8_decode('Total Crédit'))," ", - array('shaded'=>0,'showHeadings'=>1,'width'=>500, - 'cols'=>array('deb'=> array('justification'=>'right'), - 'cred'=> array('justification'=>'right'))),true); - $count=count($a_jrn)-1; - $last_id=$a_jrn[$count]['int_j_id']; - $Exercice=$periode->get_exercice($a_jrn[$count]['periode']); - - list($rap_deb,$rap_cred)=get_rappel($cn,$last_id,$Jrn->id,$Exercice,LAST,$filter,$l_centr); - $str_debit=utf8_decode(sprintf( "à reporter Débit % 10.2f",$rap_deb)); - $str_credit=utf8_deccode(sprintf("à reporter Crédit % 10.2f",$rap_cred)); - $pdf->ezText($str_debit,12,array('justification'=>'right')); - $pdf->ezText($str_credit,12,array('justification'=>'right')); - - } - $pdf->ezStream(); - exit(0); -} // impression detaillé -//---------------------------------------------------------------------- -// Simple Printing -//--------------------------------------------------------------------- -if ( ($jrn_type=='ACH' || $jrn_type=='VEN' ) && $_REQUEST['p_simple']== 1 ) -{ - /* simple printing with vat */ - if ( $own->MY_TVA_USE=='Y') { - echo_debug ('jrn_pdf',__LINE__,'here'); - echo_debug('jrn_pdf',__LINE__,$Jrn); - $pdf= new Cezpdf("A4",'landscape'); - // $pdf->selectFont('./addon/fonts/Helvetica.afm'); - $pdf->selectFont('./addon/fonts/Courier.afm'); - header_pdf($cn,$pdf); + // print all operation + for ($i=0;$i< count($array);$i++) { + $pdf->SetFont('DejaVuCond','B',7); + $row=$array[$i]; - $offset=0;$limit=30;$step=30; - $a_Tva=$cn->get_array("select tva_id,tva_label,tva_poste from tva_rate where tva_rate != 0.0000 order by tva_id"); - $col_tva="TVA "; - $space=0; - $total_HTVA=0.0; - $total_TVAC=0.0; - foreach($a_Tva as $line_tva) - { - //initialize Amount TVA - $tmp1=$line_tva['tva_label']; - $rap_tva[$tmp1]=0.0; - if ( $space == 0 ) - $col_tva=str_repeat(" ",6).utf8_decode($line_tva['tva_label']); - else { - $ecart=$space-strlen($line_tva['tva_label']); - $ecart=($ecart<0)?0:$ecart; - $col_tva.=str_repeat(" ",$ecart).utf8_decode($line_tva['tva_label']); + $pdf->Cell(15,7,$row['id']); + $pdf->Cell(20,7,$row['internal']); + $pdf->Cell(15,7,$row['date_fmt']); + $pdf->Cell(100,7,$row['comment']); + $pdf->Cell(20,7,$row['pj']); + $pdf->Cell(20,7,$row['montant'],0,0,'R'); + + $pdf->Ln(4); + // get the entries + $aEntry=$cn->get_array("select j_id,j_poste,j_qcode,j_montant,j_debit, ". + " pcm_lib ". + " from jrnx join tmp_pcmn on (j_poste=pcm_val) where j_grpt = $1". + " order by j_debit,j_id", + array($row['jr_grpt_id'])); + for ($j=0;$jSetFont('DejaVuCond','',7); + $entry=$aEntry[$j]; + // $pdf->Cell(15,6,$entry['j_id'],0,0,'R'); + $pdf->Cell(32,6,$entry['j_qcode'],0,0,'R'); + $pdf->Cell(23,6,$entry['j_poste'],0,0,'R'); + + // if j_qcode is not empty retrieve name + if ( $entry['j_qcode'] != '') { + $f_id=$cn->get_value('select f_id from vw_poste_qcode where j_qcode=$1',array($entry['j_qcode'])); + $name=$cn->get_value('select av_text from attr_value join jnt_fic_att_value using(jft_id) where f_id=$1 and ad_id=1', + array($f_id)); + } else + $name=$entry['pcm_lib']; + $pdf->Cell(80,6,$name,0,0,'L'); + + // print amount + $str_amount=sprintf('%10.2f',$entry['j_montant']); + if ( $entry['j_debit']=='t') { + $pdf->Cell(20,6,$str_amount,0,0,'R'); + $pdf->Cell(20,6,'',0,0,'R'); + } else { + $pdf->Cell(20,6,'',0,0,'R'); + $pdf->Cell(20,6,$str_amount,0,0,'R'); } - $space=9; - } - - // if the period is centralized get the first amounts - if ( $l_centr==1) - list($total_TVAC,$total_HTVA)=get_rappel_simple($cn,$Jrn->id,$jrn_type,$_GET['from_periode'],$rap_tva); - - - - while (1) { - - $a=0; - $a_jrn=$Jrn->get_rowSimple($_GET['from_periode'], - $_GET['to_periode'], - $_GET['central'], - 1, - $limit, - $offset); - if ( $a_jrn == null ) break; - - // page Header - $t=sprintf("Rappel TVAC = %.2f HTVA= %.2f",$total_TVAC,$total_HTVA); - foreach($rap_tva as $idx=>$am) { - $t.=utf8_decode(sprintf('[ %s = % .2f]',$idx,$am)); + $pdf->Ln(4); } - $pdf->ezText($t,9,array('justification'=>'left')); + } + $fDate=date('dmy-Hi'); + $pdf->Output('journal-'.$fDate.'.pdf','I'); + exit(0); + } // impression detaillé +//---------------------------------------------------------------------- +// Simple Printing Purchase Ledger +//--------------------------------------------------------------------- +if ( ($jrn_type=='VEN' || $jrn_type=='ACH') && $_REQUEST['p_simple']== 1 ) + { + $pdf= new PDFLand($cn,'L'); + $pdf->setDossierInfo($Jrn->name); + $pdf->AliasNbPages(); + $pdf->AddPage(); + $offset=0;$limit=30;$step=30; - $offset+=$step; - //total page - $total_htva_page=0.0;$total_tvac_page=0.0; + /* simple printing with vat */ + if ( $own->MY_TVA_USE=='Y') { + $pdf->SetFont('DejaVu','BI',7); + + + // Show column header, if $flag_tva is false then display vat as column + $a_Tva=$Jrn->existing_vat(); foreach($a_Tva as $line_tva) { //initialize Amount TVA - $tmp1=$line_tva['tva_label']; - $page_tva[$tmp1]=0.0; - } - $str_tva=""; + $tmp1=$line_tva['tva_id']; + $rap_tva[$tmp1]=0; + } + $flag_tva=(count($a_Tva) > 4)?true:false; + $pdf->Cell(15,6,'PJ'); + $pdf->Cell(15,6,'Date'); + if ( $jrn_type=='ACH') + $pdf->Cell(20,6,'Client'); + else + $pdf->Cell(20,6,'Fournisseur'); + $pdf->Cell(65,6,'Description'); - - $pdf->ezTable($a_jrn, - array('num'=>utf8_decode('Numéro'), - 'date'=>'Date', - 'jr_internal'=>'Int.', - 'client'=>'Client', - 'comment'=>'Description', - 'HTVA'=>'HTVA', - 'TVA_INLINE'=>$col_tva, - 'TVAC'=>'TVAC'), - utf8_decode($Jrn->name), - array('shaded'=>0,'showHeadings'=>1,'fontSize'=>8,'width'=>750,'Maxwidth'=>750), - true - - - - ); - //-------------------------------------------------------------------------------- - // Foot - // Set total foot page - // amount VAT - foreach ($a_jrn as $row) + $pdf->Cell(15,6,'HTVA',0,0,'R'); + if ( $jrn_type=='ACH') { - $total_TVAC+=$row['TVAC']; - $total_HTVA+=$row['HTVA']; - $total_tvac_page+=$row['TVAC']; - $total_htva_page+=$row['HTVA']; - - foreach ($row['TVA'] as $line) - { - $tva_id=$line[1][1]; - $rap_tva[$tva_id]+=$line[1][2]; - $page_tva[$tva_id]+=$line[1][2]; - } + $pdf->Cell(15,6,'Privé',0,0,'R'); + $pdf->Cell(15,6,'TVA ND',0,0,'R'); + } + if ( ! $flag_tva ) { + foreach($a_Tva as $line_tva) { + $pdf->Cell(15,6,$line_tva['tva_label'],0,0,'R'); } - //total page - $t=sprintf("total page TVAC = %.2f HTVA= %.2f",$total_tvac_page,$total_htva_page); - foreach($page_tva as $idx=>$am) { - $t.=utf8_decode(sprintf('[ %s = % .2f ]',$idx,$am)); } - $pdf->ezText($t,9,array('justification'=>'left')); + $pdf->Cell(15,6,'TVAC',0,0,'R'); + $pdf->Ln(5); - $t=utf8_decode(sprintf("total à reporter TVAC = %.2f HTVA= %.2f",$total_TVAC,$total_HTVA)); - foreach($rap_tva as $idx=>$am) { - $t.=utf8_decode(sprintf('[ %s = % .2f ]',$idx,$am)); - } - $pdf->ezText($t,9,array('justification'=>'left')); - - // New Page - $pdf->ezNewPage(); - header_pdf($cn,$pdf); - echo_debug('jrn_pdf',__LINE__,$a_jrn); - } - } else { /* we do not use any vat */ - - $pdf= new Cezpdf("A4",'landscape'); - // $pdf->selectFont('./addon/fonts/Helvetica.afm'); - $pdf->selectFont('./addon/fonts/Courier.afm'); - header_pdf($cn,$pdf); - - $offset=0;$limit=30;$step=30; - $space=0; - $total_HTVA=0.0; - $total_TVAC=0.0; - - if ( $l_centr==1) - list($total_TVAC,$total_HTVA)=get_rappel_simple($cn,$Jrn->id,$jrn_type,$_GET['from_periode'],$rap_tva); - - - while (1) { - - $a=0; - $a_jrn=$Jrn->get_rowSimple($_GET['from_periode'], + // if the period is centralized get the first amounts + if ( $l_centr==1) + $a=0; + $a_jrn=$Jrn->get_operation($_GET['from_periode'], $_GET['to_periode'], - $_GET['central'], - 1, - $limit, - $offset); - if ( $a_jrn == null ) break; - // page Header - $t=sprintf("Rappel Total = %.2f ",$total_TVAC); + $_GET['central']); + if ( $a_jrn == null ) exit(); + /* + * get rappel to initialize amount rap_xx + *the easiest way is to compute sum from quant_ + */ + $previous=$Jrn->previous_amount($_GET['from_periode']); + + /* initialize the amount to report */ + foreach($previous['tva'] as $line_tva) + { + //initialize Amount TVA + $tmp1=$line_tva['tva_id']; + $rap_tva[$tmp1]=$line_tva['sum_vat']; + } + $rap_htva=$previous['price'];$rap_tvac=$previous['price']+$previous['vat'];$rap_priv=$previous['priv'];$rap_nd=$previous['tva_nd_recup']; + + $pdf->SetFont('DejaVu','',6); + // page Header + $pdf->Cell(130,6,sprintf('%.2f',$previous['price']),0,0,'R'); /* HTVA */ + if ( $jrn_type != 'VEN') { + $pdf->Cell(15,6,sprintf('%.2f',$previous['priv']),0,0,'R'); /* prive */ + $pdf->Cell(15,6,sprintf('%.2f',$previous['tva_nd_recup']),0,0,'R'); /* Tva ND */ + } + foreach($previous['tva'] as $line_tva) + $pdf->Cell(15,6,sprintf('%.2f',$line_tva['sum_vat']),0,0,'R'); + $pdf->Cell(15,6,sprintf('%.2f',$previous['price']+$previous['vat']),0,0,'R'); /* Tvac */ + + $pdf->Ln(6); - $pdf->ezText($t,9,array('justification'=>'left')); $offset+=$step; + $new_page=false; + //total page - $total_htva_page=0.0;$total_tvac_page=0.0; - - - $pdf->ezTable($a_jrn, - array('num'=>utf8_decode('Numéro'), - 'date'=>'Date', - 'client'=>'Client', - 'jr_internal'=>'Int.', - 'comment'=>'Description', - 'TVAC'=>'Total'), - utf8_decode($Jrn->name), - array('shaded'=>0,'showHeadings'=>1,'fontSize'=>8,'width'=>750,'Maxwidth'=>750), - true - - - - ); - //-------------------------------------------------------------------------------- - // Foot - // Set total foot page - // amount VAT - foreach ($a_jrn as $row) + $tp_htva=0.0;$tp_tvac=0.0;$tp_priv=0;$tp_nd=0; + foreach($a_Tva as $line_tva) { - $total_TVAC+=$row['TVAC']; - $total_tvac_page+=$row['TVAC']; - + //initialize Amount TVA + $tmp1=$line_tva['tva_id']; + $tp_tva[$tmp1]=0.0; } + + for ( $i=0;$iSetFont('DejaVu','BI',7); + $pdf->AddPage(); + // page Header + $pdf->Cell(15,6,'PJ'); + $pdf->Cell(15,6,'Date'); + if ( $jrn_type=='ACH') + $pdf->Cell(20,6,'Client'); + else + $pdf->Cell(20,6,'Fournisseur'); + $pdf->Cell(65,6,'Description'); + + $pdf->Cell(15,6,'HTVA',0,0,'R'); + if ($jrn_type !='VEN') { + $pdf->Cell(15,6,'Privé',0,0,'R'); + $pdf->Cell(15,6,'TVA ND',0,0,'R'); + } + if ( ! $flag_tva ) { + foreach($a_Tva as $line_tva) { + $pdf->Cell(15,6,$line_tva['tva_label'],0,0,'R'); + } + } + $pdf->Cell(15,6,'TVAC',0,0,'R'); + $pdf->Ln(5); + $pdf->SetFont('DejaVu','',6); + $pdf->Cell(130,6,sprintf('%.2f',$rap_htva),0,0,'R'); /* HTVA */ + if($jrn_type !='VEN') { + $pdf->Cell(15,6,sprintf('%.2f',$rap_priv),0,0,'R'); /* prive */ + $pdf->Cell(15,6,sprintf('%.2f',$rap_nd),0,0,'R'); /* Tva ND */ + } + foreach($a_Tva as $line_tva) { + $l=$line_tva['tva_id']; + $pdf->Cell(15,6,sprintf('%.2f',$rap_tva[$l]),0,0,'R'); + } + $pdf->Cell(15,6,sprintf('%.2f',$rap_tvac),0,0,'R'); /* Tvac */ + + $pdf->Ln(6); + + } + + /* initialize tva */ + for ($f=0;$fvat_operation($a_jrn[$i]['jr_grpt_id']); + + // put vat into array + for ($f=0;$fCell(15,6,($row['pj'])); + $pdf->Cell(15,6,shrink_date($row['date_fmt'])); + $pdf->Cell(20,6,$row['internal']); + $pdf->Cell(65,6,$row['comment']); + /* get other amount (without vat, total vat included, private, ND */ + $other=$Jrn->get_other_amount($a_jrn[$i]['jr_grpt_id']); + $tp_htva+=$other['price']; + $tp_tvac+=$other['price']+$other['vat']; + $tp_priv+=$other['priv']; + $tp_nd+=$other['priv']; + $rap_htva+=$other['price']; + $rap_tvac+=$other['price']+$other['vat']; + $rap_priv+=$other['priv']; + $rap_nd+=$other['priv']; + + + $pdf->Cell(15,6,sprintf("%.2f",$other['price']),0,0,'R'); + if ( $jrn_type !='VEN') { + $pdf->Cell(15,6,sprintf("%.2f",$other['priv']),0,0,'R'); + $pdf->Cell(15,6,sprintf("%.2f",$other['tva_nd_recup']),0,0,'R'); + } + foreach ($atva_amount as $row_atva_amount) { + $pdf->Cell(15,6,sprintf("%.2f",$row_atva_amount),0,0,'R'); + } + $pdf->Cell(15,6,sprintf("%.2f",($other['price']+$other['vat'])),0,0,'R'); + $pdf->Ln(5); + /* footer */ + /* every lines reset total page and print table footer and set flag new_page to true */ + if ($i>0 && $i % 26 == 0) { + $pdf->Cell(115,6,'total page',0,0,'R'); /* HTVA */ + $pdf->Cell(15,6,sprintf('%.2f',$tp_htva),0,0,'R'); /* HTVA */ + if ( $jrn_type !='VEN') { + $pdf->Cell(15,6,sprintf('%.2f',$tp_priv),0,0,'R'); /* prive */ + $pdf->Cell(15,6,sprintf('%.2f',$tp_nd),0,0,'R'); /* Tva ND */ + } + foreach($a_Tva as $line_tva) { + $l=$line_tva['tva_id']; + $pdf->Cell(15,6,sprintf('%.2f',$tp_tva[$l]),0,0,'R'); + } + $pdf->Cell(15,6,sprintf('%.2f',$tp_tvac),0,0,'R'); /* Tvac */ + $pdf->Ln(2); + + $pdf->Cell(115,6,'report',0,0,'R'); /* HTVA */ + $pdf->Cell(15,6,sprintf('%.2f',$rap_htva),0,0,'R'); /* HTVA */ + if ( $jrn_type != 'VEN') { + $pdf->Cell(15,6,sprintf('%.2f',$rap_priv),0,0,'R'); /* prive */ + $pdf->Cell(15,6,sprintf('%.2f',$rap_nd),0,0,'R'); /* Tva ND */ + } + foreach($a_Tva as $line_tva) { + $l=$line_tva['tva_id']; + $pdf->Cell(15,6,sprintf('%.2f',$rap_tva[$l]),0,0,'R'); + } + $pdf->Cell(15,6,sprintf('%.2f',$rap_tvac),0,0,'R'); /* Tvac */ + $pdf->Ln(2); + $new_page=true; + } + } + /* last footer */ + if ( ! $new_page) { + $pdf->Cell(115,6,'Total page ',0,'T','R'); /* HTVA */ + $pdf->Cell(15,6,sprintf('%.2f',$tp_htva),0,'T','R'); /* HTVA */ + if ( $jrn_type !='VEN') { + $pdf->Cell(15,6,sprintf('%.2f',$tp_priv),0,'T','R'); /* prive */ + $pdf->Cell(15,6,sprintf('%.2f',$tp_nd),0,'T','R'); /* Tva ND */ + } + foreach($a_Tva as $line_tva) { + $l=$line_tva['tva_id']; + $pdf->Cell(15,6,sprintf('%.2f',$tp_tva[$l]),0,'T','R'); + } + $pdf->Cell(15,6,sprintf('%.2f',$tp_tvac),0,'T','R'); /* Tvac */ + $pdf->Ln(2); + + $pdf->Cell(115,6,'report',0,0,'R'); /* HTVA */ + $pdf->Cell(15,6,sprintf('%.2f',$rap_htva),0,0,'R'); /* HTVA */ + if ( $jrn_type !='VEN') { + $pdf->Cell(15,6,sprintf('%.2f',$rap_priv),0,0,'R'); /* prive */ + $pdf->Cell(15,6,sprintf('%.2f',$rap_nd),0,0,'R'); /* Tva ND */ + } + foreach($a_Tva as $line_tva) { + $l=$line_tva['tva_id']; + $pdf->Cell(15,6,sprintf('%.2f',$rap_tva[$l]),0,0,'R'); + } + $pdf->Cell(15,6,sprintf('%.2f',$rap_tvac),0,0,'R'); /* Tvac */ + $pdf->Ln(2); + $new_page=true; + } + + } else { + /* ---------------------------------------------------------------------- */ + /* we do not use any vat */ + /* ---------------------------------------------------------------------- */ + $pdf->SetFont('DejaVu','BI',7); + $pdf->Cell(15,6,'PJ'); + $pdf->Cell(15,6,'Date'); + if ( $jrn_type=='ACH') + $pdf->Cell(20,6,'Client'); + else + $pdf->Cell(20,6,'Fournisseur'); + $pdf->Cell(65,6,'Description'); + + if ( $jrn_type=='ACH') + { + $pdf->Cell(15,6,'Privé',0,0,'R'); + } + $pdf->Cell(15,6,'TVAC',0,0,'R'); + $pdf->Ln(5); + + $a_jrn=$Jrn->get_operation($_GET['from_periode'], + $_GET['to_periode'], + $_GET['central']); + if ( $a_jrn == null ) exit(); + /* + * get rappel to initialize amount rap_xx + *the easiest way is to compute sum from quant_ + */ + $previous=$Jrn->previous_amount($_GET['from_periode']); + + $rap_htva=$previous['price'];$rap_tvac=$previous['price']+$previous['vat'];$rap_priv=$previous['priv'];$rap_nd=$previous['tva_nd_recup']; + + $pdf->SetFont('DejaVu','',6); + // page Header + $pdf->Cell(130,6,sprintf('%.2f',$previous['price']),0,0,'R'); /* HTVA */ + if ( $jrn_type !='VEN') { + $pdf->Cell(15,6,sprintf('%.2f',$previous['priv']),0,0,'R'); /* prive */ + } + $pdf->Ln(6); + + + $offset+=$step; + $new_page=false; + //total page - $t=sprintf("total page = %.2f ",$total_tvac_page); + $tp_htva=0.0;$tp_tvac=0.0;$tp_priv=0;$tp_nd=0; + for ( $i=0;$iezText($t,9,array('justification'=>'left')); + if ( $new_page ) { + $new_page=false; + /* reset total page */ + //total page + $tp_htva=0.0;$tp_tvac=0.0;$tp_priv=0;$tp_nd=0; + $pdf->SetFont('DejaVu','BI',7); + $pdf->AddPage(); + // page Header + $pdf->Cell(15,6,'PJ'); + $pdf->Cell(15,6,'Date'); + if ( $jrn_type=='ACH') + $pdf->Cell(20,6,'Client'); + else + $pdf->Cell(20,6,'Fournisseur'); + $pdf->Cell(65,6,'Description'); - $t=utf8_decode(sprintf("total à reporter = %.2f ",$total_TVAC)); + if ($jrn_type !='VEN') { + $pdf->Cell(15,6,'Privé',0,0,'R'); + } + $pdf->Cell(15,6,'TVAC',0,0,'R'); + $pdf->Ln(5); + $pdf->SetFont('DejaVu','',6); + if($jrn_type !='VEN') { + $pdf->Cell(15,6,sprintf('%.2f',$rap_priv),0,0,'R'); /* prive */ + } + $pdf->Cell(15,6,sprintf('%.2f',$rap_tvac),0,0,'R'); /* Tvac */ + + $pdf->Ln(6); - $pdf->ezText($t,9,array('justification'=>'left')); + } + $row=$a_jrn[$i]; + $pdf->Cell(15,6,($row['pj'])); + $pdf->Cell(15,6,shrink_date($row['date_fmt'])); + $pdf->Cell(20,6,$row['internal']); + $pdf->Cell(65,6,$row['comment']); + /* get other amount (without vat, total vat included, private, ND */ + $other=$Jrn->get_other_amount($a_jrn[$i]['jr_grpt_id']); + $tp_htva+=$other['price']; + $tp_tvac+=$other['price']+$other['vat']; + $tp_priv+=$other['priv']; + $tp_nd+=$other['priv']; + $rap_htva+=$other['price']; + $rap_tvac+=$other['price']+$other['vat']; + $rap_priv+=$other['priv']; + $rap_nd+=$other['priv']; - // New Page - $pdf->ezNewPage(); - header_pdf($cn,$pdf); - echo_debug('jrn_pdf',__LINE__,$a_jrn); - } + if ( $jrn_type !='VEN') { + $pdf->Cell(15,6,sprintf("%.2f",$other['priv']),0,0,'R'); + } - } /* else */ - - $pdf->ezStream(); - exit(0); + $pdf->Cell(15,6,sprintf("%.2f",($other['price']+$other['vat'])),0,0,'R'); + $pdf->Ln(5); + /* footer */ + /* every lines reset total page and print table footer and set flag new_page to true */ + if ($i>0 && $i % 26 == 0) { + $pdf->Cell(115,6,'total page',0,0,'R'); /* HTVA */ + if ( $jrn_type=='ACH') { + $pdf->Cell(15,6,sprintf('%.2f',$tp_priv),0,0,'R'); /* prive */ + } + $pdf->Cell(15,6,sprintf('%.2f',$tp_tvac),0,0,'R'); /* Tvac */ + $pdf->Ln(2); -} + $pdf->Cell(115,6,'report',0,0,'R'); /* HTVA */ + if ( $jrn_type=='ACH') { + $pdf->Cell(15,6,sprintf('%.2f',$rap_priv),0,0,'R'); /* prive */ + } + $pdf->Cell(15,6,sprintf('%.2f',$rap_tvac),0,0,'R'); /* Tvac */ + $pdf->Ln(2); + $new_page=true; + } + } + /* last footer */ + if ( ! $new_page) { + $pdf->Cell(115,6,'Total page ',0,'T','R'); /* HTVA */ + if ( $jrn_type=='ACH') { + $pdf->Cell(15,6,sprintf('%.2f',$tp_priv),0,'T','R'); /* prive */ + } + $pdf->Cell(15,6,sprintf('%.2f',$tp_tvac),0,'T','R'); /* Tvac */ + $pdf->Ln(2); + + $pdf->Cell(115,6,'report',0,0,'R'); /* HTVA */ + if ( $jrn_type=='ACH') { + $pdf->Cell(15,6,sprintf('%.2f',$rap_priv),0,0,'R'); /* prive */ + } + $pdf->Cell(15,6,sprintf('%.2f',$rap_tvac),0,0,'R'); /* Tvac */ + $pdf->Ln(2); + $new_page=true; + } + + } /* else */ + $fDate=date('dmy-Hi'); + $pdf->Output('journal-'.$fDate.'.pdf','I'); + + exit(0); + + } ?> diff --git a/html/style-light.css b/html/style-light.css index aa6cd55c8..dab9bab9d 100644 --- a/html/style-light.css +++ b/html/style-light.css @@ -2,8 +2,8 @@ BODY { background-color:#EDF3FF; - font-size:12px; - font-family:arial,sans-serif; + font-size:10; + font-family:helvetica,arial,sans-serif; padding:0; margin:0; } @@ -19,14 +19,14 @@ table.result { } table.result th { font-weight:bold; - font-family:arial,sans-serif; + font-family:helvetica,arial,sans-serif; border-bottom:1px solid blue; padding-left:10px; padding-right:10px; } h2 { - font-family:arial,sans-serif; + font-family:Helvetica,arial,sans-serif; font-size:14px; color:grey; } @@ -56,7 +56,7 @@ u_redcontent h2.info { h2.info { background-color:#879ED4; color:white; - font-size:16pt; + font-size:14px; text-align:center; padding:0px; margin:0px; @@ -139,7 +139,7 @@ div.lmenu { div.lextmenu { position: float; float:left; - font-family:arial,sans-serif; + font-family:helvetica,arial,sans-serif; font-size:9px; } @@ -154,7 +154,7 @@ div.searchmenu { div.recherche_form{ width:700px; font-size:9px; - font-family:arial,sans-serif; + font-family:Helvetica,arial,sans-serif; border-style:outset; border-width:1px; @@ -165,7 +165,7 @@ div.u_redcontent{ padding-top:7px; padding-left:8px; font-size:9px; - font-family:arial,sans-serif; + font-family:helvetica,arial,sans-serif; width:75%; } @@ -174,7 +174,7 @@ div.content{ float:left; padding-top:7px; width:100%; - font-family:arial,sans-serif; + font-family:helvetica,arial,sans-serif; clear:both; @@ -184,12 +184,12 @@ div.content30{ float:left; padding-top:7px; width:35%; - font-family:arial,sans-serif; + font-family:helvetica,arial,sans-serif; } div.no span{ position:static; - font-family:arial,sans-serif; + font-family:helvetica,arial,sans-serif; font-weight:bold; font-color:red; @@ -366,7 +366,7 @@ a.one:hover { a.detail { font-size:9px; - font-family:arial,sans-serif; + font-family:helvetica,arial,sans-serif; text-decoration: none; display: block; color: blue; @@ -375,7 +375,7 @@ a.detail a.detail:hover { font-size:9px; - font-family:arial,sans-serif; + font-family:helvetica,arial,sans-serif; color: white; background-color: rgb(93, 144, 205); text-decoration: none; @@ -387,7 +387,7 @@ li.menuv,ol.menuv { padding:1em 1em; } div.u_redcontent a { - font-family:arial,sans-serif; + font-family:helvetica,arial,sans-serif; text-decoration: none; display: block; color: blue; @@ -395,7 +395,7 @@ div.u_redcontent a { } div.u_redcontent a:hover { - font-family:arial,sans-serif; + font-family:helvetica,arial,sans-serif; color: white; background-color: rgb(93, 144, 205); text-decoration: none; @@ -403,7 +403,7 @@ div.u_redcontent a:hover { } div.content a { - font-family:arial,sans-serif; + font-family:helvetica,arial,sans-serif; text-decoration: none; display: block; color: blue; @@ -413,7 +413,7 @@ padding: 1px ; div.content a:hover { - font-family:arial,sans-serif; + font-family:helvetica,arial,sans-serif; color: white; background-color: rgb(93, 144, 205); text-decoration: none; @@ -457,7 +457,7 @@ div.content a.mtitle:hover { } div.u_redcontent input.text { - font-family:arial,sans-serif; + font-family:helvetica,arial,sans-serif; font-weight:normal; border-color:336699; border-style:solid; @@ -466,7 +466,7 @@ div.u_redcontent input.text { color:blue; } div.content input.text { - font-family:arial,sans-serif; + font-family:helvetica,arial,sans-serif; font-weight:normal; border-color:336699; border-style:solid; @@ -588,7 +588,7 @@ div.popup_border_title { border: 2px outset #201e87; background-color:#879ED4; font-size: 110% ; - font-family: arial,sans-serif; + font-family: helvetica,arial,sans-serif; font-style: italic; font-weight: bolder; text-align:center; @@ -610,7 +610,7 @@ div.popup_border_notitle { /*border:dotted 1px black;*/ border: 3px outset #201e87; background-color:lightblue; - font-family: arial,sans-serif; + font-family: helvetica,arial,sans-serif; font-style: italic; font-weight: bolder; text-align:center; @@ -632,7 +632,7 @@ div.popup_content { overflow: auto; background-color:#DFE7FF; font-size:10px ; - font-family: arial,sans-serif; + font-family: helvetica,arial,sans-serif; font-style: normal; font-weight: normal; color: black; @@ -750,7 +750,7 @@ cursor:inherit; } .button { - font-size:12; + font-size:10; color:black; text-decoration:none; font-family: helvetica,arial,sans-serif; @@ -764,7 +764,7 @@ cursor:inherit; -moz-border-radius:2 2; } -.button:hover{ +.button:hover { cursor:pointer; background-color:white; border-style: inset ; diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index d73ebecf2..1e24e284e 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -2339,4 +2339,189 @@ function get_last_date() } } + /** + *@brief retrieve operation from centralized or jrn + *@param $p_from periode (id) + *@param $p_to periode (id) + *@param $p_cent off or on + *@return an array + */ + function get_operation($p_from,$p_to,$cent) { + $jrn=($this->id==0)?'':' and jr_def_id = '.$this->id; + if ( $cent == 'off') { + $sql="select jr_id as id ,jr_internal as internal, ". + "jr_pj_number as pj,jr_grpt_id,". + " to_char(jr_date,'DDMMYY') as date_fmt, ". + " jr_comment as comment, jr_montant as montant ,". + " jr_grpt_id". + " from jrn where jr_tech_per >= $1 ". + ' and jr_tech_per <=$2 '.$jrn.' order by jr_date,substring(jr_pj_number,\'\\\d+$\')::numeric asc'; + } else { + $sql="select jr_c_opid as id ,jr_internal as internal, ". + "jr_pj_number as pj,jr_grpt_id,". + " to_char(jr_date,'DDMMYY') as date_fmt, ". + " jr_comment as comment, jr_montant as montant ,". + " jr_grpt_id". + " from jrn where jr_grpt_id in ( select c_grp from centralized) and jr_tech_per >= $1 ". + " and jr_tech_per <=$2 $jrn order by jr_date,substring(jr_pj_number,'\\\d+$')::numeric"; + } + $ret=$this->db->get_array($sql,array($p_from,$p_to)); + return $ret; + } + /** + *@brief return the used VAT code with a rate > 0 + *@return an array of tva_id,tva_label,tva_poste + */ + public function existing_vat(){ + if ( $this->type=='ACH') { + $array=$this->db->get_array("select tva_id,tva_label,tva_poste from tva_rate where tva_rate != 0.0000 ". + " and exists (select qp_vat_code from quant_purchase + where qp_vat_code=tva_id and exists (select j_id from jrnx where j_jrn_def = $1)) order by tva_id", + array($this->id)); + } + if ( $this->type=='VEN') { + $array=$this->db->get_array("select tva_id,tva_label,tva_poste from tva_rate where tva_rate != 0.0000 ". + " and exists (select qs_vat_code from quant_sold + where qs_vat_code=tva_id and exists (select j_id from jrnx where j_jrn_def = $1)) order by tva_id", + array($this->id)); + + } + return $array; + } + /** + *@brief get the amount of vat for a given jr_grpt_id from the table + * quant_purchase + *@param the jr_grpt_id + *@return array price=htva, [1] = vat, + *@note + *@see +@code +array + 'price' => string '91.3500' (length=7) + 'vat' => string '0.0000' (length=6) + 'priv' => string '0.0000' (length=6) + 'tva_nd_recup' => string '0.0000' (length=6) + +@endcode + */ + function get_other_amount($p_jr_id) { + if ( $this->type=='ACH') { + $array=$this->db->get_array('select sum(qp_price) as price,sum(qp_vat) as vat '. + ',sum(qp_dep_priv) as priv'. + ',sum(qp_nd_tva_recup) as tva_nd_recup'. + ' from quant_purchase join jrnx using(j_id) + where j_grpt=$1 ', + array($p_jr_id)); + $ret=$array[0]; + } + if ( $this->type=='VEN') { + $array=$this->db->get_array('select sum(qs_price) as price,sum(qs_vat) as vat '. + ',0 as priv'. + ',0 as tva_nd_recup'. + ' from quant_sold join jrnx using(j_id) + where j_grpt=$1 ', + array($p_jr_id)); + $ret=$array[0]; + + } + return $ret; + } + + /** + *@brief get the amount of vat for a given jr_grpt_id from the table + * quant_purchase + *@param the jr_grpt_id + *@return array of sum_vat, tva_label + *@note + *@see +@code + +@endcode + */ + function vat_operation($p_jr_id) { + if ( $this->type=='ACH') { + $array=$this->db->get_array('select coalesce(sum(qp_vat),0) as sum_vat,tva_id + from quant_purchase as p right join tva_rate on (qp_vat_code=tva_id) join jrnx using(j_id) + where tva_rate !=0.0 and j_grpt=$1 group by tva_id', + array($p_jr_id)); + } + if ( $this->type=='VEN') { + $array=$this->db->get_array('select coalesce(sum(qs_vat),0) as sum_vat,tva_id + from quant_sold as p right join tva_rate on (qs_vat_code=tva_id) join jrnx using(j_id) + where tva_rate !=0.0 and j_grpt=$1 group by tva_id', + array($p_jr_id)); + } + return $array; + } + /** + *@brief retrieve amount of previous periode + *@param $p_to frmo the start of the exercise until $p_to + *@return $array with vat, price,other_amount + *@note + *@see +@code +array + 'price' => string '446.1900' (length=8) + 'vat' => string '21.7600' (length=7) + 'priv' => string '0.0000' (length=6) + 'tva_nd_recup' => string '0.0000' (length=6) + 'tva' => + array + 0 => + array + 'sum_vat' => string '13.7200' (length=7) + 'tva_id' => string '1' (length=1) + 1 => + array + 'sum_vat' => string '8.0400' (length=6) + 'tva_id' => string '3' (length=1) + 2 => + array + 'sum_vat' => string '0.0000' (length=6) + 'tva_id' => string '4' (length=1) + +@endcode + */ + function previous_amount($p_to) { + /* get the first periode of exercise */ + $periode=new Periode($this->db,$p_to); + $exercise=$periode->get_exercice(); + list ($min,$max)=$periode->get_limit($exercise); + // min periode + if ($this->type=='ACH') { + /* get all amount exclude vat */ + $sql="select coalesce(sum(qp_price),0) as price". + " ,coalesce(sum(qp_vat),0) as vat ". + ',coalesce(sum(qp_dep_priv),0) as priv'. + ',coalesce(sum(qp_nd_tva_recup),0) as tva_nd_recup'. + ' from quant_purchase join jrnx using(j_id) '. + ' where j_tech_per >= $1 and j_tech_per < $2'; + $array=$this->db->get_array($sql,array($min->p_id,$p_to)); + $ret=$array[0]; + /* retrieve all vat code */ + $array=$this->db->get_array('select coalesce(sum(qp_vat),0) as sum_vat,tva_id + from quant_purchase as p right join tva_rate on (qp_vat_code=tva_id) join jrnx using(j_id) + where tva_rate !=0 and j_tech_per >= $1 and j_tech_per < $2 group by tva_id', + array($min->p_id,$p_to)); + $ret['tva']=$array; + } + if ($this->type=='VEN') { + /* get all amount exclude vat */ + $sql="select coalesce(sum(qs_price),0) as price". + " ,coalesce(sum(qs_vat),0) as vat ". + ',0 as priv'. + ',0 as tva_nd_recup'. + ' from quant_sold join jrnx using(j_id) '. + ' where j_tech_per >= $1 and j_tech_per < $2'; + $array=$this->db->get_array($sql,array($min->p_id,$p_to)); + $ret=$array[0]; + /* retrieve all vat code */ + $array=$this->db->get_array('select coalesce(sum(qs_vat),0) as sum_vat,tva_id + from quant_sold as p right join tva_rate on (qs_vat_code=tva_id) join jrnx using(j_id) + where tva_rate !=0 and j_tech_per >= $1 and j_tech_per < $2 group by tva_id', + array($min->p_id,$p_to)); + $ret['tva']=$array; + } + return $ret; + } } diff --git a/include/class_fiche.php b/include/class_fiche.php index 381b02a65..c6158fe35 100644 --- a/include/class_fiche.php +++ b/include/class_fiche.php @@ -1446,6 +1446,28 @@ function is_used() { return $sql; } + /** + *@brief move a card to another cat. The properties will changed + * and be removed + *@param $p_fdid the fd_id of destination + */ + function move_to($p_fdid) { + $this->cn->start(); + $this->cn->exec_sql('update fiche set fd_id=$1 where f_id=$2',array($p_fdid,$this->id)); + // add missing + $this->cn->exec_sql('select fiche_attribut_synchro($1)',array($p_fdid)); + // remove not valid + $ajnt=$this->cn->get_array('select jft_id from jnt_fic_att_value where f_id=$1 and ad_id not in (select ad_id from jnt_fic_attr where fd_id=$2)', + array($this->id,$p_fdid)); + if ( count($ajnt) == 0 ) return; + for ($i=0;$icn->exec_sql('delete from attr_value where jft_id=$1',array($ajnt[$i]['jft_id'])); + $this->cn->exec_sql('delete from jnt_fic_att_value where jft_id=$1',array($ajnt[$i]['jft_id'])); + + } + $this->cn->commit(); + } + static function test_me() { $cn=new Database(dossier::id()); $a=new Fiche($cn); diff --git a/include/class_html_input.php b/include/class_html_input.php index 1c05cefdc..061b8ee6a 100755 --- a/include/class_html_input.php +++ b/include/class_html_input.php @@ -203,7 +203,7 @@ echo $string => property={'prop':'1','prop2':'2','prop3':'3'}; */ static function button_anchor($p_label,$p_value,$p_name="") { $str='&PHPSESSID='.$_REQUEST['PHPSESSID']; - $r=sprintf(' %s', + $r=sprintf(' %s', $p_name, $p_value.$str, $p_label); diff --git a/include/class_pdf.php b/include/class_pdf.php index 8228f0562..25df1c0b9 100644 --- a/include/class_pdf.php +++ b/include/class_pdf.php @@ -34,13 +34,14 @@ class PDF extends SFPDF { var $dossier = "n/a"; var $date = ""; - public function PDF($p_cn = null, $orientation = 'P', $unit = 'mm', $format = 'A4') { + public function __construct ($p_cn = null, $orientation = 'P', $unit = 'mm', $format = 'A4') { if($p_cn == null) die("No database connection. Abort."); parent::SFPDF($orientation, $unit, $format); $this->AddFont('DejaVu','','dejavusans.php',true); $this->AddFont('DejaVu','B','dejavusansb.php',true); + $this->AddFont('DejaVu','BI','dejavusansbi.php',true); $this->AddFont('DejaVuCond','','dejavusanscondensed.php',true); $this->AddFont('DejaVuCond','B','dejavusanscondensedb.php',true); date_default_timezone_set ('Europe/Paris'); @@ -64,7 +65,7 @@ class PDF extends SFPDF { $this->Ln(20); } function Footer() { - //Position at 1.5 cm from bottom + //Position at 2 cm from bottom $this->SetY(-20); //Arial italic 8 $this->SetFont('Arial', 'I', 8); @@ -80,3 +81,42 @@ class PDF extends SFPDF { } } +class PDFLand extends PDF { + + public function __construct ($p_cn = null, $orientation = 'P', $unit = 'mm', $format = 'A4') { + + if($p_cn == null) die("No database connection. Abort."); + + parent::SFPDF('L', $unit, $format); + $this->AddFont('DejaVu','','dejavusans.php',true); + $this->AddFont('DejaVu','B','dejavusansb.php',true); + $this->AddFont('DejaVu','BI','dejavusansbi.php',true); + $this->AddFont('DejaVuCond','','dejavusanscondensed.php',true); + $this->AddFont('DejaVuCond','B','dejavusanscondensedb.php',true); + date_default_timezone_set ('Europe/Paris'); + + $this->cn = $p_cn; + $this->own = new own($this->cn); + $this->soc = $this->own->MY_NAME; + $this->date = date('d.m.Y'); + } + function Header() { + //Arial bold 12 + $this->SetFont('DejaVu', 'B', 10); + //Title + $this->Cell(0,10,$this->dossier, 'B', 0, 'C'); + //Line break + $this->Ln(20); + } + function Footer() { + //Position at 2 cm from bottom + $this->SetY(-20); + //Arial italic 8 + $this->SetFont('Arial', 'I', 8); + //Page number + $this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'C'); + $this->Ln(3); + // Created by PhpCompta + $this->Cell(0,8,'Created by Phpcompta, the most professional opensource accounting software http://www.phpcompta.eu',0,0,'C',false,'http://www.phpcompta.eu'); + } +} \ No newline at end of file diff --git a/include/fiche.inc.php b/include/fiche.inc.php index 4192aa823..5b33dcbc0 100644 --- a/include/fiche.inc.php +++ b/include/fiche.inc.php @@ -234,6 +234,7 @@ if ( isset ( $_GET["action"]) ) { if ( isset ($_GET["fiche"]) && $action=="vue" && ! isset ($_POST['add_fiche']) && ! isset ($_POST['update_fiche']) + && ! isset ($_POST['move']) && ! isset ($_POST['delete'])) { $User->can_request(FICADD); @@ -281,13 +282,17 @@ if ( isset ( $_GET["action"]) ) { echo $fiche->Display($t); echo HtmlInput::hidden("f_id",$_GET['fiche_id']); if ( $write != 0 ) { + $iselect=new ISelect('move_to'); + $iselect->value=$cn->make_array('select fd_id,fd_label from fiche_def '); //where frd_id='.$fiche->get_fiche_def_ref_id()); + echo HtmlInput::submit("update_fiche","Mise à jour"); echo HtmlInput::submit("delete" ,"Effacer cette fiche"); + echo HtmlInput::submit('move',_('Déplacer vers')); + echo $iselect->input(); } $str=""; + echo HtmlInput::button_anchor(_('Retour'),'?p_action=fiche&action=vue&'.$str_dossier.'&fiche='.$fiche->fiche_def.$str); - echo ''; if ( $write != 0 ) echo ''; echo ''; $recherche=false; @@ -374,9 +379,8 @@ if ( isset ($_POST["fiche"]) && isset ($_POST["add"] ) ) { echo dossier::hidden().HtmlInput::phpsessid(); echo $fiche->blank($_POST['fiche']); echo HtmlInput::submit("add_fiche","Ajout"); - echo ''. - ''; - + echo HtmlInput::button_anchor(_('Annuler'),$url.'&fiche='.$_POST['fiche'].'&'.$str_dossier); + echo ''; } @@ -448,6 +452,16 @@ if ( isset ($_POST["update_fiche"]) ) { echo ''; $recherche=false; } +//-------------------------------------------------------------------------------- +// Move a card to a new category +if ( isset($_POST['move'])){ + echo '
'; + $fiche=new Fiche($cn,$_POST['f_id']); + $fiche->move_to($_POST['move_to']); + $fiche_def=new fiche_def($cn,$_GET['fiche']); + $fiche_def->myList(); + echo '
'; +} //--Search menu if ( $recherche==true) { ShowRecherche(); diff --git a/include/impress.inc.php b/include/impress.inc.php index 8587ec971..ce53e0a00 100644 --- a/include/impress.inc.php +++ b/include/impress.inc.php @@ -40,7 +40,7 @@ $p_array=array(array ("?p_action=impress&type=jrn&".$str_dossier,_("Journaux")), $default=( isset ($_GET['type']))?"?p_action=impress&type=".$_GET['type']."&$str_dossier":""; -$result=ShowItem($p_array,'H',"mtitle","mtitle",$default,' width="100%"'); +$result=ShowItem($p_array,'H',"mtitle","mtitle",$default,' '); echo $result; echo ""; diff --git a/release-note b/release-note index d4c1ea622..08b7b08ca 100644 --- a/release-note +++ b/release-note @@ -22,4 +22,12 @@ comptable à une autre. Typiquement, il s'agit d'un débit qui correspond à un 5 Impression : nouveau menu Categorie, vous permet de visualiser par catégorie de fiche avec l'historique des opérations ou simplement le résumé. -6 Ecriture directe (re) devient Opérations Diverses \ No newline at end of file +6 Ecriture directe (re) devient Opérations Diverses + +7 Ajout du lettrage dans la plupart des impressions + +8 Les PDF sont en unicode + +9 Extension : vérification du chemin + +10 Fiche : possibilité de déplacer les fiches dans une autre catégorie, attention les attributs n'existant pas dans la catégorie cible seront supprimés \ No newline at end of file