<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><title>Facility Employee Receipt</title></head>
<body>
<cfinclude template="security.cfm">
<cfquery name="EmployeeList" datasource="Gaming">
Select FirstName,MiddleName,LastName,ssn, Trim(LastName)&'.'&Trim(FirstName)&'.'&Left(Trim(MiddleName),1)&'.'&Right(ssn,4)&'.G'&'.B'&'$100' as PickString
From License
Where TrackCode='#Form.Facility#'
and ssn is not NULL
and FirstName is not NULL
and LastName is not NULL
and Trim(ssn)<>''
and Trim(Status)<>'DENIED'
Order By LastName,FirstName,MiddleName
</cfquery>
<cfset NameList=ValueList(EmployeeList.PickString)>
<br>
<div class="PageTitle" align="center">Gaming Database - Facility Employee Receipt Data Entry</div>
<br>
<cfoutput>
<form name="FacilityEmployeeReceipt" action="FacilityEmployeeReceiptPrint.cfm" method="post" onsubmit="return validateform()">
<table class="BinkleyTable" align="center">
<tr>
<td class="ColumnHeadingCell" colspan="3">Prepare Reciept for #Form.Facility#</td>
</tr>
<tr>
<td colspan="3">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="NormalCell">
Receipt Date:<br>
<input name="ReceiptDate" type="Text" size="12" value="#DateFormat(Now(),'mm/dd/yyyy')#">
</td>
<td class="NormalCell">
Receipt Number:<br>
<input name="ReceiptNumber" type="Text" size="12" value="0000099">
</td>
<td class="NormalCell">
Check Number:<br>
<input name="CheckNumber" type="Text" size="12">
</td>
<td class="NormalCell">
Check Amount:<br>
<input name="CheckAmount" type="Text" size="12" value="300">
</td>
</tr>
<tr>
<td class="NormalCell">
<div align="right">Comments:</div>
</td>
<td class="NormalCell" colspan="3">
<input name="Comments" size="70" type="Text" maxlength="150">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3">
<table width="100%" border="0">
<tr>
<td>
<span class="NormalCell">Renewals:</span><br>
<select name="list1" size="12" multiple onDblClick="moveSelectedOptions(this.form['list1'],this.form['list2'],true,this.form['movepattern1'].value)">
<cfloop list="#NameList#" index="LastName">
<option value=#LastName#>#LastName#</option>
</cfloop>
</select>
</td>
<td VALIGN=MIDDLE ALIGN=CENTER>
<div align="center">
<input type="button" NAME="right" VALUE=" > " ONCLICK="moveSelectedOptions(this.form['list1'],this.form['list2'],true,this.form['movepattern1'].value)"><BR>
<input type="button" NAME="left" VALUE=" < " ONCLICK="moveSelectedOptions(this.form['list2'],this.form['list1'],true,this['form'].movepattern1.value)"><BR><br>
<input type="button" NAME="right" VALUE=">>" ONCLICK="moveAllOptions(this.form['list1'],this.form['list2'],true,this.form['movepattern1'].value)"><BR>
<input type="button" NAME="left" VALUE="<<" ONCLICK="moveAllOptions(this.form['list2'],this.form['list1'],true,this.form['movepattern1'].value)">
</div>
</td>
<td>
<span class="NormalCell">Include: </span><input name="EmployeeTotal" size="10" value="$0.00" /><br>
<SELECT NAME="list2" multiple size="12" onDblClick="moveSelectedOptions(this.form['list2'],this.form['list1'],true,this.form['movepattern1'].value)"></SELECT>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>
<input name="GamingEmployeeToggle" type="Button" value=" G " ONCLICK="ToggleFeeCode(this.form['list2'],'G')">
<input name="BackGroundCheckToggle" type="Button" value=" B " ONCLICK="ToggleFeeCode(this.form['list2'],'B')">
<input name="FingerprintFeeToggle" type="Button" value=" F " ONCLICK="ToggleFeeCode(this.form['list2'],'F')">
<input name="BackGroundCheckToggle" type="Button" value=" K " ONCLICK="ToggleFeeCode(this.form['list2'],'K')">
<input name="CalculateEmployeeTotal" type="Button" value=" $ " ONCLICK="CalculateFee(this.form['list2'])">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="NormalCell">
Initial Applicants:
</td>
</tr>
<tr>
<td class="NormalCell" colspan="3">
<table width="100%" border="0">
<tr>
<td class="NormalCell">First:<br><input name="FirstName" size="12" maxlength="50"/></td>
<td class="NormalCell">Middle:<br><input name="MiddleName" size="12" maxlength="50"/></td>
<td class="NormalCell">Last:<br><input value="" name="LastName" size="12" maxlength="50"/></td>
<td class="NormalCell">SSN:<br><input name="SSN" size="12" maxlength="50"/></td>
<td class="NormalCell"> <br><input name="PushNewEmployee" type="Button" value="Add" onclick="InsertInitial(this.form['list2']);"/></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3">
<div align="center">
<input type="Hidden" value="" name="TheHiddenField">
<input type="hidden" name="movepattern1" value="" disabled>
<input type="Hidden" name="Facility" value="#Form.Facility#">
<br>
<input type="Submit" value="Print Preview">
</div>
</td>
</tr>
</table>
</form>
</cfoutput>
</body>
</html>
<script type="text/javascript">
document.FacilityEmployeeReceipt.CheckNumber.select();
function hasOptions(obj) {
if (obj!=null && obj.options!=null) { return true; }
return false;
}
function selectUnselectMatchingOptions(obj,regex,which,only) {
if (window.RegExp) {
if (which == "select") {
var selected1=true;
var selected2=false;
}
else if (which == "unselect") {
var selected1=false;
var selected2=true;
}
else {
return;
}
var re = new RegExp(regex);
if (!hasOptions(obj)) { return; }
for (var i=0; i<obj.options.length; i++) {
if (re.test(obj.options[i].text)) {
obj.options[i].selected = selected1;
}
else {
if (only == true) {
obj.options[i].selected = selected2;
}
}
}
}
}
function selectMatchingOptions(obj,regex) {
selectUnselectMatchingOptions(obj,regex,"select",false);
}
function selectOnlyMatchingOptions(obj,regex) {
selectUnselectMatchingOptions(obj,regex,"select",true);
}
function unSelectMatchingOptions(obj,regex) {
selectUnselectMatchingOptions(obj,regex,"unselect",false);
}
function sortSelect(obj) {
var o = new Array();
if (!hasOptions(obj)) { return; }
for (var i=0; i<obj.options.length; i++) {
o[o.length] = new Option( obj.options[i].text, obj.options[i].value, obj.options[i].defaultSelected, obj.options[i].selected) ;
}
if (o.length==0) { return; }
o = o.sort(
function(a,b) {
if ((a.text+"") < (b.text+"")) { return -1; }
if ((a.text+"") > (b.text+"")) { return 1; }
return 0;
}
);
for (var i=0; i<o.length; i++) {
obj.options[i] = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
}
}
function selectAllOptions(obj) {
if (!hasOptions(obj)) { return; }
for (var i=0; i<obj.options.length; i++) {
obj.options[i].selected = true;
}
}
function moveSelectedOptions(from,to) {
// Unselect matching options, if required
if (arguments.length>3) {
var regex = arguments[3];
if (regex != "") {
unSelectMatchingOptions(from,regex);
}
}
// Move them over
if (!hasOptions(from)) { return; }
for (var i=0; i<from.options.length; i++) {
var o = from.options[i];
if (o.selected) {
if (!hasOptions(to)) { var index = 0; } else { var index=to.options.length; }
to.options[index] = new Option( o.text, o.value, false, false);
}
}
// Delete them from original
for (var i=(from.options.length-1); i>=0; i--) {
var o = from.options[i];
if (o.selected) {
from.options[i] = null;
}
}
if ((arguments.length<3) || (arguments[2]==true)) {
sortSelect(from);
sortSelect(to);
}
from.selectedIndex = -1;
to.selectedIndex = -1;
LoadHiddenField();
to.options
CalculateFee(document.FacilityEmployeeReceipt.list2);
}
function copySelectedOptions(from,to) {
var options = new Object();
if (hasOptions(to)) {
for (var i=0; i<to.options.length; i++) {
options[to.options[i].value] = to.options[i].text;
}
}
if (!hasOptions(from)) { return; }
for (var i=0; i<from.options.length; i++) {
var o = from.options[i];
if (o.selected) {
if (options[o.value] == null || options[o.value] == "undefined" || options[o.value]!=o.text) {
if (!hasOptions(to)) { var index = 0; } else { var index=to.options.length; }
to.options[index] = new Option( o.text, o.value, false, false);
}
}
}
if ((arguments.length<3) || (arguments[2]==true)) {
sortSelect(to);
}
from.selectedIndex = -1;
to.selectedIndex = -1;
}
function moveAllOptions(from,to) {
selectAllOptions(from);
if (arguments.length==2) {
moveSelectedOptions(from,to);
}
else if (arguments.length==3) {
moveSelectedOptions(from,to,arguments[2]);
}
else if (arguments.length==4) {
moveSelectedOptions(from,to,arguments[2],arguments[3]);
}
LoadHiddenField();
CalculateFee(document.FacilityEmployeeReceipt.list2);
}
function LoadHiddenField() {
var NewOption = "";
var oelem=document.FacilityEmployeeReceipt.list2;
for ( var idx = 0; idx < oelem.length; idx++ ) {
NewOption += oelem.options[idx].value;
// NewOption += (idx==oelem.length-1)?",":"";
NewOption += (idx==oelem.length-1)?"":",";
}
document.FacilityEmployeeReceipt.TheHiddenField.value = NewOption;
}
function copyAllOptions(from,to) {
selectAllOptions(from);
if (arguments.length==2) {
copySelectedOptions(from,to);
}
else if (arguments.length==3) {
copySelectedOptions(from,to,arguments[2]);
}
}
function swapOptions(obj,i,j) {
var o = obj.options;
var i_selected = o[i].selected;
var j_selected = o[j].selected;
var temp = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
var temp2= new Option(o[j].text, o[j].value, o[j].defaultSelected, o[j].selected);
o[i] = temp2;
o[j] = temp;
o[i].selected = j_selected;
o[j].selected = i_selected;
}
function moveOptionUp(obj) {
if (!hasOptions(obj)) { return; }
for (i=0; i<obj.options.length; i++) {
if (obj.options[i].selected) {
if (i != 0 && !obj.options[i-1].selected) {
swapOptions(obj,i,i-1);
obj.options[i-1].selected = true;
}
}
}
}
function moveOptionDown(obj) {
if (!hasOptions(obj)) { return; }
for (i=obj.options.length-1; i>=0; i--) {
if (obj.options[i].selected) {
if (i != (obj.options.length-1) && ! obj.options[i+1].selected) {
swapOptions(obj,i,i+1);
obj.options[i+1].selected = true;
}
}
}
}
function removeSelectedOptions(from) {
if (!hasOptions(from)) { return; }
if (from.type=="select-one") {
from.options[from.selectedIndex] = null;
}
else {
for (var i=(from.options.length-1); i>=0; i--) {
var o=from.options[i];
if (o.selected) {
from.options[i] = null;
}
}
}
from.selectedIndex = -1;
}
function removeAllOptions(from) {
if (!hasOptions(from)) { return; }
for (var i=(from.options.length-1); i>=0; i--) {
from.options[i] = null;
}
from.selectedIndex = -1;
}
function addOption(obj,text,value,selected) {
if (obj!=null && obj.options!=null) {
obj.options[obj.options.length] = new Option(text, value, false, true);
}
}
function InsertInitial() {
var temp=event.srcElement;
var NewOption = "";
var IsEmployeeDataValid='Yes';
var AlertMessage="";
var ssnRegExp = /\d{3}-\d{2}-\d{4}/;
//'Add' is the value set for the button that adds a new employee to list two. The if below
//stops this validation from executing when the Print Preview button is pressed. lp 9/8/2006
if (event.srcElement.value == 'Add'){
if (!ssnRegExp.test(document.FacilityEmployeeReceipt.SSN.value))
{
AlertMessage="Proper SSN Format is Required";
IsEmployeeDataValid='No';
document.FacilityEmployeeReceipt.SSN.select();
}
if (document.FacilityEmployeeReceipt.FirstName.value==""){
AlertMessage="First Name is Required";
IsEmployeeDataValid='No';
document.FacilityEmployeeReceipt.FirstName.select();
}
if (document.FacilityEmployeeReceipt.MiddleName.value==""){
AlertMessage="At Least Middle Initial is Required";
IsEmployeeDataValid='No';
document.FacilityEmployeeReceipt.MiddleName.select();
}
if (document.FacilityEmployeeReceipt.LastName.value==""){
AlertMessage="Last Name is Required";
IsEmployeeDataValid='No';
document.FacilityEmployeeReceipt.LastName.select();
}
if (document.FacilityEmployeeReceipt.FirstName.value==""){
AlertMessage="First Name is Required";
IsEmployeeDataValid='No';
document.FacilityEmployeeReceipt.FirstName.select();
}
if (IsEmployeeDataValid=='No'){
alert(AlertMessage);
}
else{
NewOption += document.FacilityEmployeeReceipt.LastName.value;
NewOption += ".";
NewOption += document.FacilityEmployeeReceipt.FirstName.value;
NewOption += ".";
NewOption += document.FacilityEmployeeReceipt.MiddleName.value.substring(0,1);
NewOption += ".";
NewOption += document.FacilityEmployeeReceipt.SSN.value;
NewOption += ".G.B$100,";
addOption(document.FacilityEmployeeReceipt.list2, NewOption, NewOption, true);
sortSelect(document.FacilityEmployeeReceipt.list2);
document.FacilityEmployeeReceipt.LastName.value="";
document.FacilityEmployeeReceipt.FirstName.value="";
document.FacilityEmployeeReceipt.MiddleName.value="";
document.FacilityEmployeeReceipt.SSN.value="";
LoadHiddenField();
CalculateFee(document.FacilityEmployeeReceipt.list2);
}
}
}
function ToggleFeeCode(obj,code) {
var SelectedRowNumber=-1;
var strOption="";
var FourthPeriod=0;
var FirstDollarSign=0;
var DollarAmount=0;
var ContainsK='No';
var ContainsG='No';
var ContainsF='No';
var ContainsB='No';
var RemoveOne='No';
var SendK='No';
var SendG='No';
var SendF='No';
var SendB='No';
var NewFeeCodePart='';
var NewFeeCodePartLength=0;
for ( var idx = 0; idx < obj.length; idx++ ) {
if (obj.options[idx].selected){
if (SelectedRowNumber<0) {
SelectedRowNumber=idx;
}
}
}
if (SelectedRowNumber<0){
alert("An Employee Must be Selected!");
}
if (SelectedRowNumber>=0) {
strOption=obj[SelectedRowNumber].value;
var FeeCodePart=strOption.substr(strOption.indexOf('.'));
for (var idx = 0; idx < 4; idx++){
FeeCodePart=FeeCodePart.substr(FeeCodePart.indexOf('.')+1);
}
var PeriodCount=0
for (var idx = 0; idx < strOption.length; idx++){
if (strOption.substr(idx,1)=="."){
PeriodCount +=1;
if (PeriodCount==4){
FourthPeriod=idx;
}
}
}
FirstDollarSign=strOption.indexOf('$');
FeeCodePart=FeeCodePart.substr(0,FeeCodePart.indexOf('$'));
LeftOfFeeCodePart=strOption.substr(0,FourthPeriod);
RightOfFeeCodePart=strOption.substr(FirstDollarSign,strOption.length);
DollarAmount=parseInt(strOption.substr(FirstDollarSign+1,strOption.length));
if (FeeCodePart.indexOf('K')>=0){
ContainsK='Yes';
}
if (FeeCodePart.indexOf('G')>=0){
ContainsG='Yes';
SendG='Yes';
}
if (FeeCodePart.indexOf('F')>=0){
ContainsF='Yes';
SendF='Yes';
}
if (FeeCodePart.indexOf('B')>=0){
ContainsB='Yes';
SendB='Yes';
}
if (FeeCodePart.indexOf(code)>=0){
RemoveOne='Yes';
}
if (RemoveOne=='Yes'){
if (code=='K'){
DollarAmount=(DollarAmount-250);
SendK='No';
}
else{
SendK='Yes';
}
if (code=='G'){
DollarAmount=(DollarAmount-50);
SendG='No';
}
else{
SendG='Yes';
}
if (code=='F'){
DollarAmount=(DollarAmount-41);
SendF='No';
}
else{
SendF='Yes';
}
if (code=='B'){
DollarAmount=(DollarAmount-50);
SendB='No';
}
else{
SendB='Yes';
}
}
else
{ //Add One RemoveOne='No'
if (code=='K'){
DollarAmount=(DollarAmount+250);
SendK='Yes';
ContainsK='Yes';
}
if (code=='G'){
DollarAmount=(DollarAmount+50);
SendG='Yes';
ContainsG='Yes';
}
if (code=='F'){
DollarAmount=(DollarAmount+41);
SendF='Yes';
ContainsF='Yes';
}
if (code=='B'){
DollarAmount=(DollarAmount+50);
SendB='Yes';
ContainsB='Yes';
}
}
if (SendK=='Yes' && ContainsK=='Yes'){
NewFeeCodePart += '.K';
}
if (SendG=='Yes' && ContainsG=='Yes'){
NewFeeCodePart += '.G';
}
if (SendF=='Yes' && ContainsF=='Yes'){
NewFeeCodePart += '.F';
}
if (SendB=='Yes' && ContainsB=='Yes'){
NewFeeCodePart += '.B';
}
if (DollarAmount==0){
NewFeeCodePart += '.';
}
strOption=LeftOfFeeCodePart+NewFeeCodePart+'$'+DollarAmount;
obj.options[SelectedRowNumber] = null;
addOption(obj, strOption, strOption, true);
sortSelect(obj);
CalculateFee(obj);
LoadHiddenField();
}
return;
}
function CalculateFee(obj){
var GrandTotal=0;
var strOption='';
var FirstDollarSign=0;
var DollarAmount;
for ( var idx = 0; idx < obj.length; idx++ ) {
strOption=obj[idx].value;
FirstDollarSign=strOption.indexOf('$');
if (FirstDollarSign > 0){
DollarAmount=parseInt(strOption.substr(FirstDollarSign+1,strOption.length));
GrandTotal += DollarAmount;
}
}
document.FacilityEmployeeReceipt.EmployeeTotal.value='$'+addCommas(GrandTotal.toFixed(2));
//CalculateFee(document.FacilityEmployeeReceipt.list2);
}
function addCommas(nStr)
{
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
//document.FacilityEmployeeReceipt.ReceiptDate.focus();
//document.FacilityEmployeeReceipt.ReceiptDate.select();
//var bgBad = "#F7F28A";
//setColor(document.FacilityEmployeeReceipt.ReceiptDate, bgBad);
function validateform(){
var AlertMessage='';
var IsValid=true;
//<input name="ReceiptDate" type="Text" size="12" value="#DateFormat(Now(),'mm/dd/yyyy')#">
if (trim(document.FacilityEmployeeReceipt.ReceiptDate.value)==""){
AlertMessage='Receipt Date is Required';
IsValid=false;
}
//<input name="ReceiptNumber" type="Text" size="12" value="0000099">
if (trim(document.FacilityEmployeeReceipt.ReceiptNumber.value)==""){
AlertMessage='Receipt Number is Required';
IsValid=false;
}
//<input name="CheckNumber" type="Text" size="12">
if (trim(document.FacilityEmployeeReceipt.CheckNumber.value)==""){
AlertMessage='Check Number is Required';
IsValid=false;
}
//<input name="CheckAmount" type="Text" size="12" value="300">
if (ParseInt(document.FacilityEmployeeReceipt.CheckAmount.value)==0){
AlertMessage='Check Amount is Required';
IsValid=false;
}
if (!IsValid){
alert(AlertMessage);
}
return IsValid;
}
//function trim(strText){
// while (strText.substring(0,1) == " ")
// strText = strText.substring(1, strText.length);
// while (strText.substring(strText.length-1,strText.length) == " ")
// strText = strText.substring(0, strText.length-1);
// return strText;
//}
function trim(t) {
return t.replace( /^\s+/, "" ).replace( /\s+$/, "" );
}
</script>