| Current Path : /var/www/cesa.co.za/members/inc/ |
| Current File : /var/www/cesa.co.za/members/inc/submitcheckA.inc |
<title>Submit Check</title>
<div align="center">
<?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;
if (!($link = mysql_connect("$host", "$user", "$password"))) {
throw new Exception("Unable to connect to SQL server");
}
if (!($result = mysql_select_db("$db"))) {
throw new Exception("Unable to select database");
}
include( '../inc/conf.inc' );
// **** Check to see if the update has been performed.
$query = "SELECT FirmID, Prev_FirmID FROM ADec_tblMemberFirms WHERE Prev_FirmID = '$MemberFirmID' AND DeclarationYear = $DeclarationYear";
if (!($result = mysql_query($query))) {
throw new Exception("Select of id Failed: " . $query);
}
$row = mysql_fetch_array($result);
if ($row) {
$ErrorReport = "You have already completed this section of the update.<p>";
$NextSection = "complete";
} else {
// **** Check the fields to see if they were completed correctly
if ($form[firmname]) {
$errorcondition = "no";
} else {
$errorcondition = "yes";
$ErrorReport = "<font color = red>FOUT !!! : </font> Voltooi ASB die veld <b>FIRMA NAAM</b>.";
}
if ($errorcondition == "no") {
if ($form[name]) {
$errorcondition = "no";
} else {
$errorcondition = "yes";
$ErrorReport = "<font color = red>FOUT !!! : </font> Voltooi ASB die veld <b>NAAM VAN VERSEKERAAR</b>.";
}
}
if ($errorcondition == "no") {
if ($form[amount]) {
$errorcondition = "no";
} else {
$errorcondition = "yes";
$ErrorReport = "<font color = red>FOUT !!! : </font> Voltooi ASB die veld <b>DEKKINGSBEDRAG</b>.";
}
}
$boxselected = 0;
if ($box[1]) {
$boxselected = $boxselected + 1;
}
if ($box[2]) {
$boxselected = $boxselected + 1;
}
if ($box[3]) {
$boxselected = $boxselected + 1;
}
if ($box[4]) {
$boxselected = $boxselected + 1;
}
if ($box[5]) {
$boxselected = $boxselected + 1;
}
if ($box[6]) {
$boxselected = $boxselected + 1;
}
if ($errorcondition == "no") {
if ($boxselected > 1) {
$errorcondition = "yes";
$ErrorReport = "<font color = red>FOUT !!! : </font> Kies ASB net <b>EEN</b> Tipe Firma.";
} else {
$errorcondition = "no";
}
}
if ($errorcondition == "no") {
if ($boxselected == 0) {
$errorcondition = "yes";
$ErrorReport = "<font color = red>FOUT !!! : </font> Kies ASB ten minste <b>EEN</b> Tipe Firma.";
} else {
$errorcondition = "no";
}
}
if ($errorcondition == "no") {
if ($form[q1]) {
$errorcondition = "no";
} else {
$errorcondition = "yes";
$ErrorReport = "<font color = red>FOUT !!! : </font> Voltooi ASB die veld <b>Q1</b>.";
}
}
if ($errorcondition == "no") {
if ($form[q2]) {
$errorcondition = "no";
} else {
$errorcondition = "yes";
$ErrorReport = "<font color = red>FOUT !!! : </font> Voltooi ASB die veld <b>Q2</b>.";
}
}
if ($errorcondition == "no") {
if ($form[q3]) {
$errorcondition = "no";
} else {
$errorcondition = "yes";
$ErrorReport = "<font color = red>FOUT !!! : </font> Voltooi ASB die veld <b>Q3</b>.";
}
}
if ($errorcondition == "no") {
if ($form[q4]) {
$errorcondition = "no";
} else {
$errorcondition = "yes";
$ErrorReport = "<font color = red>FOUT !!! : </font> Voltooi ASB die veld <b>Q4</b>.";
}
}
if ($errorcondition == "no") {
if ($form[q4] == "Yes") {
if ($form[partydate]) {
$errorcondition = "no";
} else {
$errorcondition = "yes";
$ErrorReport = "<font color = red>FOUT !!! : </font> Voltooi ASB die veld <b>Q5</b>.";
}
} else {
$errorcondition = "no";
}
}
if ($errorcondition == "no") {
if ($form[q5]) {
$errorcondition = "no";
} else {
$errorcondition = "yes";
$ErrorReport = "<font color = red>FOUT !!! : </font> Voltooi ASB die veld <b>Q6</b>.";
}
}
if ($errorcondition == "no") {
if ($form[firstname]) {
$errorcondition = "no";
} else {
$errorcondition = "yes";
$ErrorReport = "<font color = red>FOUT !!! : </font> Voltooi ASB die veld <b>VOOR NAAM VAN MANDAATPRINSIPAAL</b>.";
}
}
if ($errorcondition == "no") {
if ($form[lastname]) {
$errorcondition = "no";
} else {
$errorcondition = "Yes";
$ErrorReport = "<font color = red>FOUT !!! : </font> Voltooi ASB die veld <b>VAN, VAN MANDAATPRINSIPAAL </b>.";
}
}
if ($errorcondition == "no") {
if ($form[date]) {
$errorcondition = "no";
} else {
$errorcondition = "yes";
$ErrorReport = "<font color = red>FOUT !!! : </font> Voltooi ASB die veld <b>DATUM DOKUMENT VOLTOOI</b>.";
}
}
// **** Set the values to put in the type of incorporation field
if ($box[1]) {
$form[incorp] = "Sole Practice";
}
if ($box[2]) {
$form[incorp] = "Limited Company";
}
if ($box[3]) {
$form[incorp] = "Partnership";
}
if ($box[4]) {
$form[incorp] = "(Pty) Ltd";
}
if ($box[5]) {
$form[incorp] = "Close Corporation";
}
if ($box[6]) {
$form[incorp] = $form[other];
}
if ($errorcondition == "no") {
// Update the Tables. *********************************************************
// ****************************************************************************
// **** Fetch the Details of the TBLMEMBERFIRMS table and write to ADEC_TBLMEMBERFIRMS
$query = "SELECT FirmID, FirmName, FormOfIncorporation, DateJoined, DateTerminated, DirectoryLastUpdate, EntryType, PageRef, LogoReceived, CONVERT(TEXT,EntryText), RunOns, "
. "OrderNumber, InvoiceNumber, PaymentReceived, DeclarationReceived, MemberStatus, 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, PIUnderwriter, LevelOfCover, "
. "`Quality Management`, `Date of last peer review`, URL, CompanyLogo, DocumentAccess, QualityMxSystem, ExportDivision, Active, School, LNumber, ExistingOrExperience, "
. "SeekingToExportTo,QMSPlan, QMSDocs, QMSISOComply, QMSISOCert, QMSISOCertDate, QMSOffices, QMSConsult, QMSCertBody, MainFirmInvoice, GroupFirmsInvoice, AcousticsName, "
. "AgriculturalName, BuildingServicesName, ChemicalName, CivilName, DevelopmentName, ElectricalName, ElectronicName, EnvironmentalName, GeotechnicalName, IndustrialName, "
. "MechanicalName, MarineName, MiningName, ProcessName, StructuralName, TransportationName, ArchitectureName, RuralDevelopmentName, ProjectManagementName, "
. "QuantitySurveyingName, TownPlanningName, MultidisciplinaryName, DisputeResolutionName, ExpertWitnessName, InformationSystemsName, FacilitiesManagementName, GISName "
. "FROM tblMemberFirms WHERE tblMemberFirms.FirmID = '$MemberFirmID' AND DeclarationYear = $DeclarationYear";
if (!($result = mysql_query($query))) {
throw new Exception("Select failed: " . $query);
}
$OCrow = mysql_fetch_array($result);
$ocr[1] = $OCrow['DateJoined'];
$ocr[2] = $OCrow['DateTerminated'];
$ocr[3] = $OCrow['DirectoryLastUpdate'];
$ocr[4] = $OCrow['EntryType'];
$ocr[5] = $OCrow['PageRef'];
$ocr[6] = $OCrow['LogoReceived'];
$ocr[8] = $OCrow['EntryText'];
$ocr[9] = $OCrow['RunOns'];
$ocr[10] = $OCrow['OrderNumber'];
$ocr[11] = $OCrow['InvoiceNumber'];
$ocr[12] = $OCrow['PaymentReceived'];
$ocr[13] = $OCrow['DeclarationReceived'];
$ocr[14] = $OCrow['MemberStatus'];
$ocr[15] = $OCrow['Acoustics'];
$ocr[16] = $OCrow['Agricultural'];
$ocr[17] = $OCrow['BuildingServices'];
$ocr[18] = $OCrow['Chemical'];
$ocr[19] = $OCrow['Civil'];
$ocr[20] = $OCrow['Development'];
$ocr[21] = $OCrow['Electrical'];
$ocr[22] = $OCrow['Electronic'];
$ocr[23] = $OCrow['Environmental'];
$ocr[24] = $OCrow['Geotechnical'];
$ocr[25] = $OCrow['Industrial'];
$ocr[26] = $OCrow['Mechanical'];
$ocr[27] = $OCrow['Marine'];
$ocr[28] = $OCrow['Mining'];
$ocr[29] = $OCrow['Process'];
$ocr[30] = $OCrow['Structural'];
$ocr[31] = $OCrow['Transportation'];
$ocr[32] = $OCrow['Architecture'];
$ocr[33] = $OCrow['RuralDevelopment'];
$ocr[34] = $OCrow['ProjectManagement'];
$ocr[35] = $OCrow['QuantitySurveying'];
$ocr[36] = $OCrow['TownPlanning'];
$ocr[37] = $OCrow['Multidisciplinary'];
$ocr[38] = $OCrow['DisputeResolution'];
$ocr[39] = $OCrow['ExpertWitness'];
$ocr[40] = $OCrow['InformationSystems'];
$ocr[41] = $OCrow['FacilitiesManagement'];
$ocr[42] = $OCrow['GIS'];
$ocr[43] = $OCrow['Quality Management'];
$ocr[44] = $OCrow['Date of last peer review'];
$ocr[45] = $OCrow['CompanyLogo'];
$ocr[46] = $OCrow['DocumentAccess'];
$ocr[47] = $OCrow['QualityMxSystem'];
$ocr[48] = $OCrow['ExportDivision'];
$ocr[49] = $OCrow['Active'];
$ocr[50] = $OCrow['School'];
$ocr[51] = $OCrow['LNumber'];
$ocr[52] = $OCrow['ExistingOrExperience'];
$ocr[53] = $OCrow['SeekingToExportTo'];
$ocr[54] = $ORrow['MainFirmInvoice'];
$ocr[55] = $ORrow['GroupFirmInvoice'];
$ocr[56] = $OCrow['AcousticsName'];
$ocr[57] = $OCrow['AgriculturalName'];
$ocr[58] = $OCrow['BuildingServicesName'];
$ocr[59] = $OCrow['ChemicalName'];
$ocr[60] = $OCrow['CivilName'];
$ocr[61] = $OCrow['DevelopmentName'];
$ocr[62] = $OCrow['ElectricalName'];
$ocr[63] = $OCrow['ElectronicName'];
$ocr[64] = $OCrow['EnvironmentalName'];
$ocr[65] = $OCrow['GeotechnicalName'];
$ocr[66] = $OCrow['IndustrialName'];
$ocr[67] = $OCrow['MechanicalName'];
$ocr[68] = $OCrow['MarineName'];
$ocr[69] = $OCrow['MiningName'];
$ocr[70] = $OCrow['ProcessName'];
$ocr[71] = $OCrow['StructuralName'];
$ocr[72] = $OCrow['TransportationName'];
$ocr[73] = $OCrow['ArchitectureName'];
$ocr[74] = $OCrow['RuralDevelopmentName'];
$ocr[75] = $OCrow['ProjectManagementName'];
$ocr[76] = $OCrow['QuantitySurveyingName'];
$ocr[77] = $OCrow['TownPlanningName'];
$ocr[78] = $OCrow['MultidisciplinaryName'];
$ocr[79] = $OCrow['DisputeResolutionName'];
$ocr[80] = $OCrow['ExpertWitnessName'];
$ocr[81] = $OCrow['InformationSystemsName'];
$ocr[82] = $OCrow['FacilitiesManagementName'];
$ocr[83] = $OCrow['GISName'];
// NOTE: I do not update the image here as I will keep the file for later in the ADMIN section**
// *********************************************************************************************
$query = "INSERT INTO ADec_tblMemberFirms (Prev_FirmID, FirmName, FormOfIncorporation, DateJoined, DateTerminated, DirectoryLastUpdate, EntryType, PageRef, LogoReceived, EntryText,
RunOns, OrderNumber, InvoiceNumber, PaymentReceived, DeclarationReceived, MemberStatus, 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, PIUnderwriter, LevelOfCover, `Quality Management`, `Date of last peer review`, URL,
DocumentAccess, QualityMxSystem, ExportDivision, Active, School, LNumber, ExistingOrExperience, SeekingToExportTo,QMSPlan, QMSDocs, QMSISOComply, QMSISOCert, QMSISOCertDate, QMSOffices,
QMSConsult, QMSCertBody,MainFirmInvoice, GroupFirmsInvoice, AcousticsName, AgriculturalName, BuildingServicesName, ChemicalName, CivilName, DevelopmentName, ElectricalName, ElectronicName,
EnvironmentalName, GeotechnicalName, IndustrialName, MechanicalName, MarineName, MiningName, ProcessName, StructuralName, TransportationName, ArchitectureName, RuralDevelopmentName,
ProjectManagementName, QuantitySurveyingName, TownPlanningName, MultidisciplinaryName, DisputeResolutionName, ExpertWitnessName, InformationSystemsName, FacilitiesManagementName, GISName,
DeclarationYear)
values('$MemberFirmID'
,'$form[firmname]'
,'$form[incorp]'
,'$ocr[1]'
,'$ocr[2]'
,'$ocr[3]'
,'$ocr[4]'
,'$ocr[5]'
,'$ocr[6]'
,'$ocr[8]'
,'$ocr[9]'
,'$ocr[10]'
,'$ocr[11]'
,'$ocr[12]'
,'$ocr[13]'
,'$ocr[14]'
,'$ocr[15]'
,'$ocr[16]'
,'$ocr[17]'
,'$ocr[18]'
,'$ocr[19]'
,'$ocr[20]'
,'$ocr[21]'
,'$ocr[22]'
,'$ocr[23]'
,'$ocr[24]'
,'$ocr[25]'
,'$ocr[26]'
,'$ocr[27]'
,'$ocr[28]'
,'$ocr[29]'
,'$ocr[30]'
,'$ocr[31]'
,'$ocr[32]'
,'$ocr[33]'
,'$ocr[34]'
,'$ocr[35]'
,'$ocr[36]'
,'$ocr[37]'
,'$ocr[38]'
,'$ocr[39]'
,'$ocr[40]'
,'$ocr[41]'
,'$ocr[42]'
,'$form[name]'
,CONVERT(MONEY,'$form[amount]')
,'$ocr[43]'
,'$ocr[44]'
,'$form[www]'
,'$ocr[46]'
,'$ocr[47]'
,'$ocr[48]'
,'$ocr[49]'
,'$ocr[50]'
,'$ocr[51]'
,'$ocr[52]'
,'$ocr[53]'
,'$form[q1]'
,'$form[q2]'
,'$form[q3]'
,'$form[q4]'
,'$form[partydate]'
,'$form[q5]'
,'$form[q6]'
,'$form[q7]'
,'$ocr[54]'
,'$ocr[55]'
,'$ocr[56]'
,'$ocr[57]'
,'$ocr[58]'
,'$ocr[59]'
,'$ocr[60]'
,'$ocr[61]'
,'$ocr[62]'
,'$ocr[63]'
,'$ocr[64]'
,'$ocr[65]'
,'$ocr[66]'
,'$ocr[67]'
,'$ocr[68]'
,'$ocr[69]'
,'$ocr[70]'
,'$ocr[71]'
,'$ocr[72]'
,'$ocr[73]'
,'$ocr[74]'
,'$ocr[75]'
,'$ocr[76]'
,'$ocr[77]'
,'$ocr[78]'
,'$ocr[79]'
,'$ocr[80]'
,'$ocr[81]'
,'$ocr[82]'
,'$ocr[83]', " . $DeclarationYear . ")";
if (!($result = mysql_query($query))) {
throw new Exception("Insert of tblMemberFirms Failed: " . $query);
}
// **** Fetch the Details of the CONTACTS table and write to ADEC_CONTACTS****
// ***************************************************************************
// not copying the image file*************************************************
// ***************************************************************************
$query = "SELECT * FROM Contacts WHERE Contacts.ContactsID = '$MemberContactID'";
if (!($result = mysql_query($query))) {
throw new Exception("Select failed: " . $query);
}
$OCrow = mysql_fetch_array($result);
$ocs[1] = $OCrow['ContactsID'];
$ocs[2] = $OCrow['ContactInitials'];
$ocs[3] = $OCrow['Language'];
$ocs[4] = $OCrow['BirthDate'];
$ocs[5] = $OCrow['NameOfSpouse'];
$ocs[6] = $OCrow['CellPhone'];
$ocs[8] = $OCrow['PersonalTel'];
$ocs[9] = $OCrow['PersonalFax'];
$ocs[10] = $OCrow['Comments'];
$ocs[11] = $OCrow['ProfessionalRegistrations'];
$ocs[12] = $OCrow['Qualifications'];
$ocs[13] = $CCrow['ContactsID'];
$ocs[14] = $OCrow['ContactID'];
$ocs[15] = $OCrow['PreferredEmail'];
$ocs[16] = $OCrow['ContactType'];
$ocs[17] = $OCrow['UniqueCode'];
$ocs[18] = $OCrow['PostalAddress'];
$ocs[19] = $OCrow['Address2'];
$ocs[20] = $OCrow['TownCity'];
$ocs[21] = $OCrow['Country'];
$ocs[22] = $OCrow['PostalCode'];
$ocs[23] = $OCrow['OrgName'];
$ocs[24] = $OCrow['DocumentAccess'];
$query = "INSERT INTO ADec_Contacts (Prev_ContactsID
, ContactSurname
, ContactInitials
, ContactFirstName
, ContactDesignation
, Language
, BirthDate
, NameOfSpouse
, CellPhone
, PersonalTel
, PersonalFax
, Comments
, ProfessionalRegistrations
, Qualifications
, ContactID
, Prev_ContactID
, PreferredEmail
, ContactType
, UniqueCode
, PostalAddress
, Address2
, TownCity
, Country
, PostalCode
, OrgName
, DocumentAccess
, DeclarationYear)
values('$MemberContactID'
,'$form[lastname]'
,'$ocs[2]'
,'$form[firstname]'
,'$form[designate]'
,'$ocs[3]'
,'$ocs[4]'
,'$ocs[5]'
,'$ocs[6]'
,'$ocs[8]'
,'$ocs[9]'
,'$ocs[10]'
,'$ocs[11]'
,'$ocs[12]'
,'$ocs[13]'
,'$ocs[14]'
,'$ocs[15]'
,'$ocs[16]'
,'$ocs[17]'
,'$ocs[18]'
,'$ocs[19]'
,'$ocs[20]'
,'$ocs[21]'
,'$ocs[22]'
,'$ocs[23]'
,'$ocs[24]', " . $DeclarationYear . ")";
if (!($result = mysql_query($query))) {
throw new Exception("Insert Failed: " . $query);
}
// Fetch the Details of the ADEC_CONTACTS just written ************************
// ****************************************************************************
$query = "SELECT * FROM ADec_Contacts WHERE ADec_Contacts.Prev_ContactsID = '$MemberContactID'";
if (!($result = mysql_query($query))) {
throw new Exception("Select failed: " . $query);
}
$ICrow = mysql_fetch_array($result);
$icr[0] = $ICrow[0];
$query = "SELECT * FROM OfficeContacts WHERE OfficeContacts.ContactsID = '$MemberContactID'";
if (!($result = mysql_query($query))) {
throw new Exception("Select failed: " . $query);
}
$OCrow = mysql_fetch_array($result);
$ocf[1] = $OCrow['ContactPosition'];
$ocf[2] = $OCrow['MandatedPrincipal'];
$ocf[3] = $OCrow['OfficeHead'];
$ocf[4] = '0';
$ocf[5] = $OCrow['Principal'];
$ocf[6] = $OCrow['Email'];
$ocf[7] = $OCrow['Mail'];
$ocf[8] = $OCrow['OfficeLiaison'];
$ocf[9] = $OCrow['OfficeLiaisonB'];
$ocf[10] = $OCrow['SchoolMail'];
$query = "INSERT INTO ADec_OfficeContacts (
ContactsID,
Prev_ContactsID,
ContactPosition,
MandatedPrincipal,
OfficeHead,
OfficeID,
Prev_OfficeID,
Principal,
Email,
Mail,
OfficeLiaison,
OfficeLiaisonB,
SchoolMail,
DeclarationYear) values(
'$icr[0]',
'$MemberContactID',
'$ocf[1]',
'$ocf[2]',
'$ocf[3]',
'$ocf[4]',
'$MemberOfficeID',
'$ocf[5]',
'$ocf[6]',
'$ocf[7]',
'$ocf[8]',
'$ocf[9]',
'$ocf[10]', " . $DeclarationYear . ")";
if (!($result = mysql_query($query))) {
throw new Exception("Insert Failed: " . $query);
}
$query = "SELECT FirmID, Prev_FirmID FROM ADec_tblMemberFirms WHERE Prev_FirmID = '$MemberFirmID'";
if (!($Hresult = mysql_query($query))) {
throw new Exception("Select failed: " . $query);
}
$Hrow = mysql_fetch_array($Hresult);
$Hf[1] = $Hrow['FirmID'];
$reftype = "FirmID";
$refdoc = "AnnualDeclaration";
$adecdate = date("Y-m-d H:i");
$query = "INSERT INTO ADec_Done (RefID,RefType,RefDoc,ADecDate, DeclarationYear)
values('$Hf[1]','$reftype','$refdoc','$adecdate', " . $DeclarationYear . ")";
if (!($Jresult = mysql_query($query))) {
throw new Exception("Insert Failed: " . $query);
}
$ErrorReport = "Thank you for completing this section.<p>";
$NextSection = "complete";
} else {
$NextSection = "notcomplete";
}
}
// **** End of the Page
?>
</div>