954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

ideas



voucher Data Entry
";
$receiptno=$_REQUEST['receiptno'];
//Populate a list of valid receipt numbers in a drop-down list
$query = "SELECT receiptno FROM tblreceipt";
$statement = OCIParse ($conn, $query);
OCIExecute ($statement);
print "Receipt No. ";
print "";
while (OCIFetchInto ($statement, $row, OCI_ASSOC)) {
$selected = $row['RECEIPTNO'] == $receiptno ? "SELECTED" : "";
print "".$row['RECEIPTNO']."";
}
print "";
print "

Voucherno


";
print "

Expirydate


";
print "

value


";

print "

companyof issue


";
print "


Click Here to cancel and go back to the list of receipt headers

";
//If the submit flag was not null then we shall try to insert the new recordw
} else {
//Validate the data entry
if (is_null($receiptno) or $receiptno == "") {
$errmsg = "You have not selected a Receipt No. from the list";
} elseif (is_null($Voucherno) or $Voucherno == "") {
$errmsg .= "You have not entered a voucherno ";
} elseif ($expirydate > SYSDATE or $expirydate == "") {
$errmsg .= " this voucher has expired or one has not been entered";
} elseif (is_null($value) or $value == "") {
$errmsg .= "You have not entered a value ";
} elseif (is_null($companyofissue) or $companyofissue == "") {
$errmsg .= "You have not entered a companyofissue ";
}
//If an error was found then dont do the insert - print error message instead
if (!is_null($errmsg) ) {
print "


voucher Data Entry Validation Error!

The voucher details failed validation for the following reasons
";
print $errmsg;
print "


Please Click Here to try again

Or Click Here to go back to the list of receipt headers
";
//All validation checks were successful, so go ahead and insert the row
} else {
print "


voucher Details Accepted

voucher details successfully accepted";
//Firstly insert the new voucher details
$sql = "INSERT INTO tblvoucher (receiptno, Voucherno, expirydate, value, companyofissue)
VALUES (".$receiptno.",'".$Voucherno."','".$expirydate."',".$value.",'".$companyofissue."')";
$stmt = OCIParse($conn, $sql);
OCIExecute($stmt);
$sql = "UPDATE tblreceipt
SET tblreceipt.totalvalue = tblreceipt.totalvalue - tblvoucher.value
WHERE tblreceipt.receiptno= tblvoucher.receiptno
$stmt = OCIParse($conn, $sql);
OCIExecute($stmt);
print "Thank you for the voucher details, these have been successully accepted.
Receipt No: ".$receiptno."
Voucherno: ".$Voucherno."
expirydate: ".$expirydate."
value: ".$value."
companyofissue: ".$companyofissue."


Please Click Here if you'd like to add another voucher

Or Click Here to go back to the list of receipt headers";
}
}
print "

dansmit
Newbie Poster
3 posts since Apr 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You