<?php





// parse general TRF data

$trfdetails = mysqli_query($cmctrfdb, "SELECT * FROM `trf-details` LEFT JOIN `article_type` ON `trf-details`.idarticletype=`article_type`.idarticletype LEFT JOIN modelarticle ON `trf-details`.model=modelarticle.idmodelarticle  WHERE `trf-details`.idtrfdetails='$idtrf'");

$trfData = mysqli_fetch_assoc($trfdetails);

$idcertificate=$trfData['idcertification'];

// parse identification parts data

$identparts = mysqli_query($cmctrfdb, "SELECT * FROM `identificationparts` WHERE `identificationparts`.idtrfdetails='$idtrf'");

$identpartData = mysqli_fetch_assoc($identparts);

// parse fileattached data

$fileattach = mysqli_query($cmctrfdb, "SELECT * FROM `fileattached` WHERE `fileattached`.idtrfdetails='$idtrf'");

$fileattachData = mysqli_fetch_assoc($fileattach);

// parse standards data

$stdinfo = new WA_MySQLi_RS("stdinfo",$cmctrfdb,0);

$stdinfo->setQuery("SELECT * FROM `trfstandards` LEFT JOIN `standards` ON `trfstandards`.idstandards=`standards`.idstandards LEFT JOIN protectioncategory ON `trfstandards`.idprotectioncategory=protectioncategory.idprotectioncategory LEFT JOIN dpicategory ON `trfstandards`.iddpicategory=dpicategory.iddpicategory WHERE `trfstandards`.idtrfdetails='$idtrf'");

$stdinfo->execute();

// parse add requirements data

$addreqlist = new WA_MySQLi_RS("addreqlist",$cmctrfdb,0);

$addreqlist->setQuery("SELECT * FROM trfaddrequirements LEFT JOIN additionalrequirements ON trfaddrequirements.idadditionalrequirements=additionalrequirements.idadditionalrequirements WHERE trfaddrequirements.idtrf='$idtrf'");

$addreqlist->execute();

$totreq=$addreqlist->TotalRows;

// parse chemical agent data

$cheminfo = new WA_MySQLi_RS("cheminfo",$cmctrfdb,0);

$cheminfo->setQuery("SELECT * FROM trfchemicalagent LEFT JOIN chemicalagent ON trfchemicalagent.idchemicalagent=chemicalagent.idchemicalagent WHERE trfchemicalagent.idtrf='$idtrf'");

$cheminfo->execute();

// parse certification revision

$certificationrevision = new WA_MySQLi_RS("certificationrevision",$cmctrfdb,0);

$certificationrevision->setQuery("SELECT * FROM certificationtype WHERE certificationtype.idcertificationtype='$idcertificate'");

$certificationrevision->execute();

// parse identification parts









if ($idcertificate==5 || $idcertificate==6) {

	$kindcont='audit';

// parse contacts data  with variable kindofcontacts

//$contactsinfo = mysqli_query($cmctrfdb, "SELECT * FROM `contacts` WHERE `contacts`.idtrf='$idtrf' WHERE contacts.kindofcontacts='kindcont'");

//$contactsinfoData = mysqli_fetch_assoc($contactsinfo);

// parse audit dpi

//$identparts = mysqli_query($cmctrfdb, "SELECT * FROM auditdpi WHERE auditdpi.idtrfdetails='$idtrf'");

//$identpartData = mysqli_fetch_assoc($identparts);

}

?>

<?php







$appformn=$pdfrequestformn." N.".$trfData['trfnumber'];

if (isset($trfData['photofilename'])) {

$image1="uploadimages/".$trfData['photofilename'];

} 

//echo $appformn;

?>

