| Current Path : /var/www/cesa.co.za/members/inc/ |
| Current File : /var/www/cesa.co.za/members/inc/readnext.inc |
<?php
// **************************************************************************************
// All the variables for the reading of the information of the Annual Declaration
// **************************************************************************************
include_once($_SERVER['DOCUMENT_ROOT'] . '/cfg/config.php');
$host = EW_CONN_HOST;
$user = EW_CONN_USER;
$password = EW_CONN_PASS;
$db = EW_CONN_DB;
mysql_connect("$host","$user","$password") or die("Unable to connect to SQL server");
mysql_select_db("$db") or die("Unable to select database");
// **************************************************************************************
// Get the Office ID that is valid for the Member firm logged on.
// **************************************************************************************
$CID = GetCID();
$query = "SELECT * FROM OfficeContacts WHERE OfficeContacts.ContactsID = '$CID'";
$result = mysql_query($query) or die("Select of id Failed");
$row = mysql_fetch_array($result);
$MemberOfficeID = $row['OfficeID'];
$MemberOfficeMandated = $row['MandatedPrincipal'];
// **************************************************************************************
// Get the Principle responsible person.
// **************************************************************************************
$query = "SELECT * FROM OfficeContacts WHERE (OfficeContacts.OfficeID = '$MemberOfficeID') AND (OfficeContacts.MandatedPrincipal = 1)";
$result = mysql_query($query) or die("Select of id Failed");
$row = mysql_fetch_array($result);
$MemberContactID = $row['ContactsID'];
$query = "SELECT * FROM Contacts WHERE Contacts.ContactsID = '$MemberContactID'";
$result = mysql_query($query) or die("Select of id Failed");
$row = mysql_fetch_array($result);
$MemberContactSurname = $row['ContactSurname'];
$MemberContactFirstname = $row['ContactFirstName'];
$MemberContactDesignation = $row['ContactDesignation'];
// **************************************************************************************
// Get the Firm ID that is valid for the Member firm logged on.
// **************************************************************************************
$query = "SELECT * FROM tblMemberFirmOffices WHERE tblMemberFirmOffices.OfficeID = '$MemberOfficeID'";
$result = mysql_query($query) or die("Select of id Failed");
$row = mysql_fetch_array($result);
$MemberFirmID = $row['FirmID'];
// var_dump($row);
// exit;
// **************************************************************************************
// Count how many Firm Offices there are.
// **************************************************************************************
$Squery = "SELECT * FROM ADec_tblMemberFirmOffices WHERE Prev_FirmID = '$MemberFirmID'
AND (SaaceBranch<>'International' OR SaaceBranch IS NULL)
AND DeclarationYear = '$DeclarationYear'";
$Sresult = mysql_query($Squery) or die("Select of offices Failed");
$OfficeCount = mysql_num_rows($Sresult);
$Squery = "SELECT * FROM ADec_tblMemberFirmOffices WHERE Prev_FirmID = '$MemberFirmID'
AND SaaceBranch='International'
AND DeclarationYear = '$DeclarationYear'";
// echo $Squery;
$Sresult = mysql_query($Squery) or die("Select of offices Failed");
$OfficeCountInternat = mysql_num_rows($Sresult);
// Get this office
$Squery = "SELECT * FROM ADec_tblMemberFirmOffices WHERE OfficeID = '$SelectOfficeID'";
$Sresult = mysql_query($Squery) or die("Select of id Failed");
$Srow = mysql_fetch_array($Sresult);
$OfficeID = $Srow['OfficeID'];
$OfficeStatus = $Srow['OfficeStatus'];
$OfficeName = $Srow['OfficeName'];
$OfficeBuilding = $Srow['BldgName'];
$OfficeStreet = $Srow['StreetName'];
$OfficeSuburb = $Srow['Suburb'];
$OfficeTownCity = $Srow['TownCity'];
$OfficeCountry = $Srow['Country'];
$OfficeCode = $Srow['PostalCode'];
$OfficeProvince = $Srow['Province'];
$OfficePostalAdd = $Srow['PostalAddress'];
$OfficeTel = $Srow['Telephone'];
$OfficeFax = $Srow['Fax'];
$OfficeEmail = $Srow['Email'];
$OfficeLanguage = $Srow['Language'];
$OfficeLocalM = $Srow['GeoLocationLocal'];
$OfficeDistrict = $Srow['GeoLocationDistrict'];
$OfficeAddress2 = $Srow['Address2'];
$OfficeGeoLocation = $Srow['GeoLocation'];
$MemberProffStaff = $Srow['ProfessionalStaff'];
$MemberNonProff = $Srow['NonProfTechStaff'];
$MemberOtherStaff = $Srow['OtherStaff'];
$HRName = $Srow['HRName'];
$HREmail = $Srow['HREmail'];
$HoldingComp = $Srow['HoldingCompany'];
$Fidic = $Srow['Fidic'];
if (strlen($OfficeBuilding) <= 0) {
$OfficeBuilding = $row['BldgName'];
}
if (strlen($OfficeStreet) <= 0) {
$OfficeStreet = $row['StreetName'];
}
if (strlen($OfficeSuburb) <= 0) {
$OfficeSuburb = $row['Suburb'];
}
if (strlen($OfficeTownCity) <= 0) {
$OfficeTownCity = $row['TownCity'];
}
if (strlen($OfficeCountry) <= 0) {
$OfficeCountry = $row['Country'];
}
if (strlen($OfficeCode) <= 0) {
$OfficeCode = $row['PostalCode'];
}
if (strlen($OfficeProvince) <= 0) {
$OfficeProvince = $row['Province'];
}
if (strlen($OfficePostalAdd) <= 0) {
$OfficePostalAdd = $row['PostalAddress'];
}
if (strlen($OfficeTel) <= 0) {
$OfficeTel = $row['Telephone'];
}
if (strlen($OfficeFax) <= 0) {
$OfficeFax = $row['Fax'];
}
if (strlen($OfficeEmail) <= 0) {
$OfficeEmail = $row['Email'];
}
if (strlen($OfficeLanguage) <= 0) {
$OfficeLanguage = $row['Language'];
}
if (strlen($OfficeLocalM) <= 0) {
$OfficeLocalM = $row['GeoLocationLocal'];
}
if (strlen($OfficeDistrict) <= 0) {
$OfficeDistrict = $row['GeoLocationDistrict'];
}
if (strlen($OfficeAddress2) <= 0) {
$OfficeAddress2 = $row['Address2'];
}
if (strlen($OfficeGeoLocation) <= 0) {
$OfficeGeoLocation = $row['GeoLocation'];
}
if (strlen($MemberProffStaff) <= 0) {
$MemberProffStaff = $row['ProfessionalStaff'];
}
if (strlen($MemberNonProff) <= 0) {
$MemberNonProff = $row['NonProfTechStaff'];
}
if (strlen($MemberOtherStaff) <= 0) {
$MemberOtherStaff = $row['OtherStaff'];
}
if (strlen($HRName) <= 0) {
$HRName = $row['HRName'];
}
if (strlen($HREmail) <= 0) {
$HREmail = $row['HREmail'];
}
if (strlen($HoldingComp) <= 0) {
$HoldingComp = $row['HoldingCompany'];
}
if (strlen($Fidic) <= 0) {
$Fidic = $row['Fidic'];
}
// **************************************************************************************
// Get the Firm Details that is valid for the Member firm logged on.
// **************************************************************************************
$query = "SELECT FirmID, FirmName, PIUnderwriter, LevelOfCover, FormOfIncorporation, `Quality Management`, `Date of last peer review`, URL,
Acoustics, Agricultural, BuildingServices, Chemical, Civil, Development, Electrical, Electronic, Environmental, Geotechnical, Industrial,
Mechanical, Marine, Mining, Process, Structural, Transportation, Architecture, RuralDevelopment, ProjectManagement, QuantitySurveying,
TownPlanning, Multidisciplinary, DisputeResolution, ExpertWitness, InformationSystems, FacilitiesManagement, GIS
FROM ADec_tblMemberFirms
WHERE Prev_FirmID = '$MemberFirmID' AND DeclarationYear = $DeclarationYear";
$result = mysql_query($query) or die("Select of id Failed");
$row = mysql_fetch_array($result);
$MemberFirmName = $row['FirmName'];
$MemberFirmInsurer = $row['PIUnderwriter'];
$MemberFirmLevelCover = $row['LevelOfCover'];
$MemberFirmFormIncorp = $row['FormOfIncorporation'];
$MemberFirmISO = $row['Quality Management'];
$MemberFirmDateReview = $row['Date of last peer review'];
$MemberFirmURL = $row['URL'];
$MemberFirmMainInvoice = $row['MainFirmInvoice'];
$MEmberFirmGroupInvoice = $row['GroupFirmsInvoice'];
// **************************************************************************************
// Get the Principle person responsible for the office.
// **************************************************************************************
$query = "SELECT * FROM ADec_OfficeContacts WHERE (OfficeID = '$OfficeID') AND (OfficeHead = 1 )";
$result = mysql_query($query) or die("Select of id Failed");
$row = mysql_fetch_array($result);
$HeadOfficeID = $row['ContactsID'];
$query = "SELECT * FROM ADec_Contacts WHERE ContactsID = '$HeadOfficeID'";
$result = mysql_query($query) or die("Select of id Failed");
$row = mysql_fetch_array($result);
$HeadContactSurname = $row['ContactSurname'];
$HeadContactFirstname = $row['ContactFirstName'];
$HeadContactDesignation = $row['ContactDesignation'];
$HeadContactQualifications = $row['Qualifications'];
$HeadContactRegistration = $row['ProfessionalRegistrations'];
$HeadContactEmail = $row['PreferredEmail'];