<?php
/****************************************************************************************
SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV

Version 0.9.9

Copyright (C) 2006-2009  Sylvain FATOME
This program 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.

This program 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 this program
(in the directory docs); 
if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
Boston, MA  02110-1301, USA.

Contact : galawa@free.fr

Web : http://smitst.homelinux.com
****************************************************************************************/


// Vérification des tentatives de hack
$pos=strpos($_SERVER['PHP_SELF'],"inc.php");
if ($pos===FALSE)
	$ok_inc=TRUE;
else
	$ok_inc=FALSE;
if ($ok_inc==FALSE) header("Location: ../index.php");

include_once("../inc/fic_age.inc.php");
include_once("../inc/fic_cli.inc.php");
include_once("../inc/fic_hum.inc.php");
include_once("../inc/fic_dos.inc.php");
include_once("../inc/fic_st.inc.php");
include_once("../inc/fic_tec.inc.php");
include_once("../inc/fic_txt.inc.php");
include_once("../inc/func_time.inc.php");
include_once("../inc/func_date.inc.php");
include_once("../inc/func_geo.inc.php");
include_once("../inc/func_txt.inc.php");
include_once("../inc/func_txtcm.inc.php");
include_once("../inc/func_geo.inc.php");
Archivelog(@$_SESSION["code_log"]);

$cd = strip_tags(trim($_GET['cd']));	// Récupération code Dossier
$niv_util = @$_SESSION["niv_log"];
	
$pbm_dospdf = FALSE;

