| Current Path : /var/www/cesa.co.za/contracts/ |
| Current File : /var/www/cesa.co.za/contracts/index.php |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="/sites/default/files/favicon.ico" type="image/x-icon" />
<title>Consulting Engineers South Africa</title>
<link type="text/css" rel="stylesheet" media="all" href="/modules/aggregator/aggregator.css?C" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/book/book.css?C" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/cck_bak/theme/content-module.css?C" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/dhtml_menu/dhtml_menu.css?C" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/node/node.css?C" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/poll/poll.css?C" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/simplenews/simplenews.css?C" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/defaults.css?C" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/system.css?C" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/system-menus.css?C" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/user/user.css?C" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/views/css/views.css?C" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/default/files/color/cesa-24ce7d4e/style.css?C" />
<link type="text/css" rel="stylesheet" media="print" href="/sites/all/themes/cesa/print.css?C" />
<!--[if lt IE 7]>
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/cesa/fix-ie.css" /> <![endif]-->
<script src='https://www.google.com/recaptcha/api.js'></script>
<?php include("../inc_googletag.php"); ?>
</head>
<body class="sidebars">
<!-- Layout -->
<div id="header-region" class="clear-block"></div>
<div id="wrapper" style='background-image:url('')'>
<div id="container" class="clear-block">
<div id="header" style="height:160px; background-image:url(''); background-repeat:no-repeat">
<table border=0 cellspacing=0 cellpadding=0 style="padding:0px 0px 0px 0px;margin:0;border:0px;border-collapse:separate;background-color:white" width="980">
<tr><td style="padding:25px 0px 0px 20px;margin:0;border:0px;width:215px">
<img src="/images/logo.png" />
</td><td style="padding:20px 0px 0px 0px;margin:0;border:0px">
<!--<a href="/bce"><img src="/sites/default/files/BCE_Banner_Design-02.jpg" width="800" height="120" border="0" /></a>-->
<!-- <div style="padding-top:2px"></div> -->
<h1 style="color:blue">CESA Contract Creation Portal</h1>
</td><td style="padding:0px 0px 0px 0px;margin:0;border:0px" align="left" valign="top" nowrap="nowrap"><a href="http://www.twitter.com/the_cesa" target="_blank"><img alt="" src="/images/spacer.gif" style="width: 60px; height: 100px; border-width: 0px; border-style: solid;" /></a><a href="http://www.facebook.com/ConsultingEngineersSA" target="_blank"><img alt="" src="/images/spacer.gif" style="width: 60px; height: 100px; border-width: 0px; border-style: solid;" /></a><a href="http://www.linkedin.com/pub/cesa-consulting-engineers-south-africa/77/454/286" target="_blank"><img alt="" src="/images/spacer.gif" style="width: 60px; height: 100px; border-width: 0px; border-style: solid;" /></a></td></tr></table>
<!--
<div id="logo-floater">
</div>
-->
</div> <!-- /header -->
<div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner">
<div class="clear-block">
<div class="view view-content node">
<?php
include("../php/inc_db.php");
$bShowStep1 = true;
$bShowStep2 = false;
$bShowStep3 = false;
$bShowStep4 = false;
$errors = array();
if (isset($_POST["step"])) {
if ($_POST["step"] == 1) {
// var_dump(array_keys($_POST));
// echo '<br />';
// var_dump(array_keys($_FILES));
// exit;
// if (!reCaptcha($_POST["g-recaptcha-response"]))
// $errors[] = "You could not be verified as not being a robot, please tick the reCaptcha verification option at the bottom of the form.";
if (empty($_POST["FullName"]))
$errors[] = "Your name is required.";
if (empty($_POST["CompanyName"]))
$errors[] = "Your company name is required.";
if (empty($_POST["EmailAddress"]))
$errors[] = "Your email address is required.";
if (empty($_POST["PhoneNumber"]))
$errors[] = "Your telephone number is required.";
if (count($errors) == 0) {
$sql = "INSERT INTO ContractPurchases (FullName, CompanyName, EmailAddress, PhoneNumber, Address, VATNumber, OrderNumber, ContractType, DateCreated)
VALUES ('" . addslashes($_POST["FullName"]) . "', '" . addslashes($_POST["CompanyName"]) . "', '" . addslashes($_POST["EmailAddress"]) . "', '" . addslashes($_POST["PhoneNumber"]) . "',
'" . addslashes($_POST["Address"]) . "', '" . addslashes($_POST["VATNumber"]) . "', '" . addslashes($_POST["OrderNumber"]) . "', " . intval($_POST["ContractType"]) . ",
'" . date("Y-m-d H:i:s") . "')";
// echo $sql;
// exit;
mysqli_query($conni, $sql);
$iPurchaseID = mysqli_insert_id($conni);
$bShowStep1 = false;
$bShowStep2 = true;
}
}
if ($_POST["step"] == 2) {
$iPurchaseID = $_POST["PurchaseID"];
if (isset($_POST['change'])) {
$bShowStep1 = false;
$bShowStep2 = true;
} else {
if (count($errors) == 0) {
$_POST["Field18"] = '';
if (intval($_POST["ContractType"]) == 9 && isset($_FILES['Field18']) && is_array($_FILES['Field18']) && count($_FILES['Field18']) > 0) {
$imgName = explode('.', $_FILES["Field18"]["name"]);
$imgName = array_reverse($imgName);
$imageFileType = strtolower($imgName[0]);
if ($imageFileType == 'jpeg') {
$imageFileType = 'jpg';
}
if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
$errors[] = "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
}
if (isset($_FILES["Field18"]) && isset($_FILES["Field18"]["tmp_name"]) && strlen($_FILES["Field18"]["tmp_name"]) > 0) {
$_POST["Field18"] = base64_encode(file_get_contents($_FILES["Field18"]["tmp_name"]));
} else {
$_POST["Field18"] = '';
}
}
$sql = "DELETE FROM ContractData WHERE ContractPurchaseID=" . $iPurchaseID;
mysqli_query($conni, $sql);
$sql = "SELECT DISTINCT DataField FROM ContractFields WHERE ContractTypeID=" . intval($_POST["ContractType"]) . " ORDER BY DataField";
$rec = mysqli_query($conni, $sql);
$arrSql = array();
while ($row = mysqli_fetch_assoc($rec)) {
$arrSql[] = "INSERT INTO ContractData (ContractPurchaseID, DataField, DataValue) VALUES (" . $_POST["PurchaseID"] . ", '" . $row["DataField"] . "', '" . addslashes($_POST[$row["DataField"]]) . "')";
}
// var_dump($arrSql);
mysqli_free_result($rec);
foreach ($arrSql as $key => $value) {
mysqli_query($conni, $value);
}
$bShowStep1 = false;
$bShowStep2 = false;
$bShowStep3 = true;
}
}
}
if ($_POST["step"] == 3) {
$iPurchaseID = $_POST["PurchaseID"];
$iBookPrice = 280 / $incvat;
$sql = "SELECT ConfigValue FROM Config WHERE ConfigName='ContractPrice'";
$rec = mysqli_query($conni, $sql);
if ($row = mysqli_fetch_assoc($rec)) {
if (!empty($row["ConfigValue"]))
$iBookPrice = floatval($row["ConfigValue"]) / $incvat;
}
mysqli_free_result($rec);
$sql = "SELECT ContractPurchases.*, ContractTypes.StockCode, ContractTypes.TypeName
FROM ContractTypes, ContractPurchases
WHERE ContractTypes.ContractTypeID=ContractPurchases.ContractType AND ContractPurchases.ContractPurchaseID=" . $iPurchaseID;
$rec = mysqli_query($conni, $sql);
if ($row = mysqli_fetch_assoc($rec)) {
$sStockCode = $row["StockCode"];
mail("athromethm@cesa.co.za,patiencet@cesa.co.za", "New online contract generated", "The following online contract has been generated, please check for EFT payment as per the details below:
Name: " . $row["FullName"] . "
Email: " . $row["EmailAddress"] . "
Phone: " . $row["PhoneNumber"] . "
Contract: " . $row["TypeName"] . "
Stock Code: " . $row["StockCode"] . "
Amount Due: R" . ($iBookPrice * $incvat) . "
Once payment is received, please mark the contract as Authorised and update the payment details at:
http://www.cesa.co.za/echasl23/ContractPurchasesedit.php?PurchaseID=" . $iPurchaseID);
mail($row["EmailAddress"], "New CESA contract generated", "Thank you for completing the contract generation process. To purchase your contract, please make payment by EFT as follows:
Bank: Nedbank
Branch: Central Gauteng, Branch Code 198765
Account Number: 1922 019 801
Reference: CONTRACT" . $iPurchaseID . "
Amount: R" . ($iBookPrice * $incvat) . " (incl VAT)
Proof of payment may be emailed to Athrometh at athromethm@cesa.co.za
On receipt of payment, your contract will be emailed to you. The contract is valid for one use only.
Please address any queries to Patience on 011 463 2022 or patiencet@cesa.co.za", "From:patiencet@cesa.co.za");
$sql = "UPDATE ContractPurchases SET Accepted=1, AmountDue=" . ($iBookPrice * $incvat) . ", PaymentRef='CONTRACT" . $iPurchaseID . "' WHERE ContractPurchaseID=" . $iPurchaseID;
mysqli_query($conni, $sql);
}
mysqli_free_result($rec);
$bShowStep1 = false;
$bShowStep2 = false;
$bShowStep3 = false;
$bShowStep4 = true;
}
}
if ($bShowStep1) {
?>
<p><strong>Step 1: Your details</strong></p>
<?php
if (count($errors) > 0) {
?>
<div style="border:2px solid red">
<p>Your information has not been saved. Please correct the following errors:</p>
<ul><li><?php echo implode("</li><li>", $errors); ?></li></ul>
</div>
<?php
}
?>
<form method="post" action="index.php" enctype="multipart/form-data">
<input type="hidden" name="step" value="1" />
<p>Please fill in the form below. The information
you provide here will be used for invoicing and payment purposes.</p>
<table border="0" width="900" cellpadding="4" cellspacing="0">
<tr><td>Your full name:</td><td><input type="text" name="FullName" id="FullName" size="60" placeholder="Required" required value="<?php echo $_POST["FullName"]; ?>" /></td></tr>
<tr><td>Company name:</td><td>
<input type="text" name="CompanyName" id="CompanyName" size="60" placeholder="Required" required value="<?php echo $_POST["CompanyName"]; ?>" /></td></tr>
<tr><td>Email address:</td><td>
<input type="text" name="EmailAddress" id="EmailAddress" size="60" placeholder="Required" required value="<?php echo $_POST["EmailAddress"]; ?>" /></td></tr>
<tr><td>Telephone number:</td><td>
<input type="text" name="PhoneNumber" id="PhoneNumber" size="60" placeholder="Required" required value="<?php echo $_POST["PhoneNumber"]; ?>" /></td></tr>
<tr><td>Address:</td><td><textarea name="Address" id="Address" cols="50" rows="5"><?php echo $_POST["Address"]; ?></textarea></td></tr>
<tr><td>VAT number:</td><td>
<input type="text" name="VATNumber" id="VATNumber" size="60" value="<?php echo $_POST["VATNumber"]; ?>" /></td></tr>
<tr><td>Purchase order number:</td><td>
<input type="text" name="OrderNumber" id="OrderNumber" size="60" value="<?php echo $_POST["OrderNumber"]; ?>" /></td></tr>
<tr><td>Digital Signature:</td><td align="center">
<?php
if ($_POST["Signature"] != '') {
?>
<img src="<?php echo $_POST["Signature"]; ?>" border="0" />
<?php
}
?>
<input type="file" name="Signature" id="OrderNumber" size="60" /></td></tr>
<tr><td>Type of contract you wish to create:</td><td>
<select name="ContractType" id="ContractType" onchange="document.getElementById('sampleframe').src = 'sample.php?id=' + this.options[this.selectedIndex].value">
<?php
$sql = "SELECT * FROM ContractTypes WHERE DisplayOnline=1 ORDER BY TypeName";
$rec = mysqli_query($conni, $sql);
while ($row = mysqli_fetch_assoc($rec)) {
echo "<option value='" . $row["ContractTypeID"] . "'";
if ($_POST["ContractType"] == $row["ContractTypeID"])
echo " selected";
echo ">" . $row["TypeName"] . "</option>";
}
mysqli_free_result($rec);
?>
</select><br />
<input type="button" value="Click here to view a sample of this contract below" onclick="javascript:document.getElementById('sampleframe').style.display = ''" />
</td></tr>
<tr><td colspan="2" align="center">
<div class="g-recaptcha" data-sitekey="6Lf6ARkUAAAAAOjjMStte7StrjPXpXTiuMoQtt8k"></div>
<input type="submit" value="Continue" /></td></tr>
</table>
</form>
<iframe id="sampleframe" src="sample.php?id=<?php echo (isset($_POST["ContractType"]) ? $_POST["ContractType"] : 1); ?>" style="display:none" width="700" height="400"></iframe>
<?php
}
if ($bShowStep2) {
?>
<p><strong>Step 2: Complete the required contract details</strong></p>
<?php
if (count($errors) > 0) {
?>
<div style="border:2px solid red">
<p>Your information has not been saved. Please correct the following errors:</p>
<ul><li><?php echo implode("</li><li>", $errors); ?></li></ul>
</div>
<?php
}
?>
<form method="post" action="index.php" enctype="multipart/form-data">
<input type="hidden" name="step" value="2" />
<input type="hidden" name="PurchaseID" value="<?php echo $iPurchaseID; ?>" />
<input type="hidden" name="ContractType" value="<?php echo $_POST["ContractType"]; ?>" />
<p>Please fill in the form below. The information
you provide here will be used to create your personalised contract. </p>
<p>Please ensure it is all correct before submitting.
<b>The generated contract document cannot be edited.</b></p>
<?php
include("inc_ctype" . intval($_POST["ContractType"]) . ".php");
?>
<table border="0" width="900">
<tr><td align="center"><input type="submit" value="Continue" /></td></tr>
</table>
</form>
<?php
}
if ($bShowStep3) {
?>
<p><strong>Step 3: Preview and confirm your contract</strong></p>
<p>You can view a preview of your contract in the window below. Note that your personalised information begins on <b>Page 17</b>.</p>
<table border="0" width="900">
<tr><td width="50%" align="center">
<form method="post" action="index.php">
<input type="hidden" name="step" value="2" />
<input type="hidden" name="change" value="1" />
<input type="hidden" name="ContractType" value="<?php echo $_POST["ContractType"]; ?>" />
<?php
for ($i = 1; $i <= $_POST["NumFields"]; $i++) {
?>
<input type="hidden" name="Field<?php echo $i; ?>" value="<?php echo $_POST["Field" . $i]; ?>" />
<?php
}
?>
<input type="hidden" name="PurchaseID" value="<?php echo $iPurchaseID; ?>" />
<input type="submit" value="Return to Previous Step" />
</form>
</td><td width="50%" align="center">
<form method="post" action="index.php">
<input type="hidden" name="step" value="3" />
<input type="hidden" name="PurchaseID" value="<?php echo $iPurchaseID; ?>" />
<input type="submit" value="Complete Your Purchase" />
</form>
</td></tr>
</table>
<iframe src="preview.php?id=<?php echo $iPurchaseID; ?>&r=<?php echo rand(); ?>" width="900" height="900"></iframe>
<?php
}
if ($bShowStep4) {
?>
<p><b>Thank you for completing the contract generation process. To purchase your contract, please make payment by EFT as follows:</b></p>
<p>Bank: Nedbank<br>
Branch: Central Gauteng, Branch Code 198765<br>
Account Number: 1032977302<br>
Reference: CONTRACT<?php echo $iPurchaseID; ?><br>
Amount: R<?php echo $iBookPrice * $incvat; ?> (incl VAT)</p>
<p>Proof of payment may be emailed to Athrometh at <a href="mailto:athromethm@cesa.co.za">athromethm@cesa.co.za</a>.</p>
<p>On receipt of payment, your contract will be emailed to you. The contract is valid for one use only.</p>
<p>Please address any queries to Patience on 011 463 2022 or <a href="mailto:patiencet@cesa.co.za">patiencet@cesa.co.za</a>.</p>
<?php
}
?>
</div> </div>
<div id="footer">© CESA 2010-<?php echo date("Y"); ?> All rights reserved</div>
</div></div></div></div> <!-- /.left-corner, /.right-corner, /#squeeze, /#center -->
</div> <!-- /container -->
</div>
<!-- /layout -->
</body>
</html>