if ($cd <> "")
{
	$nbdosd = nb_dosd_in_dos($cd);

	$row = lit_enr_dos($cd);
	if (is_array($row))
	{
		extract ($row);
		
		// Contrôle de hack pour une agence
		if ((($niv_util == 4) OR ($niv_util == 3)) AND ($dos_codeage <> @$_SESSION["code_age"]))
			$pbm_dospdf=TRUE;
		
		if ($pbm_dospdf==FALSE)
		{
			$dos_datecreaf = formatedate($dos_datecrea);
			$dos_datemodf = formatedate($dos_datemod);
			$dos_dateddef = formatedate($dos_datedde);
			$dos_datefinpf = formatedate($dos_datefinp);
			$dos_datefinf = formatedate($dos_datefin);
	
			$row = lit_enr_age($dos_codeage,TRUE);
			extract ($row);
	
			$cp_age = Retournecp_openId($age_ville,TRUE);
			$ville_age = Retourneville_openId($age_ville,TRUE);

			// Coordonnées compte client
			$row = lit_enr_cli($dos_codecli,TRUE);
			extract ($row);
	
			// Coordonnées technicien
			$row = lit_enr_tec($dos_codesuiv,TRUE);
			if (is_array($row))
				extract ($row);
	
			include_once('../classes/fpdf/fpdf.php');
			include_once('../inc/fpdf_ext.inc.php');
			
			$pdf=new PDF();
			$pdf->FPDF('P','mm','A4');
			$pdf->SetDisplayMode('real');
			$pdf->AliasNbPages();
			$pdf->SetTitle('Dossier N°'.$dos_code);
			$pdf->SetSubject('Dossier N°'.$dos_code);
			$pdf->settheader("dos");
			$pdf->AddPage();
	
			$pv_det_cli = $pv_ent_age; // Récupération de la position sous l'entête agence pour le pointeur détail client
			$pv_det_dos = $pv_ent_age; // Récupération de la position sous l'entête agence pour le pointeur détail dossier
	
			$pdf->SetLineWidth(0.4);
	
			// Impression du détail client
			$pdf->SetY($pv_det_cli); // Renvoie le pointeur SOUS l'entête agence
	
			$pdf->SetFont('Arial','BU',12); // Titre
			$nl_ent=8;
			$pdf->Cell(95,5,'CLIENT','LTR',1,'C');
		
			$ent_cli = ""; // Détail
			if ($cli_ste <>"") 
				$ent_cli.=$cli_ste."\n";
			else
				$ent_cli.= $cli_civilite." ".$cli_prenom." ".$cli_nom."\n";
			$pdf->SetFont('Arial','B',10);
			$pdf->MultiCell(95,4,$ent_cli,'LR','L');
			$nl_ent=$nl_ent-1;
	
			$ent_cli = $cli_adr1."\n"; // Suite...
			if (trim($cli_adr2)<>"")
			{
				$ent_cli.= $cli_adr2."\n";
				$nl_ent=$nl_ent-1;
			}
			$ent_cli.= Retournecp_openId($cli_ville,TRUE)." ".Retourneville_openId($cli_ville,TRUE)."\n";
			$ent_cli.= "Tel : ".$cli_telf."\n";
			$ent_cli.= "Fax : ".$cli_fax;
			$nl_ent=$nl_ent-4;
			if (trim($cli_tvai)<>"")
			{
				$ent_cli.= "\nTVA : ".$cli_tvai;
				$nl_ent=$nl_ent-1;
			}
			if ($nl_ent>0)
			{
				for ($nl=$nl_ent; $nl>=0; $nl--)
				{
					$ent_cli.= "\n";
				}
			}

			$pdf->SetFont('Arial','',10);
			$pdf->MultiCell(95,4,$ent_cli,'LRB','L');
	
			// Impression du détail dossier
	
			$pdf->SetY($pv_det_dos); // Renvoie le pointeur SOUS l'entête agence
	
	
			$pdf->Cell(95);
			
			$pdf->SetFont('Arial','',8);  // Niveau d'urgence
			$pdf->Cell(95,5,$dos_urg,'LTR',1,'R');
	
			$pdf->Cell(95);
	
			$ent_dos = "Création :\n";
			$ent_dos.= "Fin prévue :\n";
			$ent_dos.= "Agence :\n";
			$ent_dos.= "Responsable :\n";
			$ent_dos.= "Catégorie :\n";
			$ent_dos.= "Statut :\n";
			$ent_dos.= "Probabilité :\n";
			$ent_dos.= "Avancement :\n";
	
			$pdf->MultiCell(22,4,$ent_dos,'B','R');
	
			$pdf->SetY($pv_det_dos+5); // Renvoie le pointeur SOUS l'entête agence + 5mm (cellule niveau urgence)
			$pdf->Cell(117);
	
			$ent_dos = $dos_codecrea."\n";
			$ent_dos.= $dos_datefinpf."\n";
			$ent_dos.= $dos_codeage."\n";
			$ent_dos.= $dos_codesuiv."\n";
	
				// Récupération libellé catégorie
				$row = lit_enr_dosc($dos_codedosc);
				if (is_array($row))
					extract($row);
			$ent_dos.= $dosc_desc."\n";

				// Récupération libellé statut
				$row = lit_enr_doss($dos_codedoss);
				if (is_array($row))
					extract($row);
			$ent_dos.= $doss_desc."\n";
			$ent_dos.= $dos_proba."%\n";
			$ent_dos.= $dos_avance."%\n";

			$pdf->MultiCell(73,4,$ent_dos,'BR','L');
			
			$pdf->ln(2);
			
			$pdf->SetLineWidth(0.2);
			$pdf->SetDrawColor(220);
	
			// Détail du dossier

			$pdf->SetFont('Arial','B',10);
			$pdf->Cell(40,5,'Titre : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->MultiCell(150,4,$dos_titre,1,'L');
	
			$pdf->ln(1);

			$pdf->SetFont('Arial','B',10);
			$pdf->Cell(40,5,'Résumé : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->MultiCell(150,4,$dos_res,1,'L');
			
			$pdf->ln(1);

			$pdf->SetFont('Arial','B',10);
			$pdf->Cell(40,5,'Prix de revient : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->MultiCell(150,4,format_num(px_revient_dos($dos_code,TRUE),2).$lang['symbole_monnaie_txt'],1,'L');
	
	
			$pdf->ln(1);

			if ($nbdosd <> 0) // S'il y a des détails, on les affiche
			{ 
				$pdf->SetFillColor(255);
				$pdf->SetTextColor(0);
	
				$pdf->Ln(2);
				$pdf->SetFont('Arial','BU',12);
				$pdf->Cell(190,5,'HISTORIQUE',0,1,'C');
				$pdf->Ln(2);

				$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
				mysql_select_db(DBNAME);

				$rech = "SELECT * FROM ".TBDOSD." WHERE dosd_codedos='".$dos_code."' ORDER BY dosd_dateact";
				$rs = mysql_query($rech) or die(mysql_error());
					
				while ($row = mysql_fetch_assoc($rs)) 
				{
					extract($row);
					
					$pdf->Ln(3);
					$pdf->SetFont('Arial','',10);
					$pdf->SetFillColor(0);
					$pdf->SetTextColor(255);
					$pdf->Cell(80,5,'Action du '.formatedate($dosd_dateact).' de '.substr($dosd_heured,0,5).' à '.substr($dosd_heuref,0,5),1,1,'C',1);
					$pdf->SetFillColor(255);
					$pdf->SetTextColor(0);
					$pdf->Ln(1);

					$PosY=$pdf->GetY();
					$pdf->SetDrawColor(125);
					$pdf->SetLineWidth(0.4);
					$pdf->LineHP(10,200,$PosY,5,1);
					$pdf->SetDrawColor(0);
					$pdf->SetLineWidth(0.2);
	

					$pdf->SetLineWidth(0.2);
					$pdf->SetDrawColor(220);
					$pdf->Ln(1);
		
					$pdf->SetFont('Arial','',8);

					// Type action
					$pdf->SetFont('Arial','B',10);
					$pdf->Cell(40,5,'Type action : ',0,0,'R');
						// Récupération libellé type action
						$rech2 = "SELECT * FROM `" .TBDOSTA. "` WHERE `dosta_code` = '$dosd_codedosta'";
						$rs2 = mysql_query($rech2)or die(mysql_error());
						if ($row2 = mysql_fetch_array($rs2))
							extract($row2);
					$pdf->SetFont('Arial','',8);
					$pdf->MultiCell(150,4,$dosta_desc,1,'L');
					$pdf->Ln(1);

					// Objet
					$pdf->SetFont('Arial','B',10);
					$pdf->Cell(40,5,'Objet : ',0,0,'R');
					$pdf->SetFont('Arial','',8);
					$pdf->MultiCell(150,4,$dosd_obj,1,'L');
					$pdf->Ln(1);

					// Résumé
					$pdf->SetFont('Arial','B',10);
					$pdf->Cell(40,5,'Résumé : ',0,0,'R');
					$pdf->SetFont('Arial','',8);
					$pdf->MultiCell(150,4,$dosd_res,1,'L');
					$pdf->Ln(1);

					// Conclusion
					$pdf->SetFont('Arial','B',10);
					$pdf->Cell(40,5,'Conclusion : ',0,0,'R');
					$pdf->SetFont('Arial','',8);
					$pdf->MultiCell(150,4,$dosd_concl,1,'L');
					$pdf->Ln(1);

					// Intervenants
					$pdf->SetFont('Arial','BU',10);
					$pdf->Cell(190,5,'Intervenants',0,1,'C');
					
					//...Agences
					$rech2 = "SELECT * FROM `".TBDOSDI."` WHERE `dosdi_iddosd`=".$dosd_id." AND `dosdi_typinter`=0";
					$rs2 = mysql_query($rech2) or die(mysql_error());
					
					if (mysql_num_rows($rs2)>0)
					{
						$pdf->Ln(1);
						$pdf->SetFont('Arial','IU',8);
						$pdf->MultiCell(190,4,'Agence',0,1,'C');
						$pdf->Ln(1);

						$row2=lit_enr_age($dos_codeage,FALSE);
						if (is_array($row2))
							extract($row2);
						
						$txt_ctact="";
						// Contact principal
						$txt_cage = $age_resp_nom." ".$age_resp_prenom." (Contact principal)";
						if (exist_inter_id_in_dosdi($dosd_id,0,"-1",$dos_codeage,FALSE))
							$txt_ctact.=$txt_cage."\n";

						// Contacts secondaires
						$rech3 = "SELECT * FROM ".TBCAGE." WHERE `cage_codeage` = '".$dos_codeage."' ORDER BY cage_nom";
						$rs3 = mysql_query($rech3) or die(mysql_error());
						if (mysql_num_rows($rs3) <> 0)
						{
							while ($row3 = mysql_fetch_array($rs3)) 
							{
								extract($row3);
						
								$txt_cage = $cage_nom." ".$cage_prenom;
								$row4=lit_enr_fonc($cage_codefonc,FALSE);
								if (is_array($row4))
								{
									extract($row4);
									$txt_fonc=$fonc_desc;
								}
								else
									$txt_fonc=$cage_codefonc;
								$txt_cage.=" (".$txt_fonc.")";
								if (exist_inter_id_in_dosdi($dosd_id,0,$cage_id,$dos_codeage,FALSE))
									$txt_ctact.=$txt_cage."\n";
							}
						}
						mysql_free_result($rs3);
						$pdf->SetFont('Arial','',8);
						$pdf->MultiCell(190,4,$txt_ctact,1,'L');
						$pdf->Ln(1);
					}
					mysql_free_result($rs2);

					//...Techniciens
					$rech2 = "SELECT * FROM `".TBDOSDI."` WHERE `dosdi_iddosd`=".$dosd_id." AND `dosdi_typinter`=1";
					$rs2 = mysql_query($rech2) or die(mysql_error());
					
					if (mysql_num_rows($rs2)>0)
					{
						$pdf->Ln(1);
						$pdf->SetFont('Arial','IU',8);
						$pdf->MultiCell(190,4,'Techniciens',0,1,'C');
						$pdf->Ln(1);

						$txt_ctact="";

						$rech3 = "SELECT * FROM ".TBTEC." WHERE `tec_codeage` = '$dos_codeage' AND `tec_out` = '0' ORDER BY tec_nom";
						$rs3 = mysql_query($rech3) or die(mysql_error());
						if (mysql_num_rows($rs3) <> 0)
						{
							while ($row3 = mysql_fetch_array($rs3)) 
							{
								extract($row3);
						
								$txt_tec = $tec_nom." ".$tec_prenom;
								if (exist_inter_id_in_dosdi($dosd_id,'1',$tec_id,$tec_code,FALSE))
									$txt_ctact.=$txt_tec."\n";
							}
						}
						mysql_free_result($rs3);
						$pdf->SetFont('Arial','',8);
						$pdf->MultiCell(190,4,$txt_ctact,1,'L');
						$pdf->Ln(1);
					}
					mysql_free_result($rs2);

					//...Clients
					$rech2 = "SELECT * FROM `".TBDOSDI."` WHERE `dosdi_iddosd`=".$dosd_id." AND (`dosdi_typinter`=2 OR `dosdi_typinter`=6)";
					$rs2 = mysql_query($rech2) or die(mysql_error());
					
					if (mysql_num_rows($rs2)>0)
					{
						$pdf->Ln(1);
						$pdf->SetFont('Arial','IU',8);
						$pdf->MultiCell(190,4,'Client',0,1,'C');
						$pdf->Ln(1);

						$row2=lit_enr_cli($dos_codecli,FALSE);
						if (is_array($row2))
							extract($row2);
						
						
						$txt_ctact="";
						// Contact principal
						$txt_ccli = $cli_nom." ".$cli_prenom." (Contact principal)";
						if (exist_inter_id_in_dosdi($dosd_id,2,"-1",$cli_code,FALSE))
							$txt_ctact.=$txt_ccli."\n";

						// Contacts secondaires
						$rech3 = "SELECT * FROM ".TBCCLI." WHERE `ccli_codecli` = '".$cli_code."' ORDER BY ccli_nom";
						$rs3 = mysql_query($rech3) or die(mysql_error());
						if (mysql_num_rows($rs3) <> 0)
						{
							while ($row3 = mysql_fetch_array($rs3)) 
							{
								extract($row3);
						
								$txt_ccli = $ccli_nom." ".$ccli_prenom;
								$row4=lit_enr_fonc($ccli_codefonc,FALSE);
								if (is_array($row4))
								{
									extract($row4);
									$txt_fonc=$fonc_desc;
								}
								else
									$txt_fonc=$ccli_codefonc;
								$txt_ccli.=" (".$txt_fonc.")";
								if (exist_inter_id_in_dosdi($dosd_id,2,$ccli_id,$cli_code,FALSE))
									$txt_ctact.=$txt_ccli."\n";
							}
						}
						mysql_free_result($rs3);

						// Contacts sites
						$rech3 = "SELECT * FROM ".TBSCLI." WHERE `scli_codecli` = '".$cli_code."' ORDER BY scli_ste,scli_rnom";
						$rs3 = mysql_query($rech3) or die(mysql_error());
						if (mysql_num_rows($rs3) <> 0)
						{
							while ($row3 = mysql_fetch_array($rs3)) 
							{
								extract($row3);
						
								$txt_ccli = $scli_rnom." ".$scli_rprenom;
								$row4=lit_enr_fonc($scli_rcodefonc,FALSE);
								if (is_array($row4))
								{
									extract($row4);
									$txt_fonc=$fonc_desc;
								}
								else
									$txt_fonc=$scli_rcodefonc;
								$txt_ccli.=" (Site ".$scli_ste.", ".$txt_fonc.")";
								if (exist_inter_id_in_dosdi($dosd_id,6,$scli_id,$cli_code,FALSE))
									$txt_ctact.=$txt_ccli."\n";
							}
						}
						mysql_free_result($rs3);

						$pdf->SetFont('Arial','',8);
						$pdf->MultiCell(190,4,$txt_ctact,1,'L');
						$pdf->Ln(1);
					}
					mysql_free_result($rs2);

					//...Marques
					$rech2 = "SELECT * FROM `".TBDOSDI."` WHERE `dosdi_iddosd`=".$dosd_id." AND `dosdi_typinter`=3";
					$rs2 = mysql_query($rech2) or die(mysql_error());
					
					if (mysql_num_rows($rs2)>0)
					{
						$pdf->Ln(1);
						$pdf->SetFont('Arial','IU',8);
						$pdf->MultiCell(190,4,'Fabricant / Editeur',0,1,'C');
						$pdf->Ln(1);

						$txt_ctact="";

						$codemque="";
						$codemque=donne_code_mds($dosd_id,3,FALSE);
						$rech3 = "SELECT mque_ste FROM ".TBMQUE." WHERE `mque_code` = '".$codemque."'";
						$rs3 = mysql_query($rech3) or die(mysql_error());
						if ($row3 = mysql_fetch_array($rs3)) 
							extract($row3);
						mysql_free_result($rs3);
						
						$rech3 = "SELECT * FROM ".TBCMQUE." WHERE `cmque_codemque` = '".$codemque."' ORDER BY cmque_nom";
						$rs3 = mysql_query($rech3) or die(mysql_error());
						if (mysql_num_rows($rs3) <> 0)
						{
							while ($row3 = mysql_fetch_array($rs3)) 
							{
								extract($row3);
						
								$txt = $cmque_nom." ".$cmque_prenom;
								$row4=lit_enr_fonc($cmque_codefonc,FALSE);
								if (is_array($row2))
								{
									extract($row4);
									$txt_fonc=$fonc_desc;
								}
								else
									$txt_fonc=$cmque_codefonc;
								$txt.=" (".$mque_ste.", ".$txt_fonc.")";
								if (exist_inter_id_in_dosdi($dosd_id,3,$cmque_id,$codemque,FALSE))
									$txt_ctact.=$txt."\n";
							}
						}
						mysql_free_result($rs3);
						
						$pdf->SetFont('Arial','',8);
						$pdf->MultiCell(190,4,$txt_ctact,1,'L');
						$pdf->Ln(1);
					}
					mysql_free_result($rs2);

					//...Donneurs d'ordres
					$rech2 = "SELECT * FROM `".TBDOSDI."` WHERE `dosdi_iddosd`=".$dosd_id." AND `dosdi_typinter`=4";
					$rs2 = mysql_query($rech2) or die(mysql_error());
					
					if (mysql_num_rows($rs2)>0)
					{
						$pdf->Ln(1);
						$pdf->SetFont('Arial','IU',8);
						$pdf->MultiCell(190,4,'Donneur d\'ordres',0,1,'C');
						$pdf->Ln(1);

						$txt_ctact="";

						$codedo="";
						$codedo=donne_code_mds($dosd_id,4,FALSE);
						$rech3 = "SELECT do_nom FROM ".TBDO." WHERE `do_code` = '".$codedo."'";
						$rs3 = mysql_query($rech3) or die(mysql_error());
						if ($row3 = mysql_fetch_array($rs3)) 
							extract($row3);
						mysql_free_result($rs3);
						
						$rech3 = "SELECT * FROM ".TBCDO." WHERE `cdo_codedo` = '".$codedo."' ORDER BY cdo_nom";
						$rs3 = mysql_query($rech3) or die(mysql_error());
						if (mysql_num_rows($rs3) <> 0)
						{
							while ($row3 = mysql_fetch_array($rs3)) 
							{
								extract($row3);
						
								$txt = $cdo_nom." ".$cdo_prenom;
								$row4=lit_enr_fonc($cdo_codefonc,FALSE);
								if (is_array($row2))
								{
									extract($row4);
									$txt_fonc=$fonc_desc;
								}
								else
									$txt_fonc=$cdo_codefonc;
								$txt.=" (".$do_nom.", ".$txt_fonc.")";
								if (exist_inter_id_in_dosdi($dosd_id,4,$cdo_id,$codedo,FALSE))
									$txt_ctact.=$txt."\n";
							}
						}
						mysql_free_result($rs3);
						
						$pdf->SetFont('Arial','',8);
						$pdf->MultiCell(190,4,$txt_ctact,1,'L');
						$pdf->Ln(1);
					}
					mysql_free_result($rs2);

					//...Sous-traitants
					$rech2 = "SELECT * FROM `".TBDOSDI."` WHERE `dosdi_iddosd`=".$dosd_id." AND `dosdi_typinter`=5";
					$rs2 = mysql_query($rech2) or die(mysql_error());
					
					if (mysql_num_rows($rs2)>0)
					{
						$pdf->Ln(1);
						$pdf->SetFont('Arial','IU',8);
						$pdf->MultiCell(190,4,'Sous-traitants',0,1,'C');
						$pdf->Ln(1);

						$txt_ctact="";

						$codest="";
						$codest=donne_code_mds($dosd_id,5,FALSE);
						$rech3 = "SELECT st_nom FROM ".TBST." WHERE `st_code` = '".$codest."'";
						$rs3 = mysql_query($rech3) or die(mysql_error());
						if ($row3 = mysql_fetch_array($rs3)) 
							extract($row3);
						mysql_free_result($rs3);
						
						$rech3 = "SELECT * FROM ".TBCST." WHERE `cst_codest` = '".$codest."' ORDER BY cst_nom";
						$rs3 = mysql_query($rech3) or die(mysql_error());
						if (mysql_num_rows($rs3) <> 0)
						{
							while ($row3 = mysql_fetch_array($rs3)) 
							{
								extract($row3);
						
								$txt = $cst_nom." ".$st_prenom;
								$row4=lit_enr_fonc($cst_codefonc,FALSE);
								if (is_array($row4))
								{
									extract($row4);
									$txt_fonc=$fonc_desc;
								}
								else
									$txt_fonc=$cst_codefonc;
								$txt.=" (".$st_nom.", ".$txt_fonc.")";
								if (exist_inter_id_in_dosdi($dosd_id,5,$cst_id,$codest,FALSE))
									$txt_ctact.=$txt."\n";
							}
						}
						mysql_free_result($rs3);
						
						$pdf->SetFont('Arial','',8);
						$pdf->MultiCell(190,4,$txt_ctact,1,'L');
						$pdf->Ln(1);
					}
					mysql_free_result($rs2);
				}  
			}

			$PosY=$pdf->GetY();
			$pdf->SetDrawColor(125);
			$pdf->SetLineWidth(0.4);
			$pdf->LineHP(10,200,$PosY,5,1);
			$pdf->SetDrawColor(0);
			$pdf->SetLineWidth(0.2);
    /*
			//Détermination d'un nom de fichier temporaire dans le répertoire courant
			$file=basename(tempnam(getcwd(),'tmp'));
			rename($file,$file.'.pdf');
			$file.='.pdf';
	*/
			// $pdf->Output($file,'D');
			$pdf->Output('dos_'.$dos_code,'I');
		}
	}
	else
	{
		$pbm_dospdf = TRUE;
	}			
}
else
{
	$pbm_dospdf = TRUE;
}

if ($pbm_dospdf == TRUE)
{
?>
	<script type="text/javascript">
<!--
	self.close('');
	</script>
<?PHP
}
?>
